Previous Topic: Sm_AgentApi_Login()

Next Topic: Sm_AgentApi_MakeCertificateHash()

Sm_AgentApi_Logout()

Logs a user out of a user session and issues an event. No database is updated.

When a user logs out, you must explicitly terminate the session by discarding the session specification.

This function does not deallocate memory. It is your responsibility to deallocate any memory you allocated for your custom agent.

Syntax

int SM_EXTERN Sm_AgentApi_Logout (
   const void*                   pHandle,
   const char*                   lpszClientIpAddr,
   const Sm_AgentApi_Session_t*  pSession
);

Parameter

I/O

Description

pHandle

I

Agent API session handle returned in parameter pHandle of Sm_AgentApi_Init().

lpszClientIpAddr

 

I

The IP address of the client that the user is logging out from. This is an optional parameter. If the client IP begins with a star (*), the Policy Server logs the IP address but does not validate it against a session specification.

pSession

I

A session definition structure (Sm_AgentApi_Session_t) for the user's session. The nreason field will be passed in the event issued by the Policy Server. See Sm_Api_Reason_t.

Return Values

Remarks

To terminate a user's session when a user logs out, you must discard the session specification. You can do so by re-initializing the session specification in the Sm_AgentApi_Session_t structure, as illustrated in the following code:

iResult = Sm_AgentApi_Logout (
                pHandle,
                SMAPI_SAMPLE_AGENTIP,
                &pSession);

if (SM_AGENTAPI_YES==iResult)
      memset(&pSession,0,sizeof(Sm_AgentApi_Session_t));


Copyright © 2010 CA. All rights reserved. Email CA about this topic