]> git.meshlink.io Git - meshlink/blobdiff - src/edge.c
Remove everything GPL that is not copyright Guus Sliepen, update copyright statements.
[meshlink] / src / edge.c
index f5aa0994412e2b0416467cf03ada7ce423cc3f6b..88847909c01b3fb9e31b19e5a08e1a444e293974 100644 (file)
@@ -1,7 +1,6 @@
 /*
     edge.c -- edge tree management
-    Copyright (C) 2000-2006 Guus Sliepen <guus@tinc-vpn.org>,
-                  2000-2005 Ivo Timmermans
+    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
 
     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
@@ -21,7 +20,6 @@
 #include "system.h"
 
 #include "splay_tree.h"
-#include "control_common.h"
 #include "edge.h"
 #include "logger.h"
 #include "netutl.h"
@@ -29,7 +27,7 @@
 #include "utils.h"
 #include "xalloc.h"
 
-splay_tree_t *edge_weight_tree;        /* Tree with all edges, sorted on weight */
+splay_tree_t *edge_weight_tree;
 
 static int edge_compare(const edge_t *a, const edge_t *b) {
        return strcmp(a->to->name, b->to->name);
@@ -70,7 +68,7 @@ void exit_edges(void) {
 /* Creation and deletion of connection elements */
 
 edge_t *new_edge(void) {
-       return xmalloc_and_zero(sizeof(edge_t));
+       return xzalloc(sizeof(edge_t));
 }
 
 void free_edge(edge_t *e) {
@@ -99,31 +97,9 @@ void edge_del(edge_t *e) {
 
 edge_t *lookup_edge(node_t *from, node_t *to) {
        edge_t v;
-       
+
        v.from = from;
        v.to = to;
 
        return splay_search(from->edge_tree, &v);
 }
-
-bool dump_edges(connection_t *c) {
-       splay_node_t *node, *node2;
-       node_t *n;
-       edge_t *e;
-       char *address;
-
-       for(node = node_tree->head; node; node = node->next) {
-               n = node->data;
-               for(node2 = n->edge_tree->head; node2; node2 = node2->next) {
-                       e = node2->data;
-                       address = sockaddr2hostname(&e->address);
-                       send_request(c, "%d %d %s to %s at %s options %x weight %d",
-                                       CONTROL, REQ_DUMP_EDGES,
-                                       e->from->name, e->to->name, address,
-                                       e->options, e->weight);
-                       free(address);
-               }
-       }
-
-       return send_request(c, "%d %d", CONTROL, REQ_DUMP_EDGES);
-}