ClearBox Server v1.2 Developer's Guide |
IServer2::SetCookieAllows server extension to store some data associated with a packet. HRESULT SetCookie( [in] long packetTag, [in] unsigned long cookieDataSize, [in] unsigned char* cookieData); Parameters
Return ValuesThis method always returns S_OK. Thread SafetyThis method can be called from any thread. Memory ManagementServer extension should allocate and free memory for cookieData parameter. RemarksThis method allows to design server extension as "stateless", one that doesn't store intermediary data. Server extension may call this method only once for a particular packetTag unless GetCookie method has been called and has erased stored data. Example CodeThis code uses m_pServer as IServer interface pointer stored in ICommonExtenderEx::InitializeEx implementation. In this example server stores 8 bytes of some data. STDMETHODIMP CTest::GetChallengeResponseAttributes( long tag, AUTHENTYPE authType, USERINFOLITE * userInf, unsigned char * waitForAttribute, unsigned long * attrNumOut, RADIUS_ATTRIBUTE * * outpAttributes ) { ... IServer2* pS2=NULL; m_pServer->QueryInterface(IID_IServer2,(void**)&pS2; //QueryInterface will always succeed BYTE* pData=(BYTE*)CoTaskMemAlloc(8); memcpy(pData,pPointerToSomeData,8); pS2->SetCookie(tag,8,pData); CoTaskMemFree(pData); // Call to pS2->Release() is not necessary ... } See AlsoIServer2, Server services, IRADIUSAuthentication::GetChallengeResponseAttributes, IEAP::ProcessMessage, GetCookie
© 2001-2003 XPerience Technologies. www.xperiencetech.com |
Created by chm2web html help conversion utility. |