SNMP Manager Programmer's Guide

Reference Summary
SNMP Manager Programmer’s Guide–134249
9-44
Encoding Packets
Encoding Packets
SNMP_Encode_Packet()
This function BER-encodes a request or trap packet into an initialized encoded-packet
buffer. If you previously allocated memory for the buffer, SNMP_Encode_Packet()
determines whether the memory allocated is sufficient, then proceeds only if it is. If you
have not allocated memory for the buffer, this function dynamically allocates enough
memory to hold the encoded packet.
tdm_SNMP_Encode_Packet()
This function either BER- or IPC-encodes a request or trap packet into an initialized
encoded-packet buffer, depending on the value of its final argument. If you previously
allocated memory for the buffer, tdm_SNMP_Encode_Packet() determines whether the
memory allocated is sufficient, then proceeds only if it is. If you have not allocated
memory for the buffer, this function dynamically allocates enough memory to hold the
encoded packet.
rcode = SNMP_Encode_Packet(packet, buffer);
int SNMP_Encode_Packet(SNMP_PKT_T* packet, EBUFFER_T*
buffer);
rcode
An integer describing the outcome of the call. If the call is
successful, 0 is returned; if not, -1 is returned.
packet
A pointer to an unencoded request or trap packet.
buffer
A pointer to the descriptor structure for an encoded-packet buffer
previously initialized with EBufferInitialize() or EBufferSetup().
rcode = tdm_SNMP_Encode_Packet(packet, buffer, mode);
int SNMP_Encode_Packet(SNMP_PKT_T* packet,
EBUFFER_T* buffer
short mode);
rcode
An integer describing the outcome of the call. If the call is
successful, 0 is returned; if not, -1 is returned.
packet
A pointer to an unencoded request or trap packet.
buffer
A pointer to the descriptor structure for an encoded-packet buffer
previously initialized with EBufferInitialize() or EBufferSetup().
mode
An integer indicating whether to BER- or IPC-encode the packet:
1 indicates IPC encoding.
Any other value indicates BER encoding.