diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-04-24 00:35:35 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-05-29 21:06:16 +0200 |
commit | 21ccc0cf24f80b7b75815dba3da308f6bae70492 (patch) | |
tree | 6bf49b5128524f5d7e1d5a39be34d44d70a5a211 /zebra/zserv.h | |
parent | zebra: reorganize zserv.c by pthread affinity (diff) | |
download | frr-21ccc0cf24f80b7b75815dba3da308f6bae70492.tar.xz frr-21ccc0cf24f80b7b75815dba3da308f6bae70492.zip |
zebra: refactor zserv names, consolidate events
* Add centralized thread scheduling dispatchers for client threads and
the main thread
* Rename everything in zserv.c to stop using a combination of:
- zebra_server_*
- zebra_*
- zserv_*
Everything in zserv.c now begins with zserv_*.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'zebra/zserv.h')
-rw-r--r-- | zebra/zserv.h | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/zebra/zserv.h b/zebra/zserv.h index 77c5d9a89..6cd8b8c29 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -160,8 +160,8 @@ struct zserv { struct zebra_vrf *zvrf /* Hooks for client connect / disconnect */ -DECLARE_HOOK(zapi_client_connect, (struct zserv *client), (client)); -DECLARE_KOOH(zapi_client_close, (struct zserv *client), (client)); +DECLARE_HOOK(zserv_client_connect, (struct zserv *client), (client)); +DECLARE_KOOH(zserv_client_close, (struct zserv *client), (client)); /* Zebra instance */ struct zebra_t { @@ -169,6 +169,9 @@ struct zebra_t { struct thread_master *master; struct list *client_list; + /* Socket */ + int sock; + /* default table */ uint32_t rtm_table_default; @@ -186,12 +189,48 @@ struct zebra_t { extern struct zebra_t zebrad; extern unsigned int multipath_num; -/* Prototypes. */ +/* + * Initialize Zebra API server. + * + * Installs CLI commands and creates the client list. + */ extern void zserv_init(void); -extern void zebra_zserv_socket_init(char *path); -extern int zebra_server_send_message(struct zserv *client, struct stream *msg); -extern struct zserv *zebra_find_client(uint8_t proto, unsigned short instance); +/* + * Start Zebra API server. + * + * Allocates resources, creates the server socket and begins listening on the + * socket. + * + * path + * where to place the Unix domain socket + */ +extern void zserv_start(char *path); + +/* + * Send a message to a connected Zebra API client. + * + * client + * the client to send to + * + * msg + * the message to send + */ +extern int zserv_send_message(struct zserv *client, struct stream *msg); + +/* + * Retrieve a client by its protocol and instance number. + * + * proto + * protocol number + * + * instance + * instance number + * + * Returns: + * The Zebra API client. + */ +extern struct zserv *zserv_find_client(uint8_t proto, unsigned short instance); #if defined(HANDLE_ZAPI_FUZZING) extern void zserv_read_file(char *input); |