CONTENT="Modular DocBook HTML Stylesheet Version 1.73 >lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem -- lightweight resolver buffer management</
DIV>(lwres_buffer_t *b, void *base, unsigned int length);</
CODElwres_buffer_invalidate</
CODE>(lwres_buffer_t *b);</
CODE>(lwres_buffer_t *b, unsigned int n);</
CODElwres_buffer_subtract</
CODE>(lwres_buffer_t *b, unsigned int n);</
CODE>(lwres_buffer_t *b);</
CODE>(lwres_buffer_t *b);</
CODElwres_buffer_forward</
CODE>(lwres_buffer_t *b, unsigned int n);</
CODE>(lwres_buffer_t *b, unsigned int n);</
CODElwres_buffer_getuint8</
CODE>(lwres_buffer_t *b);</
CODElwres_buffer_putuint8</
CODE>(lwres_buffer_t *b, lwres_uint8_t val);</
CODElwres_buffer_getuint16</
CODE>(lwres_buffer_t *b);</
CODElwres_buffer_putuint16</
CODE>(lwres_buffer_t *b, lwres_uint16_t val);</
CODElwres_buffer_getuint32</
CODE>(lwres_buffer_t *b);</
CODElwres_buffer_putuint32</
CODE>(lwres_buffer_t *b, lwres_uint32_t val);</
CODElwres_buffer_putmem</
CODE>(lwres_buffer_t *b, const unsigned char *base, unsigned int length);</
CODElwres_buffer_getmem</
CODE>(lwres_buffer_t *b, unsigned char *base, unsigned int length);</
CODE>These functions provide bounds checked access to a region of memory
where data is being read or written.
They are based on, and similar to, the
functions in the ISC library.</
P>A buffer is a region of memory, together with a set of related
> region are disjoint, and
their union is the buffer's region.
The used region extends from the beginning of the buffer region to the
The available region extends from one byte greater than the last used
byte to the end of the buffer's region.
The size of the used region can be changed using various
Initially, the used region is empty.</
P>The used region is further subdivided into two disjoint regions: the
The union of these two regions is the used region.
The consumed region extends from the beginning of the used region to
the byte before the <
SPAN> region the current pointer to the end of the used
The size of the consumed region can be changed using various
Initially, the consumed region is empty.</
P> is an (optional) subregion of the remaining
It extends from the current offset to an offset in the
Initially, the active region is empty.
If the current offset advances beyond the chosen offset,
the active region will also be empty.</
P /------------entire length---------------\\
/----- used region -----\\/-- available --\\
+----------------------------------------+
| consumed | remaining | |
+----------------------------------------+
b == current pointer. Can be anywhere between a and d.
c == active pointer. Meaningful between b and d.
a-e == entire length of buffer.
b-c == optional active region.</
PREand assocates it with the memory region of size
bytes starting at location
>lwres_buffer_invalidate()</
TTas invalid. Invalidating a buffer after use is not required,
but makes it possible to catch its possible accidental use.</
P>lwres_buffer_subtract()</
TTrespectively increase and decrease the used space in
checks for buffer overflow and
>lwres_buffer_subtract()</
TTThese functions do not allocate or deallocate memory.
They just change the value of
>A buffer is re-initialised by
>lwres_buffer_clear()</
TTmakes the consumed region of buffer
to zero (the start of the buffer).</
P>lwres_buffer_forward()</
TTincreases the consumed region of buffer
bytes, checking for overflow.
bytes and checks for underflow.</
P>lwres_buffer_getuint8()</
TTreads an unsigned 8-bit integer from
>lwres_buffer_putuint8()</
TTwrites the unsigned 8-bit integer
>lwres_buffer_getuint16()</
TT>lwres_buffer_getuint32()</
TT>lwres_buffer_putuint8()</
TTexcept that they respectively read an unsigned 16-bit or 32-bit integer
in network byte order from
>lwres_buffer_putuint16()</
TT>lwres_buffer_putuint32()</
TTwrites the unsigned 16-bit or 32-bit integer
in network byte order.</
P>Arbitrary amounts of data are read or written from a lightweight
>lwres_buffer_getmem()</
TT>lwres_buffer_putmem()</
TT>lwres_buffer_putmem()</
TT>lwres_buffer_getmem()</
TT