const char *str;
/* Function for value set or match. */
- route_map_result_t (*func_apply)(void *, struct prefix *,
- route_map_object_t, void *);
+ route_map_result_t (*func_apply)(void *rule,
+ const struct prefix *prefix,
+ route_map_object_t type,
+ void *object);
/* Compile argument and return result as void *. */
void *(*func_compile)(const char *);
struct route_map_index *next;
struct route_map_index *prev;
+ /* Keep track how many times we've try to apply */
+ uint64_t applied;
+
QOBJ_FIELDS
};
DECLARE_QOBJ_TYPE(route_map_index)
struct route_map *prev;
/* Maintain update info */
- int to_be_processed; /* True if modification isn't acted on yet */
- int deleted; /* If 1, then this node will be deleted */
+ bool to_be_processed; /* True if modification isn't acted on yet */
+ bool deleted; /* If 1, then this node will be deleted */
+
+ /* How many times have we applied this route-map */
+ uint64_t applied;
QOBJ_FIELDS
};
/* Prototypes. */
extern void route_map_init(void);
+
+/*
+ * This should only be called on shutdown
+ * Additionally this function sets the hooks to NULL
+ * before any processing is done.
+ */
extern void route_map_finish(void);
/* Add match statement to route map. */
/* Lookup route map by name. */
extern struct route_map *route_map_lookup_by_name(const char *name);
+/* Simple helper to warn if route-map does not exist. */
+struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *name);
+
/* Apply route map to the object. */
extern route_map_result_t route_map_apply(struct route_map *map,
- struct prefix *,
+ const struct prefix *prefix,
route_map_object_t object_type,
void *object);
extern void route_map_add_hook(void (*func)(const char *));
extern void route_map_delete_hook(void (*func)(const char *));
extern void route_map_event_hook(void (*func)(route_map_event_t, const char *));
-extern int route_map_mark_updated(const char *name, int deleted);
-extern int route_map_clear_updated(struct route_map *rmap);
-extern void route_map_walk_update_list(int (*update_fn)(char *name));
+extern int route_map_mark_updated(const char *name);
+extern void route_map_walk_update_list(void (*update_fn)(char *name));
extern void route_map_upd8_dependency(route_map_event_t type, const char *arg,
const char *rmap_name);
extern void route_map_notify_dependencies(const char *affected_name,
extern void route_map_no_match_ip_next_hop_prefix_list_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,
const char *arg, route_map_event_t type));
+/* match ip next hop type */
+extern void route_map_match_ip_next_hop_type_hook(int (*func)(
+ struct vty *vty, struct route_map_index *index, const char *command,
+ const char *arg, route_map_event_t type));
+/* no match ip next hop type */
+extern void route_map_no_match_ip_next_hop_type_hook(int (*func)(
+ struct vty *vty, struct route_map_index *index, const char *command,
+ const char *arg, route_map_event_t type));
/* match ipv6 address */
extern void route_map_match_ipv6_address_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,
extern void route_map_no_match_ipv6_address_prefix_list_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,
const char *arg, route_map_event_t type));
+/* match ipv6 next-hop type */
+extern void route_map_match_ipv6_next_hop_type_hook(int (*func)(
+ struct vty *vty, struct route_map_index *index, const char *command,
+ const char *arg, route_map_event_t type));
+/* no match ipv6 next-hop type */
+extern void route_map_no_match_ipv6_next_hop_type_hook(int (*func)(
+ struct vty *vty, struct route_map_index *index, const char *command,
+ const char *arg, route_map_event_t type));
/* match metric */
extern void route_map_match_metric_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,