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 or TACACS+ 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 or TACACS+ attributes to log. Server may also be responsible for rollover capability.

CSV Accounting

It's often required that RADIUS/TACACS+ server logs accounting records to a file. One of the widely used formats of accounting records is so-called CSV (Comma Separated Values) format, where every accounting record value is separated by some character (usually by comma), and every new record starts on a new line. This format is supported by most billing and accounting systems and may be imported to the major spreadsheet or relational database applications.

As an option, logfile may contain names of logged attributes in the order as they appear in the file. Here's an example of how RADIUS accounting packets are logged in this format:

		
Acct-Session-Id,User-Name,NAS-IP-Address,Acct-Terminate-Cause,Acct-Session-Time
"131234","localadmin",192.168.2.4,User-Request,15
"131235","Wictor",192.168.2.4,Lost-Carrier,2234
"131236","Marry",192.168.2.4,User-Request,2355
"131237","manager",192.168.2.4,Session-Timeout,3600
      

How to Use

First, server extension has to get a pointer to ICSVAccounting 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 ICSVAccounting 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 inherited by ICSVAccounting from ILivingstonAccounting. It's common case to do it in ICommonExtenderEx::InitializeEx implementation during the initialization phase. Also SetCSVOptions may be called. The next step it to call SetLoggedAttributes or SetLoggedAttributesNames to specify what attributes and in what order should be logged (TACACS accounting logging works with SetLoggedAttributesNames only).

Finally, server extension calls LogRADPacketCSV method in IRADIUSAccounting::ProcessAccounting implementation or LogTACPacketCSV in ITACACSAccounting::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 or ITACACSAccounting::ProcessAccounting.


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

Created by chm2web html help conversion utility.