Debian Codegraph @

runtime/parser.h

raw
1 /* header for parser.c
2 *
3 * Copyright 2008-2026 Adiscon GmbH.
4 *
5 * This file is part of the rsyslog runtime library.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 * -or-
13 * see COPYING.ASL20 in the source distribution
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21 #ifndef INCLUDED_PARSER_H
22 #define INCLUDED_PARSER_H
23
24 /* we create a small helper object, a list of parsers, that we can use to
25 * build a chain of them whereever this is needed (initially thought to be
26 * used in ruleset.c as well as ourselvs).
27 */
28 struct parserList_s {
29 parser_t *pParser;
30 parserList_t *pNext;
31 };
32
33
34 /* the parser object, a dummy because we have only static methods */
35 struct parser_s {
36 BEGINobjInstance
37 ; /* Data to implement generic object - MUST be the first data element! */
38 uchar *pName; /* name of this parser */
39 modInfo_t *pModule; /* pointer to parser's module */
40 void *pInst; /* instance data for the parser (v2+ module interface) */
41 sbool bDoSanitazion; /* do standard message sanitazion before calling parser? */
42 sbool bDoPRIParsing; /* do standard PRI parsing before calling parser? */
43 };
44
45 /* interfaces */
46 BEGINinterface(parser) /* name must also be changed in ENDinterface macro! */
47 INTERFACEObjDebugPrint(var);
48 rsRetVal (*Construct)(parser_t **ppThis);
49 rsRetVal (*ConstructFinalize)(parser_t *pThis);
50 rsRetVal (*Destruct)(parser_t **ppThis);
51 rsRetVal (*SetName)(parser_t *pThis, uchar *name);
52 rsRetVal (*SetModPtr)(parser_t *pThis, modInfo_t *pMod);
53 rsRetVal (*SetDoPRIParsing)(parser_t *pThis, int);
54 rsRetVal (*FindParser)(parserList_t *pParserListRoot, parser_t **ppThis, uchar *name);
55 rsRetVal (*DestructParserList)(parserList_t **pListRoot);
56 rsRetVal (*AddParserToList)(parserList_t **pListRoot, parser_t *pParser);
57 rsRetVal (*destroyMasterParserList)(parserList_t *pParserListRoot);
58 /* static functions */
59 rsRetVal (*ParseMsg)(smsg_t *pMsg);
60 rsRetVal (*SanitizeMsg)(smsg_t *pMsg);
61 rsRetVal (*AddDfltParser)(uchar *);
62 ENDinterface(parser)
63 #define parserCURR_IF_VERSION 3 /* increment whenever you change the interface above! */
64 /* version changes
65 2 SetDoSanitization removed, no longer needed
66 3 InitParserList removed, no longer needed
67 destroyMasterParserList added
68 findParser extended with new parameter specifying the parser list
69 */
70
71 void printParserList(parserList_t *pList);
72
73 /* prototypes */
74 PROTOTYPEObjFull(parser);
75 rsRetVal parserConstructViaModAndName(modInfo_t *pMod, uchar *const pName, void *parserInst);
76
77
78 #endif /* #ifndef INCLUDED_PARSER_H */