Extended MOTD with GUI
[tomato.git] / release / src / router / zebra / bgpd / bgp_advertise.h
blob500d2956763defe6d51b631300bf6d83d544dc6a
1 /* BGP advertisement and adjacency
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
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.
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.
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. */
21 /* BGP advertise FIFO. */
22 struct bgp_advertise_fifo
24 struct bgp_advertise *next;
25 struct bgp_advertise *prev;
28 /* BGP advertise attribute. */
29 struct bgp_advertise_attr
31 /* Head of advertisement pointer. */
32 struct bgp_advertise *adv;
34 /* Reference counter. */
35 unsigned long refcnt;
37 /* Attribute pointer to be announced. */
38 struct attr *attr;
41 struct bgp_advertise
43 /* FIFO for advertisement. */
44 struct bgp_advertise_fifo fifo;
46 /* Link list for same attribute advertise. */
47 struct bgp_advertise *next;
48 struct bgp_advertise *prev;
50 /* Prefix information. */
51 struct bgp_node *rn;
53 /* Reference pointer. */
54 struct bgp_adj_out *adj;
56 /* Advertisement attribute. */
57 struct bgp_advertise_attr *baa;
59 /* BGP info. */
60 struct bgp_info *binfo;
63 /* BGP adjacency out. */
64 struct bgp_adj_out
66 /* Lined list pointer. */
67 struct bgp_adj_out *next;
68 struct bgp_adj_out *prev;
70 /* Advertised peer. */
71 struct peer *peer;
73 /* Advertised attribute. */
74 struct attr *attr;
76 /* Advertisement information. */
77 struct bgp_advertise *adv;
80 /* BGP adjacency in. */
81 struct bgp_adj_in
83 /* Linked list pointer. */
84 struct bgp_adj_in *next;
85 struct bgp_adj_in *prev;
87 /* Received peer. */
88 struct peer *peer;
90 /* Received attribute. */
91 struct attr *attr;
94 /* BGP advertisement list. */
95 struct bgp_synchronize
97 struct bgp_advertise_fifo update;
98 struct bgp_advertise_fifo withdraw;
99 struct bgp_advertise_fifo withdraw_low;
102 /* BGP adjacency linked list. */
103 #define BGP_INFO_ADD(N,A,TYPE) \
104 do { \
105 (A)->prev = NULL; \
106 (A)->next = (N)->TYPE; \
107 if ((N)->TYPE) \
108 (N)->TYPE->prev = (A); \
109 (N)->TYPE = (A); \
110 } while (0)
112 #define BGP_INFO_DEL(N,A,TYPE) \
113 do { \
114 if ((A)->next) \
115 (A)->next->prev = (A)->prev; \
116 if ((A)->prev) \
117 (A)->prev->next = (A)->next; \
118 else \
119 (N)->TYPE = (A)->next; \
120 } while (0)
122 #define BGP_ADJ_IN_ADD(N,A) BGP_INFO_ADD(N,A,adj_in)
123 #define BGP_ADJ_IN_DEL(N,A) BGP_INFO_DEL(N,A,adj_in)
124 #define BGP_ADJ_OUT_ADD(N,A) BGP_INFO_ADD(N,A,adj_out)
125 #define BGP_ADJ_OUT_DEL(N,A) BGP_INFO_DEL(N,A,adj_out)
127 /* Prototypes. */
128 void bgp_adj_out_set (struct bgp_node *, struct peer *, struct prefix *,
129 struct attr *, afi_t, safi_t, struct bgp_info *);
130 void bgp_adj_out_unset (struct bgp_node *, struct peer *, struct prefix *,
131 afi_t, safi_t);
132 void bgp_adj_out_remove (struct bgp_node *, struct bgp_adj_out *,
133 struct peer *, afi_t, safi_t);
134 int bgp_adj_out_lookup (struct peer *, struct prefix *, afi_t, safi_t,
135 struct bgp_node *);
137 void bgp_adj_in_set (struct bgp_node *, struct peer *, struct attr *);
138 void bgp_adj_in_unset (struct bgp_node *, struct peer *);
139 void bgp_adj_in_remove (struct bgp_node *, struct bgp_adj_in *);
141 struct bgp_advertise *
142 bgp_advertise_clean (struct peer *, struct bgp_adj_out *, afi_t, safi_t);
144 void bgp_sync_init (struct peer *);
145 void bgp_sync_delete (struct peer *);