summaryrefslogtreecommitdiff
path: root/lib/routemap.h
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@opensourcerouting.org>2019-09-30 10:34:49 -0300
committerRafael Zalamena <rzalamena@opensourcerouting.org>2020-02-04 14:05:43 -0300
commit686d244f00d87fa0b76c8e4644550d413fc3400b (patch)
tree4ad346eee6657cc776d89ca4ba5c363bad348d08 /lib/routemap.h
parenta7282663eff6f036a427165b7fa73c75dccd47ff (diff)
lib: implement route map northbound
Based on the route map old CLI, implement the route map handling using the exported functions. Use a curry-like programming pattern avoid code repetition when destroying match/set entries. This is needed by other daemons that implement custom route map functions and need to pass to lib their specific destroy functions. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/routemap.h')
-rw-r--r--lib/routemap.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/routemap.h b/lib/routemap.h
index 41959c24e5..d9e7f73f81 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -644,6 +644,30 @@ extern struct route_map_index *route_map_index_get(struct route_map *map,
int pref);
extern void route_map_index_delete(struct route_map_index *index, int notify);
+/* routemap_northbound.c */
+typedef int (*routemap_match_hook_fun)(struct vty *vty,
+ struct route_map_index *rmi,
+ const char *command, const char *arg,
+ route_map_event_t event);
+
+typedef int (*routemap_set_hook_fun)(struct vty *vty,
+ struct route_map_index *rmi,
+ const char *command, const char *arg);
+
+struct routemap_hook_context {
+ struct route_map_index *rhc_rmi;
+ const char *rhc_rule;
+ route_map_event_t rhc_event;
+ routemap_set_hook_fun rhc_shook;
+ routemap_match_hook_fun rhc_mhook;
+};
+
+int lib_route_map_entry_match_destroy(enum nb_event event,
+ const struct lyd_node *dnode);
+int lib_route_map_entry_set_destroy(enum nb_event event,
+ const struct lyd_node *dnode);
+extern const struct frr_yang_module_info frr_route_map_info;
+
#ifdef __cplusplus
}
#endif