SNMP Manager Programmer's Guide
Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-17
Function for Decoding Packets
Function for Decoding Packets
When you receive a response or trap packet, regardless of whether the packet is BER- or 
IPC-encoded, you use SNMP_Decode_Packet_WER() to decode it into a structure of 
type SNMP_PKT_T, which this function allocates dynamically. Dynamically allocated 
memory should be released by using SNMP_Free() when you no longer need the 
decoded-packet structure.  
packet
is a pointer to a structure of type SNMP_PKT_T if the function succeeds or a null 
pointer if it fails.
rcvd-buffer
is a pointer to the descriptor structure for the buffer containing the packet to be 
decoded.
read-count
is the number of bytes to decode.
rcode
is a pointer to an integer describing the success of the call. A value of 0 indicates 
success, and a value of 1 indicates an error occurred.
pktsrc
pktdst
are pointers to the source and destination addresses of the packet. These values are 
ignored; the sample managers all set the addresses to 0.
packet = SNMP_Decode_Packet_WER(rcvd-buffer, read-count,
 (SNMPADDR_T*) 0,
 (SNMPADDR_T*) 0,
 rcode);
SNMP_PKT_T* SNMP_Decode_Packet_WER(unsigned char *rcvd-
buffer,
 int read-count,
 SNMPADDR_T *pktsrc,
 SNMPADDR_T *pktdst,
 int *rcode);










