public class RADIUS extends BasePacket
Modifier and Type | Field and Description |
---|---|
protected java.util.List<RADIUSAttribute> |
attributes |
protected byte[] |
authenticator |
protected byte |
code |
protected byte |
identifier |
protected short |
length |
static short |
MAX_ATTR_VALUE_LENGTH |
static byte |
RADIUS_CODE_ACCESS_ACCEPT |
static byte |
RADIUS_CODE_ACCESS_CHALLENGE |
static byte |
RADIUS_CODE_ACCESS_REJECT |
static byte |
RADIUS_CODE_ACCESS_REQUEST |
static byte |
RADIUS_CODE_ACCOUNTING_REQUEST |
static byte |
RADIUS_CODE_ACCOUNTING_RESPONSE |
static short |
RADIUS_MAX_LENGTH |
static short |
RADIUS_MIN_LENGTH |
parent, payload
Constructor and Description |
---|
RADIUS()
Default constructor.
|
RADIUS(byte code,
byte identifier)
Constructs a RADIUS packet with the given code and identifier.
|
Modifier and Type | Method and Description |
---|---|
RADIUSAttribute |
addMessageAuthenticator(java.lang.String key)
Adds a message authenticator to the packet based on the given key.
|
boolean |
checkMessageAuthenticator(java.lang.String key)
Checks the message authenticator in the packet with one generated from
the given key.
|
EAP |
decapsulateMessage()
Decapsulates an EAP packet from the RADIUS packet.
|
static Deserializer<RADIUS> |
deserializer()
Deserializer for RADIUS packets.
|
void |
encapsulateMessage(EAP message)
Encapsulates an EAP packet in this RADIUS packet.
|
byte[] |
generateAuthCode()
Generates an authenticator code.
|
RADIUSAttribute |
getAttribute(byte attrType)
Gets an attribute from the RADIUS packet.
|
java.util.ArrayList<RADIUSAttribute> |
getAttributeList(byte attrType)
Gets a list of attributes from the RADIUS packet.
|
byte[] |
getAuthenticator()
Gets the authenticator.
|
byte |
getCode()
Gets the code.
|
byte |
getIdentifier()
Gets the identifier.
|
boolean |
isValidCode()
Checks if the packet's code field is valid.
|
byte[] |
serialize()
Sets all payloads parent packet if applicable, then serializes this
packet and all payloads.
|
RADIUSAttribute |
setAttribute(byte attrType,
byte[] value)
Sets an attribute in the RADIUS packet.
|
void |
setAuthenticator(byte[] authenticator)
Sets the authenticator.
|
void |
setCode(byte code)
Sets the code.
|
void |
setIdentifier(byte identifier)
Sets the identifier.
|
java.lang.String |
toString() |
RADIUSAttribute |
updateAttribute(byte attrType,
byte[] value)
Updates an attribute in the RADIUS packet.
|
clone, equals, getParent, getPayload, hashCode, resetChecksum, setParent, setPayload
protected byte code
protected byte identifier
protected short length
protected byte[] authenticator
protected java.util.List<RADIUSAttribute> attributes
public static final short RADIUS_MIN_LENGTH
public static final short MAX_ATTR_VALUE_LENGTH
public static final short RADIUS_MAX_LENGTH
public static final byte RADIUS_CODE_ACCESS_REQUEST
public static final byte RADIUS_CODE_ACCESS_ACCEPT
public static final byte RADIUS_CODE_ACCESS_REJECT
public static final byte RADIUS_CODE_ACCOUNTING_REQUEST
public static final byte RADIUS_CODE_ACCOUNTING_RESPONSE
public static final byte RADIUS_CODE_ACCESS_CHALLENGE
public RADIUS()
public RADIUS(byte code, byte identifier)
code
- codeidentifier
- identifierpublic byte getCode()
public void setCode(byte code)
code
- codepublic byte getIdentifier()
public void setIdentifier(byte identifier)
identifier
- identifierpublic byte[] getAuthenticator()
public void setAuthenticator(byte[] authenticator)
authenticator
- authenticatorpublic byte[] generateAuthCode()
public boolean isValidCode()
public RADIUSAttribute addMessageAuthenticator(java.lang.String key)
key
- key to generate message authenticatorpublic boolean checkMessageAuthenticator(java.lang.String key)
key
- key to generate message authenticatorpublic void encapsulateMessage(EAP message)
message
- EAP message object to be embedded in the RADIUS
EAP-Message attributedpublic EAP decapsulateMessage()
public java.util.ArrayList<RADIUSAttribute> getAttributeList(byte attrType)
attrType
- the type field of the required attributespublic RADIUSAttribute getAttribute(byte attrType)
attrType
- the type field of the required attributepublic RADIUSAttribute setAttribute(byte attrType, byte[] value)
attrType
- the type field of the attribute to setvalue
- value to be setpublic RADIUSAttribute updateAttribute(byte attrType, byte[] value)
attrType
- the type field of the attribute to updatevalue
- the value to update topublic static Deserializer<RADIUS> deserializer()
public byte[] serialize()
IPacket
public java.lang.String toString()
toString
in class java.lang.Object