saIoLib

NAME

saIoLib - default transport routines for SNMP subagent

SYNOPSIS

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) 
STATUS saIoWrite (PTR_T ipchandle, EBUFFER_T * pBuf, INT_32_T code)
void saIpcFree (PTR_T ipchandle)
void saMsgBuild (VBL_T * vblist, SA_HEADER_T * hdr_blk, SA_DEMUX_T * demuxer, PTR_T saId)
void hdrBlkBuild (SA_HEADER_T * hdr, VBL_T * vblist, int opt, int group, PTR_T saId)
bits32_t envoy_now (void)
void envoy_call_timer (bits32_t when, void (*what)(void))

DESCRIPTION

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.