snmpSaInit( ) - initialize the subagent
saIoWrite( ) - send a packet to the master agent's message queue
saIpcFree( ) - free the specified IPC mechanism
saMsgBuild( ) - build and encode a message and send it to the master agent
hdrBlkBuild( ) - create the header block and the demuxer information
envoy_now( ) - return the number of clock ticks elapsed since the timer was set
envoy_call_timer( ) - execute the specified function when the timer expires
PTR_T snmpSaInit (PTR_T saId, PTR_T sa_root, SA_REG_COMPLETE_T saRegComp)
This library implements the subagent side of the IPC mechanism used to pass messages between the SNMP master agent and its subagents. In the shipped version of this library, the IPC mechanism is a message queue. However, it is a relatively simple matter to replace the message queue with a socket if you cannot use message queues.
To set up the IPC mechanism and spawn a task to monitor it, call snmpSaInit( ). To send a message to the master agent, you can call saIoWrite( ). However, you will likely never call this function directly. Instead, you will call hdrBlkBuild( ). Internally, hdrBlkBuild( ) calls saMsgBuild( ), which calls snmpSubEncode( ) and finally saIoWrite( ).
The first message you will transmit using hdrBlkBuild( ) will be a registration message that registers objects and instances as a group in the master agent's MIB tree. If successful, the response to this message will contain a group ID. Make sure that you store this ID so that you can later remove the group from the MIB tree when you want to deregister the subagent. You also need this ID if you want to register instances of the object just registered.
Exactly how and when you register a subagent is up to you, but keep in mind that you can do so only after the master agent is up an running.