diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-03 18:44:02 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-03 18:44:02 +0100 |
commit | b1db196953713dd09c499a3edf81347bd903c19e (patch) | |
tree | 7c4d1d4a92337f0cd1538c7cd9bc77904901ce8d /runtime/parser.h | |
parent | 6f511cecfae3592f271627ebcb41e6a8c4f831e9 (diff) | |
download | rsyslog-b1db196953713dd09c499a3edf81347bd903c19e.tar.gz rsyslog-b1db196953713dd09c499a3edf81347bd903c19e.tar.bz2 rsyslog-b1db196953713dd09c499a3edf81347bd903c19e.zip |
one step closer to dynamically loadable parsers
This is a milestone commit, which adds new code that breaks
nothing, but also does not add any visible change. Just prep work...
Diffstat (limited to 'runtime/parser.h')
-rw-r--r-- | runtime/parser.h | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/runtime/parser.h b/runtime/parser.h index d5d9243d..47521f63 100644 --- a/runtime/parser.h +++ b/runtime/parser.h @@ -1,8 +1,6 @@ /* header for parser.c - * This is not yet an object, but contains all those code necessary to - * parse syslog messages. * - * Copyright 2008 Rainer Gerhards and Adiscon GmbH. + * Copyright 2008,2009 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * @@ -21,18 +19,43 @@ * * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution. */ -#ifndef INCLUDED_PARSE_H -#define INCLUDED_PARSE_H +#ifndef INCLUDED_PARSER_H +#define INCLUDED_PARSER_H + + +/* we create a small helper object, a list of parsers, that we can use to + * build a chain of them whereever this is needed (initially thought to be + * used in ruleset.c as well as ourselvs). + */ +struct parserList_s { + parser_t *pParser; + parserList_t *pNext; +}; + /* the parser object, a dummy because we have only static methods */ -typedef struct parser_s { +struct parser_s { BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */ -} parser_t; + uchar *pName; /* name of this parser */ + modInfo_t *pModule; /* pointer to parser's module */ + bool bDoSanitazion; /* do standard message sanitazion before calling parser? */ +}; /* interfaces */ BEGINinterface(parser) /* name must also be changed in ENDinterface macro! */ INTERFACEObjDebugPrint(var); + rsRetVal (*Construct)(parser_t **ppThis); + rsRetVal (*ConstructFinalize)(parser_t *pThis); + rsRetVal (*Destruct)(parser_t **ppThis); + rsRetVal (*SetName)(parser_t *pThis, uchar *name); + rsRetVal (*SetModPtr)(parser_t *pThis, modInfo_t *pMod); + rsRetVal (*SetDoSanitazion)(parser_t *pThis, int); + rsRetVal (*FindParser)(parser_t **ppThis, uchar*name); + rsRetVal (*InitParserList)(parserList_t **pListRoot); + rsRetVal (*AddParserToList)(parserList_t **pListRoot, parser_t *pParser); + /* static functions */ rsRetVal (*ParseMsg)(msg_t *pMsg); + rsRetVal (*SanitizeMsg)(msg_t *pMsg); ENDinterface(parser) #define parserCURR_IF_VERSION 1 /* increment whenever you change the interface above! */ @@ -41,4 +64,4 @@ ENDinterface(parser) PROTOTYPEObj(parser); -#endif /* #ifndef INCLUDED_PARSE_H */ +#endif /* #ifndef INCLUDED_PARSER_H */ |