SNMP Manager Programmer's Guide
Encoding and Decoding Packets
SNMP Manager Programmer’s Guide–134249
6-7
Functions for Managing an EBUFFER_T Buffer
Functions for Managing an EBUFFER_T Buffer
This subsection describes and provides examples for the functions listed in Table 6-1, 
which are used for initializing and managing EBUFFER_T buffers.
EBufferClean()
This function releases dynamic memory previously allocated for an EBUFFER_T buffer 
and calls EBufferInitialize() to set all the buffer descriptors to zero.  
buffer
is a pointer to the descriptor structure for the buffer for which memory is to be 
released.
Table 6-1. Functions for Managing EBUFFER_T Buffers
Function Description
EBufferClean() Releases dynamically obtained memory for a buffer and calls 
EBufferInitialize().
EBufferClone() Copies a buffer into a second buffer after dynamically allocating 
memory for it, duplicating the source buffer’s contents and 
descriptors.
EBufferInitialize() Initializes descriptors for a buffer that has no memory allocated 
for it, setting them all to 0.
EBufferNext() Returns the value of next_bp, the buffer descriptor pointing to 
the next unused byte in the buffer.
EBufferPreLoad() Sets up buffer descriptors for a buffer to which you have already 
written information but have not initialized.
EBufferRemaining() Returns the value of remaining, the buffer descriptor 
indicating the number of bytes still available in the buffer.
EBufferReset() Resets the buffer descriptors for a buffer already allocated; 
start_bp and next_bp are set to point to the start of the buffer, 
and the number of bytes allocated is assigned to remaining.
EBufferSetup() Initializes descriptors for a buffer for which you have allocated 
memory; start_bp and next_bp are set to point to the start of the 
buffer, and the number of bytes allocated is assigned to 
remaining.
EBufferStart() Returns the value of start_bp, the buffer descriptor pointing to 
the first byte of interest.
EBufferUsed() Returns the number of used bytes in the buffer.
SNMP_memory_alloc() Dynamically allocates memory for the buffer.
EBufferClean(buffer);
void EBufferClean(EBUFFER_T *buffer);










