Accounting

Interface

The programmer's accounting code resides in a class that extends AccountingImpl.   The AccountingInfo class object is passed to the accounting() method the programmer defines.  The AccountingInfo class has a number of methods to facilitate accounting, logging and other functions.  AccountInfo extends the PacketInfo class.  PacketInfo has methods common to AuthInfo, ProxyInfo, AccountingInfo, ExtendedInfo, and other classes. the common methods listed below are not exhaustive but cover most of the methods useful in Authentication.  The section 'Accounting specific methods' covers the methods defined in the AccountingInfo class.

Common Methods

getUserName()

Get the User-Name attribute as a string.  This is the raw name as it arrived. It may contain realm information as proxy information.  Proxy information customarily appears after an '@' sign as in vivian@radius3.com. The proxy information is called the realm.  If there is no User-Name present a null is returned.

getName()

Get only the name portion of the User-Name attribute.  This will discard any realm information.  GetName() would return vivian from the above example. If there is no User-Name attribute present an empty string is returned.

getRealm()

Get the realm information from the User-Name attribute. The will remove the name and only the realm information will be returned. GetRealm() would return radius3.com from the above example.  If there is no realm information an empty string is returned.

Accounting specific methods

getClassAttributeList()

Class attributes hold information that a previous authentication may have returned to a client.  this attribute hints at the type of accounting to be performed. Zero or more Class attributes may be available.

getLivingstonEntry()

A Livingstone style log entry is returned as a string, complete with newlines.   Vendor-Specific attributes are represented in hexadecimal.

getMSNTEntry()

A Microsoft NT style log entry is returned as a string.  This a one line entry and contains the NAS address, User-Name, Record date, Record time, "IAS" NT service name, RADIUS server name, and all other attributes and their values separated by commas.

getSyslogEntry()

Get a SysLog style log entry as a string:

mm dd HH:MM:SS NAS-IP-Address: port NAS-Port id Acct-Session-Id: User-Name [start | stop] {Type=Async|Sync} {Proto=PPP|SLIP} {Service=Telnet|Rlogin|TCP-Clear} {Host=Login-IP-Host} {Speed=Connect-Speed} {Time=Acct-Session-Time} {Cause=Acct-Terminate-Cause}

getTime()

Get a formatted version of the time.

getNASAddress()

Get the NAS (Network Access Server / client) IP address as a string.

getNASAddress()

Get the NAS IP address as a string.

setDateFormat()

Set the date style according to the java.text.SimpleDateFormat format.  If this is not used the server's default time stamp format is used.

AccountingImpl behavior

The AccountingImpl class provides a way to perform accounting tasks. You may use flat files of the Livinston format or write your own JDBC methods or even use your own LDAP code. The RADIUS Accounting RFC says that an accounting reponse packet must not be sent if accounting cannot be completed. The behavior of the AccountingImpl.accounting() method is to return a response packet if it exists normally. To drop a packet you must explicity throw an AccessDropException.