Class Packet
- java.lang.Object
-
- org.forgerock.openam.radius.common.Packet
-
- Direct Known Subclasses:
AccessAccept,AccessChallenge,AccessReject,AccessRequest
public abstract class Packet extends Object
Represents a RADIUS packet and all contained attribute fields.
-
-
Field Summary
Fields Modifier and Type Field Description protected AttributeSetattrsThe attribute instances held by this packet with ordering preserved.protected AuthenticatorauthenticatorThe authenticator field of the packet.protected shortidThe id of the packet.protected PacketTypetypeThe packet type.
-
Constructor Summary
Constructors Constructor Description Packet(PacketType packetType)Constructs a new Packet of the specified type in preparation for generating its on-the-wire representation and sending it.Packet(PacketType packetType, short id, Authenticator auth)Constructs a new Packet of the specified type, with the indicated identifier and authenticator .
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(Attribute attr)Adds the passed-in attribute to the set of attributes for this packet preserving insertion order.AttributegetAttributeAt(int pos)Returns the attribute instance at the indicated insertion order or location order on the wire.AttributeSetgetAttributeSet()Returns the object that holds the attributes for the packet and maintains insertion order.AuthenticatorgetAuthenticator()Returns the authenticator for this packet.shortgetIdentifier()Returns the identifier of this packet.byte[]getOctets()Get the on-the-wire octet sequence for this packet conforming to rfc 2865.PacketTypegetType()Returns the packet type.voidsetAuthenticator(Authenticator authenticator)Sets the authenticator instance for this packet.voidsetIdentifier(short id)Sets the identifier of this packet.StringtoString()Returns a representation of the packet.
-
-
-
Field Detail
-
type
protected PacketType type
The packet type.
-
id
protected short id
The id of the packet.
-
authenticator
protected Authenticator authenticator
The authenticator field of the packet.
-
attrs
protected AttributeSet attrs
The attribute instances held by this packet with ordering preserved.
-
-
Constructor Detail
-
Packet
public Packet(PacketType packetType)
Constructs a new Packet of the specified type in preparation for generating its on-the-wire representation and sending it.- Parameters:
packetType- The type of the packet.
-
Packet
public Packet(PacketType packetType, short id, Authenticator auth)
Constructs a new Packet of the specified type, with the indicated identifier and authenticator .- Parameters:
packetType- The type of the packet.id- The identifier of the packet.auth- The authenticator of the packet.
-
-
Method Detail
-
getType
public PacketType getType()
Returns the packet type.- Returns:
- the packet type.
-
getIdentifier
public short getIdentifier()
Returns the identifier of this packet.- Returns:
- the identifier of this packet.
-
setIdentifier
public void setIdentifier(short id)
Sets the identifier of this packet.- Parameters:
id- The identifier.
-
getAuthenticator
public Authenticator getAuthenticator()
Returns the authenticator for this packet.- Returns:
- the authenticator instance for this packet.
-
addAttribute
public void addAttribute(Attribute attr)
Adds the passed-in attribute to the set of attributes for this packet preserving insertion order.- Parameters:
attr- the attribute instance to be added.
-
getAttributeSet
public AttributeSet getAttributeSet()
Returns the object that holds the attributes for the packet and maintains insertion order.- Returns:
- the attribute set for this packet.
-
getAttributeAt
public Attribute getAttributeAt(int pos)
Returns the attribute instance at the indicated insertion order or location order on the wire.- Parameters:
pos- the index of the attribute- Returns:
- the attribute instance.
- Throws:
ArrayIndexOutOfBoundsException- if in index is specified beyond the set of existing attributes.
-
toString
public String toString()
Returns a representation of the packet. Used to log packets and their contents if logging is enabled for the RADIUS server functionality.
-
setAuthenticator
public void setAuthenticator(Authenticator authenticator)
Sets the authenticator instance for this packet.- Parameters:
authenticator- the authenticator.
-
getOctets
public byte[] getOctets()
Get the on-the-wire octet sequence for this packet conforming to rfc 2865.- Returns:
- the octet bytes for streaming across the wire.
-
-