]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP routing table |
2 | Copyright (C) 1998, 2001 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
00d252cb | 21 | #ifndef _QUAGGA_BGP_TABLE_H |
22 | #define _QUAGGA_BGP_TABLE_H | |
23 | ||
fee0f4c6 | 24 | typedef enum |
25 | { | |
26 | BGP_TABLE_MAIN, | |
27 | BGP_TABLE_RSCLIENT, | |
28 | } bgp_table_t; | |
29 | ||
718e3744 | 30 | struct bgp_table |
31 | { | |
fee0f4c6 | 32 | bgp_table_t type; |
64e580a7 PJ |
33 | |
34 | /* afi/safi of this table */ | |
35 | afi_t afi; | |
36 | safi_t safi; | |
37 | ||
228da428 CC |
38 | int lock; |
39 | ||
fee0f4c6 | 40 | /* The owner of this 'bgp_table' structure. */ |
228da428 | 41 | struct peer *owner; |
fee0f4c6 | 42 | |
718e3744 | 43 | struct bgp_node *top; |
cbdfbaa5 PJ |
44 | |
45 | unsigned long count; | |
718e3744 | 46 | }; |
47 | ||
48 | struct bgp_node | |
49 | { | |
50 | struct prefix p; | |
51 | ||
52 | struct bgp_table *table; | |
53 | struct bgp_node *parent; | |
54 | struct bgp_node *link[2]; | |
55 | #define l_left link[0] | |
56 | #define l_right link[1] | |
57 | ||
718e3744 | 58 | void *info; |
59 | ||
60 | struct bgp_adj_out *adj_out; | |
61 | ||
62 | struct bgp_adj_in *adj_in; | |
63 | ||
718e3744 | 64 | struct bgp_node *prn; |
200df115 | 65 | |
228da428 | 66 | int lock; |
cbdfbaa5 | 67 | |
200df115 | 68 | u_char flags; |
69 | #define BGP_NODE_PROCESS_SCHEDULED (1 << 0) | |
718e3744 | 70 | }; |
71 | ||
64e580a7 | 72 | extern struct bgp_table *bgp_table_init (afi_t, safi_t); |
228da428 CC |
73 | extern void bgp_table_lock (struct bgp_table *); |
74 | extern void bgp_table_unlock (struct bgp_table *); | |
b608d5b5 | 75 | extern void bgp_table_finish (struct bgp_table **); |
94f2b392 | 76 | extern void bgp_unlock_node (struct bgp_node *node); |
851a1a5c | 77 | extern struct bgp_node *bgp_table_top (const struct bgp_table *const); |
94f2b392 | 78 | extern struct bgp_node *bgp_route_next (struct bgp_node *); |
79 | extern struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); | |
851a1a5c PJ |
80 | extern struct bgp_node *bgp_node_get (struct bgp_table *const, struct prefix *); |
81 | extern struct bgp_node *bgp_node_lookup (const struct bgp_table *const, struct prefix *); | |
94f2b392 | 82 | extern struct bgp_node *bgp_lock_node (struct bgp_node *node); |
851a1a5c PJ |
83 | extern struct bgp_node *bgp_node_match (const struct bgp_table *, struct prefix *); |
84 | extern struct bgp_node *bgp_node_match_ipv4 (const struct bgp_table *, | |
718e3744 | 85 | struct in_addr *); |
86 | #ifdef HAVE_IPV6 | |
851a1a5c | 87 | extern struct bgp_node *bgp_node_match_ipv6 (const struct bgp_table *, |
718e3744 | 88 | struct in6_addr *); |
89 | #endif /* HAVE_IPV6 */ | |
851a1a5c | 90 | extern unsigned long bgp_table_count (const struct bgp_table *const); |
00d252cb | 91 | #endif /* _QUAGGA_BGP_TABLE_H */ |