X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnode.h;fp=src%2Fnode.h;h=acf20bc180782d85bd16e6034754034d781e4bda;hb=ff03bb9b0a744530e1145fef656644987a10d62d;hp=0000000000000000000000000000000000000000;hpb=56c51e94a620dd91eeb510176b9c970af9a9a372;p=tinc diff --git a/src/node.h b/src/node.h new file mode 100644 index 00000000..acf20bc1 --- /dev/null +++ b/src/node.h @@ -0,0 +1,75 @@ +/* + node.h -- node management + + Copyright (C) 2003-2004 Guus Sliepen , + 2003-2004 Ivo Timmermans + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id$ +*/ + +#ifndef __NODE_H__ +#define __NODE_H__ + +typedef int node_options_t; + +#define NODE_OPTION_INDIRECT 1 + +#include "rt/edge.h" +#include "rt/subnet.h" +#include "support/avl.h" +#include "tnl/tnl.h" + +typedef struct node_status { + int active:1; + int visited:1; + int reachable:1; + int indirect:1; +} node_status_t; + +typedef struct node { + char *name; + + avl_tree_t *queue; + + struct node *nexthop; + struct node *via; + + avl_tree_t *subnets; + avl_tree_t *edges; + + struct tnl *tnl; + + node_status_t status; + node_options_t options; + + struct sockaddr_storage address; + + avl_tree_t *cfg; +} node_t; + +extern avl_tree_t *nodes; +extern struct node *myself; + +extern bool node_init(void); +extern bool node_exit(void); +extern struct node *node_new(void) __attribute__ ((__malloc__)); +extern void node_free(struct node *); +extern void node_add(struct node *); +extern void node_del(struct node *); +extern struct node *node_get(char *); + +#endif