diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-31 13:30:55 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-31 13:30:55 +0000 |
commit | 7449e8356b19900acaa33e387bd4ea65ba85e204 (patch) | |
tree | 2eb63b04a2c5fbdba3c18df0ad1636a13075f2da /cfsysline.c | |
parent | 48fd0e472a75a32e70fa1938c2279cf730282370 (diff) | |
download | rsyslog-7449e8356b19900acaa33e387bd4ea65ba85e204.tar.gz rsyslog-7449e8356b19900acaa33e387bd4ea65ba85e204.tar.xz rsyslog-7449e8356b19900acaa33e387bd4ea65ba85e204.zip |
- added interface to register a cfsysline command handler (basic
functionality)
Diffstat (limited to 'cfsysline.c')
-rw-r--r-- | cfsysline.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/cfsysline.c b/cfsysline.c index daebdd05..c28e8865 100644 --- a/cfsysline.c +++ b/cfsysline.c @@ -412,10 +412,20 @@ rsRetVal cslchCallHdlr(cslCmdHdlr_t *pThis, uchar **ppConfLine) * now come the handlers for cslCmd_t * ---------------------------------------------------------------------- */ +/* destructor for a cslCmd list key (a string as of now) + */ +static rsRetVal cslcKeyDestruct(void *pData) +{ + free(pData); /* we do not need to cast as all we do is free it anyway... */ + return RS_RET_OK; +} + /* destructor for cslCmd */ -rsRetVal cslcDestruct(cslCmd_t *pThis) +static rsRetVal cslcDestruct(void *pData) { + cslCmd_t *pThis = (cslCmd_t*) pData; + assert(pThis != NULL); llDestroy(pThis->pllCmdHdlrs); @@ -443,6 +453,34 @@ finalize_it: *ppThis = pThis; return iRet; } + + +/* function that initializes this module here. This is primarily a hook + * for syslogd. + */ +rsRetVal cfsyslineInit(void) +{ + DEFiRet; + + CHKiRet(llInit(&llCmdList, cslcDestruct, cslcKeyDestruct)); + +finalize_it: + return iRet; +} + + +/* function that registers cfsysline handlers. + */ +rsRetVal regCfSysLineHdlr(uchar *pCmdName, ecslCmdHdrlType eType, rsRetVal (*pHdlr)(), void *pData) +{ + cslCmd_t *pThis; + DEFiRet; + + iRet = llFind(&llCmdList, (void *) pCmdName, (void**) &pThis); +dprintf("regCfSysLineHdlr returned %d\n", iRet); + + return iRet; +} /* * vi:set ai: */ |