]>
Commit | Line | Data |
---|---|---|
57d187bc | 1 | /* BGP Large Communities Attribute. |
2acb4ac2 DL |
2 | * |
3 | * Copyright (C) 2016 Keyur Patel <keyur@arrcus.com> | |
4 | * | |
5 | * This file is part of FreeRangeRouting (FRR). | |
6 | * | |
7 | * FRR is free software; you can redistribute it and/or modify it under the | |
8 | * terms of the GNU General Public License as published by the Free Software | |
9 | * Foundation; either version 2, or (at your option) any later version. | |
10 | * | |
11 | * FRR is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
13 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
14 | * details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along | |
896014f4 DL |
17 | * with this program; see the file COPYING; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
2acb4ac2 | 19 | */ |
57d187bc JS |
20 | |
21 | #ifndef _QUAGGA_BGP_LCOMMUNITY_H | |
22 | #define _QUAGGA_BGP_LCOMMUNITY_H | |
23 | ||
24 | /* Extended communities attribute string format. */ | |
25 | #define LCOMMUNITY_FORMAT_ROUTE_MAP 0 | |
26 | #define LCOMMUNITY_FORMAT_COMMUNITY_LIST 1 | |
27 | #define LCOMMUNITY_FORMAT_DISPLAY 2 | |
28 | ||
29 | /* Large Communities value is twelve octets long. */ | |
30 | #define LCOMMUNITY_SIZE 12 | |
31 | ||
32 | /* Large Communities attribute. */ | |
33 | struct lcommunity | |
34 | { | |
35 | /* Reference counter. */ | |
36 | unsigned long refcnt; | |
37 | ||
38 | /* Size of Extended Communities attribute. */ | |
39 | int size; | |
40 | ||
41 | /* Extended Communities value. */ | |
42 | u_int8_t *val; | |
43 | ||
44 | /* Human readable format string. */ | |
45 | char *str; | |
46 | }; | |
47 | ||
48 | /* Extended community value is eight octet. */ | |
49 | struct lcommunity_val | |
50 | { | |
51 | char val[LCOMMUNITY_SIZE]; | |
52 | }; | |
53 | ||
54 | #define lcom_length(X) ((X)->size * LCOMMUNITY_SIZE) | |
55 | ||
56 | extern void lcommunity_init (void); | |
57 | extern void lcommunity_finish (void); | |
58 | extern void lcommunity_free (struct lcommunity **); | |
59 | extern struct lcommunity *lcommunity_parse (u_int8_t *, u_short); | |
60 | extern struct lcommunity *lcommunity_dup (struct lcommunity *); | |
61 | extern struct lcommunity *lcommunity_merge (struct lcommunity *, struct lcommunity *); | |
62 | extern struct lcommunity *lcommunity_uniq_sort (struct lcommunity *); | |
63 | extern struct lcommunity *lcommunity_intern (struct lcommunity *); | |
64 | extern int lcommunity_cmp (const void *, const void *); | |
65 | extern void lcommunity_unintern (struct lcommunity **); | |
66 | extern unsigned int lcommunity_hash_make (void *); | |
67 | extern struct hash *lcommunity_hash (void); | |
68 | extern struct lcommunity *lcommunity_str2com (const char *); | |
69 | extern char *lcommunity_lcom2str (struct lcommunity *, int); | |
70 | extern int lcommunity_match (const struct lcommunity *, const struct lcommunity *); | |
71 | extern char *lcommunity_str (struct lcommunity *); | |
72 | extern int lcommunity_include (struct lcommunity *lcom, u_char *ptr); | |
73 | extern void lcommunity_del_val (struct lcommunity *lcom, u_char *ptr); | |
74 | #endif /* _QUAGGA_BGP_LCOMMUNITY_H */ |