diff --git a/src/tm-modules.c b/src/tm-modules.c index 0ed4d0a2e5..d00044d8dc 100644 --- a/src/tm-modules.c +++ b/src/tm-modules.c @@ -63,6 +63,16 @@ TmModule *TmModuleGetByName(const char *name) { return NULL; } +/** \brief get the id of a module from it's name + * \param name registered name of the module + * \retval id the id or -1 in case of error */ +int TmModuleGetIdByName(const char *name) { + TmModule *tm = TmModuleGetByName(name); + if (tm == NULL) + return -1;; + return TmModuleGetIDForTM(tm); +} + /** * \brief Returns a TM Module by its id. * diff --git a/src/tm-modules.h b/src/tm-modules.h index 08f8a55561..46065ef973 100644 --- a/src/tm-modules.h +++ b/src/tm-modules.h @@ -106,6 +106,7 @@ int LogFileFreeCtx(LogFileCtx *); TmModule *TmModuleGetByName(const char *name); TmModule *TmModuleGetById(int id); +int TmModuleGetIdByName(const char *name); int TmModuleGetIDForTM(TmModule *tm); TmEcode TmModuleRegister(char *name, int (*module_func)(ThreadVars *, Packet *, void *)); void TmModuleDebugList(void);