From 138c5a745018a291c8463b67dba7602886859d2e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 18 Sep 2019 16:20:04 -0400 Subject: *: Add infrastructure to support zapi interface callbacks Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp --- ospfd/ospf_interface.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ospfd') diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 387770870..3324740d5 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -1218,8 +1218,31 @@ uint8_t ospf_default_iftype(struct interface *ifp) return OSPF_IFTYPE_BROADCAST; } +static int ospf_ifp_create(struct interface *ifp) +{ + return 0; +} + +static int ospf_ifp_up(struct interface *ifp) +{ + return 0; +} + +static int ospf_ifp_down(struct interface *ifp) +{ + return 0; +} + +static int ospf_ifp_destroy(struct interface *ifp) +{ + return 0; +} + void ospf_if_init(void) { + if_zapi_callbacks(ospf_ifp_create, ospf_ifp_up, + ospf_ifp_down, ospf_ifp_destroy); + /* Initialize Zebra interface data structure. */ hook_register_prio(if_add, 0, ospf_if_new_hook); hook_register_prio(if_del, 0, ospf_if_delete_hook); -- cgit v1.2.3