Annotation of embedaddon/quagga/bgpd/bgp_advertise.h, revision 1.1.1.2
1.1 misho 1: /* BGP advertisement and adjacency
2: Copyright (C) 1996, 97, 98, 99, 2000 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:
21: #ifndef _QUAGGA_BGP_ADVERTISE_H
22: #define _QUAGGA_BGP_ADVERTISE_H
23:
1.1.1.2 ! misho 24: #include <lib/fifo.h>
1.1 misho 25:
26: /* BGP advertise attribute. */
27: struct bgp_advertise_attr
28: {
29: /* Head of advertisement pointer. */
30: struct bgp_advertise *adv;
31:
32: /* Reference counter. */
33: unsigned long refcnt;
34:
35: /* Attribute pointer to be announced. */
36: struct attr *attr;
37: };
38:
39: struct bgp_advertise
40: {
41: /* FIFO for advertisement. */
1.1.1.2 ! misho 42: struct fifo fifo;
1.1 misho 43:
44: /* Link list for same attribute advertise. */
45: struct bgp_advertise *next;
46: struct bgp_advertise *prev;
47:
48: /* Prefix information. */
49: struct bgp_node *rn;
50:
51: /* Reference pointer. */
52: struct bgp_adj_out *adj;
53:
54: /* Advertisement attribute. */
55: struct bgp_advertise_attr *baa;
56:
57: /* BGP info. */
58: struct bgp_info *binfo;
59: };
60:
61: /* BGP adjacency out. */
62: struct bgp_adj_out
63: {
64: /* Lined list pointer. */
65: struct bgp_adj_out *next;
66: struct bgp_adj_out *prev;
67:
68: /* Advertised peer. */
69: struct peer *peer;
70:
71: /* Advertised attribute. */
72: struct attr *attr;
73:
74: /* Advertisement information. */
75: struct bgp_advertise *adv;
76: };
77:
78: /* BGP adjacency in. */
79: struct bgp_adj_in
80: {
81: /* Linked list pointer. */
82: struct bgp_adj_in *next;
83: struct bgp_adj_in *prev;
84:
85: /* Received peer. */
86: struct peer *peer;
87:
88: /* Received attribute. */
89: struct attr *attr;
90: };
91:
92: /* BGP advertisement list. */
93: struct bgp_synchronize
94: {
1.1.1.2 ! misho 95: struct fifo update;
! 96: struct fifo withdraw;
! 97: struct fifo withdraw_low;
1.1 misho 98: };
99:
1.1.1.2 ! misho 100: #define BGP_ADV_FIFO_HEAD(F) ((struct bgp_advertise *)FIFO_HEAD(F))
! 101:
1.1 misho 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)
111:
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)
121:
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)
126:
127: /* Prototypes. */
128: extern void bgp_adj_out_set (struct bgp_node *, struct peer *, struct prefix *,
129: struct attr *, afi_t, safi_t, struct bgp_info *);
130: extern void bgp_adj_out_unset (struct bgp_node *, struct peer *, struct prefix *,
131: afi_t, safi_t);
132: extern void bgp_adj_out_remove (struct bgp_node *, struct bgp_adj_out *,
133: struct peer *, afi_t, safi_t);
134: extern int bgp_adj_out_lookup (struct peer *, struct prefix *, afi_t, safi_t,
135: struct bgp_node *);
136:
137: extern void bgp_adj_in_set (struct bgp_node *, struct peer *, struct attr *);
1.1.1.2 ! misho 138: extern int bgp_adj_in_unset (struct bgp_node *, struct peer *);
1.1 misho 139: extern void bgp_adj_in_remove (struct bgp_node *, struct bgp_adj_in *);
140:
141: extern struct bgp_advertise *
142: bgp_advertise_clean (struct peer *, struct bgp_adj_out *, afi_t, safi_t);
143:
144: extern void bgp_sync_init (struct peer *);
145: extern void bgp_sync_delete (struct peer *);
146:
147: #endif /* _QUAGGA_BGP_ADVERTISE_H */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>