Sm_AgentApi_GetSessionVariables()

Retrieves the values of existing session variables.
sm1252sp1
Retrieves the values of existing session variables.
Syntax
int Sm_AgentApi_GetSessionVariables (
   const void*                           pHandle,
   const Sm_AgentApi_ResourceContext_t*  pResourceContext,
   const char*                           lpszSessionId,
   long                                  nNumReqAttributes,
   Sm_AgentApi_Attribute_t*              pReqAttributes,
   long*                                 pRespNumAttributes,
   Sm_AgentApi_Attribute_t**             ppRespAttributes
);
Parameter
I/O
Description
pHandle
I
Agent API session handle returned in parameter
ppHandle
of Sm_AgentApi_Init().
pResourceContext
I
Reserved for future use. Set all fields to 0.
lpszSessionId
I
A unique identifier of the session for which the variable is to be retrieved. Variables can only be retrieved for an active session.
After a successful login, the session ID is returned in the
lpszSessionId
field of the structure Sm_AgentApi_Session_t.
nNumReqAttributes
I
Size of the array of attributes in
pReqAttributes
.
pReqAttributes
An array of attributes representing the names of session variables to be retrieved.
Set the variable name in the field
lpszAttributeOid
of structure Sm_AgentApi_Attribute_t.
Set the
nAttributeFlags
field of the Sm_AgentApi_Attribute_t structure to one of these values:
SM_AGENTAPI_REQATTR_FLAGS_NONE
Retrieve the named variable, but don’t delete it.
SM_AGENTAPI_REQATTR_FLAGS_DELETE
Delete the variable from the session store after retrieving it.
The structure’s
nAttributeId
and
nAttributeTTL
fields are ignored.
Set the
nAttributeFlags
field of the Sm_AgentApi_Attribute_t structure to one of these values:
SM_AGENTAPI_REQATTR_FLAGS_NONE
Retrieve the named variable, but don’t delete it.
SM_AGENTAPI_REQATTR_FLAGS_DELETE
Delete the variable from the session store after retrieving it.
The structure’s
nAttributeId
and
nAttributeTTL
fields are ignored.
pRespNumAttributes
O
Size of the array of responses in
ppRespAttributes
.
ppRespAttributes
O
An array of response attributes representing session variables and their values.
The value returned from this function indicates the contents of the response attribute result set, as follows:
SM_AGENTAPI_UNRESOLVED
Some variables could not be fetched. If a given variable can’t be fetched, the associated
nAttributeFlags
field of the Sm_AgentApi_Attribute_t structure is set to SM_AGENTAPI_ RESPATTR_FLAGS_UNRESOLVED.
For the variables that are fetched, the
nAttributeFlags
 field is set to SM_AGENTAPI_RESPATTR_FLAGS_NONE.
SM_AGENTAPI_YES
All requested variables and their values were fetched from the session store and returned in
ppRespAttributes
.
The structure’s
nAttributeId
and
nAttributeTTL
fields are ignored.
Return Values
  • SM_AGENTAPI_YES. The operation succeeded.
  • SM_AGENTAPI_NO. The call was refused.
  • SM_AGENTAPI_UNRESOLVED. Some variables could not be fetched. See the description of the
    ppRespAttributes
    parameter.
  • SM_AGENTAPI_NOCONNECTION. The initialization was not done.
  • SM_AGENTAPI_FAILURE. The server could not be reached.
  • SM_AGENTAPI_TIMEOUT. The function timed out.
  • SM_AGENTAPI_SUCCESS. The operation succeeded.
Remarks
This function fails if the session referenced by
lpszSessionId
is not active, if no variables are found, or if the connection to the session store is lost.
To delete a variable from the session store after fetching it, set the SM_AGENTAPI_REQATTR_FLAGS_DELETE flag in the
pReqAttributes
parameter. To delete a variable without fetching it, call the function Sm_AgentApi_DelSessionVariables().
To release the memory allocated for any variables returned in the
ppRespAttributes
parameter, call Sm_AgentApi_FreeAttributes().