SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-12
Managers Supporting UDP and IPC
32. The SNMP_WriteRead_() function encodes and transmits request packets and 
receives and decodes response packets. This function accepts a pointer to 
SNMP_HOST_INT_T, a pointer to an unencoded request packet structure, a double 
pointer to the response packet structure, a pointer to a structure containing 
descriptors for the encoded-packet buffer (ebuffp), and an integer describing the 
kind of output messages desired. The function returns an integer describing the 
outcome of its processing.
33. A second structure for holding encoded-packet buffer descriptors, myEBuff, is 
declared.  Descriptors in this structure are used when sending IPC packets. 
34. The passed encoded-packet buffer descriptors are initialized using the Manager 
Services library function EBufferReset(). This function sets a start pointer 
(start_bp) and a next pointer (next_bp) to point to the beginning of the buffer, and 
sets the value of remaining to the size of the buffer: 
35. For UDP communication, myEBuff descriptors are set up to point past the socket 
address:
36.  The Manager Services library function tdm_SNMP_Encode_Packet() encodes the 
request packet for transmission.  This function encodes the contents of spkt into the 
buffer described by myEBuff, starting at start_bp. If the third argument has been 
assigned the value LOCAL_HOSTNAME, Manager Services encodes the packet for 
IPC communication. If the argument has been assigned the value 
REMOTE_HOSTNAME, Manager Services encodes the packet for UDP 
communication.  After encoding, the buffer descriptors look like this:
203
ebuffp
start_bp
next_bp
remaining
204
myEBuff
size of 
sockaddr_in
remaining
start_bp
next_bp
205
myEBuff
start_bp next_bp
remaining
spkt values
size of 
sockaddr_in










