ClearBox Server™ v1.2 Developer's Guide

IRADIUSProcessor::ProcessPacket

Called by server when code of the packet is accepted in preceding call to IRADIUSProcessor::CanProcessPacket.

HRESULT ProcessPacket(
	[in] long clientIPAdress,
	[in] long tag,
	[in] RADIUS_PACKET * inpPacket,
	[out] RADIUS_PACKET * retPacket,
	[out] VARIANT_BOOL * statusOK);

Parameters

clientIPAdress
[in] IP address of the client that sent the packet.
tag
[in] Unique value identifying RADIUS packet in whose context this method is called.
inpPacket
[in] Received packet.
retPacket
[out] If extension has processed packet successfully, it must fill this structure with RADIUS response attributes. attrNum and attributes must be set. All other fields are set by server.
statusOK
[out] If extension has processed packet successfully and packet supplied by extension must be returned to client, this parameter must be set to VARIANT_TRUE. If server must proceed with processing, extension must set it to VARIANT_FALSE.

Return Values

If extension returns error code, it is assumed that packet was not processed by the server extension.

Thread Safety

This method is called in context of WORK thread. (See Server Threads Model for details.) You should synchronize data which is shared with other threads.

Memory Management

Memory for contents of inpPacket is allocated and freed by server, so extension must not change them.

Extension may allocate memory for attributes field of retPacket, and it is freed by server.

Remarks

Server extension may set statusOK to VARIANT_FALSE and still process packet, making framework continue the processing.

Example Code

This code processes Status-Server packet and replies with Reply-Message. Packets with other codes are passed to the framework processing.

STDMETHODIMP CTest::ProcessPacket(
	long clientIPAdress, long tag,
	RADIUS_PACKET * inpPacket,
	RADIUS_PACKET * retPacket, VARIANT_BOOL * statusOK)
{
	*statusOK=VARIANT_FALSE;
	if (inpPacket->packetCode==12) // "Status-Server" code
	{
		retPacket->attrNum=1;
		retPacket->attributes=
			reinterpret_cast<RADIUS_ATTRIBUTE>(
			CoTaskMemAlloc(sizeof(RADIUS_ATTRIBUTE)));
		retPacket->attributes[0].type=18; // "Reply-Message" attribute
		retPacket->attributes[0].valType=RADTXT;
		retPacket->attributes[0].txtValue=SysAllocString(L"Hello, world!");
		retPacket->attributes[0].flags=0;
		
		*statusOK=VARIANT_TRUE;
	}

	return S_OK;
}

See Also

IRADIUSProcessor, IRADIUSProcessor::CanProcessPacket, RADIUS authentication packet processing, RADIUS accounting packet processing


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

Created by chm2web html help conversion utility.