SNMP Manager Programmer's Guide
Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-2
EBUFFER_T Attributes
 EBUFFER_T Attributes
Buffers that hold encoded packets must be described by the EBUFFER_T structure, 
defined in Section 4, Using Header Files, Data Structures, and Defines,, although you 
can use EBUFFER_T buffers for any buffer in your manager:
EBUFFER_T ebuff;
The EBUFFER_T type provides a set of descriptors for a buffer. It does not itself 
allocate the storage to hold information. Buffer storage space is allocated by you or by 
Manager Services, as described in subsequent subsections. EBUFFER_T fields describe 
various regions in a buffer:
The buffer descriptors are initially set when you initialize the buffer.
Using a Buffer for Packet Encoding and Decoding 
In the context of packet encoding and decoding, you perform several operations that use 
a buffer described by the EBUFFER_T structure:
1. You initialize the EBUFFER_T buffer descriptors.
2. You encode a request or trap packet in a structure of type SNMP_PKT_T into the 
buffer, then transmit the buffer to its target entity.
3. You receive a response or trap packet into an EBUFFER_T buffer, then decode the 
buffer contents into a structure of type SNMP_PKT_T.
4. You deallocate any dynamic memory allocated for the buffer. 
Initializing the Encoded-Packet Buffer Descriptors
Before encoding a packet into the encoded-packet buffer, you need to initialize its 
descriptors. The approach you use depends on whether you want to allocate memory for 
the buffer in your manager or whether you want Manager Services to allocate memory 
for the buffer.
start_bp Points to the buffer location where the information of interest starts.
next_bp Points to the next unused byte in the buffer.
remaining Is the number of unused bytes remaining in the buffer.
601
ebuff
remaining
start_bp next_bp










