]>
Commit | Line | Data |
---|---|---|
57d187bc JS |
1 | /* BGP Large Communities Attribute. |
2 | ||
3 | Copyright (C) 2016 Keyur Patel <keyur@arrcus.com> | |
4 | ||
5 | This file is part of GNU Zebra. | |
6 | ||
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 | |
10 | later version. | |
11 | ||
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. | |
16 | ||
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 | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #ifndef _QUAGGA_BGP_LCOMMUNITY_H | |
23 | #define _QUAGGA_BGP_LCOMMUNITY_H | |
24 | ||
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 | |
29 | ||
30 | /* Large Communities value is twelve octets long. */ | |
31 | #define LCOMMUNITY_SIZE 12 | |
32 | ||
33 | /* Large Communities attribute. */ | |
34 | struct lcommunity | |
35 | { | |
36 | /* Reference counter. */ | |
37 | unsigned long refcnt; | |
38 | ||
39 | /* Size of Extended Communities attribute. */ | |
40 | int size; | |
41 | ||
42 | /* Extended Communities value. */ | |
43 | u_int8_t *val; | |
44 | ||
45 | /* Human readable format string. */ | |
46 | char *str; | |
47 | }; | |
48 | ||
49 | /* Extended community value is eight octet. */ | |
50 | struct lcommunity_val | |
51 | { | |
52 | char val[LCOMMUNITY_SIZE]; | |
53 | }; | |
54 | ||
55 | #define lcom_length(X) ((X)->size * LCOMMUNITY_SIZE) | |
56 | ||
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 */ |