SNMP Manager Programmer's Guide

Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-18
Function for Decoding Packets
The sample managers that support both UDP and IPC obtain the number of bytes read
when the packet was received by calling AWAITIOX(). Before decoding BER-encoded
packets, the start_bp pointer is set to the byte after the socket address:
short read_cnt;
SNMP_PKT_T **rpkt;
EBUFFER_T myEBuff;
long err2 = 0;
AWAITIOX (&temp_file_num, (long*) &IOC_buffp, &read_cnt,
&IO_tag,
(long)(host_int->timeout));
host_int->count_read = read_cnt;
...
if (host_int->local_flag == REMOTE_HOSTNAME)
{
memcpy ((char*) &host_int->from,
(void *) ebuffp->start_bp,
sizeof(host_int->from));
read_cnt -= sizeof(struct sockaddr_in);
}
*rpkt = SNMP_Decode_Packet_WER(myEBuff.start_bp, read_cnt,
(SNMPADDR_T*) 0, (SNMPADDR_T *) 0, &err2);