|
@@ -67,6 +67,8 @@ static void dump_gws(rpc_t* rpc, void* c)
|
|
|
str gw_name, hostname, params;
|
|
|
str prefix, tag;
|
|
|
struct gw_info *gws;
|
|
|
+ char buf[INT2STR_MAX_LEN], *start;
|
|
|
+ int len;
|
|
|
|
|
|
for (j = 1; j <= lcr_count_param; j++) {
|
|
|
|
|
@@ -132,12 +134,14 @@ static void dump_gws(rpc_t* rpc, void* c)
|
|
|
prefix.len=gws[i].prefix_len;
|
|
|
tag.s=gws[i].tag;
|
|
|
tag.len=gws[i].tag_len;
|
|
|
- rpc->struct_add(st, "dSSdd",
|
|
|
+ start = int2strbuf(gws[i].defunct_until, &(buf[0]), INT2STR_MAX_LEN,
|
|
|
+ &len);
|
|
|
+ rpc->struct_add(st, "dSSds",
|
|
|
"strip", gws[i].strip,
|
|
|
"prefix", &prefix,
|
|
|
"tag", &tag,
|
|
|
"flags", gws[i].flags,
|
|
|
- "defunct_until", &gws[i].defunct_until
|
|
|
+ "defunct_until", start
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -199,9 +203,33 @@ static void dump_rules(rpc_t* rpc, void* c)
|
|
|
}
|
|
|
|
|
|
|
|
|
+static const char* defunct_gw_doc[2] = {
|
|
|
+ "Defunct gateway until speficied time (Unix timestamp).",
|
|
|
+ 0
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+static void defunct_gw(rpc_t* rpc, void* c)
|
|
|
+{
|
|
|
+ unsigned int lcr_id, gw_id, until;
|
|
|
+
|
|
|
+ if (rpc->scan(c, "ddd", &lcr_id, &gw_id, &until) < 3) {
|
|
|
+ rpc->fault(c, 400, "lcr_id, gw_id, and timestamp parameters required");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rpc_defunct_gw(lcr_id, gw_id, until) == 0) {
|
|
|
+ rpc->fault(c, 400, "parameter value error (see syslog)");
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
rpc_export_t lcr_rpc[] = {
|
|
|
{"lcr.reload", reload, reload_doc, 0},
|
|
|
{"lcr.dump_gws", dump_gws, dump_gws_doc, 0},
|
|
|
{"lcr.dump_rules", dump_rules, dump_rules_doc, 0},
|
|
|
+ {"lcr.defunct_gw", defunct_gw, defunct_gw_doc, 0},
|
|
|
{0, 0, 0, 0}
|
|
|
};
|