]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_ecommunity.h
2005-06-28 Paul Jakma <paul.jakma@sun.com>
[mirror_frr.git] / bgpd / bgp_ecommunity.h
CommitLineData
718e3744 1/* BGP Extended Communities Attribute.
2 Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
00d252cb 21#ifndef _QUAGGA_BGP_ECOMMUNITY_H
22#define _QUAGGA_BGP_ECOMMUNITY_H
23
718e3744 24/* High-order octet of the Extended Communities type field. */
25#define ECOMMUNITY_ENCODE_AS 0x00
26#define ECOMMUNITY_ENCODE_IP 0x01
27
28/* Low-order octet of the Extended Communityes type field. */
29#define ECOMMUNITY_ROUTE_TARGET 0x02
30#define ECOMMUNITY_SITE_ORIGIN 0x03
31
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
36
37/* Extended Communities value is eight octet long. */
38#define ECOMMUNITY_SIZE 8
39
4372df71 40/* Extended Communities type flag. */
41#define ECOMMUNITY_FLAG_NON_TRANSITIVE 0x40
42
718e3744 43/* Extended Communities attribute. */
44struct ecommunity
45{
46 /* Reference counter. */
47 unsigned long refcnt;
48
49 /* Size of Extended Communities attribute. */
50 int size;
51
52 /* Extended Communities value. */
5228ad27 53 u_int8_t *val;
718e3744 54
55 /* Human readable format string. */
56 char *str;
57};
58
59/* Extended community value is eight octet. */
60struct ecommunity_val
61{
62 char val[ECOMMUNITY_SIZE];
63};
64
65#define ecom_length(X) ((X)->size * ECOMMUNITY_SIZE)
66
67void ecommunity_init (void);
68void ecommunity_free (struct ecommunity *);
69struct ecommunity *ecommunity_new (void);
5228ad27 70struct ecommunity *ecommunity_parse (u_int8_t *, u_short);
718e3744 71struct ecommunity *ecommunity_dup (struct ecommunity *);
72struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
73struct ecommunity *ecommunity_intern (struct ecommunity *);
fd79ac91 74int ecommunity_cmp (const struct ecommunity *, const struct ecommunity *);
718e3744 75void ecommunity_unintern (struct ecommunity *);
76unsigned int ecommunity_hash_make (struct ecommunity *);
fd79ac91 77struct ecommunity *ecommunity_str2com (const char *, int, int);
718e3744 78char *ecommunity_ecom2str (struct ecommunity *, int);
fd79ac91 79int ecommunity_match (const struct ecommunity *, const struct ecommunity *);
4372df71 80char *ecommunity_str (struct ecommunity *);
00d252cb 81
82#endif /* _QUAGGA_BGP_ECOMMUNITY_H */