ClearBox Server™ v1.2 Developer's Guide


Allows server extension to retrieve some data associated with a packet and stored earlier with SetCookie method.

HRESULT GetCookie(
	[in] long packetTag,
	[out] unsigned long* cookieDataSize,	
	[out] unsigned char** cookieData);


[in] Packet unique ID. It is usually obtained by server extension in its implementation of IRADIUSAuthentication::ChallengeDataReply and IEAP::ProcessMessage as prevTag (although its use is not restricted by them).
[out] On return this variable contains size in bytes of array pointed by cookieData. It's set to 0 if no data with specified packetTag has been stored or it has expired (see Remarks).
[out] Server allocates this parameter as a byte array and copies to it cookie data that server extension has stored earlier with SetCookie method. This parameter is NULL on return if no data with specified packetTag has been stored or it has expired (see Remarks).

Return Values

This method returns S_OK if succeeds and cookie data is returned, S_FALSE otherwise.

Thread Safety

This method can be called from any thread.

Memory Management

Server allocates memory for cookieData parameter, and server extension should free it.


This method allows to design server extension as "stateless", one that doesn't store intermediary data.

This method erases the stored data.

It may happen that although data has been stored earlier this method returns S_FALSE. It's because server erases stored data after "expiration time". It's configured with Server Manager (Server settings -> Agent settings -> Free lost RADIUS resources after...).

Example Code

This code uses m_pServer as IServer interface pointer stored in ICommonExtenderEx::InitializeEx implementation. In this example server extension reprieves data stored earlier in GetChallengeResponseAttributes while issuing Access-Challenge response.

STDMETHODIMP CTest::ChallengeDataReply(long tag,
	long prevTag, AUTHENTYPE authType,
IServer2* pS2=NULL;
//QueryInterface will always succeed

ULONG dataSize;
BYTE* pData;

if (pS2->GetCookie(prevTag,&dataSize,&pData)==S_FALSE)
// no data was found
	// use *pData array with dataSize length
// Call to  pS2->Release() is not necessary 

See Also

IServer2, Server services, IRADIUSAuthentication::GetChallengeResponseAttributes, IEAP::ProcessMessage, SetCookie

© 2001-2003 XPerience Technologies.

Created by chm2web html help conversion utility.