X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fnode.c;h=79531e462012a408d173dbb7c00272c7251b6dd9;hb=158cbe99f972a1613b7d4d95abfe5fe48e019e67;hp=aab83ca7b020dc1e2a6bb38f2bb4d52dbe19bdcc;hpb=5b07039b0712bee0f19749d63116a10fb08a2d8b;p=meshlink diff --git a/src/node.c b/src/node.c index aab83ca7..79531e46 100644 --- a/src/node.c +++ b/src/node.c @@ -1,7 +1,6 @@ /* node.c -- node tree management - Copyright (C) 2001-2013 Guus Sliepen , - 2001-2005 Ivo Timmermans + Copyright (C) 2014 Guus Sliepen , This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +19,6 @@ #include "system.h" -#include "control_common.h" #include "hash.h" #include "logger.h" #include "net.h" @@ -53,7 +51,6 @@ node_t *new_node(void) { node_t *n = xzalloc(sizeof *n); if(replaywin) n->late = xzalloc(replaywin); - n->subnet_tree = new_subnet_tree(); n->edge_tree = new_edge_tree(); n->mtu = MTU; n->maxmtu = MTU; @@ -62,9 +59,6 @@ node_t *new_node(void) { } void free_node(node_t *n) { - if(n->subnet_tree) - free_subnet_tree(n->subnet_tree); - if(n->edge_tree) free_edge_tree(n->edge_tree); @@ -97,9 +91,6 @@ void node_add(node_t *n) { } void node_del(node_t *n) { - for splay_each(subnet_t, s, n->subnet_tree) - subnet_del(n, s); - for splay_each(edge_t, e, n->edge_tree) edge_del(e); @@ -141,22 +132,3 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) { logger(DEBUG_PROTOCOL, LOG_DEBUG, "UDP address of %s set to %s", n->name, n->hostname); } } - -bool dump_nodes(connection_t *c) { - for splay_each(node_t, n, node_tree) - send_request(c, "%d %d %s %s %d %d %d %d %x %x %s %s %d %hd %hd %hd %ld", CONTROL, REQ_DUMP_NODES, - n->name, n->hostname ?: "unknown port unknown", cipher_get_nid(n->outcipher), - digest_get_nid(n->outdigest), (int)digest_length(n->outdigest), n->outcompression, - n->options, bitfield_to_int(&n->status, sizeof n->status), n->nexthop ? n->nexthop->name : "-", - n->via ? n->via->name ?: "-" : "-", n->distance, n->mtu, n->minmtu, n->maxmtu, (long)n->last_state_change); - - return send_request(c, "%d %d", CONTROL, REQ_DUMP_NODES); -} - -bool dump_traffic(connection_t *c) { - for splay_each(node_t, n, node_tree) - send_request(c, "%d %d %s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, CONTROL, REQ_DUMP_TRAFFIC, - n->name, n->in_packets, n->in_bytes, n->out_packets, n->out_bytes); - - return send_request(c, "%d %d", CONTROL, REQ_DUMP_TRAFFIC); -}