NAME

catbuf_get - extract data from the filter stack

SYNOPSIS

#include <cat.h>

cat_buffer *catbuf_get(cat_session *s, int fd);

DESCRIPTION

catbuf_get() and catbuf_put() comprise the interface with the filter stack. All data passed to or from file descriptors in a filter should use these functions. Hence, these functions work only in association with a session.

catbuf_get() removes the current data buffer for file descriptor fd in session s, and returns the buffer. This function should be called by any filter function that wants to look at or modify the buffer data. The buffer data should be returned to the session with catbuf_put() or it will disappear from the data stream.

The offset counter is reset to zero when the buffer is returned.

RETURN VALUES

If successful, catbuf_get() returns a pointer to the data buffer. If the supplied file descriptor fd is invalid, the function returns NULL.

SEE ALSO

cat, catbuf, catbuf_put