]> git.proxmox.com Git - mirror_frr.git/blob - lib/routemap.h
bgpd, lib: Use bool instead of uint8_t for community/prefix-list "any"
[mirror_frr.git] / lib / routemap.h
1 /* Route map function.
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 along
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
19 */
20
21 #ifndef _ZEBRA_ROUTEMAP_H
22 #define _ZEBRA_ROUTEMAP_H
23
24 #include "prefix.h"
25 #include "memory.h"
26 #include "qobj.h"
27 #include "vty.h"
28 #include "lib/plist.h"
29 #include "lib/plist_int.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 DECLARE_MTYPE(ROUTE_MAP_NAME)
36 DECLARE_MTYPE(ROUTE_MAP_RULE)
37 DECLARE_MTYPE(ROUTE_MAP_COMPILED)
38
39 /* Route map's type. */
40 enum route_map_type { RMAP_PERMIT, RMAP_DENY, RMAP_ANY };
41
42 typedef enum {
43 RMAP_DENYMATCH,
44 RMAP_PERMITMATCH
45 } route_map_result_t;
46
47 /*
48 * Route-map match or set result "Eg: match evpn vni xx"
49 * route-map match cmd always returns match/nomatch/noop
50 * match--> found a match
51 * nomatch--> didnt find a match
52 * noop--> not applicable
53 * route-map set retuns okay/error
54 * okay --> set was successful
55 * error --> set was not successful
56 */
57 enum route_map_cmd_result_t {
58 /*
59 * route-map match cmd results
60 */
61 RMAP_MATCH,
62 RMAP_NOMATCH,
63 RMAP_NOOP,
64 /*
65 * route-map set cmd results
66 */
67 RMAP_OKAY,
68 RMAP_ERROR
69 };
70
71
72 typedef enum {
73 RMAP_RIP,
74 RMAP_RIPNG,
75 RMAP_OSPF,
76 RMAP_OSPF6,
77 RMAP_BGP,
78 RMAP_ZEBRA,
79 RMAP_ISIS,
80 } route_map_object_t;
81
82 typedef enum { RMAP_EXIT, RMAP_GOTO, RMAP_NEXT } route_map_end_t;
83
84 typedef enum {
85 RMAP_EVENT_SET_ADDED,
86 RMAP_EVENT_SET_DELETED,
87 RMAP_EVENT_SET_REPLACED,
88 RMAP_EVENT_MATCH_ADDED,
89 RMAP_EVENT_MATCH_DELETED,
90 RMAP_EVENT_MATCH_REPLACED,
91 RMAP_EVENT_INDEX_ADDED,
92 RMAP_EVENT_INDEX_DELETED,
93 RMAP_EVENT_CALL_ADDED, /* call to another routemap added */
94 RMAP_EVENT_CALL_DELETED,
95 RMAP_EVENT_PLIST_ADDED,
96 RMAP_EVENT_PLIST_DELETED,
97 RMAP_EVENT_CLIST_ADDED,
98 RMAP_EVENT_CLIST_DELETED,
99 RMAP_EVENT_ECLIST_ADDED,
100 RMAP_EVENT_ECLIST_DELETED,
101 RMAP_EVENT_LLIST_ADDED,
102 RMAP_EVENT_LLIST_DELETED,
103 RMAP_EVENT_ASLIST_ADDED,
104 RMAP_EVENT_ASLIST_DELETED,
105 RMAP_EVENT_FILTER_ADDED,
106 RMAP_EVENT_FILTER_DELETED,
107 } route_map_event_t;
108
109 /* Depth limit in RMAP recursion using RMAP_CALL. */
110 #define RMAP_RECURSION_LIMIT 10
111
112 /* Route map rule structure for matching and setting. */
113 struct route_map_rule_cmd {
114 /* Route map rule name (e.g. as-path, metric) */
115 const char *str;
116
117 /* Function for value set or match. */
118 enum route_map_cmd_result_t (*func_apply)(void *rule,
119 const struct prefix *prefix,
120 route_map_object_t type,
121 void *object);
122
123 /* Compile argument and return result as void *. */
124 void *(*func_compile)(const char *);
125
126 /* Free allocated value by func_compile (). */
127 void (*func_free)(void *);
128
129 /** To get the rule key after Compilation **/
130 void *(*func_get_rmap_rule_key)(void *val);
131 };
132
133 /* Route map apply error. */
134 enum rmap_compile_rets {
135 RMAP_COMPILE_SUCCESS,
136
137 /* Route map rule is missing. */
138 RMAP_RULE_MISSING,
139
140 /* Route map rule can't compile */
141 RMAP_COMPILE_ERROR,
142
143 };
144
145 /* Route map rule. This rule has both `match' rule and `set' rule. */
146 struct route_map_rule {
147 /* Rule type. */
148 const struct route_map_rule_cmd *cmd;
149
150 /* For pretty printing. */
151 char *rule_str;
152
153 /* Pre-compiled match rule. */
154 void *value;
155
156 /* Linked list. */
157 struct route_map_rule *next;
158 struct route_map_rule *prev;
159 };
160
161 /* Route map rule list. */
162 struct route_map_rule_list {
163 struct route_map_rule *head;
164 struct route_map_rule *tail;
165 };
166
167 /* Forward struct declaration: the complete can be found later this file. */
168 struct routemap_hook_context;
169
170 /* Route map index structure. */
171 struct route_map_index {
172 struct route_map *map;
173 char *description;
174
175 /* Preference of this route map rule. */
176 int pref;
177
178 /* Route map type permit or deny. */
179 enum route_map_type type;
180
181 /* Do we follow old rules, or hop forward? */
182 route_map_end_t exitpolicy;
183
184 /* If we're using "GOTO", to where do we go? */
185 int nextpref;
186
187 /* If we're using "CALL", to which route-map do ew go? */
188 char *nextrm;
189
190 /* Matching rule list. */
191 struct route_map_rule_list match_list;
192 struct route_map_rule_list set_list;
193
194 /* Make linked list. */
195 struct route_map_index *next;
196 struct route_map_index *prev;
197
198 /* Keep track how many times we've try to apply */
199 uint64_t applied;
200 uint64_t applied_clear;
201
202 /* List of match/sets contexts. */
203 TAILQ_HEAD(, routemap_hook_context) rhclist;
204
205 QOBJ_FIELDS
206 };
207 DECLARE_QOBJ_TYPE(route_map_index)
208
209 /* Route map list structure. */
210 struct route_map {
211 /* Name of route map. */
212 char *name;
213
214 /* Route map's rule. */
215 struct route_map_index *head;
216 struct route_map_index *tail;
217
218 /* Make linked list. */
219 struct route_map *next;
220 struct route_map *prev;
221
222 /* Maintain update info */
223 bool to_be_processed; /* True if modification isn't acted on yet */
224 bool deleted; /* If 1, then this node will be deleted */
225 bool optimization_disabled;
226
227 /* How many times have we applied this route-map */
228 uint64_t applied;
229 uint64_t applied_clear;
230
231 /* Counter to track active usage of this route-map */
232 uint16_t use_count;
233
234 /* Tables to maintain IPv4 and IPv6 prefixes from
235 * the prefix-list match clause.
236 */
237 struct route_table *ipv4_prefix_table;
238 struct route_table *ipv6_prefix_table;
239
240 QOBJ_FIELDS
241 };
242 DECLARE_QOBJ_TYPE(route_map)
243
244 /* Prototypes. */
245 extern void route_map_init(void);
246
247 /*
248 * This should only be called on shutdown
249 * Additionally this function sets the hooks to NULL
250 * before any processing is done.
251 */
252 extern void route_map_finish(void);
253
254 /* Add match statement to route map. */
255 extern enum rmap_compile_rets route_map_add_match(struct route_map_index *index,
256 const char *match_name,
257 const char *match_arg,
258 route_map_event_t type);
259
260 /* Delete specified route match rule. */
261 extern enum rmap_compile_rets
262 route_map_delete_match(struct route_map_index *index,
263 const char *match_name, const char *match_arg,
264 route_map_event_t type);
265
266 extern const char *route_map_get_match_arg(struct route_map_index *index,
267 const char *match_name);
268
269 /* Add route-map set statement to the route map. */
270 extern enum rmap_compile_rets route_map_add_set(struct route_map_index *index,
271 const char *set_name,
272 const char *set_arg);
273
274 /* Delete route map set rule. */
275 extern enum rmap_compile_rets
276 route_map_delete_set(struct route_map_index *index,
277 const char *set_name, const char *set_arg);
278
279 /* Install rule command to the match list. */
280 extern void route_map_install_match(const struct route_map_rule_cmd *cmd);
281
282 /*
283 * Install rule command to the set list.
284 *
285 * When installing a particular item, Allow a difference of handling
286 * of bad cli inputted(return NULL) -vs- this particular daemon cannot use
287 * this form of the command(return a pointer and handle it appropriately
288 * in the apply command). See 'set metric' command
289 * as it is handled in ripd/ripngd and ospfd.
290 */
291 extern void route_map_install_set(const struct route_map_rule_cmd *cmd);
292
293 /* Lookup route map by name. */
294 extern struct route_map *route_map_lookup_by_name(const char *name);
295
296 /* Simple helper to warn if route-map does not exist. */
297 struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *name);
298
299 /* Apply route map to the object. */
300 extern route_map_result_t route_map_apply(struct route_map *map,
301 const struct prefix *prefix,
302 route_map_object_t object_type,
303 void *object);
304
305 extern void route_map_add_hook(void (*func)(const char *));
306 extern void route_map_delete_hook(void (*func)(const char *));
307
308 /*
309 * This is the callback for when something has changed about a
310 * route-map. The interested parties can register to receive
311 * this data.
312 *
313 * name - Is the name of the changed route-map
314 */
315 extern void route_map_event_hook(void (*func)(const char *name));
316 extern int route_map_mark_updated(const char *name);
317 extern void route_map_walk_update_list(void (*update_fn)(char *name));
318 extern void route_map_upd8_dependency(route_map_event_t type, const char *arg,
319 const char *rmap_name);
320 extern void route_map_notify_dependencies(const char *affected_name,
321 route_map_event_t event);
322 extern void
323 route_map_notify_pentry_dependencies(const char *affected_name,
324 struct prefix_list_entry *pentry,
325 route_map_event_t event);
326 extern int generic_match_add(struct vty *vty, struct route_map_index *index,
327 const char *command, const char *arg,
328 route_map_event_t type);
329
330 extern int generic_match_delete(struct vty *vty, struct route_map_index *index,
331 const char *command, const char *arg,
332 route_map_event_t type);
333 extern int generic_set_add(struct vty *vty, struct route_map_index *index,
334 const char *command, const char *arg);
335 extern int generic_set_delete(struct vty *vty, struct route_map_index *index,
336 const char *command, const char *arg);
337
338
339 /* match interface */
340 extern void route_map_match_interface_hook(int (*func)(
341 struct vty *vty, struct route_map_index *index, const char *command,
342 const char *arg, route_map_event_t type));
343 /* no match interface */
344 extern void route_map_no_match_interface_hook(int (*func)(
345 struct vty *vty, struct route_map_index *index, const char *command,
346 const char *arg, route_map_event_t type));
347 /* match ip address */
348 extern void route_map_match_ip_address_hook(int (*func)(
349 struct vty *vty, struct route_map_index *index, const char *command,
350 const char *arg, route_map_event_t type));
351 /* no match ip address */
352 extern void route_map_no_match_ip_address_hook(int (*func)(
353 struct vty *vty, struct route_map_index *index, const char *command,
354 const char *arg, route_map_event_t type));
355 /* match ip address prefix list */
356 extern void route_map_match_ip_address_prefix_list_hook(int (*func)(
357 struct vty *vty, struct route_map_index *index, const char *command,
358 const char *arg, route_map_event_t type));
359 /* no match ip address prefix list */
360 extern void route_map_no_match_ip_address_prefix_list_hook(int (*func)(
361 struct vty *vty, struct route_map_index *index, const char *command,
362 const char *arg, route_map_event_t type));
363 /* match ip next hop */
364 extern void route_map_match_ip_next_hop_hook(int (*func)(
365 struct vty *vty, struct route_map_index *index, const char *command,
366 const char *arg, route_map_event_t type));
367 /* no match ip next hop */
368 extern void route_map_no_match_ip_next_hop_hook(int (*func)(
369 struct vty *vty, struct route_map_index *index, const char *command,
370 const char *arg, route_map_event_t type));
371 /* match ip next hop prefix list */
372 extern void route_map_match_ip_next_hop_prefix_list_hook(int (*func)(
373 struct vty *vty, struct route_map_index *index, const char *command,
374 const char *arg, route_map_event_t type));
375 /* no match ip next hop prefix list */
376 extern void route_map_no_match_ip_next_hop_prefix_list_hook(int (*func)(
377 struct vty *vty, struct route_map_index *index, const char *command,
378 const char *arg, route_map_event_t type));
379 /* match ip next hop type */
380 extern void route_map_match_ip_next_hop_type_hook(int (*func)(
381 struct vty *vty, struct route_map_index *index, const char *command,
382 const char *arg, route_map_event_t type));
383 /* no match ip next hop type */
384 extern void route_map_no_match_ip_next_hop_type_hook(int (*func)(
385 struct vty *vty, struct route_map_index *index, const char *command,
386 const char *arg, route_map_event_t type));
387 /* match ipv6 address */
388 extern void route_map_match_ipv6_address_hook(int (*func)(
389 struct vty *vty, struct route_map_index *index, const char *command,
390 const char *arg, route_map_event_t type));
391 /* no match ipv6 address */
392 extern void route_map_no_match_ipv6_address_hook(int (*func)(
393 struct vty *vty, struct route_map_index *index, const char *command,
394 const char *arg, route_map_event_t type));
395 /* match ipv6 address prefix list */
396 extern void route_map_match_ipv6_address_prefix_list_hook(int (*func)(
397 struct vty *vty, struct route_map_index *index, const char *command,
398 const char *arg, route_map_event_t type));
399 /* no match ipv6 address prefix list */
400 extern void route_map_no_match_ipv6_address_prefix_list_hook(int (*func)(
401 struct vty *vty, struct route_map_index *index, const char *command,
402 const char *arg, route_map_event_t type));
403 /* match ipv6 next-hop type */
404 extern void route_map_match_ipv6_next_hop_type_hook(int (*func)(
405 struct vty *vty, struct route_map_index *index, const char *command,
406 const char *arg, route_map_event_t type));
407 /* no match ipv6 next-hop type */
408 extern void route_map_no_match_ipv6_next_hop_type_hook(int (*func)(
409 struct vty *vty, struct route_map_index *index, const char *command,
410 const char *arg, route_map_event_t type));
411 /* match metric */
412 extern void route_map_match_metric_hook(int (*func)(
413 struct vty *vty, struct route_map_index *index, const char *command,
414 const char *arg, route_map_event_t type));
415 /* no match metric */
416 extern void route_map_no_match_metric_hook(int (*func)(
417 struct vty *vty, struct route_map_index *index, const char *command,
418 const char *arg, route_map_event_t type));
419 /* match tag */
420 extern void route_map_match_tag_hook(int (*func)(
421 struct vty *vty, struct route_map_index *index, const char *command,
422 const char *arg, route_map_event_t type));
423 /* no match tag */
424 extern void route_map_no_match_tag_hook(int (*func)(
425 struct vty *vty, struct route_map_index *index, const char *command,
426 const char *arg, route_map_event_t type));
427 /* set ip nexthop */
428 extern void route_map_set_ip_nexthop_hook(
429 int (*func)(struct vty *vty, struct route_map_index *index,
430 const char *command, const char *arg));
431 /* no set ip nexthop */
432 extern void route_map_no_set_ip_nexthop_hook(
433 int (*func)(struct vty *vty, struct route_map_index *index,
434 const char *command, const char *arg));
435 /* set ipv6 nexthop local */
436 extern void route_map_set_ipv6_nexthop_local_hook(
437 int (*func)(struct vty *vty, struct route_map_index *index,
438 const char *command, const char *arg));
439 /* no set ipv6 nexthop local */
440 extern void route_map_no_set_ipv6_nexthop_local_hook(
441 int (*func)(struct vty *vty, struct route_map_index *index,
442 const char *command, const char *arg));
443 /* set metric */
444 extern void route_map_set_metric_hook(int (*func)(struct vty *vty,
445 struct route_map_index *index,
446 const char *command,
447 const char *arg));
448 /* no set metric */
449 extern void route_map_no_set_metric_hook(
450 int (*func)(struct vty *vty, struct route_map_index *index,
451 const char *command, const char *arg));
452 /* set tag */
453 extern void route_map_set_tag_hook(int (*func)(struct vty *vty,
454 struct route_map_index *index,
455 const char *command,
456 const char *arg));
457 /* no set tag */
458 extern void route_map_no_set_tag_hook(int (*func)(struct vty *vty,
459 struct route_map_index *index,
460 const char *command,
461 const char *arg));
462
463 extern void *route_map_rule_tag_compile(const char *arg);
464 extern void route_map_rule_tag_free(void *rule);
465
466 /* Increment the route-map used counter */
467 extern void route_map_counter_increment(struct route_map *map);
468
469 /* Decrement the route-map used counter */
470 extern void route_map_counter_decrement(struct route_map *map);
471
472 /* Route map hooks data structure. */
473 struct route_map_match_set_hooks {
474 /* match interface */
475 int (*match_interface)(struct vty *vty, struct route_map_index *index,
476 const char *command, const char *arg,
477 route_map_event_t type);
478
479 /* no match interface */
480 int (*no_match_interface)(struct vty *vty,
481 struct route_map_index *index,
482 const char *command, const char *arg,
483 route_map_event_t type);
484
485 /* match ip address */
486 int (*match_ip_address)(struct vty *vty, struct route_map_index *index,
487 const char *command, const char *arg,
488 route_map_event_t type);
489
490 /* no match ip address */
491 int (*no_match_ip_address)(struct vty *vty,
492 struct route_map_index *index,
493 const char *command, const char *arg,
494 route_map_event_t type);
495
496 /* match ip address prefix list */
497 int (*match_ip_address_prefix_list)(struct vty *vty,
498 struct route_map_index *index,
499 const char *command,
500 const char *arg,
501 route_map_event_t type);
502
503 /* no match ip address prefix list */
504 int (*no_match_ip_address_prefix_list)(struct vty *vty,
505 struct route_map_index *index,
506 const char *command,
507 const char *arg,
508 route_map_event_t type);
509
510 /* match ip next hop */
511 int (*match_ip_next_hop)(struct vty *vty, struct route_map_index *index,
512 const char *command, const char *arg,
513 route_map_event_t type);
514
515 /* no match ip next hop */
516 int (*no_match_ip_next_hop)(struct vty *vty,
517 struct route_map_index *index,
518 const char *command, const char *arg,
519 route_map_event_t type);
520
521 /* match ip next hop prefix list */
522 int (*match_ip_next_hop_prefix_list)(struct vty *vty,
523 struct route_map_index *index,
524 const char *command,
525 const char *arg,
526 route_map_event_t type);
527
528 /* no match ip next hop prefix list */
529 int (*no_match_ip_next_hop_prefix_list)(struct vty *vty,
530 struct route_map_index *index,
531 const char *command,
532 const char *arg,
533 route_map_event_t type);
534
535 /* match ip next-hop type */
536 int (*match_ip_next_hop_type)(struct vty *vty,
537 struct route_map_index *index,
538 const char *command,
539 const char *arg,
540 route_map_event_t type);
541
542 /* no match ip next-hop type */
543 int (*no_match_ip_next_hop_type)(struct vty *vty,
544 struct route_map_index *index,
545 const char *command,
546 const char *arg,
547 route_map_event_t type);
548
549 /* match ipv6 address */
550 int (*match_ipv6_address)(struct vty *vty,
551 struct route_map_index *index,
552 const char *command, const char *arg,
553 route_map_event_t type);
554
555 /* no match ipv6 address */
556 int (*no_match_ipv6_address)(struct vty *vty,
557 struct route_map_index *index,
558 const char *command, const char *arg,
559 route_map_event_t type);
560
561
562 /* match ipv6 address prefix list */
563 int (*match_ipv6_address_prefix_list)(struct vty *vty,
564 struct route_map_index *index,
565 const char *command,
566 const char *arg,
567 route_map_event_t type);
568
569 /* no match ipv6 address prefix list */
570 int (*no_match_ipv6_address_prefix_list)(struct vty *vty,
571 struct route_map_index *index,
572 const char *command,
573 const char *arg,
574 route_map_event_t type);
575
576 /* match ipv6 next-hop type */
577 int (*match_ipv6_next_hop_type)(struct vty *vty,
578 struct route_map_index *index,
579 const char *command,
580 const char *arg,
581 route_map_event_t type);
582
583 /* no match ipv6 next-hop type */
584 int (*no_match_ipv6_next_hop_type)(struct vty *vty,
585 struct route_map_index *index,
586 const char *command, const char *arg,
587 route_map_event_t type);
588
589 /* match metric */
590 int (*match_metric)(struct vty *vty, struct route_map_index *index,
591 const char *command, const char *arg,
592 route_map_event_t type);
593
594 /* no match metric */
595 int (*no_match_metric)(struct vty *vty, struct route_map_index *index,
596 const char *command, const char *arg,
597 route_map_event_t type);
598
599 /* match tag */
600 int (*match_tag)(struct vty *vty, struct route_map_index *index,
601 const char *command, const char *arg,
602 route_map_event_t type);
603
604 /* no match tag */
605 int (*no_match_tag)(struct vty *vty, struct route_map_index *index,
606 const char *command, const char *arg,
607 route_map_event_t type);
608
609 /* set ip nexthop */
610 int (*set_ip_nexthop)(struct vty *vty, struct route_map_index *index,
611 const char *command, const char *arg);
612
613 /* no set ip nexthop */
614 int (*no_set_ip_nexthop)(struct vty *vty, struct route_map_index *index,
615 const char *command, const char *arg);
616
617 /* set ipv6 nexthop local */
618 int (*set_ipv6_nexthop_local)(struct vty *vty,
619 struct route_map_index *index,
620 const char *command, const char *arg);
621
622 /* no set ipv6 nexthop local */
623 int (*no_set_ipv6_nexthop_local)(struct vty *vty,
624 struct route_map_index *index,
625 const char *command, const char *arg);
626
627 /* set metric */
628 int (*set_metric)(struct vty *vty, struct route_map_index *index,
629 const char *command, const char *arg);
630
631 /* no set metric */
632 int (*no_set_metric)(struct vty *vty, struct route_map_index *index,
633 const char *command, const char *arg);
634
635 /* set tag */
636 int (*set_tag)(struct vty *vty, struct route_map_index *index,
637 const char *command, const char *arg);
638
639 /* no set tag */
640 int (*no_set_tag)(struct vty *vty, struct route_map_index *index,
641 const char *command, const char *arg);
642 };
643
644 extern struct route_map_match_set_hooks rmap_match_set_hook;
645
646 /* Making route map list. */
647 struct route_map_list {
648 struct route_map *head;
649 struct route_map *tail;
650
651 void (*add_hook)(const char *);
652 void (*delete_hook)(const char *);
653 void (*event_hook)(const char *);
654 };
655
656 extern struct route_map_list route_map_master;
657
658 extern struct route_map *route_map_get(const char *name);
659 extern void route_map_delete(struct route_map *map);
660 extern struct route_map_index *route_map_index_get(struct route_map *map,
661 enum route_map_type type,
662 int pref);
663 extern void route_map_index_delete(struct route_map_index *index, int notify);
664
665 /* routemap_northbound.c */
666 typedef int (*routemap_match_hook_fun)(struct vty *vty,
667 struct route_map_index *rmi,
668 const char *command, const char *arg,
669 route_map_event_t event);
670
671 typedef int (*routemap_set_hook_fun)(struct vty *vty,
672 struct route_map_index *rmi,
673 const char *command, const char *arg);
674
675 struct routemap_hook_context {
676 struct route_map_index *rhc_rmi;
677 const char *rhc_rule;
678 route_map_event_t rhc_event;
679 routemap_set_hook_fun rhc_shook;
680 routemap_match_hook_fun rhc_mhook;
681 TAILQ_ENTRY(routemap_hook_context) rhc_entry;
682 };
683
684 int lib_route_map_entry_match_destroy(enum nb_event event,
685 const struct lyd_node *dnode);
686 int lib_route_map_entry_set_destroy(enum nb_event event,
687 const struct lyd_node *dnode);
688
689 struct routemap_hook_context *
690 routemap_hook_context_insert(struct route_map_index *rmi);
691 void routemap_hook_context_free(struct routemap_hook_context *rhc);
692
693 extern const struct frr_yang_module_info frr_route_map_info;
694
695 /* routemap_cli.c */
696 extern void route_map_instance_show(struct vty *vty, struct lyd_node *dnode,
697 bool show_defaults);
698 extern void route_map_instance_show_end(struct vty *vty,
699 struct lyd_node *dnode);
700 extern void route_map_condition_show(struct vty *vty, struct lyd_node *dnode,
701 bool show_defaults);
702 extern void route_map_action_show(struct vty *vty, struct lyd_node *dnode,
703 bool show_defaults);
704 extern void route_map_exit_policy_show(struct vty *vty, struct lyd_node *dnode,
705 bool show_defaults);
706 extern void route_map_call_show(struct vty *vty, struct lyd_node *dnode,
707 bool show_defaults);
708 extern void route_map_description_show(struct vty *vty,
709 struct lyd_node *dnode,
710 bool show_defaults);
711 extern void route_map_cli_init(void);
712
713 #ifdef __cplusplus
714 }
715 #endif
716
717 #endif /* _ZEBRA_ROUTEMAP_H */