ClearBox Server™ v1.2 Developer's Guide

Accounting Services

ClearBox Server since v1.2 provides server extension developers with so-called 'Accounting service'. This service includes several interfaces and allows server extension log RADIUS accounting data in an easy way as the server makes the major part of the work. In general, server extension uses interface methods to set logging options and then pass an array of RADIUS attributes to log. Server may also be responsible for rollover capability.

Livingston Accounting

It's often required that RADIUS server logs accounting records to a file. One of the widely used formats of accounting records is so-called 'Livingston', or Lucent format as it was introduced by Livingston RADIUS server. It's supported by most billing and accounting systems.

Livingston accounting format records are multi-line records with one attribute = value pair listed per line, and with records separated by a blank line. Here's an example of how RADIUS accounting packets are logged:

		
Tue Apr 08 10:21:24 2003
	Acct-Session-Id = "8732423"
	User-Name = "localadmin"
	NAS-IP-Address = 192.168.2.4
	NAS-Port = 1121
	NAS-Port-Type = ISDN
	Acct-Status-Type = Start
	Acct-Authentic = RADIUS
	Calling-Station-Id = "8615681265"
	Service-Type = Framed-User
	Framed-Protocol = PPP
	Framed-IP-Address = 217.32.56.12
	Acct-Delay-Time = 0
		
Tue Apr 01 10:21:34 2003
	Acct-Session-Id = "8732423"
	User-Name = "localadmin"
	NAS-IP-Address = 192.168.2.4
	NAS-Port = 1121
	NAS-Port-Type = ISDN
	Acct-Status-Type = Stop
	Acct-Session-Time = 10
	Acct-Authentic = RADIUS
	Acct-Input-Octets = 8
	Acct-Output-Octets = 20
	Calling-Station-Id = "8615681265"
	Acct-Terminate-Cause = User-Request
	Service-Type = Framed-User
	Framed-Protocol = PPP
	Framed-IP-Address = 217.32.56.12
	Acct-Delay-Time = 0
      

How to Use

First, server extension has to get a pointer to ILivingstonAccounting interface. For this purpose server extension must implement ICommonExtenderEx instead of ICommonExtender. Server passes a pointer to IServer to the server extension implementation of InitializeEx. Then server extension queries a pointer to ILivingstonAccounting interface from a pointer to IServer and stores it.

After that server extension has to set 'logging options' that include logfile name, extension, rollover mode and some other parameters so server would know how and where it should create log files. This is done through SetLoggingOptions or SetLoggingOptionsEx methods. It's common case to do it in ICommonExtenderEx::InitializeEx implementation during the initialization phase.

Finally, server extension calls LogPacket method in IRADIUSAccounting::ProcessAccounting implementation. This task is very simple as server extension may pass this method the same set of attributes that its receives in IRADIUSAccounting::ProcessAccounting.


© 2001-2003 XPerience Technologies. www.xperiencetech.com

Created by chm2web html help conversion utility.