X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fvertex.c;h=9e72f9e702661a971896862cb499de7ee56d8aca;hp=54da87201a88de0e813de7689bcf2c395d0d74e3;hb=ac066bb057dcb187bf91670793ba5e6ca456e052;hpb=ec0c16b9b63f361b11a757ee1641d562e4811f93 diff --git a/src/vertex.c b/src/vertex.c index 54da8720..9e72f9e7 100644 --- a/src/vertex.c +++ b/src/vertex.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: vertex.c,v 1.1.2.1 2001/10/10 08:49:47 guus Exp $ + $Id: vertex.c,v 1.1.2.3 2001/10/27 13:13:35 guus Exp $ */ #include "config.h" @@ -40,12 +40,6 @@ #include "system.h" avl_tree_t *vertex_tree; /* Tree with all known vertices (replaces active_tree) */ -avl_tree_t *connection_tree; /* Tree with all meta connections with ourself */ - -int connection_compare(connection_t *a, connection_t *b) -{ - return a->meta_socket - b->meta_socket; -} int vertex_compare(vertex_t *a, vertex_t *b) { @@ -97,29 +91,38 @@ cp void free_vertex(vertex_t *v) { cp - if(v->from.hostname) - free(v->from.hostname) - if(v->to.hostname) - free(v->to.hostname) - free(v); cp } +void vertex_add(vertex_t *v) +{ +cp + avl_insert(vertex_tree, v); +cp +} + +void vertex_del(vertex_t *v) +{ +cp + avl_delete(vertex_tree, v); +cp +} + vertex_t *lookup_vertex(node_t *from, node_t *to) { vertex_t v, *result; cp - v.from.node = from; - v.to.node = to; + v.from = from; + v.to = to; result = avl_search(vertex_tree, &v); if(result) return result; cp - v.from.node = to; - v.to.node = from; + v.from = to; + v.to = from; return avl_search(vertex_tree, &v); } @@ -135,7 +138,7 @@ cp { v = (vertex_t *)node->data; syslog(LOG_DEBUG, _(" %s - %s options %ld"), - v->from.node->name, v->to.node->name, v->options); + v->from->name, v->to->name, v->options); } syslog(LOG_DEBUG, _("End of vertices."));