src/filterset.h File Reference


Detailed Description

Filter collection module.

This header file defines routines that allow a client to create a collection of filters ---a filter set--- and to pass data to all filters in such a filter set with a single function call.

Definition in file filterset.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _RDD_FILTERSET
 Representation of a filter collection. More...
struct  _RDD_FSET_CURSOR
 Representation of a filter cursor. More...
struct  _RDD_FSET_NODE
 Representation of a filter node. More...

Typedefs

typedef struct _RDD_FILTERSET RDD_FILTERSET
 Representation of a filter collection.
typedef struct _RDD_FSET_CURSOR RDD_FSET_CURSOR
 Representation of a filter cursor.
typedef struct _RDD_FSET_NODE RDD_FSET_NODE
 Representation of a filter node.

Functions

int rdd_fset_add (RDD_FILTERSET *fset, const char *name, RDD_FILTER *f)
 Adds a named filter to a filter set.
int rdd_fset_clear (RDD_FILTERSET *fset)
 Destroys all resources associated with a filter set.
int rdd_fset_close (RDD_FILTERSET *fset)
 Closes all filters in a filter set.
int rdd_fset_cursor_close (RDD_FSET_CURSOR *c)
 Closes a filter cursor.
int rdd_fset_cursor_next (RDD_FSET_CURSOR *c, RDD_FILTER **f)
 Retrieves the filter stored at a filter cursor's current position and advances the filter cursor.
int rdd_fset_get (RDD_FILTERSET *fset, const char *name, RDD_FILTER **f)
 Looks up a filter by name in a filter set.
int rdd_fset_init (RDD_FILTERSET *fset)
 Initializes a filter set.
int rdd_fset_open_cursor (RDD_FILTERSET *fset, RDD_FSET_CURSOR *c)
 Opens a cursor that can be used to iterate over a filter set.
int rdd_fset_push (RDD_FILTERSET *fset, const unsigned char *buf, unsigned nbyte)
 Pushes a data buffer into all filters in a filter set.


Typedef Documentation

typedef struct _RDD_FILTERSET RDD_FILTERSET

Representation of a filter collection.

A filter set is implemented as a linked list of RDD_FSET_NODE nodes. This structure defines the list structure that gives access to the list nodes.

Representation of a filter cursor.

A filter cursor is used to visit all filters in a filter set. The cursor keeps track of the current position in the filter set.

typedef struct _RDD_FSET_NODE RDD_FSET_NODE

Representation of a filter node.

A filter set is implemented as a linked list of filters. This structure defines the representation of a list node.


Function Documentation

int rdd_fset_add ( RDD_FILTERSET fset,
const char *  name,
RDD_FILTER f 
)

Adds a named filter to a filter set.

Parameters:
fset the filter set
name the name that will be associated with the filter that is added to the filter set
f the filter that is added
Returns:
Returns RDD_OK on success (the filter has been added to the filter set). Returns RDD_EEXISTS if the filter set already contains a filter named name. In this case the filter is not added to the filter set.

Definition at line 72 of file filterset.c.

References error(), _RDD_FSET_NODE::filter, _RDD_FSET_NODE::name, _RDD_FSET_NODE::next, RDD_BADARG, RDD_EEXISTS, rdd_fset_get(), RDD_NOMEM, RDD_NOTFOUND, RDD_OK, and _RDD_FILTERSET::tail.

Here is the call graph for this function:

int rdd_fset_clear ( RDD_FILTERSET fset  ) 

Destroys all resources associated with a filter set.

Parameters:
fset the filter set
Returns:
Returns RDD_OK on success.
This function will also destroy all filters stored in the filter set by calling rdd_filter_free() for each filter.

Definition at line 205 of file filterset.c.

References _RDD_FSET_NODE::filter, _RDD_FILTERSET::head, _RDD_FSET_NODE::name, _RDD_FSET_NODE::next, rdd_filter_free(), and RDD_OK.

Here is the call graph for this function:

int rdd_fset_close ( RDD_FILTERSET fset  ) 

Closes all filters in a filter set.

Parameters:
fset the filter set
Returns:
Returns RDD_OK on success.
This function closes all filters in the filters by calling rdd_filter_close(f) for each filter f in the filter set.

Definition at line 189 of file filterset.c.

References _RDD_FSET_NODE::filter, _RDD_FILTERSET::head, _RDD_FSET_NODE::next, rdd_filter_close(), and RDD_OK.

Here is the call graph for this function:

int rdd_fset_cursor_close ( RDD_FSET_CURSOR c  ) 

Closes a filter cursor.

Parameters:
c the filter cursor
Returns:
Returns RDD_OK on success.

Definition at line 166 of file filterset.c.

References _RDD_FSET_CURSOR::current, and RDD_OK.

int rdd_fset_cursor_next ( RDD_FSET_CURSOR c,
RDD_FILTER **  f 
)

Retrieves the filter stored at a filter cursor's current position and advances the filter cursor.

Parameters:
c the filter cursor
f output value: the filter stored at the current position
Returns:
Returns RDD_OK on success. Returns RDD_NOTFOUND if the cursor has already visited all filters.

Definition at line 153 of file filterset.c.

References _RDD_FSET_CURSOR::current, _RDD_FSET_NODE::filter, _RDD_FSET_NODE::next, RDD_NOTFOUND, and RDD_OK.

int rdd_fset_get ( RDD_FILTERSET fset,
const char *  name,
RDD_FILTER **  f 
)

Looks up a filter by name in a filter set.

Parameters:
fset the filter set
name the name
f output value: the filter that is associated with name
Returns:
Returns RDD_OK on success (filter set fset contains a filter named name). Returns RDD_NOTFOUND if filter set fset contains no filter named name.

Definition at line 124 of file filterset.c.

References _RDD_FSET_NODE::filter, _RDD_FILTERSET::head, _RDD_FSET_NODE::name, _RDD_FSET_NODE::next, RDD_NOTFOUND, and RDD_OK.

int rdd_fset_init ( RDD_FILTERSET fset  ) 

Initializes a filter set.

Parameters:
fset a pointer to the filter set that is to be initialized
Returns:
Returns RDD_OK on success.

Definition at line 63 of file filterset.c.

References _RDD_FILTERSET::head, RDD_OK, and _RDD_FILTERSET::tail.

int rdd_fset_open_cursor ( RDD_FILTERSET fset,
RDD_FSET_CURSOR c 
)

Opens a cursor that can be used to iterate over a filter set.

Parameters:
fset the filter set
c the cursor
Returns:
Returns RDD_OK on success.
A filter cursor is used to visit all filters in a filter set. The order in which filters are visited is not defined. A filter set must not be modified (no insertions or deletions) while it is being visited by a filter cursor.

Definition at line 146 of file filterset.c.

References _RDD_FSET_CURSOR::current, _RDD_FILTERSET::head, and RDD_OK.

int rdd_fset_push ( RDD_FILTERSET fset,
const unsigned char *  buf,
unsigned  nbyte 
)

Pushes a data buffer into all filters in a filter set.

Parameters:
fset the filter set
buf the data buffer
nbyte the size in bytes of the data buffer
Returns:
Returns RDD_OK on success.
This function passes data buffer buf to each filter in the filter set by calling rdd_filter_push(f, buf, nbyte) for each filter f in the filter set.

Definition at line 173 of file filterset.c.

References _RDD_FSET_NODE::filter, _RDD_FILTERSET::head, _RDD_FSET_NODE::next, rdd_filter_push(), and RDD_OK.

Here is the call graph for this function:


Generated on Sun Feb 6 12:36:12 2011 for rdd by  doxygen 1.5.6