1 /* BGP Extended Communities Attribute.
2 Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
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 /* High-order octet of the Extended Communities type field. */
22 #define ECOMMUNITY_ENCODE_AS 0x00
23 #define ECOMMUNITY_ENCODE_IP 0x01
25 /* Low-order octet of the Extended Communityes type field. */
26 #define ECOMMUNITY_ROUTE_TARGET 0x02
27 #define ECOMMUNITY_SITE_ORIGIN 0x03
29 /* Extended communities attribute string format. */
30 #define ECOMMUNITY_FORMAT_ROUTE_MAP 0
31 #define ECOMMUNITY_FORMAT_COMMUNITY_LIST 1
32 #define ECOMMUNITY_FORMAT_DISPLAY 2
34 /* BGP routing distinguisher size. */
37 #endif /* BGP_RD_SIZE */
39 /* Extended Communities attribute. */
48 #define ecom_length(X) ((X)->size * 8)
50 void ecommunity_init (void);
51 void ecommunity_free (struct ecommunity *);
52 struct ecommunity *ecommunity_new (void);
53 struct ecommunity *ecommunity_parse (char *, u_short);
54 struct ecommunity *ecommunity_dup (struct ecommunity *);
55 struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
56 struct ecommunity *ecommunity_intern (struct ecommunity *);
57 int ecommunity_cmp (struct ecommunity *, struct ecommunity *);
58 void ecommunity_unintern (struct ecommunity *);
59 unsigned int ecommunity_hash_make (struct ecommunity *);
61 void ecommunity_rd2com (struct bgp_rd *, u_char);
62 struct ecommunity *ecommunity_str2com (char *, int, int);
63 void ecommunity_vty_out (struct vty *, struct ecommunity *);
64 char *ecommunity_ecom2str (struct ecommunity *, int);