]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* |
2 | * Routing Table | |
3 | * Copyright (C) 1998 Kunihiro Ishiguro | |
4 | * | |
5 | * This file is part of GNU Zebra. | |
6 | * | |
7 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2, or (at your option) any | |
10 | * later version. | |
11 | * | |
12 | * GNU Zebra is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with GNU Zebra; see the file COPYING. If not, write to the Free | |
19 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
20 | * 02111-1307, USA. | |
21 | */ | |
22 | ||
23 | #ifndef _ZEBRA_TABLE_H | |
24 | #define _ZEBRA_TABLE_H | |
25 | ||
26 | /* Routing table top structure. */ | |
27 | struct route_table | |
28 | { | |
29 | struct route_node *top; | |
30 | }; | |
31 | ||
32 | /* Each routing entry. */ | |
33 | struct route_node | |
34 | { | |
35 | /* Actual prefix of this radix. */ | |
36 | struct prefix p; | |
37 | ||
38 | /* Tree link. */ | |
39 | struct route_table *table; | |
40 | struct route_node *parent; | |
41 | struct route_node *link[2]; | |
42 | #define l_left link[0] | |
43 | #define l_right link[1] | |
44 | ||
45 | /* Lock of this radix */ | |
46 | unsigned int lock; | |
47 | ||
48 | /* Each node of route. */ | |
49 | void *info; | |
50 | ||
51 | /* Aggregation. */ | |
52 | void *aggregate; | |
53 | }; | |
54 | ||
55 | /* Prototypes. */ | |
8cc4198f | 56 | extern struct route_table *route_table_init (void); |
57 | extern void route_table_finish (struct route_table *); | |
58 | extern void route_unlock_node (struct route_node *node); | |
59 | extern void route_node_delete (struct route_node *node); | |
60 | extern struct route_node *route_top (struct route_table *); | |
61 | extern struct route_node *route_next (struct route_node *); | |
62 | extern struct route_node *route_next_until (struct route_node *, | |
63 | struct route_node *); | |
64 | extern struct route_node *route_node_get (struct route_table *, | |
65 | struct prefix *); | |
66 | extern struct route_node *route_node_lookup (struct route_table *, | |
67 | struct prefix *); | |
68 | extern struct route_node *route_lock_node (struct route_node *node); | |
69 | extern struct route_node *route_node_match (struct route_table *, | |
70 | struct prefix *); | |
71 | extern struct route_node *route_node_match_ipv4 (struct route_table *, | |
718e3744 | 72 | struct in_addr *); |
73 | #ifdef HAVE_IPV6 | |
8cc4198f | 74 | extern struct route_node *route_node_match_ipv6 (struct route_table *, |
718e3744 | 75 | struct in6_addr *); |
76 | #endif /* HAVE_IPV6 */ | |
77 | ||
78 | #endif /* _ZEBRA_TABLE_H */ |