updated stroke to allow run-time manipulation of debug levels
authorMartin Willi <martin@strongswan.org>
Wed, 18 Oct 2006 11:47:26 +0000 (11:47 -0000)
committerMartin Willi <martin@strongswan.org>
Wed, 18 Oct 2006 11:47:26 +0000 (11:47 -0000)
src/stroke/stroke.c
src/stroke/stroke.h
src/stroke/stroke_keywords.h
src/stroke/stroke_keywords.txt

index 0d68820..1d4d118 100644 (file)
@@ -238,25 +238,13 @@ static int reread(stroke_keyword_t kw)
        return send_stroke_msg(&msg);
 }
 
-static int set_logtype(char *context, char *type, int enable)
-{
-       stroke_msg_t msg;
-       
-       msg.type = STR_LOGTYPE;
-       msg.length = offsetof(stroke_msg_t, buffer);
-       msg.logtype.context = push_string(&msg, context);
-       msg.logtype.type = push_string(&msg, type);
-       msg.logtype.enable = enable;
-       return send_stroke_msg(&msg);
-}
-
-static int set_loglevel(char *context, u_int level)
+static int set_loglevel(char *type, u_int level)
 {
        stroke_msg_t msg;
        
        msg.type = STR_LOGLEVEL;
        msg.length = offsetof(stroke_msg_t, buffer);
-       msg.loglevel.context = push_string(&msg, context);
+       msg.loglevel.type = push_string(&msg, type);
        msg.loglevel.level = level;
        return send_stroke_msg(&msg);
 }
@@ -289,17 +277,10 @@ static void exit_usage(char *error)
        printf("  Terminate a connection:\n");
        printf("    stroke down NAME\n");
        printf("    where: NAME is a connection name added with \"stroke add\"\n");
-       printf("  Set logtype for a logging context:\n");
-       printf("    stroke logtype CONTEXT TYPE ENABLE\n");
-       printf("    where: CONTEXT is PARSR|GNRAT|IKESA|SAMGR|CHDSA|MESSG|TPOOL|WORKR|SCHED|\n");
-       printf("                      SENDR|RECVR|SOCKT|TESTR|DAEMN|CONFG|ENCPL|PAYLD\n");
-       printf("           TYPE is CONTROL|ERROR|AUDIT|RAW|PRIVATE\n");
-       printf("           ENABLE is 0|1\n");
-       printf("  Set loglevel for a logging context:\n");
-       printf("    stroke loglevel CONTEXT LEVEL\n");
-       printf("    where: CONTEXT is PARSR|GNRAT|IKESA|SAMGR|CHDSA|MESSG|TPOOL|WORKR|SCHED|\n");
-       printf("                      SENDR|RECVR|SOCKT|TESTR|DAEMN|CONFG|ENCPL|PAYLD\n");
-       printf("           LEVEL is 0|1|2|3\n");
+       printf("  Set loglevel for a logging type:\n");
+       printf("    stroke loglevel TYPE LEVEL\n");
+       printf("    where: TYPE is any|dmn|mgr|ike|chd|job|cfg|knl|net|enc|lib\n");
+       printf("           LEVEL is -1|0|1|2|3|4\n");
        printf("  Show connection status:\n");
        printf("    stroke status\n");
        printf("  Show list of locally loaded certificates and crls:\n");
@@ -375,13 +356,6 @@ int main(int argc, char *argv[])
                        }
                        res = unroute_connection(argv[2]);
                        break;
-               case STROKE_LOGTYPE:
-                       if (argc < 5)
-                       {
-                               exit_usage("\"logtype\" needs more parameters...");
-                       }
-                       res = set_logtype(argv[2], argv[3], atoi(argv[4])); 
-                       break;
                case STROKE_LOGLEVEL:
                        if (argc < 4)
                        {
index 3383f27..048ee08 100644 (file)
@@ -115,8 +115,6 @@ struct stroke_msg_t {
                /* show verbose connection status */
                STR_STATUS_ALL,
                /* set a log type to log/not log */
-               STR_LOGTYPE,
-               /* set the verbosity of a logging context */
                STR_LOGLEVEL,
                /* list various objects */
                STR_LIST,
@@ -154,23 +152,16 @@ struct stroke_msg_t {
                        stroke_end_t me, other;
                } add_conn;
 
-               /* data for STR_LOGTYPE */
-               struct {
-                       char *context;
-                       char *type;
-                       int enable;
-               } logtype;
-
                /* data for STR_LOGLEVEL */
                struct {
-                       char *context;
+                       char *type;
                        int level;
                } loglevel;
 
                /* data for STR_LIST */
                struct {
                        list_flag_t flags;
-                       bool  utc;
+                       bool utc;
                } list;
 
                /* data for STR_REREAD */
index 6a8dd53..d8c9632 100644 (file)
@@ -26,7 +26,6 @@ typedef enum {
        STROKE_UNROUTE,
        STROKE_UP,
        STROKE_DOWN,
-       STROKE_LOGTYPE,
        STROKE_LOGLEVEL,
        STROKE_STATUS,
        STROKE_STATUSALL,
index d720a7d..b0f56dd 100644 (file)
@@ -33,7 +33,6 @@ route,         STROKE_ROUTE
 unroute,       STROKE_UNROUTE
 up,            STROKE_UP
 down,          STROKE_DOWN
-logtype,       STROKE_LOGTYPE
 loglevel,      STROKE_LOGLEVEL
 status,        STROKE_STATUS
 statusall,     STROKE_STATUSALL