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.
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 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.
typedef struct _RDD_FSET_CURSOR RDD_FSET_CURSOR |
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.
int rdd_fset_add | ( | RDD_FILTERSET * | fset, | |
const char * | name, | |||
RDD_FILTER * | f | |||
) |
Adds a named filter to a filter set.
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 |
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.
int rdd_fset_clear | ( | RDD_FILTERSET * | fset | ) |
Destroys all resources associated with a filter set.
fset | the filter set |
RDD_OK
on success.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.
int rdd_fset_close | ( | RDD_FILTERSET * | fset | ) |
Closes all filters in a filter set.
fset | the filter set |
RDD_OK
on success.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.
int rdd_fset_cursor_close | ( | RDD_FSET_CURSOR * | c | ) |
Closes a filter cursor.
c | the filter cursor |
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.
c | the filter cursor | |
f | output value: the filter stored at the current position |
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.
fset | the filter set | |
name | the name | |
f | output value: the filter that is associated with name |
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.
fset | a pointer to the filter set that is to be initialized |
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.
fset | the filter set | |
c | the cursor |
RDD_OK
on success.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.
fset | the filter set | |
buf | the data buffer | |
nbyte | the size in bytes of the data buffer |
RDD_OK
on success.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.