#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rdd.h"
#include "writer.h"
#include "filter.h"
Go to the source code of this file.
Defines | |
#define | is_block_filter(fltr) ((fltr)->ops->block != 0) |
#define | is_stream_filter(fltr) ((fltr)->ops->block == 0) |
Functions | |
static int | block_filter_push (RDD_FILTER *f, const unsigned char *buf, unsigned nbyte) |
int | rdd_filter_close (RDD_FILTER *f) |
Closes a filter for input. | |
int | rdd_filter_free (RDD_FILTER *f) |
Deallocates a filter and its resources. | |
int | rdd_filter_get_result (RDD_FILTER *f, unsigned char *buf, unsigned nbyte) |
Obtains a filter's result. | |
int | rdd_filter_push (RDD_FILTER *f, const unsigned char *buf, unsigned nbyte) |
Pushes a data buffer into a filter. | |
int | rdd_new_filter (RDD_FILTER **self, RDD_FILTER_OPS *ops, unsigned statesize, unsigned blocksize) |
static int | stream_filter_push (RDD_FILTER *f, const unsigned char *buf, unsigned nbyte) |
Variables | |
static char | copyright [] |
static int block_filter_push | ( | RDD_FILTER * | f, | |
const unsigned char * | buf, | |||
unsigned | nbyte | |||
) | [static] |
Definition at line 107 of file filter.c.
References _RDD_FILTER_OPS::block, _RDD_FILTER::blocksize, _RDD_FILTER_OPS::input, _RDD_FILTER::ops, _RDD_FILTER::pos, and RDD_OK.
int rdd_filter_close | ( | RDD_FILTER * | f | ) |
Closes a filter for input.
f | the filter |
RDD_OK
on success.rdd_filter_push()
).
Definition at line 160 of file filter.c.
References _RDD_FILTER_OPS::block, _RDD_FILTER_OPS::close, is_block_filter, _RDD_FILTER::ops, _RDD_FILTER::pos, and RDD_OK.
int rdd_filter_free | ( | RDD_FILTER * | f | ) |
Deallocates a filter and its resources.
f | the filter |
RDD_OK
on success.Definition at line 193 of file filter.c.
References _RDD_FILTER_OPS::free, _RDD_FILTER::ops, RDD_OK, and _RDD_FILTER::state.
int rdd_filter_get_result | ( | RDD_FILTER * | f, | |
unsigned char * | buf, | |||
unsigned | nbyte | |||
) |
Obtains a filter's result.
f | the filter | |
buf | the client's result buffer | |
nbyte | the size of the client's result buffer |
RDD_OK
on success.Definition at line 181 of file filter.c.
References _RDD_FILTER_OPS::get_result, _RDD_FILTER::ops, RDD_BADARG, and RDD_NOTFOUND.
int rdd_filter_push | ( | RDD_FILTER * | f, | |
const unsigned char * | buf, | |||
unsigned | nbyte | |||
) |
Pushes a data buffer into a filter.
Passes a buffer of nbyte bytes to a filter. If the filter is a stream filter it will simply pass the buffer to the client's handler. If the filter is a block filter, it processes the buffer block by block, calling the client's block handler at each block boundary.
Definition at line 149 of file filter.c.
References block_filter_push(), is_stream_filter, and stream_filter_push().
int rdd_new_filter | ( | RDD_FILTER ** | self, | |
RDD_FILTER_OPS * | ops, | |||
unsigned | statesize, | |||
unsigned | blocksize | |||
) |
This is a convenience routine that can (and should) be used by filter implementations to initialize the 'base' filter.
Definition at line 63 of file filter.c.
References _RDD_FILTER_OPS::block, _RDD_FILTER::blocksize, _RDD_FILTER::ops, _RDD_FILTER::pos, RDD_BADARG, RDD_NOMEM, RDD_OK, and _RDD_FILTER::state.
static int stream_filter_push | ( | RDD_FILTER * | f, | |
const unsigned char * | buf, | |||
unsigned | nbyte | |||
) | [static] |
char copyright[] [static] |