]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_table.h
2005-05-23 Paul Jakma <paul@dishone.st>
[mirror_frr.git] / bgpd / bgp_table.h
CommitLineData
718e3744 1/* BGP routing table
2 Copyright (C) 1998, 2001 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
fee0f4c6 21typedef enum
22{
23 BGP_TABLE_MAIN,
24 BGP_TABLE_RSCLIENT,
25} bgp_table_t;
26
718e3744 27struct bgp_table
28{
fee0f4c6 29 bgp_table_t type;
30
31 /* The owner of this 'bgp_table' structure. */
32 void *owner;
33
718e3744 34 struct bgp_node *top;
35};
36
37struct bgp_node
38{
39 struct prefix p;
40
41 struct bgp_table *table;
42 struct bgp_node *parent;
43 struct bgp_node *link[2];
44#define l_left link[0]
45#define l_right link[1]
46
47 unsigned int lock;
48
49 void *info;
50
51 struct bgp_adj_out *adj_out;
52
53 struct bgp_adj_in *adj_in;
54
55 void *aggregate;
56
57 struct bgp_node *prn;
58};
59
60struct bgp_table *bgp_table_init (void);
61void bgp_table_finish (struct bgp_table *);
62void bgp_unlock_node (struct bgp_node *node);
63void bgp_node_delete (struct bgp_node *node);
64struct bgp_node *bgp_table_top (struct bgp_table *);
65struct bgp_node *bgp_route_next (struct bgp_node *);
66struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *);
67struct bgp_node *bgp_node_get (struct bgp_table *, struct prefix *);
68struct bgp_node *bgp_node_lookup (struct bgp_table *, struct prefix *);
69struct bgp_node *bgp_lock_node (struct bgp_node *node);
70struct bgp_node *bgp_node_match (struct bgp_table *, struct prefix *);
71struct bgp_node *bgp_node_match_ipv4 (struct bgp_table *,
72 struct in_addr *);
73#ifdef HAVE_IPV6
74struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *,
75 struct in6_addr *);
76#endif /* HAVE_IPV6 */