threading: add utility to get module id from name

Add TmModuleGetIdByName to go from module name to id directly.
pull/808/merge
Victor Julien 11 years ago
parent 8a735a9b90
commit c36a8d30e5

@ -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.
*

@ -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);

Loading…
Cancel
Save