Move debug groups from charon's bus.h to libstrongswan's debug.h.
authorTobias Brunner <tobias@strongswan.org>
Wed, 31 Mar 2010 15:17:02 +0000 (17:17 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 6 Apr 2010 10:47:40 +0000 (12:47 +0200)
src/libcharon/bus/bus.c
src/libcharon/bus/bus.h
src/libstrongswan/debug.c
src/libstrongswan/debug.h

index 524a776..764744a 100644 (file)
 #include <threading/condvar.h>
 #include <threading/mutex.h>
 
-ENUM(debug_names, DBG_DMN, DBG_LIB,
-       "DMN",
-       "MGR",
-       "IKE",
-       "CHD",
-       "JOB",
-       "CFG",
-       "KNL",
-       "NET",
-       "ENC",
-       "LIB",
-);
-
-ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
-       "dmn",
-       "mgr",
-       "ike",
-       "chd",
-       "job",
-       "cfg",
-       "knl",
-       "net",
-       "enc",
-       "lib",
-);
-
 typedef struct private_bus_t private_bus_t;
 
 /**
index ca974d8..8cf392e 100644 (file)
 #ifndef BUS_H_
 #define BUS_H_
 
-typedef enum debug_t debug_t;
-typedef enum level_t level_t;
 typedef enum alert_t alert_t;
 typedef struct bus_t bus_t;
 
 #include <stdarg.h>
 
+#include <debug.h>
 #include <sa/ike_sa.h>
 #include <sa/child_sa.h>
 #include <processing/jobs/job.h>
 #include <bus/listeners/listener.h>
 
-/**
- * Debug message group.
- */
-enum debug_t {
-       /** daemon main loop */
-       DBG_DMN,
-       /** IKE_SA_MANAGER */
-       DBG_MGR,
-       /** IKE_SA */
-       DBG_IKE,
-       /** CHILD_SA */
-       DBG_CHD,
-       /** job processing */
-       DBG_JOB,
-       /** configuration backends */
-       DBG_CFG,
-       /** kernel interface */
-       DBG_KNL,
-       /** networking/sockets */
-       DBG_NET,
-       /** message encoding/decoding */
-       DBG_ENC,
-       /** libstrongswan via logging hook */
-       DBG_LIB,
-       /** number of groups */
-       DBG_MAX,
-       /** pseudo group with all groups */
-       DBG_ANY = DBG_MAX,
-};
-
-/**
- * short names of debug message group.
- */
-extern enum_name_t *debug_names;
-
-/**
- * short names of debug message group, lower case.
- */
-extern enum_name_t *debug_lower_names;
-
-/**
- * Debug levels used to control output verbosity.
- */
-enum level_t {
-       /** absolutely silent */
-       LEVEL_SILENT =  -1,
-       /** most important auditing logs */
-       LEVEL_AUDIT =    0,
-       /** control flow */
-       LEVEL_CTRL =     1,
-       /** diagnose problems */
-       LEVEL_DIAG =     2,
-       /** raw binary blobs */
-       LEVEL_RAW =      3,
-       /** including sensitive data (private keys) */
-       LEVEL_PRIVATE =  4,
-};
+/* undefine the definitions from libstrongswan */
+#undef DBG0
+#undef DBG1
+#undef DBG2
+#undef DBG3
+#undef DBG4
 
 #ifndef DEBUG_LEVEL
 # define DEBUG_LEVEL 4
index 51b7875..d098259 100644 (file)
 
 #include "debug.h"
 
+ENUM(debug_names, DBG_DMN, DBG_LIB,
+       "DMN",
+       "MGR",
+       "IKE",
+       "CHD",
+       "JOB",
+       "CFG",
+       "KNL",
+       "NET",
+       "ENC",
+       "LIB",
+);
+
+ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
+       "dmn",
+       "mgr",
+       "ike",
+       "chd",
+       "job",
+       "cfg",
+       "knl",
+       "net",
+       "enc",
+       "lib",
+);
+
 /**
  * level logged by the default logger
  */
index 085795a..b0d820f 100644 (file)
 #ifndef DEBUG_H_
 #define DEBUG_H_
 
+typedef enum debug_t debug_t;
+typedef enum level_t level_t;
+
 #include <stdio.h>
 
+#include "enum.h"
+
+/**
+ * Debug message group.
+ */
+enum debug_t {
+       /** daemon specific */
+       DBG_DMN,
+       /** IKE_SA_MANAGER */
+       DBG_MGR,
+       /** IKE_SA */
+       DBG_IKE,
+       /** CHILD_SA */
+       DBG_CHD,
+       /** job processing */
+       DBG_JOB,
+       /** configuration backends */
+       DBG_CFG,
+       /** kernel interface */
+       DBG_KNL,
+       /** networking/sockets */
+       DBG_NET,
+       /** message encoding/decoding */
+       DBG_ENC,
+       /** libstrongswan */
+       DBG_LIB,
+       /** number of groups */
+       DBG_MAX,
+       /** pseudo group with all groups */
+       DBG_ANY = DBG_MAX,
+};
+
+/**
+ * short names of debug message group.
+ */
+extern enum_name_t *debug_names;
+
+/**
+ * short names of debug message group, lower case.
+ */
+extern enum_name_t *debug_lower_names;
+
+/**
+ * Debug levels used to control output verbosity.
+ */
+enum level_t {
+       /** absolutely silent */
+       LEVEL_SILENT =  1,
+       /** most important auditing logs */
+       LEVEL_AUDIT =   0,
+       /** control flow */
+       LEVEL_CTRL =    1,
+       /** diagnose problems */
+       LEVEL_DIAG =    2,
+       /** raw binary blobs */
+       LEVEL_RAW =     3,
+       /** including sensitive data (private keys) */
+       LEVEL_PRIVATE = 4,
+};
+
 #ifndef DEBUG_LEVEL
 # define DEBUG_LEVEL 4
 #endif /* DEBUG_LEVEL */
 # define DBG4(fmt, ...) dbg(4, fmt, ##__VA_ARGS__)
 #endif /* DEBUG_LEVEL */
 
+#ifndef DBG0
+# define DBG0(...) {}
+#endif
 #ifndef DBG1
 # define DBG1(...) {}
 #endif