diff options
| author | Mark Stapp <mjs@voltanet.io> | 2020-04-15 16:31:57 -0400 |
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2020-06-02 08:21:38 -0400 |
| commit | 2ac6c90d1866517628c6325c411c3fae526b9225 (patch) | |
| tree | b0f53c5d051dfd0c1a6454572498905daeb10ee7 /sharpd/sharp_zebra.c | |
| parent | 79b3664a67fef8bad76439a2f34e608b6c475d85 (diff) | |
sharpd: send new OPAQUE messages
Add a simple cli to exercise the new OPAQUE messages.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'sharpd/sharp_zebra.c')
| -rw-r--r-- | sharpd/sharp_zebra.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 0795096440..1be6ec197b 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -480,6 +480,35 @@ static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS) return 0; } +/* + * Send OPAQUE messages, using subtype 'type'. + */ +void sharp_opaque_send(uint32_t type, uint32_t count) +{ + uint8_t buf[100]; + int ret; + uint32_t i; + + /* Prepare a small payload */ + for (i = 0; i < sizeof(buf); i++) { + if (type < 255) + buf[i] = type; + else + buf[i] = 255; + } + + /* Send some messages */ + for (i = 0; i < count; i++) { + ret = zclient_send_opaque(zclient, type, buf, sizeof(buf)); + if (ret < 0) { + zlog_debug("%s: send_opaque() failed => %d", + __func__, ret); + break; + } + } + +} + extern struct zebra_privs_t sharp_privs; void sharp_zebra_init(void) |
