From 453844abd7bce28479d10490de513ca59cd0d490 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 22 Apr 2018 17:03:52 -0400 Subject: zebra: use hooks for client lifecycle callbacks zserv.c was using hardcoded callbacks to clean up various components when a client disconnected. Ergo zserv.c had to know about all these unrelated components that it should not care about. We have hooks now, let's use the proper thing instead. Signed-off-by: Quentin Young --- zebra/zserv.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'zebra/zserv.h') diff --git a/zebra/zserv.h b/zebra/zserv.h index 2a148f645..b3f3cce7e 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -34,6 +34,7 @@ #include "lib/thread.h" /* for thread, thread_master */ #include "lib/linklist.h" /* for list */ #include "lib/workqueue.h" /* for work_queue */ +#include "lib/hook.h" /* for DECLARE_HOOK, DECLARE_KOOH */ #include "zebra/zebra_vrf.h" /* for zebra_vrf */ @@ -88,7 +89,7 @@ struct zserv { /* client's protocol */ uint8_t proto; - unsigned short instance; + uint16_t instance; uint8_t is_synchronous; /* Statistics */ @@ -141,6 +142,10 @@ struct zserv { struct zserv *client, struct zmsghdr *hdr, struct stream *msg, \ struct zebra_vrf *zvrf +/* Hooks for client connect / disconnect */ +DECLARE_HOOK(client_connect, (struct zserv *client), (client)); +DECLARE_KOOH(client_close, (struct zserv *client), (client)); + /* Zebra instance */ struct zebra_t { /* Thread master */ -- cgit v1.2.3