ClearBox Server v1.2 Developer's Guide |
ITACACSAccounting::ProcessAccountingCalled when server receives TACACS+ accounting packet. HRESULT ProcessAccounting( [in] long tag, [in] TAC_AUTHORPARAMS * accParams, [in] unsigned long avSize, [in] AVPAIR * avPairs, [in] VARIANT_BOOL start, [in] VARIANT_BOOL update, [out] USERADDRESS * userAddr, [out] ACCOUNTINGSTATUS * status); Parameters
Return ValuesIf extension returns error code, it is assumed that status was set to A_ERROR. Thread SafetyThis 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 ManagementMemory for accParams fields and avPairs is allocated and freed by server, so extension must not change them. Memory for userAddr fields may be allocated by extension and is freed by server. RemarksThis method may be used to disconnect a user when it is an interim accounting record (update=VARIANT_TRUE), setting status to A_DISCONNECT. Disconnecting user on receiving "start" or "stop" record is senseless. Example CodeThis code will record session duration when it ends. STDMETHODIMP CTest::ProcessAccounting( long tag, TAC_AUTHORPARAMS * accParams, unsigned long avSize, AVPAIR * avPairs, VARIANT_BOOL start, VARIANT_BOOL update, USERADDRESS * userAddr, ACCOUNTINGSTATUS * status) { *status=A_OK; if (start==VARIANT_TRUE) return S_OK; BSTR elapsed=NULL; for (int i=0;i<avSize;i++) { if (wcscmp(avPairs[i].attribute,L"elapsed")==0) { elapsed=avPairs[i].value; break; } } if (elapsed!=NULL) { int elpsd=_wtoi(elapsed); // Some function defined by extension RecordResourceUsage(accParams->user,elpsd); } return S_OK; } See AlsoITACACSAccounting, List of TACACS+ Attribute-Value Pairs, Accounting concepts, TACACS+ accounting packet processing © 2001-2003 XPerience Technologies. www.xperiencetech.com |
Created by chm2web html help conversion utility. |