catbuf - dynamic session data container
A cat_buffer
is a data dynamic container of data, passed along the sessions, from input
to output. The buffers appear as a continuous memory area.
Important properties of the buffers are as follows:
-
Each buffer is normally, but not necessarily, associated with a session.
This allows the implementation to use smart caching of frequently used
buffer sizes.
-
The contents of a cat_buffer should not be modified directly. Functions and macros are available for the
manipulation of buffer data.
-
A buffer uses an ``offset counter,'' or index, or pointer, which starts at
zero. Several of the functions that operate on buffers use or change this
index. Using these functions, the buffer can be viewed as a virtual
contiguous memory area.
-
The buffer functions perform only minimal error checking for invalid data.
No supplied pointer arguments should be null, unless this is explicitly
allowed. Functions will detect offsets that are out of range. Error
handlers are never called from within the buffer functions.
- catbuf_block
-
Gives direct access to the data block in a catbuffer structure.
- catbuf_ch
-
Read a character from a catbuffer.
- catbuf_copy
-
Copy the contents of a catbuffer to a ``normal'' data buffer.
- catbuf_delete
-
Remove a range of bytes.
- catbuf_dup
-
Duplicate a catbuffer.
- catbuf_extract
-
Extract bytes from a catbuffer, that is, remove the bytes from the
catbuffer and copy them to another ``real'' buffer.
- catbuf_free
-
Destroy a catbuffer and free its contents.
- catbuf_get
-
Remove a catbuffer from the framework data stream.
- catbuf_index
-
Set the index pointer value.
- catbuf_insert
-
Insert data into the buffer.
- catbuf_join
-
Combine two catbuffers to form a single catbuffer.
- catbuf_len
-
Get the length of the contents of the catbuffer.
- catbuf_match
-
Check if the catbuffer data contains any of the specified characters.
- catbuf_new
-
Create a new catbuffer and optionally insert data in it.
- catbuf_overwrite
-
Place data in a catbuffer, overwriting any previous contents.
- catbuf_pos
-
Get the index position.
- catbuf_put
-
Insert a buffer into the framework data stream.
- catbuf_scan
-
Scan a buffer for the occurrence of certain specified characters.
- catbuf_split
-
Split a catbuffer into two catbuffers.
All functions that return integers return a negative value on error. The
generic error codes can be found in caterr.
For other functions, the relevant return values are stated in the
corresponding function documentation.
cat,
catbuf_block,
catbuf_ch, catbuf_copy, catbuf_delete, catbuf_extract,
catbuf_free,
catbuf_dup,
catbuf_get, catbuf_index, catbuf_insert, catbuf_join,
catbuf_len, catbuf_match, catbuf_new, catbuf_overwrite,
catbuf_pos, catbuf_put, catbuf_scan, catbuf_split