2 Copyright (C) 1999 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
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
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.
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
21 /* Master Community-list. */
22 #define COMMUNITY_LIST_MASTER 0
23 #define EXTCOMMUNITY_LIST_MASTER 1
25 /* Community-list deny and permit. */
26 #define COMMUNITY_DENY 0
27 #define COMMUNITY_PERMIT 1
29 /* Number and string based community-list name. */
30 #define COMMUNITY_LIST_STRING 0
31 #define COMMUNITY_LIST_NUMBER 1
33 /* Community-list entry types. */
34 #define COMMUNITY_LIST_STANDARD 0 /* Standard community-list. */
35 #define COMMUNITY_LIST_EXPANDED 1 /* Expanded community-list. */
36 #define EXTCOMMUNITY_LIST_STANDARD 2 /* Standard extcommunity-list. */
37 #define EXTCOMMUNITY_LIST_EXPANDED 3 /* Expanded extcommunity-list. */
42 /* Name of the community-list. */
45 /* String or number. */
48 /* Link to upper list. */
49 struct community_list_list
*parent
;
51 /* Linked list for other community-list. */
52 struct community_list
*next
;
53 struct community_list
*prev
;
55 /* Community-list entry in this community-list. */
56 struct community_entry
*head
;
57 struct community_entry
*tail
;
60 /* Each entry in community-list. */
61 struct community_entry
63 struct community_entry
*next
;
64 struct community_entry
*prev
;
69 /* Standard or expanded. */
75 /* Community structure. */
78 struct community
*com
;
79 struct ecommunity
*ecom
;
82 /* Configuration string. */
85 /* Expanded community-list regular expression. */
89 /* Linked list of community-list. */
90 struct community_list_list
92 struct community_list
*head
;
93 struct community_list
*tail
;
96 /* Master structure of community-list and extcommunity-list. */
97 struct community_list_master
99 struct community_list_list num
;
100 struct community_list_list str
;
103 /* Community-list handler. community_list_init() returns this
104 structure as handler. */
105 struct community_list_handler
107 /* Community-list. */
108 struct community_list_master community_list
;
110 /* Exteded community-list. */
111 struct community_list_master extcommunity_list
;
114 /* Error code of community-list. */
115 #define COMMUNITY_LIST_ERR_CANT_FIND_LIST -1
116 #define COMMUNITY_LIST_ERR_MALFORMED_VAL -2
117 #define COMMUNITY_LIST_ERR_STANDARD_CONFLICT -3
118 #define COMMUNITY_LIST_ERR_EXPANDED_CONFLICT -4
121 extern struct community_list_handler
*bgp_clist
;
124 struct community_list_handler
*community_list_init ();
126 int community_list_set (struct community_list_handler
*ch
, const char *name
,
127 const char *str
, int direct
, int style
);
128 int community_list_unset (struct community_list_handler
*ch
, const char *name
,
129 const char *str
, int direct
, int style
);
130 int extcommunity_list_set (struct community_list_handler
*ch
, const char *name
,
131 const char *str
, int direct
, int style
);
132 int extcommunity_list_unset (struct community_list_handler
*ch
,
133 const char *name
, const char *str
,
134 int direct
, int style
);
136 struct community_list_master
*
137 community_list_master_lookup (struct community_list_handler
*, int);
139 struct community_list
*
140 community_list_lookup (struct community_list_handler
*, const char *, int);
142 int community_list_match (struct community
*, struct community_list
*);
143 int ecommunity_list_match (struct ecommunity
*, struct community_list
*);
144 int community_list_exact_match (struct community
*, struct community_list
*);
146 community_list_match_delete (struct community
*,
147 struct community_list
*);