mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 12:37:10 +00:00
lib: add zapi encode/decode func for srv6 locator
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
This commit is contained in:
parent
b44f7c3f6d
commit
15588d7b63
@ -1105,6 +1105,33 @@ stream_failure:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int zapi_srv6_locator_encode(struct stream *s, const struct srv6_locator *l)
|
||||||
|
{
|
||||||
|
stream_putw(s, strlen(l->name));
|
||||||
|
stream_put(s, l->name, strlen(l->name));
|
||||||
|
stream_putw(s, l->prefix.prefixlen);
|
||||||
|
stream_put(s, &l->prefix.prefix, sizeof(l->prefix.prefix));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int zapi_srv6_locator_decode(struct stream *s, struct srv6_locator *l)
|
||||||
|
{
|
||||||
|
uint16_t len = 0;
|
||||||
|
|
||||||
|
STREAM_GETW(s, len);
|
||||||
|
if (len > SRV6_LOCNAME_SIZE)
|
||||||
|
goto stream_failure;
|
||||||
|
|
||||||
|
STREAM_GET(l->name, s, len);
|
||||||
|
STREAM_GETW(s, l->prefix.prefixlen);
|
||||||
|
STREAM_GET(&l->prefix.prefix, s, sizeof(l->prefix.prefix));
|
||||||
|
l->prefix.family = AF_INET6;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
stream_failure:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
|
static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1090,6 +1090,9 @@ extern int zapi_labels_encode(struct stream *s, int cmd,
|
|||||||
struct zapi_labels *zl);
|
struct zapi_labels *zl);
|
||||||
extern int zapi_labels_decode(struct stream *s, struct zapi_labels *zl);
|
extern int zapi_labels_decode(struct stream *s, struct zapi_labels *zl);
|
||||||
|
|
||||||
|
extern int zapi_srv6_locator_encode(struct stream *s,
|
||||||
|
const struct srv6_locator *l);
|
||||||
|
extern int zapi_srv6_locator_decode(struct stream *s, struct srv6_locator *l);
|
||||||
extern int zapi_srv6_locator_chunk_encode(struct stream *s,
|
extern int zapi_srv6_locator_chunk_encode(struct stream *s,
|
||||||
const struct srv6_locator_chunk *c);
|
const struct srv6_locator_chunk *c);
|
||||||
extern int zapi_srv6_locator_chunk_decode(struct stream *s,
|
extern int zapi_srv6_locator_chunk_decode(struct stream *s,
|
||||||
|
Loading…
Reference in New Issue
Block a user