SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide134249
2-13
Managers Supporting UDP and IPC
37. If the PRINT_SEND_MSG flag is set, the contents of spkt are displayed using the
common utility function print_pkt().
38. The Manager Services library function EBufferUsed() returns the number of bytes
between start_bp and next_bp to send_cnt.
39. For UDP communication, the destination socket address is written to the beginning
of the buffer described by ebuffp, as required by the D20 socket library.
Then send_cnt is incremented by the size of the sockaddr_in value, and data in the
buffer, starting at start_bp and continuing to next_bp, is sent using the t_sendto_nw()
socket call.
40. For IPC communication, data in the buffer described by myEBuff, illustrated in Item
36 earlier, is sent using WRITEX(), again starting at start_bp and continuing to
next_bp.
41. The AWAITIOX() system call detects when an I/O operation has been completed.
Then it identifies the file used and describes the outcome of the operation. Note that
the value of timeout is used to specify the maximum amount of time the manager
waits for I/O completion, in centiseconds. Any timeout is detected by the
subsequent call to FILE_GETINFO_().
42. If FILE_GETINFO_() indicates that an error occurred in either UDP or IPC
communication, it prints a message if the PRINT_DEBUG_MSG flag is set.
43. EBufferReset() is called to reset the encoded-packed buffer descriptors as described
in Item 34 in preparation for decoding a response packet.
44. If the response is received using UDP communication, socket_get_len() is called to
determine how much of the buffer to read. Then t_recvfrom_nw() receives the
response packet into the buffer.
45. If the response is received using IPC communication, READX() receives the
response packet into the buffer. FILE_GETINFO_() detects whether an error
occurred during this read operation.
46. Another AWAITIOX() system call detects I/O completion and returns the number of
bytes read in read_cnt.
47. If the response is received using UDP communication, the structure named “from”
in SNMP_HOST_INT_T is set to describe the socket from which the response was
received, and read_cnt is adjusted to decrement the count by the number of bytes in
the address.
206
ebuffp
start_bp
next_bp
remaining
spkt valuessockaddr_in