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 #ifndef _QUAGGA_BGP_ECOMMUNITY_H
22 #define _QUAGGA_BGP_ECOMMUNITY_H
24 /* High-order octet of the Extended Communities type field. */
25 #define ECOMMUNITY_ENCODE_AS 0x00
26 #define ECOMMUNITY_ENCODE_IP 0x01
28 /* Low-order octet of the Extended Communityes type field. */
29 #define ECOMMUNITY_ROUTE_TARGET 0x02
30 #define ECOMMUNITY_SITE_ORIGIN 0x03
32 /* Extended communities attribute string format. */
33 #define ECOMMUNITY_FORMAT_ROUTE_MAP 0
34 #define ECOMMUNITY_FORMAT_COMMUNITY_LIST 1
35 #define ECOMMUNITY_FORMAT_DISPLAY 2
37 /* Extended Communities value is eight octet long. */
38 #define ECOMMUNITY_SIZE 8
40 /* Extended Communities type flag. */
41 #define ECOMMUNITY_FLAG_NON_TRANSITIVE 0x40
43 /* Extended Communities attribute. */
46 /* Reference counter. */
49 /* Size of Extended Communities attribute. */
52 /* Extended Communities value. */
55 /* Human readable format string. */
59 /* Extended community value is eight octet. */
62 char val
[ECOMMUNITY_SIZE
];
65 #define ecom_length(X) ((X)->size * ECOMMUNITY_SIZE)
67 extern void ecommunity_init (void);
68 extern void ecommunity_free (struct ecommunity
*);
69 extern struct ecommunity
*ecommunity_new (void);
70 extern struct ecommunity
*ecommunity_parse (u_int8_t
*, u_short
);
71 extern struct ecommunity
*ecommunity_dup (struct ecommunity
*);
72 extern struct ecommunity
*ecommunity_merge (struct ecommunity
*, struct ecommunity
*);
73 extern struct ecommunity
*ecommunity_intern (struct ecommunity
*);
74 extern int ecommunity_cmp (const struct ecommunity
*, const struct ecommunity
*);
75 extern void ecommunity_unintern (struct ecommunity
*);
76 extern unsigned int ecommunity_hash_make (struct ecommunity
*);
77 extern struct ecommunity
*ecommunity_str2com (const char *, int, int);
78 extern char *ecommunity_ecom2str (struct ecommunity
*, int);
79 extern int ecommunity_match (const struct ecommunity
*, const struct ecommunity
*);
80 extern char *ecommunity_str (struct ecommunity
*);
82 #endif /* _QUAGGA_BGP_ECOMMUNITY_H */