along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: connection.c,v 1.1.2.1 2000/11/20 19:12:11 guus Exp $
+ $Id: connection.c,v 1.1.2.2 2000/11/20 19:41:10 guus Exp $
*/
#include "config.h"
#include "config.h"
#include "conf.h"
#include <utils.h>
+#include "subnet.h"
#include "xalloc.h"
#include "system.h"
cp
/* initialise all those stupid pointers at once */
memset(p, '\0', sizeof(*p));
+
+ p->subnet_tree = new_rbltree((rbl_compare_t)subnet_compare, NULL);
cp
return p;
}
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net.c,v 1.35.4.77 2000/11/20 19:12:12 guus Exp $
+ $Id: net.c,v 1.35.4.78 2000/11/20 19:41:10 guus Exp $
*/
#include "config.h"
{
config_t const *cfg;
cp
+ init_connections();
+ init_subnets();
+
if((cfg = get_config_val(config, config_pingtimeout)) == NULL)
timeout = 60;
else
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: subnet.c,v 1.1.2.12 2000/11/20 19:12:17 guus Exp $
+ $Id: subnet.c,v 1.1.2.13 2000/11/20 19:41:13 guus Exp $
*/
#include "config.h"
/* lists type of subnet */
-rbltree_t _subnet_tree = { NULL };
-rbltree_t *subnet_tree = &_subnet_tree;
+rbltree_t *subnet_tree;
+
+void init_subnets(void)
+{
+cp
+ subnet_tree = new_rbltree((rbl_compare_t)subnet_compare, (rbl_action_t)free_subnet);
+cp
+}
/* Subnet comparison */
void subnet_del(subnet_t *subnet)
{
cp
- free_rbl(rbl_unlink(subnet->owner->subnet_tree, subnet));
+ rbl_delete(subnet->owner->subnet_tree, subnet);
rbl_delete(subnet_tree, subnet);
cp
}
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: subnet.h,v 1.1.2.6 2000/11/20 19:12:17 guus Exp $
+ $Id: subnet.h,v 1.1.2.7 2000/11/20 19:41:13 guus Exp $
*/
#ifndef __TINC_SUBNET_H__
extern subnet_t *new_subnet(void);
extern void free_subnet(subnet_t *);
+extern void init_subnets(void);
extern void subnet_add(struct connection_t *, subnet_t *);
extern void subnet_del(subnet_t *);
extern char *net2str(subnet_t *);
extern subnet_t *str2net(char *);
+extern int subnet_compare(subnet_t *, subnet_t *);
extern subnet_t *lookup_subnet_mac(mac_t);
extern subnet_t *lookup_subnet_ipv4(ipv4_t);
extern subnet_t *lookup_subnet_ipv6(ipv6_t);