ClearBox Server™ v1.2 Developer's Guide

ILivingstonAccounting::LogPacket

The main method of the interface. When server extension calls this method and passes it an array of RADIUS attributes found in the RADIUS Accounting-Request packet (although this type of packets is not restricted), then server logs these attributes to the accounting logfile.

This method differs from LogPacketEx in the way that is uses log files automatically managed by the server, while LogPacketEx expects file handle as a parameter, and server extension is responsible for creating and managing this file.

Server extension should define logfile parameters before calling this method. This is done by making call to SetLoggingOptionsEx or SetLoggingOptions.

HRESULT LogPacket(
	[in] unsigned long attributesNum,
	[in] RADIUS_ATTRIBUTE* inpAttributes);

Parameters

attributesNum
[in] Number of elements in the array pointed by inpAttributes. Should not be 0.
inpAttributes
[in] Array of RADIUS attributes elements that server should log as a separate log unit. Generally, these attributes are those passed to server extension's IRADIUSAccounting::ProcessAccounting implementation as inpAttributes parameter. Should not be NULL.

Return Values

This method may return E_INVALIDARG if attributesNum=0, inpAttributes=NULL, or SetLoggingOptions or SetLoggingOptionsEx were not called before.

Thread Safety

This method can be called from any thread.

Memory Management

Server extension should allocate and free memory for inpAttributes parameter. If server extension uses inpAttributes parameter passed to IRADIUSAccounting::ProcessAccounting implementation, then this memory is managed by the server.

Remarks

 

Example Code

This code uses m_pAcc as ILivingstonAccounting interface pointer stored in ICommonExtenderEx::InitializeEx implementation. It makes server log accounting data into the file.

//Implementation of IRADIUSAccounting::ProcessAccounting
STDMETHODIMP CTest::ProcessAccounting(
long tag, USERINFOLITE * userInf, unsigned long attributesNum,
RADIUS_ATTRIBUTE * inpAttributes, USERADDRESS * userAddr, ACCOUNTINGSTATUS * status)
{
	*status=A_OK;
	return m_pAcc->LogPacket(attributesNum,inpAttribures);
}

See Also

ILivingstonAccounting, Server services, SetLoggingOptionsEx, LogPacketEx


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

Created by chm2web html help conversion utility.