neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-upf/+/28226 )
Change subject: api: osmo_pfcp_ie_node_id_to_str_c ......................................................................
api: osmo_pfcp_ie_node_id_to_str_c
Change-Id: I5c580bc510afce58a03dea0861db9630b063b2ae --- M include/osmocom/pfcp/pfcp_ies_custom.h M src/libosmo-pfcp/pfcp_ies_custom.c 2 files changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/26/28226/1
diff --git a/include/osmocom/pfcp/pfcp_ies_custom.h b/include/osmocom/pfcp/pfcp_ies_custom.h index c28fdb2..08e62d1 100644 --- a/include/osmocom/pfcp/pfcp_ies_custom.h +++ b/include/osmocom/pfcp/pfcp_ies_custom.h @@ -48,6 +48,9 @@ }; };
+int osmo_pfcp_ie_node_id_to_str_buf(char *buf, size_t buflen, const struct osmo_pfcp_ie_node_id *node_id); +char *osmo_pfcp_ie_node_id_to_str_c(void *ctx, const struct osmo_pfcp_ie_node_id *node_id); + bool osmo_pfcp_bits_get(const uint8_t *bits, unsigned int bitpos); void osmo_pfcp_bits_set(uint8_t *bits, unsigned int bitpos, bool val); int osmo_pfcp_bits_to_str_buf(char *buf, size_t buflen, const uint8_t *bits, const struct value_string *bit_strs); diff --git a/src/libosmo-pfcp/pfcp_ies_custom.c b/src/libosmo-pfcp/pfcp_ies_custom.c index 660a08d..5975a29 100644 --- a/src/libosmo-pfcp/pfcp_ies_custom.c +++ b/src/libosmo-pfcp/pfcp_ies_custom.c @@ -317,9 +317,8 @@ return 0; }
-int osmo_pfcp_enc_to_str_node_id(char *buf, size_t buflen, const void *encode_from) +int osmo_pfcp_ie_node_id_to_str_buf(char *buf, size_t buflen, const struct osmo_pfcp_ie_node_id *node_id) { - const struct osmo_pfcp_ie_node_id *node_id = encode_from; struct osmo_strbuf sb = { .buf = buf, .len = buflen };
switch (node_id->type) { @@ -343,6 +342,16 @@ return sb.chars_needed; }
+char *osmo_pfcp_ie_node_id_to_str_c(void *ctx, const struct osmo_pfcp_ie_node_id *node_id) +{ + OSMO_NAME_C_IMPL(ctx, 64, "ERROR", osmo_pfcp_ie_node_id_to_str_buf, node_id) +} + +int osmo_pfcp_enc_to_str_node_id(char *buf, size_t buflen, const void *encode_from) +{ + return osmo_pfcp_ie_node_id_to_str_buf(buf, buflen, encode_from); +} + bool osmo_pfcp_bits_get(const uint8_t *bits, unsigned int bitpos) { unsigned int bytenum = bitpos / 8;