SNMP Manager Programmer's Guide

Encoding and Decoding Packets
SNMP Manager Programmer’s Guide134249
6-5
Releasing Encoded-Packet Buffer Memory
Releasing Encoded-Packet Buffer Memory
When you no longer need a buffer for which space has been dynamically allocated by
you or by Manager Services, you use the EBufferClean() function to release allocated
memory:
EBufferClean(&ebuff);
This function releases memory allocated for the buffer and calls EBufferInitialize(),
setting the buffer descriptors as described for that function.
Using a Buffer for General Purposes
The Manager Services buffer manipulation functions are useful for handling any buffer
you manage using EBUFFER_T descriptors. For example, they can be used to
manipulate the two EBUFFER_T fields in the packet structure: community and
std_pdu.std_vbl.vblist.value_u.v_string.
The previous subsection describes some of the buffer manipulation functions:
EBufferInitialize(), EBufferSetup(), SNMP_memory_alloc(), and EBufferClean(). This
subsection introduces the remaining functions.
Four of the functions retrieve information about the buffer and its contents:
EBufferStart() returns the value of start_bp.
EBufferNext() returns the value of next_bp.
EBufferRemaining() returns the value of remaining.
EBufferUsed() returns the number of bytes between start_bp and next_bp.
Three additional Manager Services functions are available for manipulating an
EBUFFER_T buffer:
EBufferReset() resets the buffer descriptors for a buffer already allocated:
EBufferReset(ebuffp);
The buffer descriptors after an EBufferReset() call are exactly as described for
EBufferSetup().
602
remaining
start_bp next_bp
(EBufferStart())
(EBufferNext())
EBufferRemaining()
(EBufferUsed())