1 /* BGP Large Communities Attribute.
3 Copyright (C) 2016 Keyur Patel <keyur@arrcus.com>
5 This file is part of GNU Zebra.
7 GNU Zebra is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 GNU Zebra is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Zebra; see the file COPYING. If not, write to the Free
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef _QUAGGA_BGP_LCOMMUNITY_H
23 #define _QUAGGA_BGP_LCOMMUNITY_H
25 /* Extended communities attribute string format. */
26 #define LCOMMUNITY_FORMAT_ROUTE_MAP 0
27 #define LCOMMUNITY_FORMAT_COMMUNITY_LIST 1
28 #define LCOMMUNITY_FORMAT_DISPLAY 2
30 /* Large Communities value is twelve octets long. */
31 #define LCOMMUNITY_SIZE 12
33 /* Large Communities attribute. */
36 /* Reference counter. */
39 /* Size of Extended Communities attribute. */
42 /* Extended Communities value. */
45 /* Human readable format string. */
49 /* Extended community value is eight octet. */
52 char val[LCOMMUNITY_SIZE];
55 #define lcom_length(X) ((X)->size * LCOMMUNITY_SIZE)
57 extern void lcommunity_init (void);
58 extern void lcommunity_finish (void);
59 extern void lcommunity_free (struct lcommunity **);
60 extern struct lcommunity *lcommunity_parse (u_int8_t *, u_short);
61 extern struct lcommunity *lcommunity_dup (struct lcommunity *);
62 extern struct lcommunity *lcommunity_merge (struct lcommunity *, struct lcommunity *);
63 extern struct lcommunity *lcommunity_uniq_sort (struct lcommunity *);
64 extern struct lcommunity *lcommunity_intern (struct lcommunity *);
65 extern int lcommunity_cmp (const void *, const void *);
66 extern void lcommunity_unintern (struct lcommunity **);
67 extern unsigned int lcommunity_hash_make (void *);
68 extern struct hash *lcommunity_hash (void);
69 extern struct lcommunity *lcommunity_str2com (const char *);
70 extern char *lcommunity_lcom2str (struct lcommunity *, int);
71 extern int lcommunity_match (const struct lcommunity *, const struct lcommunity *);
72 extern char *lcommunity_str (struct lcommunity *);
73 extern int lcommunity_include (struct lcommunity *lcom, u_char *ptr);
74 extern void lcommunity_del_val (struct lcommunity *lcom, u_char *ptr);
75 #endif /* _QUAGGA_BGP_LCOMMUNITY_H */