~arges/ubuntu/quantal/rsyslog/fix-lp1059592

« back to all changes in this revision

Viewing changes to regexp.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2009-02-15 21:56:23 UTC
  • mto: (3.2.4 squeeze) (1.1.9 upstream)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090215215623-xsycf628eo3kguc0
Tags: upstream-3.20.4
ImportĀ upstreamĀ versionĀ 3.20.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The regexp object.
2
 
 *
3
 
 * Module begun 2008-03-05 by Rainer Gerhards, based on some code
4
 
 * from syslogd.c
5
 
 *
6
 
 * Copyright 2008 Rainer Gerhards and Adiscon GmbH.
7
 
 *
8
 
 * This file is part of the rsyslog runtime library.
9
 
 *
10
 
 * The rsyslog runtime library is free software: you can redistribute it and/or modify
11
 
 * it under the terms of the GNU Lesser General Public License as published by
12
 
 * the Free Software Foundation, either version 3 of the License, or
13
 
 * (at your option) any later version.
14
 
 *
15
 
 * The rsyslog runtime library is distributed in the hope that it will be useful,
16
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 * GNU Lesser General Public License for more details.
19
 
 *
20
 
 * You should have received a copy of the GNU Lesser General Public License
21
 
 * along with the rsyslog runtime library.  If not, see <http://www.gnu.org/licenses/>.
22
 
 *
23
 
 * A copy of the GPL can be found in the file "COPYING" in this distribution.
24
 
 * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
25
 
 */
26
 
 
27
 
#include "config.h"
28
 
#include <regex.h>
29
 
#include <string.h>
30
 
#include <assert.h>
31
 
 
32
 
#include "rsyslog.h"
33
 
#include "module-template.h"
34
 
#include "obj.h"
35
 
#include "regexp.h"
36
 
 
37
 
MODULE_TYPE_LIB
38
 
 
39
 
/* static data */
40
 
DEFobjStaticHelpers
41
 
 
42
 
 
43
 
/* ------------------------------ methods ------------------------------ */
44
 
 
45
 
 
46
 
 
47
 
/* queryInterface function
48
 
 * rgerhards, 2008-03-05
49
 
 */
50
 
BEGINobjQueryInterface(regexp)
51
 
CODESTARTobjQueryInterface(regexp)
52
 
        if(pIf->ifVersion != regexpCURR_IF_VERSION) { /* check for current version, increment on each change */
53
 
                ABORT_FINALIZE(RS_RET_INTERFACE_NOT_SUPPORTED);
54
 
        }
55
 
 
56
 
        /* ok, we have the right interface, so let's fill it
57
 
         * Please note that we may also do some backwards-compatibility
58
 
         * work here (if we can support an older interface version - that,
59
 
         * of course, also affects the "if" above).
60
 
         */
61
 
        pIf->regcomp = regcomp;
62
 
        pIf->regexec = regexec;
63
 
        pIf->regerror = regerror;
64
 
        pIf->regfree = regfree;
65
 
finalize_it:
66
 
ENDobjQueryInterface(regexp)
67
 
 
68
 
 
69
 
/* Initialize the regexp class. Must be called as the very first method
70
 
 * before anything else is called inside this class.
71
 
 * rgerhards, 2008-02-19
72
 
 */
73
 
BEGINAbstractObjClassInit(regexp, 1, OBJ_IS_LOADABLE_MODULE) /* class, version */
74
 
        /* request objects we use */
75
 
 
76
 
        /* set our own handlers */
77
 
ENDObjClassInit(regexp)
78
 
 
79
 
 
80
 
/* --------------- here now comes the plumbing that makes as a library module --------------- */
81
 
 
82
 
 
83
 
BEGINmodExit
84
 
CODESTARTmodExit
85
 
ENDmodExit
86
 
 
87
 
 
88
 
BEGINqueryEtryPt
89
 
CODESTARTqueryEtryPt
90
 
CODEqueryEtryPt_STD_LIB_QUERIES
91
 
ENDqueryEtryPt
92
 
 
93
 
 
94
 
BEGINmodInit()
95
 
CODESTARTmodInit
96
 
        *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
97
 
 
98
 
        CHKiRet(regexpClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */
99
 
        /* Initialize all classes that are in our module - this includes ourselfs */
100
 
ENDmodInit
101
 
/* vi:set ai:
102
 
 */