+ if(sscanf(request, "%*d %d", &type) != 1) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "CONTROL", c->name, c->hostname);
+ return false;
+ }
+
+ switch (type) {
+ case REQ_STOP:
+ event_exit();
+ return control_ok(c, REQ_STOP);
+
+ case REQ_DUMP_NODES:
+ return dump_nodes(c);
+
+ case REQ_DUMP_EDGES:
+ return dump_edges(c);
+
+ case REQ_DUMP_SUBNETS:
+ return dump_subnets(c);
+
+ case REQ_DUMP_CONNECTIONS:
+ return dump_connections(c);
+
+ case REQ_PURGE:
+ purge();
+ return control_ok(c, REQ_PURGE);
+
+ case REQ_SET_DEBUG: {
+ int new_level;
+ if(sscanf(request, "%*d %*d %d", &new_level) != 1)
+ return false;
+ send_request(c, "%d %d %d", CONTROL, REQ_SET_DEBUG, debug_level);
+ if(new_level >= 0)
+ debug_level = new_level;
+ return true;
+ }
+
+ case REQ_RETRY:
+ retry();
+ return control_ok(c, REQ_RETRY);
+
+ case REQ_RELOAD:
+ logger(DEBUG_ALWAYS, LOG_NOTICE, "Got '%s' command", "reload");
+ int result = reload_configuration();
+ return control_return(c, REQ_RELOAD, result);
+
+ case REQ_DISCONNECT: {
+ char name[MAX_STRING_SIZE];
+ bool found = false;
+
+ if(sscanf(request, "%*d %*d " MAX_STRING, name) != 1)
+ return control_return(c, REQ_DISCONNECT, -1);
+
+ for list_each(connection_t, other, connection_list) {
+ if(strcmp(other->name, name))
+ continue;
+ terminate_connection(other, other->edge);
+ found = true;
+ }
+
+ return control_return(c, REQ_DISCONNECT, found ? 0 : -2);
+ }
+
+ case REQ_DUMP_TRAFFIC:
+ return dump_traffic(c);
+
+ case REQ_PCAP:
+ sscanf(request, "%*d %*d %d", &c->outmaclength);
+ c->status.pcap = true;
+ pcap = true;
+ return true;
+
+ case REQ_LOG:
+ sscanf(request, "%*d %*d %d", &c->outcompression);
+ c->status.log = true;
+ logcontrol = true;
+ return true;
+
+ default:
+ return send_request(c, "%d %d", CONTROL, REQ_INVALID);