nl.west.aaa.radius
Class RadiusFormat

java.lang.Object
  |
  +--nl.west.aaa.radius.RadiusFormat

public class RadiusFormat
extends java.lang.Object
implements RecordFormat


Field Summary
static int AVP_ACCT_AUTHENTIC
           
static int AVP_ACCT_DELAY_TIME
           
static int AVP_ACCT_INPUT_OCTETS
           
static int AVP_ACCT_INPUT_PACKETS
           
static int AVP_ACCT_LINK_COUNT
           
static int AVP_ACCT_MULTI_SESSION_ID
           
static int AVP_ACCT_OUTPUT_OCTETS
           
static int AVP_ACCT_OUTPUT_PACKETS
           
static int AVP_ACCT_SESSION_ID
           
static int AVP_ACCT_SESSION_TIME
           
static int AVP_ACCT_STATUS_TYPE
           
static int AVP_ACCT_TERMINATE_CAUSE
           
static int AVP_CALLBACK_ID
           
static int AVP_CALLBACK_NUMBER
           
static int AVP_CALLED_STATION_ID
           
static int AVP_CALLING_STATION_ID
           
static int AVP_CHAP_CHALLENGE
           
static int AVP_CHAP_PASSWORD
           
static int AVP_CLASS
           
static int AVP_FILTER_ID
           
static int AVP_FRAMED_APPLETALK_LINK
           
static int AVP_FRAMED_APPLETALK_NETWORK
           
static int AVP_FRAMED_APPLETALK_ZONE
           
static int AVP_FRAMED_COMPRESSION
           
static int AVP_FRAMED_IP_ADDRESS
           
static int AVP_FRAMED_IP_NETMASK
           
static int AVP_FRAMED_IPX_NETWORK
           
static int AVP_FRAMED_MTU
           
static int AVP_FRAMED_PROTOCOL
           
static int AVP_FRAMED_ROUTE
           
static int AVP_FRAMED_ROUTING
           
static int AVP_IDLE_TIMEOUT
           
static int AVP_LOGIN_IP_HOST
           
static int AVP_LOGIN_LAT_GROUP
           
static int AVP_LOGIN_LAT_NODE
           
static int AVP_LOGIN_LAT_PORT
           
static int AVP_LOGIN_LAT_SERVICE
           
static int AVP_LOGIN_SERVICE
           
static int AVP_LOGIN_TCP_PORT
           
static int AVP_NAS_IDENTIFIER
           
static int AVP_NAS_IP_ADDRESS
           
static int AVP_NAS_PORT
           
static int AVP_NAS_PORT_TYPE
           
static int AVP_PORT_LIMIT
           
static int AVP_PROXY_STATE
           
static int AVP_REPLY_MESSAGE
           
static int AVP_SERVICE_TYPE
           
static int AVP_SESSION_TIMEOUT
           
static int AVP_STATE
           
static int AVP_TERMINATION_ACTION
           
static int AVP_TYPE_ADDRESS
           
static int AVP_TYPE_DATA
           
static int AVP_TYPE_INTEGER
           
static int AVP_TYPE_STRING
           
static int AVP_TYPE_TEXT
           
static int AVP_USER_NAME
           
static int AVP_USER_PASSWORD
           
static int AVP_VENDOR_SPECIFIC
           
static int MSG_ACCESS_ACCEPT
           
static int MSG_ACCESS_CHALLENGE
           
static int MSG_ACCESS_REJECT
           
static int MSG_ACCESS_REQUEST
           
static int MSG_ACCOUNTING_REQUEST
           
static int MSG_ACCOUNTING_RESPONSE
           
 
Constructor Summary
RadiusFormat()
           
 
Method Summary
 Message decodeMessage(byte[] data, Identifier from)
          Read a Message from a byte array.
 Message decodeMessage(java.io.InputStream in, Identifier from)
          Read a RADIUS message from the stream.
 byte[] encodeMessage(Message msg)
          Encode a given message.
static int getAVPCode(java.lang.String name)
          Translate a AVP name to a AVP code.
static java.lang.String getAVPName(int code)
          Translates the AVP code to a AVP name.
static int getAVPType(int code)
          Figure out the type according to the code.
static int getMessageType(int messageCode)
          Translater the RADIUS message code value to a Message.XXXX value.
static int getRadiusMessageCode(int type)
          Translater the Message.XXX messagetype to a valid RADIUS messagecode.
static byte[] newAuthenticator()
          Generates a new random authenticator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_ACCESS_REQUEST

public static final int MSG_ACCESS_REQUEST

MSG_ACCESS_ACCEPT

public static final int MSG_ACCESS_ACCEPT

MSG_ACCESS_REJECT

public static final int MSG_ACCESS_REJECT

MSG_ACCOUNTING_REQUEST

public static final int MSG_ACCOUNTING_REQUEST

MSG_ACCOUNTING_RESPONSE

public static final int MSG_ACCOUNTING_RESPONSE

MSG_ACCESS_CHALLENGE

public static final int MSG_ACCESS_CHALLENGE

AVP_TYPE_TEXT

public static final int AVP_TYPE_TEXT

AVP_TYPE_STRING

public static final int AVP_TYPE_STRING

AVP_TYPE_ADDRESS

public static final int AVP_TYPE_ADDRESS

AVP_TYPE_INTEGER

public static final int AVP_TYPE_INTEGER

AVP_TYPE_DATA

public static final int AVP_TYPE_DATA

AVP_USER_NAME

public static final int AVP_USER_NAME

AVP_USER_PASSWORD

public static final int AVP_USER_PASSWORD

AVP_CHAP_PASSWORD

public static final int AVP_CHAP_PASSWORD

AVP_NAS_IP_ADDRESS

public static final int AVP_NAS_IP_ADDRESS

AVP_NAS_PORT

public static final int AVP_NAS_PORT

AVP_SERVICE_TYPE

public static final int AVP_SERVICE_TYPE

AVP_FRAMED_PROTOCOL

public static final int AVP_FRAMED_PROTOCOL

AVP_FRAMED_IP_ADDRESS

public static final int AVP_FRAMED_IP_ADDRESS

AVP_FRAMED_IP_NETMASK

public static final int AVP_FRAMED_IP_NETMASK

AVP_FRAMED_ROUTING

public static final int AVP_FRAMED_ROUTING

AVP_FILTER_ID

public static final int AVP_FILTER_ID

AVP_FRAMED_MTU

public static final int AVP_FRAMED_MTU

AVP_FRAMED_COMPRESSION

public static final int AVP_FRAMED_COMPRESSION

AVP_LOGIN_IP_HOST

public static final int AVP_LOGIN_IP_HOST

AVP_LOGIN_SERVICE

public static final int AVP_LOGIN_SERVICE

AVP_LOGIN_TCP_PORT

public static final int AVP_LOGIN_TCP_PORT

AVP_REPLY_MESSAGE

public static final int AVP_REPLY_MESSAGE

AVP_CALLBACK_NUMBER

public static final int AVP_CALLBACK_NUMBER

AVP_CALLBACK_ID

public static final int AVP_CALLBACK_ID

AVP_FRAMED_ROUTE

public static final int AVP_FRAMED_ROUTE

AVP_FRAMED_IPX_NETWORK

public static final int AVP_FRAMED_IPX_NETWORK

AVP_STATE

public static final int AVP_STATE

AVP_CLASS

public static final int AVP_CLASS

AVP_VENDOR_SPECIFIC

public static final int AVP_VENDOR_SPECIFIC

AVP_SESSION_TIMEOUT

public static final int AVP_SESSION_TIMEOUT

AVP_IDLE_TIMEOUT

public static final int AVP_IDLE_TIMEOUT

AVP_TERMINATION_ACTION

public static final int AVP_TERMINATION_ACTION

AVP_CALLED_STATION_ID

public static final int AVP_CALLED_STATION_ID

AVP_CALLING_STATION_ID

public static final int AVP_CALLING_STATION_ID

AVP_NAS_IDENTIFIER

public static final int AVP_NAS_IDENTIFIER

AVP_PROXY_STATE

public static final int AVP_PROXY_STATE

AVP_LOGIN_LAT_SERVICE

public static final int AVP_LOGIN_LAT_SERVICE

AVP_LOGIN_LAT_NODE

public static final int AVP_LOGIN_LAT_NODE

AVP_LOGIN_LAT_GROUP

public static final int AVP_LOGIN_LAT_GROUP

AVP_FRAMED_APPLETALK_LINK

public static final int AVP_FRAMED_APPLETALK_LINK

AVP_FRAMED_APPLETALK_NETWORK

public static final int AVP_FRAMED_APPLETALK_NETWORK

AVP_FRAMED_APPLETALK_ZONE

public static final int AVP_FRAMED_APPLETALK_ZONE

AVP_ACCT_STATUS_TYPE

public static final int AVP_ACCT_STATUS_TYPE

AVP_ACCT_DELAY_TIME

public static final int AVP_ACCT_DELAY_TIME

AVP_ACCT_INPUT_OCTETS

public static final int AVP_ACCT_INPUT_OCTETS

AVP_ACCT_OUTPUT_OCTETS

public static final int AVP_ACCT_OUTPUT_OCTETS

AVP_ACCT_SESSION_ID

public static final int AVP_ACCT_SESSION_ID

AVP_ACCT_AUTHENTIC

public static final int AVP_ACCT_AUTHENTIC

AVP_ACCT_SESSION_TIME

public static final int AVP_ACCT_SESSION_TIME

AVP_ACCT_INPUT_PACKETS

public static final int AVP_ACCT_INPUT_PACKETS

AVP_ACCT_OUTPUT_PACKETS

public static final int AVP_ACCT_OUTPUT_PACKETS

AVP_ACCT_TERMINATE_CAUSE

public static final int AVP_ACCT_TERMINATE_CAUSE

AVP_ACCT_MULTI_SESSION_ID

public static final int AVP_ACCT_MULTI_SESSION_ID

AVP_ACCT_LINK_COUNT

public static final int AVP_ACCT_LINK_COUNT

AVP_CHAP_CHALLENGE

public static final int AVP_CHAP_CHALLENGE

AVP_NAS_PORT_TYPE

public static final int AVP_NAS_PORT_TYPE

AVP_PORT_LIMIT

public static final int AVP_PORT_LIMIT

AVP_LOGIN_LAT_PORT

public static final int AVP_LOGIN_LAT_PORT
Constructor Detail

RadiusFormat

public RadiusFormat()
Method Detail

getMessageType

public static int getMessageType(int messageCode)
Translater the RADIUS message code value to a Message.XXXX value. If an illegal messagecode is given the method throws a RuntimeException.

getRadiusMessageCode

public static int getRadiusMessageCode(int type)
Translater the Message.XXX messagetype to a valid RADIUS messagecode. If an unsupported messagecode is given the method return -1.

getAVPName

public static java.lang.String getAVPName(int code)
Translates the AVP code to a AVP name.

getAVPCode

public static int getAVPCode(java.lang.String name)
Translate a AVP name to a AVP code. Returns -1 for unknown names.

getAVPType

public static int getAVPType(int code)
Figure out the type according to the code.

encodeMessage

public byte[] encodeMessage(Message msg)
Description copied from interface: RecordFormat
Encode a given message.
Specified by:
encodeMessage in interface RecordFormat

decodeMessage

public Message decodeMessage(byte[] data,
                             Identifier from)
Description copied from interface: RecordFormat
Read a Message from a byte array. The data should contain one complete message.
If the data is not a message of this record format, null should be returned (no exceptions thrown).
Any recordformat should ensure that a "sid" (session id) attribute is present in the message. This attribute is used for matching replies with requests.
Specified by:
decodeMessage in interface RecordFormat

decodeMessage

public Message decodeMessage(java.io.InputStream in,
                             Identifier from)
                      throws java.io.IOException
Read a RADIUS message from the stream. The algorithm used to check wether it is realy a RADIUS message is NOT very good, since RADIUS has no real identifying header. I suggest you use this RecordFormat last in the list to test for valid recordformats.
Specified by:
decodeMessage in interface RecordFormat

newAuthenticator

public static byte[] newAuthenticator()
Generates a new random authenticator.



Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/
2002-05-27