]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unix socket: add 'version' command
authorEric Leblond <eric@regit.org>
Fri, 30 Nov 2012 17:37:41 +0000 (18:37 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 26 Feb 2013 11:32:47 +0000 (12:32 +0100)
src/unix-manager.c

index 94995a5ed55a25a535e17773b838be18c02bbc04..d086f9b56ead85c7743bf3d9f4787a111a9033d3 100644 (file)
@@ -583,6 +583,22 @@ TmEcode UnixManagerShutdownCommand(json_t *cmd,
     SCReturnInt(TM_ECODE_OK);
 }
 
+TmEcode UnixManagerVersionCommand(json_t *cmd,
+                                   json_t *server_msg, void *data)
+{
+    SCEnter();
+    json_object_set_new(server_msg, "message", json_string(
+#ifdef REVISION
+                        PROG_VER  xstr(REVISION)
+#elif defined RELEASE
+                        PROG_VER " RELEASE"
+#else
+                        PROG_VER
+#endif
+                        ));
+    SCReturnInt(TM_ECODE_OK);
+}
+
 TmEcode UnixManagerListCommand(json_t *cmd,
                                json_t *answer, void *data)
 {
@@ -771,6 +787,7 @@ void *UnixManagerThread(void *td)
     /* Init Unix socket */
     UnixManagerRegisterCommand("shutdown", UnixManagerShutdownCommand, NULL, 0);
     UnixManagerRegisterCommand("command-list", UnixManagerListCommand, &command, 0);
+    UnixManagerRegisterCommand("version", UnixManagerVersionCommand, &command, 0);
 #if 0
     UnixManagerRegisterCommand("reload-rules", UnixManagerReloadRules, NULL, 0);
 #endif