snmpSubEncode( )

NAME

snmpSubEncode( ) - encode a packet for transmission to master agent or subagent

SYNOPSIS

INT_32_T snmpSubEncode 
    ( 
    VBL_T *        pVblist,   /* varbindlist to be encoded */ 
    SA_HEADER_T *  pHdr,      /* header block structure    */ 
    SA_DEMUX_T *   pDemuxer,  /* demuxer structure         */ 
    EBUFFER_T *    pBuf       /* buffer to place result in */ 
    )

DESCRIPTION

This routine encodes a memory-resident varbind list. The result is a buffer containing a message ready for transmission. Most of the arguments are values to be encoded into the buffer.

pVblist
Expects a pointer to a VLB_T structure containing the list of the varbinds to be encoded in the message. In a control message, the varbinds identify the nodes or instances to be added or removed from the master agents MIB tree. In a query message, the varbinds identify the variables to be gotten or set. In a trap message sent from a subagent to its master agent, the varbinds specify the objects to be sent in a trap message to the SNMP manager. A trap message from a subagent follows the SNMPv2 trap style. Thus, the first object in the list must always be sysUpTime. The second object must be a snmpTrapOID.0 whose value is the administratively assigned name of the notification.

pHdr
Expects a pointer to a SA_HEADER_T structure containing all the items that go into the message header.

pDemuxer
Expects a pointer to an SA_DEMUX_T structure containing all the information the subagent might need to demux the packet. That is, to determine the time and space contexts for this request. In a v1 request, the string part of the demuxer is the community string and the object ID is unused. In a v2 request, the string is the local entity string from the context and the Object ID is the local time ID from the context.

pBuf
Expects a pointer to an EBUFFER_T structure into which snmpSubEncode( ) can write the encoded packet. If pBuf references a previously allocated snmpSubEncode( ) tries to the necessary space.

RETURNS

0, if successful (that is, the structure at pBuf is ready for transmission); 1, if there is an illegal or unknown argument; 2, if there is insufficient buffer space at pBuf or space cannot be allocated.

SEE ALSO

subagentLib