Sm_AgentApi_SetSessionVariables()

Creates new session variables or updates existing session variables.
casso10
Creates new session variables or updates existing session variables.
Syntax
int Sm_AgentApi_SetSessionVariables (
   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 set. Variables can only be set 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 session variables in
pReqAttributes
.
pReqAttributes
I
An array of attributes representing session variable values.
Set the variable name in the field
lpszAttributeOid
of structure Sm_AgentApi_Attribute_t:
If a variable name already exists, the associated variable value is overwritten by the value of
pReqAttributes
.
If a variable name doesn’t exist, a new variable is created.
Set the
nAttributeFlags
field of the Sm_AgentApi_Attribute_t structure to SM_AGENTAPI_REQATTR_FLAGS_NONE.
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 variables that could not be set.
If this function returns SM_AGENTAPI_UNRESOLVED, the response attribute result set will contain unresolved variables. Also, for each unresolved variable returned, the field
nAttributeFlags
of the structure Sm_AgentApi_Attribute_t will be set to SM_AGENTAPI_RESPATTR_UNRESOLVED.
The structure’s
nAttributeId
and
nAttributeTTL
fields are ignored.
Returns
  • SM_AGENTAPI_YES. The operation succeeded.
  • SM_AGENTAPI_NO. The operation failed.
  • SM_AGENTAPI_UNRESOLVED. Some variables could not be set. The list of unresolved variables is returned in 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 or the connection to the session store is lost.
To release the memory allocated for any unresolved variable values returned in the
ppRespAttributes
parameter, call Sm_AgentApi_FreeAttributes().