From 738abe63ace672df7b665593dcc6820a126191c7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 19 Jul 2007 06:38:13 +0000 Subject: begin designing module interface --- syslogd-types.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'syslogd-types.h') diff --git a/syslogd-types.h b/syslogd-types.h index c598f73d..f15acfee 100644 --- a/syslogd-types.h +++ b/syslogd-types.h @@ -288,6 +288,57 @@ struct filed { }; typedef struct filed selector_t; /* new type name */ + +/* The following definitions are to be used for modularization. Currently, + * the code is NOT actually used. I am just adding pieces to it as I + * go along in designing the interface. + * rgerhards, 2007-07-19 + */ +typedef enum eModType_ { + eMOD_IN, /* input module */ + eMOD_OUT, /* output module */ + eMOD_FILTER /* filter module (not know yet if we will once have such at all...) */ +} eModType_t; + +/* how is this module linked? */ +typedef enum eModLinkType_ { + eMOD_LINK_STATIC, + eMOD_LINK_DYNAMIC_UNLOADED, /* dynalink module, currently not loaded */ + eMOD_LINK_DYNAMIC_LOADED /* dynalink module, currently loaded */ +} eModLinkType_t; + +typedef struct moduleInfo { + struct moduleInfo *pNext; /* support for creating a linked module list */ + int iModVers; /* Interface version of module */ + eModType_t eModType; /* type of this module */ + eModLinkType_t eModLinkType; + uchar* pszModName; /* printable module name, e.g. for dprintf */ + /* functions supported by all types of modules */ + rsRetVal (*modInit)(); /* initialize the module */ + /* be sure to support version handshake! */ + rsRetVal (*modExit)(); /* called before termination or module unload */ + /* below: parse a configuration line - return if processed + * or not. If not, must be parsed to next module. + */ + rsRetVal (*parseConfigLine)(uchar **pConfLine); + /* below: create an instance of this module. Most importantly the module + * can allocate instance memory in this call. + */ + rsRetVal (*createInstance)(); + union { + struct {/* data for input modules */ + /* input modules come after output modules are finished, I am + * currently not really thinking about them. rgerhards, 2007-07-19 + */ + }; + struct {/* data for output modules */ + /* below: perform the configured action + */ + rsRetVal (*doAction)(); + }; + } mod; +} modInfo_t; + #endif /* #ifndef SYSLOGD_TYPES_INCLUDED */ /* * vi:set ai: -- cgit