2 Copyright (C) 1996, 97, 98 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
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
21 /* Simple bit mapping. */
24 #define SET_BITMAP(MAP, NUM) \
25 SET_FLAG (MAP[(NUM) / BITMAP_NBBY], 1 << ((NUM) % BITMAP_NBBY))
27 #define CHECK_BITMAP(MAP, NUM) \
28 CHECK_FLAG (MAP[(NUM) / BITMAP_NBBY], 1 << ((NUM) % BITMAP_NBBY))
30 /* BGP Attribute type range. */
31 #define BGP_ATTR_TYPE_RANGE 256
32 #define BGP_ATTR_BITMAP_SIZE (BGP_ATTR_TYPE_RANGE / BITMAP_NBBY)
34 /* BGP Attribute flags. */
35 #define BGP_ATTR_FLAG_OPTIONAL 0x80 /* Attribute is optional. */
36 #define BGP_ATTR_FLAG_TRANS 0x40 /* Attribute is transitive. */
37 #define BGP_ATTR_FLAG_PARTIAL 0x20 /* Attribute is partial. */
38 #define BGP_ATTR_FLAG_EXTLEN 0x10 /* Extended length flag. */
40 /* BGP attribute header must bigger than 2. */
41 #define BGP_ATTR_MIN_LEN 2 /* Attribute flag and type. */
43 /* BGP attribute structure. */
46 /* Reference count of this attribute. */
49 /* Flag of attribute is set or not. */
54 struct in_addr nexthop
;
58 struct in_addr aggregator_addr
;
60 struct in_addr originator_id
;
61 struct cluster_list
*cluster
;
63 u_char mp_nexthop_len
;
65 struct in6_addr mp_nexthop_global
;
66 struct in6_addr mp_nexthop_local
;
67 #endif /* HAVE_IPV6 */
68 struct in_addr mp_nexthop_global_in
;
69 struct in_addr mp_nexthop_local_in
;
71 /* AS Path structure */
72 struct aspath
*aspath
;
74 /* Community structure */
75 struct community
*community
;
77 /* Extended Communities attribute. */
78 struct ecommunity
*ecommunity
;
80 /* Unknown transitive attribute. */
81 struct transit
*transit
;
84 /* Router Reflector related structure. */
92 /* Unknown transit attribute. */
100 #define ATTR_FLAG_BIT(X) (1 << ((X) - 1))
103 void bgp_attr_init ();
104 int bgp_attr_parse (struct peer
*, struct attr
*, bgp_size_t
,
105 struct bgp_nlri
*, struct bgp_nlri
*);
106 int bgp_attr_check (struct peer
*, struct attr
*);
107 struct attr
*bgp_attr_intern (struct attr
*attr
);
108 void bgp_attr_unintern (struct attr
*);
109 void bgp_attr_flush (struct attr
*);
110 struct attr
*bgp_attr_default_set (struct attr
*attr
, u_char
);
111 struct attr
*bgp_attr_default_intern (u_char
);
112 struct attr
*bgp_attr_aggregate_intern (struct bgp
*, u_char
, struct aspath
*, struct community
*, int as_set
);
113 bgp_size_t
bgp_packet_attribute (struct bgp
*bgp
, struct peer
*, struct stream
*, struct attr
*, struct prefix
*, afi_t
, safi_t
, struct peer
*, struct prefix_rd
*, u_char
*);
114 bgp_size_t
bgp_packet_withdraw (struct peer
*peer
, struct stream
*s
, struct prefix
*p
, afi_t
, safi_t
, struct prefix_rd
*, u_char
*);
115 void bgp_dump_routes_attr (struct stream
*, struct attr
*);
116 unsigned int attrhash_key_make (struct attr
*);
117 int attrhash_cmp (struct attr
*, struct attr
*);
118 void attr_show_all (struct vty
*);
120 /* Cluster list prototypes. */
121 int cluster_loop_check (struct cluster_list
*, struct in_addr
);
122 void cluster_unintern (struct cluster_list
*);
124 /* Transit attribute prototypes. */
125 void transit_unintern (struct transit
*);