summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zebra/zserv.c19
-rw-r--r--zebra/zserv.h11
2 files changed, 30 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));
diff --git a/zebra/zserv.h b/zebra/zserv.h
index b943c246c6..f2a4523818 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -282,6 +282,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.
*
* proto