diff options
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 053014f86d..cb4555650d 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1182,6 +1182,12 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID)) stream_putl(s, api->tableid); + if (CHECK_FLAG(api->message, ZAPI_MESSAGE_OPAQUE)) { + assert(api->opaque.length <= ZAPI_MESSAGE_OPAQUE_LENGTH); + + stream_putw(s, api->opaque.length); + stream_write(s, api->opaque.data, api->opaque.length); + } /* Put length at the first point of the stream. */ stream_putw_at(s, 0, stream_get_endp(s)); @@ -1403,6 +1409,13 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID)) STREAM_GETL(s, api->tableid); + if (CHECK_FLAG(api->message, ZAPI_MESSAGE_OPAQUE)) { + STREAM_GETW(s, api->opaque.length); + assert(api->opaque.length < ZAPI_MESSAGE_OPAQUE_LENGTH); + + STREAM_GET(api->opaque.data, s, api->opaque.length); + } + return 0; stream_failure: return -1; @@ -3528,6 +3541,23 @@ stream_failure: return -1; } +/* Utility to decode client close notify info */ +int zapi_client_close_notify_decode(struct stream *s, + struct zapi_client_close_info *info) +{ + memset(info, 0, sizeof(*info)); + + STREAM_GETC(s, info->proto); + STREAM_GETW(s, info->instance); + STREAM_GETL(s, info->session_id); + + return 0; + +stream_failure: + + return -1; +} + /* Zebra client message read function. */ static int zclient_read(struct thread *thread) { @@ -3868,6 +3898,12 @@ static int zclient_read(struct thread *thread) if (zclient->sr_policy_notify_status) (*zclient->sr_policy_notify_status)(command, zclient, length, vrf_id); + break; + case ZEBRA_CLIENT_CLOSE_NOTIFY: + if (zclient->zebra_client_close_notify) + (*zclient->zebra_client_close_notify)(command, zclient, + length, vrf_id); + break; default: break; } |
