mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 07:37:54 +00:00
zebra: add zserv_send_batch api
Add a zserv api to send a batch (a fifo) of messages to a zapi client. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
939b2339b4
commit
6e2a33a843
@ -544,6 +544,25 @@ int zserv_send_message(struct zserv *client, struct stream *msg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a batch of messages to a connected Zebra API client.
|
||||
*/
|
||||
int zserv_send_batch(struct zserv *client, struct stream_fifo *fifo)
|
||||
{
|
||||
struct stream *msg;
|
||||
|
||||
frr_with_mutex(&client->obuf_mtx) {
|
||||
msg = stream_fifo_pop(fifo);
|
||||
while (msg) {
|
||||
stream_fifo_push(client->obuf_fifo, msg);
|
||||
msg = stream_fifo_pop(fifo);
|
||||
}
|
||||
}
|
||||
|
||||
zserv_client_event(client, ZSERV_CLIENT_WRITE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Hooks for client connect / disconnect */
|
||||
DEFINE_HOOK(zserv_client_connect, (struct zserv *client), (client));
|
||||
|
@ -281,6 +281,17 @@ extern void zserv_start(char *path);
|
||||
*/
|
||||
extern int zserv_send_message(struct zserv *client, struct stream *msg);
|
||||
|
||||
/*
|
||||
* Send a batch of messages to a connected Zebra API client.
|
||||
*
|
||||
* client
|
||||
* the client to send to
|
||||
*
|
||||
* fifo
|
||||
* the list of messages to send
|
||||
*/
|
||||
extern int zserv_send_batch(struct zserv *client, struct stream_fifo *fifo);
|
||||
|
||||
/*
|
||||
* Retrieve a client by its protocol and instance number.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user