9c225f2129bfbd0df31d571d6712d48830ecb3f1
[oweals/tinc.git] / src / subnet.c
1 /*
2     subnet.c -- handle subnet lookups and lists
3     Copyright (C) 2000 Guus Sliepen <guus@sliepen.warande.net>,
4                   2000 Ivo Timmermans <itimmermans@bigfoot.com>
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20     $Id: subnet.c,v 1.1.2.1 2000/10/01 03:21:49 guus Exp $
21 */
22
23 #include "config.h"
24 #include "subnet.h"
25 #include "net.h"
26
27 /* Allocating and freeing space for subnets */
28
29 subnet_t *new_subnet(void)
30 {
31 cp
32 cp
33 }
34
35 void free_subnet(subnet_t *subnet)
36 {
37 cp
38 cp
39 }
40
41 /* Linked list management */
42
43 int subnet_add(conn_list_t *cl, subnet_t *subnet)
44 {
45 cp
46   subnet->next = cl->subnets->next;
47   subnet->prev = NULL;
48   subnet->next->prev = subnet
49   cl->subnets = subnet;
50 cp
51   return 0;
52 }
53
54 int subnet_del(conn_list_t *cl, subnet_t *subnet)
55 {
56 cp
57   if(subnet->prev)
58     {
59       subnet->prev->next = subnet->next;
60     }
61   else
62     {
63       subnet->owner->subnets = subnet->next;
64     }
65   
66   subnet->next->prev = subnet->prev;
67   free_subnet(subnet);
68 cp
69   return 0;
70 }
71
72 /* Ascii representation of subnets */
73
74 subnet_t *str2net(char *subnetstr)
75 {
76 cp
77 cp
78 }
79
80 char *net2str(subnet_t *subnet)
81 {
82 cp
83 cp
84 }
85
86 /* Subnet lookup routines */