From: Eric Leblond Date: Fri, 30 Nov 2012 18:17:20 +0000 (+0100) Subject: Add function to display current capture mode X-Git-Tag: suricata-1.4.1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74a9fc4b6679e60d8d5c49c85cb476ee27d6d656;p=thirdparty%2Fsuricata.git Add function to display current capture mode This patch adds a function to display the capture mode. --- diff --git a/src/runmodes.c b/src/runmodes.c index 918a20e020..3f03800752 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -162,6 +162,20 @@ char *RunmodeGetActive(void) return active_runmode; } +/** + * Return the running mode + * + * The returned string must not be freed. + * + * \return a string containing the current running mode + */ +const char *RunModeGetMainMode(void) +{ + int mainmode = RunmodeGetCurrent(); + + return RunModeTranslateModeToName(mainmode); +} + /** * \brief Register all runmodes in the engine. */ diff --git a/src/runmodes.h b/src/runmodes.h index 0e4a9e9859..9687ea0083 100644 --- a/src/runmodes.h +++ b/src/runmodes.h @@ -41,6 +41,7 @@ enum { }; char *RunmodeGetActive(void); +const char *RunModeGetMainMode(void); void RunModeListRunmodes(void); void RunModeDispatch(int, const char *, DetectEngineCtx *); diff --git a/src/suricata.c b/src/suricata.c index 660d278886..c5c0c36faf 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -242,6 +242,11 @@ int RunmodeIsUnittests(void) { return 0; } +int RunmodeGetCurrent(void) +{ + return run_mode; +} + static void SignalHandlerSigint(/*@unused@*/ int sig) { sigint_count = 1; suricata_ctl_flags |= SURICATA_STOP; diff --git a/src/suricata.h b/src/suricata.h index a75fb03be3..6b702181c9 100644 --- a/src/suricata.h +++ b/src/suricata.h @@ -151,6 +151,7 @@ void SignalHandlerSigusr2EngineShutdown(int); void SignalHandlerSigusr2Idle(int sig); int RunmodeIsUnittests(void); +int RunmodeGetCurrent(void); extern int run_mode;