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 /* Community-list deny and permit. */
22 #define COMMUNITY_DENY 0
23 #define COMMUNITY_PERMIT 1
25 /* Number and string based community-list name. */
26 #define COMMUNITY_LIST_STRING 0
27 #define COMMUNITY_LIST_NUMBER 1
29 /* Community-list entry types. */
30 #define COMMUNITY_LIST_STANDARD 0 /* Standard community-list. */
31 #define COMMUNITY_LIST_EXPANDED 1 /* Expanded community-list. */
32 #define COMMUNITY_LIST_AUTO 2 /* Automatically detected. */
33 #define EXTCOMMUNITY_LIST_STANDARD 3 /* Standard extcommunity-list. */
34 #define EXTCOMMUNITY_LIST_EXPANDED 4 /* Expanded extcommunity-list. */
35 #define EXTCOMMUNITY_LIST_AUTO 5 /* Automatically detected. */
40 /* Name of the community-list. */
43 /* String or number. */
46 /* Link to upper list. */
47 struct community_list_list
*parent
;
49 /* Linked list for other community-list. */
50 struct community_list
*next
;
51 struct community_list
*prev
;
53 /* Community-list entry in this community-list. */
54 struct community_entry
*head
;
55 struct community_entry
*tail
;
58 /* Each entry in community-list. */
59 struct community_entry
61 struct community_entry
*next
;
62 struct community_entry
*prev
;
67 /* Standard or expanded. */
73 /* Community structure. */
76 struct community
*com
;
77 struct ecommunity
*ecom
;
80 /* Configuration string. */
83 /* Expanded community-list regular expression. */
87 /* Linked list of community-list. */
88 struct community_list_list
90 struct community_list
*head
;
91 struct community_list
*tail
;
94 /* Master structure of community-list and extcommunity-list. */
95 struct community_list_master
97 struct community_list_list num
;
98 struct community_list_list str
;
101 /* Community-list handler. community_list_init() returns this
102 structure as handler. */
103 struct community_list_handler
105 /* Community-list. */
106 struct community_list_master community_list
;
108 /* Exteded community-list. */
109 struct community_list_master extcommunity_list
;
112 /* Error code of community-list. */
113 #define COMMUNITY_LIST_ERR_CANT_FIND_LIST -1
114 #define COMMUNITY_LIST_ERR_MALFORMED_VAL -2
115 #define COMMUNITY_LIST_ERR_STANDARD_CONFLICT -3
116 #define COMMUNITY_LIST_ERR_EXPANDED_CONFLICT -4
119 extern struct community_list_handler
*bgp_clist
;
122 struct community_list_handler
*community_list_init ();
124 int community_list_set (struct community_list_handler
*ch
, const char *name
,
125 const char *str
, int direct
, int style
);
126 int community_list_unset (struct community_list_handler
*ch
, const char *name
,
127 const char *str
, int direct
, int style
);
128 int extcommunity_list_set (struct community_list_handler
*ch
, const char *name
,
129 const char *str
, int direct
, int style
);
130 int extcommunity_list_unset (struct community_list_handler
*ch
,
131 const char *name
, const char *str
,
132 int direct
, int style
);
134 struct community_list_master
*
135 community_list_master_lookup (struct community_list_handler
*, int);
137 struct community_list
*
138 community_list_lookup (struct community_list_handler
*, const char *, int);
140 int community_list_match (struct community
*, struct community_list
*);
141 int ecommunity_list_match (struct ecommunity
*, struct community_list
*);
142 int community_list_exact_match (struct community
*, struct community_list
*);
144 community_list_match_delete (struct community
*,
145 struct community_list
*);