]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* Community attribute related functions. |
2 | Copyright (C) 1998 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
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 | |
9 | later version. | |
10 | ||
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. | |
15 | ||
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 | |
19 | 02111-1307, USA. */ | |
20 | ||
00d252cb | 21 | #ifndef _QUAGGA_BGP_COMMUNITY_H |
22 | #define _QUAGGA_BGP_COMMUNITY_H | |
23 | ||
f1aa5d8a DS |
24 | #include "lib/json.h" |
25 | ||
718e3744 | 26 | /* Communities attribute. */ |
27 | struct community | |
28 | { | |
29 | /* Reference count of communities value. */ | |
30 | unsigned long refcnt; | |
31 | ||
32 | /* Communities value size. */ | |
33 | int size; | |
34 | ||
35 | /* Communities value. */ | |
36 | u_int32_t *val; | |
37 | ||
f1aa5d8a DS |
38 | /* Communities as a json object */ |
39 | json_object *json; | |
40 | ||
718e3744 | 41 | /* String of community attribute. This sring is used by vty output |
42 | and expanded community-list for regular expression match. */ | |
43 | char *str; | |
44 | }; | |
45 | ||
46 | /* Well-known communities value. */ | |
47 | #define COMMUNITY_INTERNET 0x0 | |
48 | #define COMMUNITY_NO_EXPORT 0xFFFFFF01 | |
49 | #define COMMUNITY_NO_ADVERTISE 0xFFFFFF02 | |
50 | #define COMMUNITY_NO_EXPORT_SUBCONFED 0xFFFFFF03 | |
51 | #define COMMUNITY_LOCAL_AS 0xFFFFFF03 | |
52 | ||
53 | /* Macros of community attribute. */ | |
54 | #define com_length(X) ((X)->size * 4) | |
55 | #define com_lastval(X) ((X)->val + (X)->size - 1) | |
56 | #define com_nthval(X,n) ((X)->val + (n)) | |
57 | ||
58 | /* Prototypes of communities attribute functions. */ | |
94f2b392 | 59 | extern void community_init (void); |
228da428 | 60 | extern void community_finish (void); |
94f2b392 | 61 | extern void community_free (struct community *); |
62 | extern struct community *community_uniq_sort (struct community *); | |
63 | extern struct community *community_parse (u_int32_t *, u_short); | |
64 | extern struct community *community_intern (struct community *); | |
f6f434b2 | 65 | extern void community_unintern (struct community **); |
94f2b392 | 66 | extern char *community_str (struct community *); |
67 | extern unsigned int community_hash_make (struct community *); | |
68 | extern struct community *community_str2com (const char *); | |
69 | extern int community_match (const struct community *, const struct community *); | |
70 | extern int community_cmp (const struct community *, const struct community *); | |
71 | extern struct community *community_merge (struct community *, struct community *); | |
72 | extern struct community *community_delete (struct community *, struct community *); | |
73 | extern struct community *community_dup (struct community *); | |
74 | extern int community_include (struct community *, u_int32_t); | |
75 | extern void community_del_val (struct community *, u_int32_t *); | |
76 | extern unsigned long community_count (void); | |
77 | extern struct hash *community_hash (void); | |
5cbea288 | 78 | extern u_int32_t community_val_get (struct community *com, int i); |
00d252cb | 79 | |
80 | #endif /* _QUAGGA_BGP_COMMUNITY_H */ |