From 2777a04ed2ba4fd36138b991d66a32a283361f7e Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 1 May 2008 16:34:46 +0000 Subject: Import parser construction utility library svn path=/trunk/libparserutils/; revision=4111 --- src/input/filter.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/input/filter.h (limited to 'src/input/filter.h') diff --git a/src/input/filter.h b/src/input/filter.h new file mode 100644 index 0000000..96941a6 --- /dev/null +++ b/src/input/filter.h @@ -0,0 +1,57 @@ +/* + * This file is part of LibParserUtils. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell + */ + +#ifndef parserutils_input_filter_h_ +#define parserutils_input_filter_h_ + +#include + +#include +#include + +typedef struct parserutils_filter parserutils_filter; + +/** + * Input filter option types + */ +typedef enum parserutils_filter_opttype { + PARSERUTILS_FILTER_SET_ENCODING = 0, +} parserutils_filter_opttype; + +/** + * Input filter option parameters + */ +typedef union parserutils_filter_optparams { + /** Parameters for encoding setting */ + struct { + /** Encoding name */ + const char *name; + } encoding; +} parserutils_filter_optparams; + + +/* Create an input filter */ +parserutils_filter *parserutils_filter_create(const char *int_enc, + parserutils_alloc alloc, void *pw); +/* Destroy an input filter */ +void parserutils_filter_destroy(parserutils_filter *input); + +/* Configure an input filter */ +parserutils_error parserutils_filter_setopt(parserutils_filter *input, + parserutils_filter_opttype type, + parserutils_filter_optparams *params); + +/* Process a chunk of data */ +parserutils_error parserutils_filter_process_chunk(parserutils_filter *input, + const uint8_t **data, size_t *len, + uint8_t **output, size_t *outlen); + +/* Reset an input filter's state */ +parserutils_error parserutils_filter_reset(parserutils_filter *input); + +#endif + -- cgit v1.2.3