summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-04-20 16:59:38 -0400
committerMark Stapp <mjs@voltanet.io>2020-06-02 08:22:24 -0400
commit6e2a33a84391e6e49ab5da76293ebb90e2efca7a (patch)
treefc0645f286adea407b83c6243c3881710a8185b6 /zebra/zserv.c
parent939b2339b43edaf3f30910616df790c95c2b19db (diff)
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>
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 26023173b5..cb863b258c 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -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));