updated stroke to allow run-time manipulation of debug levels
This commit is contained in:
+6
-32
@@ -238,25 +238,13 @@ static int reread(stroke_keyword_t kw)
|
|||||||
return send_stroke_msg(&msg);
|
return send_stroke_msg(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_logtype(char *context, char *type, int enable)
|
static int set_loglevel(char *type, u_int level)
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
stroke_msg_t msg;
|
stroke_msg_t msg;
|
||||||
|
|
||||||
msg.type = STR_LOGLEVEL;
|
msg.type = STR_LOGLEVEL;
|
||||||
msg.length = offsetof(stroke_msg_t, buffer);
|
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;
|
msg.loglevel.level = level;
|
||||||
return send_stroke_msg(&msg);
|
return send_stroke_msg(&msg);
|
||||||
}
|
}
|
||||||
@@ -289,17 +277,10 @@ static void exit_usage(char *error)
|
|||||||
printf(" Terminate a connection:\n");
|
printf(" Terminate a connection:\n");
|
||||||
printf(" stroke down NAME\n");
|
printf(" stroke down NAME\n");
|
||||||
printf(" where: NAME is a connection name added with \"stroke add\"\n");
|
printf(" where: NAME is a connection name added with \"stroke add\"\n");
|
||||||
printf(" Set logtype for a logging context:\n");
|
printf(" Set loglevel for a logging type:\n");
|
||||||
printf(" stroke logtype CONTEXT TYPE ENABLE\n");
|
printf(" stroke loglevel TYPE LEVEL\n");
|
||||||
printf(" where: CONTEXT is PARSR|GNRAT|IKESA|SAMGR|CHDSA|MESSG|TPOOL|WORKR|SCHED|\n");
|
printf(" where: TYPE is any|dmn|mgr|ike|chd|job|cfg|knl|net|enc|lib\n");
|
||||||
printf(" SENDR|RECVR|SOCKT|TESTR|DAEMN|CONFG|ENCPL|PAYLD\n");
|
printf(" LEVEL is -1|0|1|2|3|4\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(" Show connection status:\n");
|
printf(" Show connection status:\n");
|
||||||
printf(" stroke status\n");
|
printf(" stroke status\n");
|
||||||
printf(" Show list of locally loaded certificates and crls:\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]);
|
res = unroute_connection(argv[2]);
|
||||||
break;
|
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:
|
case STROKE_LOGLEVEL:
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-11
@@ -115,8 +115,6 @@ struct stroke_msg_t {
|
|||||||
/* show verbose connection status */
|
/* show verbose connection status */
|
||||||
STR_STATUS_ALL,
|
STR_STATUS_ALL,
|
||||||
/* set a log type to log/not log */
|
/* set a log type to log/not log */
|
||||||
STR_LOGTYPE,
|
|
||||||
/* set the verbosity of a logging context */
|
|
||||||
STR_LOGLEVEL,
|
STR_LOGLEVEL,
|
||||||
/* list various objects */
|
/* list various objects */
|
||||||
STR_LIST,
|
STR_LIST,
|
||||||
@@ -154,23 +152,16 @@ struct stroke_msg_t {
|
|||||||
stroke_end_t me, other;
|
stroke_end_t me, other;
|
||||||
} add_conn;
|
} add_conn;
|
||||||
|
|
||||||
/* data for STR_LOGTYPE */
|
|
||||||
struct {
|
|
||||||
char *context;
|
|
||||||
char *type;
|
|
||||||
int enable;
|
|
||||||
} logtype;
|
|
||||||
|
|
||||||
/* data for STR_LOGLEVEL */
|
/* data for STR_LOGLEVEL */
|
||||||
struct {
|
struct {
|
||||||
char *context;
|
char *type;
|
||||||
int level;
|
int level;
|
||||||
} loglevel;
|
} loglevel;
|
||||||
|
|
||||||
/* data for STR_LIST */
|
/* data for STR_LIST */
|
||||||
struct {
|
struct {
|
||||||
list_flag_t flags;
|
list_flag_t flags;
|
||||||
bool utc;
|
bool utc;
|
||||||
} list;
|
} list;
|
||||||
|
|
||||||
/* data for STR_REREAD */
|
/* data for STR_REREAD */
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ typedef enum {
|
|||||||
STROKE_UNROUTE,
|
STROKE_UNROUTE,
|
||||||
STROKE_UP,
|
STROKE_UP,
|
||||||
STROKE_DOWN,
|
STROKE_DOWN,
|
||||||
STROKE_LOGTYPE,
|
|
||||||
STROKE_LOGLEVEL,
|
STROKE_LOGLEVEL,
|
||||||
STROKE_STATUS,
|
STROKE_STATUS,
|
||||||
STROKE_STATUSALL,
|
STROKE_STATUSALL,
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ route, STROKE_ROUTE
|
|||||||
unroute, STROKE_UNROUTE
|
unroute, STROKE_UNROUTE
|
||||||
up, STROKE_UP
|
up, STROKE_UP
|
||||||
down, STROKE_DOWN
|
down, STROKE_DOWN
|
||||||
logtype, STROKE_LOGTYPE
|
|
||||||
loglevel, STROKE_LOGLEVEL
|
loglevel, STROKE_LOGLEVEL
|
||||||
status, STROKE_STATUS
|
status, STROKE_STATUS
|
||||||
statusall, STROKE_STATUSALL
|
statusall, STROKE_STATUSALL
|
||||||
|
|||||||
Reference in New Issue
Block a user