Initializes the Agent API and sets up connections to the Policy Server. This function is called once per agent.
Note: This call succeeds even if a connection to the Policy Server cannot be established immediately. The Agent API will keep trying to reconnect. See the Remarks for more information.
Syntax
int SM_EXTERN Sm_AgentApi_Init ( const Sm_AgentApi_Init_t* pInitStruct, void** ppHandle );
Parameter |
I/O |
Description |
---|---|---|
pInitStruct |
I |
A pointer to information about the server. |
ppHandle |
O |
The address of a pointer to hold the returned handle for this API session. This is an opaque type. |
Returns
Remarks
All agents should issue the DoManagement() call and specify the SM_AGENTAPI_MANAGEMENT_SET_AGENT_INFO command once at startup.
This function is designed to fail only when a connection to the Policy Server is established, but the shared secret and/or agent name are incorrect. In all other circumstances, this function returns SM_AGENTAPI_SUCCESS, such as in the following circumstances:
In these cases, the Agent API returns a status of success and continues to try to establish the connection to the Policy Server (the connection layer does not know if the information provided is correct or incorrect). You should not assume that a connection to the Policy Server is established if the Sm_AgentApi_Init() function succeeds.
You are responsible for deallocating memory for your custom agent. When you initialize the Agent API with Sm_AgentAPI_Init(), all information in the Sm_AgentApi_Init_t structure is copied, allowing you to deallocate the structure’s memory after initialization.
Example
See the function SmAgentExample::Sm_Init() in the example application smagentexample.cpp.
Copyright © 2014 CA.
All rights reserved.
|
|