[prev in list] [next in list] [prev in thread] [next in thread] 

List:       prelude-cvslog
Subject:    [prelude-cvslog] r4555 - in trunk/libprelude/src: . include
From:       noreply () prelude-ids ! org
Date:       2004-12-10 17:19:21
Message-ID: 20041210171921.9D2423B86E7 () mail ! prelude-ids ! org
[Download RAW message or body]

Author: yoann
Date: 2004-12-10 18:19:21 +0100 (Fri, 10 Dec 2004)
New Revision: 4555

Added:
   trunk/libprelude/src/prelude.c
Modified:
   trunk/libprelude/src/Makefile.am
   trunk/libprelude/src/common.c
   trunk/libprelude/src/include/prelude.h.in
Log:
Move prelude_check_version() from common.c to prelude.c,
implemented prelude_init() - which is a NOP right now - and prelude_deinit(),
which will destroy the IDMEF object cache, and global option.



Modified: trunk/libprelude/src/Makefile.am
===================================================================
--- trunk/libprelude/src/Makefile.am	2004-12-10 17:14:34 UTC (rev 4554)
+++ trunk/libprelude/src/Makefile.am	2004-12-10 17:19:21 UTC (rev 4555)
@@ -23,6 +23,7 @@
 	tls-auth.c			\
 	tls-util.c			\
 	variable.c			\
+	prelude.c			\
 	prelude-async.c			\
 	prelude-client.c		\
 	prelude-connection.c		\

Modified: trunk/libprelude/src/common.c
===================================================================
--- trunk/libprelude/src/common.c	2004-12-10 17:14:34 UTC (rev 4554)
+++ trunk/libprelude/src/common.c	2004-12-10 17:19:21 UTC (rev 4555)
@@ -382,32 +382,3 @@
 
         return retval;
 }
-
-
-
-const char *prelude_check_version(const char *req_version)
-{
-        int ret;
-        int major, minor, micro;
-        int rq_major, rq_minor, rq_micro;
-
-        if ( ! req_version )
-                return VERSION;
-        
-        ret = sscanf(VERSION, "%d.%d.%d", &major, &minor, &micro);
-        if ( ret != 3 )
-                return NULL;
-        
-        ret = sscanf(req_version, "%d.%d.%d", &rq_major, &rq_minor, &rq_micro);
-        if ( ret != 3 )
-                return NULL;
-        
-        if ( major > rq_major
-             || (major == rq_major && minor > rq_minor)
-             || (major == rq_major && minor == rq_minor && micro > rq_micro)
-             || (major == rq_major && minor == rq_minor && micro == rq_micro) ) {
-                return VERSION;
-        }
-
-        return NULL;
-}

Modified: trunk/libprelude/src/include/prelude.h.in
===================================================================
--- trunk/libprelude/src/include/prelude.h.in	2004-12-10 17:14:34 UTC (rev 4554)
+++ trunk/libprelude/src/include/prelude.h.in	2004-12-10 17:19:21 UTC (rev 4555)
@@ -41,6 +41,10 @@
 #include "prelude-msgbuf.h"
 #include "idmef.h"
 
+int prelude_init(void);
+
+void prelude_deinit(void);
+
 const char *prelude_check_version(const char *rq_version);
 
 

Added: trunk/libprelude/src/prelude.c
===================================================================
--- trunk/libprelude/src/prelude.c	2004-12-10 17:14:34 UTC (rev 4554)
+++ trunk/libprelude/src/prelude.c	2004-12-10 17:19:21 UTC (rev 4555)
@@ -0,0 +1,74 @@
+/*****
+*
+* Copyright (C) 2004 Yoann Vandoorselaere <yoann@prelude-ids.org>
+* All Rights Reserved
+*
+* This file is part of the Prelude program.
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2, or (at your option)
+* any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; see the file COPYING.  If not, write to
+* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*****/
+
+#include "config.h"
+
+#include <stdio.h>
+
+#include "prelude.h"
+#include "idmef-object.h"
+#include "prelude-option.h"
+
+
+
+int prelude_init(void)
+{
+        return 0;
+}
+
+
+
+void prelude_deinit(void)
+{
+        _idmef_object_cache_destroy();
+        prelude_option_destroy(NULL);
+}
+
+
+
+const char *prelude_check_version(const char *req_version)
+{
+        int ret;
+        int major, minor, micro;
+        int rq_major, rq_minor, rq_micro;
+
+        if ( ! req_version )
+                return VERSION;
+        
+        ret = sscanf(VERSION, "%d.%d.%d", &major, &minor, &micro);
+        if ( ret != 3 )
+                return NULL;
+        
+        ret = sscanf(req_version, "%d.%d.%d", &rq_major, &rq_minor, &rq_micro);
+        if ( ret != 3 )
+                return NULL;
+        
+        if ( major > rq_major
+             || (major == rq_major && minor > rq_minor)
+             || (major == rq_major && minor == rq_minor && micro > rq_micro)
+             || (major == rq_major && minor == rq_minor && micro == rq_micro) ) {
+                return VERSION;
+        }
+
+        return NULL;
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic