ClearBox Server™ v1.2 Developer's Guide

ICSVAccounting::SetLoggedAttributes

Server extension should call this method or SetLoggedAttributesNames to specify list of RADIUS attributes that are logged into accounting logfile. It's necessary to call one of these methods prior to using LogRADPacketCSV or LogRADPacketCSVEx methods.

HRESULT SetLoggedAttributes(
	[in] unsigned long attributesNum,
	[in] unsigned char * loggedAttributes);

Parameters

attributesNum
[in] Number of elements in the array pointed by loggedAttributes parameter. This value must not be 0.
loggedAttributes
[in] Array of RADIUS attributes types that should be logged when they are passed to LogRADPacketCSV or LogRADPacketCSVEx. These types are one-octet (byte) numbers assigned to RADIUS attributes. 'User-Name' attribute, for example, has type 1. Full list of RADIUS attributes can be found here. This parameter must not be NULL. If for an array element type 0 is specified, pseudo-attribute '@time' is logged (for details about pseudo-attributes see SetLoggedAttributesNames).

Return Values

This method may return E_INVALIDARG if attributesNum=0 or loggedAttributes=NULL.

Thread Safety

This method can be called from any thread.

Memory Management

Server extension should allocate and free memory for loggedAttributes parameter.

Remarks

As vendor-specific attributes are defined not only by an attribute type, they can't be passed to this method. Use SetLoggedAttributesNames instead to address them by name.

It's common case to call this method from ICommonExtenderEx::InitializeEx implementation.

Example Code

This code uses m_pServer as IServer interface pointer stored in ICommonExtenderEx::InitializeEx implementation. It instructs the server that only 'User-Name', 'Acct-SessionTime' and 'Acct-Termination-Cause' attributes will be logged together with current date and time (pseudo-attribute '@time').

ICSVAccounting* pAcc=NULL;
m_pServer->QueryInterface(IID_ICSVAccounting,(void**)&pAcc;
//QueryInterface will always succeed

BYTE* pTypes=(BYTE*)CoTaskMemAlloc(sizeof(BYTE)*4);
pTypes[0]=0; // Current date and time
pTypes[1]=1; //'User-Name'
pTypes[2]=46; //'Acct-Session-Time'
pTypes[3]=49; //'Acct-Termination-Cause'

pAcc->SetLoggedAttributes(4,pTypes);

CoTaskMemFree(pTypes);
// Call to  pAcc->Release() is not necessary 

See Also

ICSVAccounting, Server services, CSV Accounting Logging, SetLoggedAttributesNames, LogRADPacketCSV


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

Created by chm2web html help conversion utility.