diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/Makefile.am | 2 | ||||
-rw-r--r-- | runtime/lookup.c | 75 | ||||
-rw-r--r-- | runtime/lookup.h | 33 | ||||
-rw-r--r-- | runtime/typedefs.h | 1 |
4 files changed, 111 insertions, 0 deletions
diff --git a/runtime/Makefile.am b/runtime/Makefile.am index dea06fe0..510368a1 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -69,6 +69,8 @@ librsyslog_la_SOURCES = \ prop.h \ ratelimit.c \ ratelimit.h \ + lookup.c \ + lookup.h \ cfsysline.c \ cfsysline.h \ sd-daemon.c \ diff --git a/runtime/lookup.c b/runtime/lookup.c new file mode 100644 index 00000000..167370f3 --- /dev/null +++ b/runtime/lookup.c @@ -0,0 +1,75 @@ +/* lookup.c + * Support for lookup tables in RainerScript. + * + * Copyright 2013 Adiscon GmbH. + * + * This file is part of the rsyslog runtime library. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "config.h" +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "rsyslog.h" +#include "errmsg.h" +#include "lookup.h" +#include "msg.h" +#include "rsconf.h" +#include "dirty.h" + +/* definitions for objects we access */ +DEFobjStaticHelpers +DEFobjCurrIf(errmsg) +DEFobjCurrIf(glbl) + +/* static data */ + +rsRetVal +lookupNew(lookup_t **ppThis, char *modname, char *dynname) +{ + lookup_t *pThis; + DEFiRet; + + CHKmalloc(pThis = calloc(1, sizeof(lookup_t))); + + *ppThis = pThis; +finalize_it: + RETiRet; +} +void +lookupDestruct(lookup_t *lookup) +{ + free(lookup); +} + +void +lookupModExit(void) +{ + objRelease(glbl, CORE_COMPONENT); + objRelease(errmsg, CORE_COMPONENT); +} + +rsRetVal +lookupModInit(void) +{ + DEFiRet; + CHKiRet(objGetObjInterface(&obj)); + CHKiRet(objUse(glbl, CORE_COMPONENT)); + CHKiRet(objUse(errmsg, CORE_COMPONENT)); +finalize_it: + RETiRet; +} diff --git a/runtime/lookup.h b/runtime/lookup.h new file mode 100644 index 00000000..5eecf215 --- /dev/null +++ b/runtime/lookup.h @@ -0,0 +1,33 @@ +/* header for lookup.c + * + * Copyright 2013 Adiscon GmbH. + * + * This file is part of the rsyslog runtime library. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * -or- + * see COPYING.ASL20 in the source distribution + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef INCLUDED_LOOKUP_H +#define INCLUDED_LOOKUP_H + +struct lookup_s { +}; + +/* prototypes */ +rsRetVal lookupNew(lookup_t **ppThis, char *modname, char *dynname); +void lookupDestruct(lookup_t *pThis); +rsRetVal lookupModInit(void); +void lookupModExit(void); + +#endif /* #ifndef INCLUDED_LOOKUP_H */ diff --git a/runtime/typedefs.h b/runtime/typedefs.h index d3f68b4a..616b60c9 100644 --- a/runtime/typedefs.h +++ b/runtime/typedefs.h @@ -100,6 +100,7 @@ typedef struct outchannels_s outchannels_t; typedef struct modConfData_s modConfData_t; typedef struct instanceConf_s instanceConf_t; typedef struct ratelimit_s ratelimit_t; +typedef struct lookup_s lookup_t; typedef struct action_s action_t; typedef int rs_size_t; /* we do never need more than 2Gig strings, signed permits to * use -1 as a special flag. */ |