SNMP Manager Programmer's Guide

Reference Summary
SNMP Manager Programmer’s Guide–134249
9-45
Decoding Packets
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 = 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);
packet
A pointer to a structure of type SNMP_PKT_T if the function
succeeds or a null pointer if it fails.
rcvd-buffer
A pointer to the buffer containing the packet to be decoded.
read-count
The number of bytes to decode.
rcode
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
Should be set to 0.