From 8b58faa4c2e1b52802293f4dce9fcc8dc3843b47 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 14 Mar 2022 16:38:15 +0100 Subject: libosmo-gtlv: add TLIV capability During code review, it was indicated that some TLV protocols that we will likely deal with in the near future also employ an I, and instance value of a tag. Add TLIV support. A usage example for a manually implemented TLIV structure is found in tests/libosmo-gtlv/gtlv_test.c. A usage example for a generated TLIV protocol is found in tests/libosmo-gtlv/test_tliv/. Related: SYS#5599 Change-Id: I0a076e54dfba6038cc779cb7c8f3967d212226aa --- tests/libosmo-gtlv/gtlv_dec_enc_test.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/libosmo-gtlv/gtlv_dec_enc_test.c') diff --git a/tests/libosmo-gtlv/gtlv_dec_enc_test.c b/tests/libosmo-gtlv/gtlv_dec_enc_test.c index 89b4011..e02a2e5 100644 --- a/tests/libosmo-gtlv/gtlv_dec_enc_test.c +++ b/tests/libosmo-gtlv/gtlv_dec_enc_test.c @@ -205,21 +205,21 @@ int enc_to_str_repeat_struct(char *buf, size_t buflen, const void *encode_from) struct osmo_gtlv_coding nested_inner_msg_ies[] = { { - .tag = TAG_FOO, + .ti = { TAG_FOO }, .dec_func = dec_u16, .enc_func = enc_u16, .enc_to_str_func = enc_to_str_u16, .memb_ofs = offsetof(struct nested_inner_msg, foo), }, { - .tag = TAG_BAR, + .ti = { TAG_BAR }, .dec_func = dec_bar, .enc_func = enc_bar, .enc_to_str_func = enc_to_str_bar, .memb_ofs = offsetof(struct nested_inner_msg, bar), }, { - .tag = TAG_BAZ, + .ti = { TAG_BAZ }, .dec_func = dec_baz, .enc_func = enc_baz, .enc_to_str_func = enc_to_str_baz, @@ -230,21 +230,21 @@ struct osmo_gtlv_coding nested_inner_msg_ies[] = { struct osmo_gtlv_coding msg_ie_coding[] = { { - .tag = TAG_FOO, + .ti = { TAG_FOO }, .dec_func = dec_u16, .enc_func = enc_u16, .enc_to_str_func = enc_to_str_u16, .memb_ofs = offsetof(struct decoded_msg, foo), }, { - .tag = TAG_BAR, + .ti = { TAG_BAR }, .dec_func = dec_bar, .enc_func = enc_bar, .enc_to_str_func = enc_to_str_bar, .memb_ofs = offsetof(struct decoded_msg, bar), }, { - .tag = TAG_BAZ, + .ti = { TAG_BAZ }, .dec_func = dec_baz, .enc_func = enc_baz, .enc_to_str_func = enc_to_str_baz, @@ -253,7 +253,7 @@ struct osmo_gtlv_coding msg_ie_coding[] = { .presence_flag_ofs = offsetof(struct decoded_msg, baz_present), }, { - .tag = TAG_REPEAT_INT, + .ti = { TAG_REPEAT_INT }, .dec_func = dec_u16, .enc_func = enc_u16, .enc_to_str_func = enc_to_str_u16, @@ -264,7 +264,7 @@ struct osmo_gtlv_coding msg_ie_coding[] = { .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_int), }, { - .tag = TAG_REPEAT_STRUCT, + .ti = { TAG_REPEAT_STRUCT }, .dec_func = dec_repeat_struct, .enc_func = enc_repeat_struct, .enc_to_str_func = enc_to_str_repeat_struct, @@ -275,7 +275,7 @@ struct osmo_gtlv_coding msg_ie_coding[] = { .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_struct), }, { - .tag = TAG_NEST, + .ti = { TAG_NEST }, .memb_ofs = offsetof(struct decoded_msg, nest), .nested_ies = nested_inner_msg_ies, .has_presence_flag = true, -- cgit v1.2.3