neels has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/29043 )
Change subject: gtlv: test repeated IEIs to several struct members ......................................................................
gtlv: test repeated IEIs to several struct members
Test the behavior fixed by Ie37585178ff27306d425b75d8e407b71f92f1cdc
Related: CID#275415 Related: SYS#5599 Change-Id: I994d0fb1f1435d2c27a8630a43fe106652ac6e41 --- M tests/libosmo-gtlv/gtlv_dec_enc_test.c M tests/libosmo-gtlv/gtlv_dec_enc_test.ok 2 files changed, 380 insertions(+), 47 deletions(-)
Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/tests/libosmo-gtlv/gtlv_dec_enc_test.c b/tests/libosmo-gtlv/gtlv_dec_enc_test.c index f0de7b0..848c0ef 100644 --- a/tests/libosmo-gtlv/gtlv_dec_enc_test.c +++ b/tests/libosmo-gtlv/gtlv_dec_enc_test.c @@ -94,7 +94,13 @@ struct baz baz;
unsigned int repeat_int_count; - int repeat_int[32]; + int repeat_int[3]; + + unsigned int repeat_int2_count; + int repeat_int2[2]; + + bool repeat_int3_present; + unsigned int repeat_int3;
unsigned int repeat_struct_count; struct repeat repeat_struct[32]; @@ -264,6 +270,26 @@ .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_int), }, { + .ti = { TAG_REPEAT_INT }, + .dec_func = dec_u16, + .enc_func = enc_u16, + .enc_to_str_func = enc_to_str_u16, + .memb_ofs = offsetof(struct decoded_msg, repeat_int2), + .memb_array_pitch = OSMO_MEMB_ARRAY_PITCH(struct decoded_msg, repeat_int2), + .has_count = true, + .count_ofs = offsetof(struct decoded_msg, repeat_int2_count), + .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_int2), + }, + { + .ti = { TAG_REPEAT_INT }, + .dec_func = dec_u16, + .enc_func = enc_u16, + .enc_to_str_func = enc_to_str_u16, + .memb_ofs = offsetof(struct decoded_msg, repeat_int3), + .has_presence_flag = true, + .presence_flag_ofs = offsetof(struct decoded_msg, repeat_int3_present), + }, + { .ti = { TAG_REPEAT_STRUCT }, .dec_func = dec_repeat_struct, .enc_func = enc_repeat_struct, @@ -284,11 +310,88 @@ {} };
-char *decoded_msg_to_str(const struct decoded_msg *m) -{ - return osmo_gtlvs_encode_to_str_c(ctx, m, sizeof(*m), 0, msg_ie_coding, tag_names); -} +/* Same as msg_ie_coding, but with different ordering of the REPEAT_INT IEIs: in msg_ie_coding, the three separate + * REPEAT_INT tags follow directly after each other, while in msg_ie_coding2, other tags appear in-between. */ +struct osmo_gtlv_coding msg_ie_coding2[] = { + { + .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), + }, + { + .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), + }, + { + .ti = { TAG_BAZ }, + .dec_func = dec_baz, + .enc_func = enc_baz, + .enc_to_str_func = enc_to_str_baz, + .memb_ofs = offsetof(struct decoded_msg, baz), + .has_presence_flag = true, + .presence_flag_ofs = offsetof(struct decoded_msg, baz_present), + }, + { + .ti = { TAG_REPEAT_INT }, + .dec_func = dec_u16, + .enc_func = enc_u16, + .enc_to_str_func = enc_to_str_u16, + .memb_ofs = offsetof(struct decoded_msg, repeat_int), + .memb_array_pitch = OSMO_MEMB_ARRAY_PITCH(struct decoded_msg, repeat_int), + .has_count = true, + .count_ofs = offsetof(struct decoded_msg, repeat_int_count), + .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_int), + }, + { + .ti = { TAG_REPEAT_STRUCT }, + .dec_func = dec_repeat_struct, + .enc_func = enc_repeat_struct, + .enc_to_str_func = enc_to_str_repeat_struct, + .memb_ofs = offsetof(struct decoded_msg, repeat_struct), + .memb_array_pitch = OSMO_MEMB_ARRAY_PITCH(struct decoded_msg, repeat_struct), + .has_count = true, + .count_ofs = offsetof(struct decoded_msg, repeat_struct_count), + .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_struct), + }, + { + .ti = { TAG_REPEAT_INT }, + .dec_func = dec_u16, + .enc_func = enc_u16, + .enc_to_str_func = enc_to_str_u16, + .memb_ofs = offsetof(struct decoded_msg, repeat_int2), + .memb_array_pitch = OSMO_MEMB_ARRAY_PITCH(struct decoded_msg, repeat_int2), + .has_count = true, + .count_ofs = offsetof(struct decoded_msg, repeat_int2_count), + .count_max = ARRAY_SIZE(((struct decoded_msg *)0)->repeat_int2), + }, + { + .ti = { TAG_NEST }, + .memb_ofs = offsetof(struct decoded_msg, nest), + .nested_ies = nested_inner_msg_ies, + .has_presence_flag = true, + .presence_flag_ofs = offsetof(struct decoded_msg, nest_present), + }, + { + .ti = { TAG_REPEAT_INT }, + .dec_func = dec_u16, + .enc_func = enc_u16, + .enc_to_str_func = enc_to_str_u16, + .memb_ofs = offsetof(struct decoded_msg, repeat_int3), + .has_presence_flag = true, + .presence_flag_ofs = offsetof(struct decoded_msg, repeat_int3_present), + }, + {} +};
+char *decoded_msg_to_str(const struct decoded_msg *m, const struct osmo_gtlv_coding *iec) +{ + return osmo_gtlvs_encode_to_str_c(ctx, m, sizeof(*m), 0, iec, tag_names); +}
const struct decoded_msg enc_dec_tests[] = { { @@ -322,6 +425,38 @@ .foo = 23, .bar = { "twentythree" },
+ .repeat_int_count = 3, + .repeat_int = { 1, 2, 0x7fff }, + + .repeat_struct_count = 1, + .repeat_struct = { + { + .v_int = 1001, + .v_bool = true, + .v_enum = R_A, + }, + }, + + .repeat_int2_count = 2, + .repeat_int2 = { 23, 42 }, + + .nest_present = true, + .nest = { + .foo = 42, + .bar = { "fortytwo" }, + .baz = { + .v_int = 4242, + .v_bool = false, + }, + }, + + .repeat_int3_present = true, + .repeat_int3 = 423, + }, + { + .foo = 23, + .bar = { "twentythree" }, + .baz_present = true, .baz = { .v_int = 2323, @@ -370,7 +505,7 @@ va_end(args); }
-void test_enc_dec(const char *label, const struct osmo_gtlv_cfg *cfg, bool ordered) +void test_enc_dec(const char *label, const struct osmo_gtlv_cfg *cfg, const struct osmo_gtlv_coding *iec, bool ordered) { int i; for (i = 0; i < ARRAY_SIZE(enc_dec_tests); i++) { @@ -381,13 +516,13 @@ struct osmo_gtlv_put put;
printf("\n=== start %s %s[%d]\n", label, __func__, i); - printf("encoded: %s\n", decoded_msg_to_str(orig)); + printf("encoded: %s\n", decoded_msg_to_str(orig, iec));
put = (struct osmo_gtlv_put){ .cfg = cfg, .dst = msgb_alloc(1024, __func__), }; - rc = osmo_gtlvs_encode(&put, (void *)orig, sizeof(*orig), 0, msg_ie_coding, + rc = osmo_gtlvs_encode(&put, (void *)orig, sizeof(*orig), 0, iec, err_cb, &verify_err_cb_data, tag_names); printf("osmo_gtlvs_encode() rc = %d\n", rc); printf("%s.\n", osmo_hexdump(put.dst->data, put.dst->len)); @@ -396,11 +531,11 @@ .cfg = cfg, .src = { put.dst->data, put.dst->len }, }; - rc = osmo_gtlvs_decode(&parsed, sizeof(parsed), 0, &load, ordered, msg_ie_coding, + rc = osmo_gtlvs_decode(&parsed, sizeof(parsed), 0, &load, ordered, iec, err_cb, &verify_err_cb_data, tag_names); printf("osmo_gtlvs_decode() rc = %d\n", rc); - printf("decoded: %s\n", decoded_msg_to_str(&parsed)); - if (strcmp(decoded_msg_to_str(orig), decoded_msg_to_str(&parsed))) { + printf("decoded: %s\n", decoded_msg_to_str(&parsed, iec)); + if (strcmp(decoded_msg_to_str(orig, iec), decoded_msg_to_str(&parsed, iec))) { printf(" ERROR: parsed != orig\n"); exit(1); } @@ -413,11 +548,17 @@ ctx = talloc_named_const(NULL, 0, "gtlv_test"); msgb_talloc_ctx_init(ctx, 0);
- test_enc_dec("t8l8v ordered", &osmo_t8l8v_cfg, true); - test_enc_dec("t8l8v unordered", &osmo_t8l8v_cfg, false); + test_enc_dec("1: t8l8v ordered", &osmo_t8l8v_cfg, msg_ie_coding, true); + test_enc_dec("1: t8l8v unordered", &osmo_t8l8v_cfg, msg_ie_coding, false);
- test_enc_dec("t16l16v ordered", &osmo_t16l16v_cfg, true); - test_enc_dec("t16l16v unordered", &osmo_t16l16v_cfg, false); + test_enc_dec("1: t16l16v ordered", &osmo_t16l16v_cfg, msg_ie_coding, true); + test_enc_dec("1: t16l16v unordered", &osmo_t16l16v_cfg, msg_ie_coding, false); + + test_enc_dec("2: t8l8v ordered", &osmo_t8l8v_cfg, msg_ie_coding2, true); + test_enc_dec("2: t8l8v unordered", &osmo_t8l8v_cfg, msg_ie_coding2, false); + + test_enc_dec("2: t16l16v ordered", &osmo_t16l16v_cfg, msg_ie_coding2, true); + test_enc_dec("2: t16l16v unordered", &osmo_t16l16v_cfg, msg_ie_coding2, false);
talloc_free(ctx); return 0; diff --git a/tests/libosmo-gtlv/gtlv_dec_enc_test.ok b/tests/libosmo-gtlv/gtlv_dec_enc_test.ok index bd6df52..b6a2d7f 100644 --- a/tests/libosmo-gtlv/gtlv_dec_enc_test.ok +++ b/tests/libosmo-gtlv/gtlv_dec_enc_test.ok @@ -1,128 +1,320 @@
-=== start t8l8v ordered test_enc_dec[0] +=== start 1: t8l8v ordered test_enc_dec[0] encoded: 'FOO'=23 'BAR'="twentythree" osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" -=== end t8l8v ordered test_enc_dec[0] +=== end 1: t8l8v ordered test_enc_dec[0]
-=== start t8l8v ordered test_enc_dec[1] +=== start 1: t8l8v ordered test_enc_dec[1] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} -=== end t8l8v ordered test_enc_dec[1] +=== end 1: t8l8v ordered test_enc_dec[1]
-=== start t8l8v ordered test_enc_dec[2] +=== start 1: t8l8v ordered test_enc_dec[2] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } -=== end t8l8v ordered test_enc_dec[2] +=== end 1: t8l8v ordered test_enc_dec[2]
-=== start t8l8v ordered test_enc_dec[3] +=== start 1: t8l8v ordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 04 02 00 01 04 02 00 02 04 02 7f ff 04 02 00 17 04 02 00 2a 04 02 01 a7 05 03 03 e9 80 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 1: t8l8v ordered test_enc_dec[3] + +=== start 1: t8l8v ordered test_enc_dec[4] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 05 03 03 ea 01 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } -=== end t8l8v ordered test_enc_dec[3] +=== end 1: t8l8v ordered test_enc_dec[4]
-=== start t8l8v unordered test_enc_dec[0] +=== start 1: t8l8v unordered test_enc_dec[0] encoded: 'FOO'=23 'BAR'="twentythree" osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" -=== end t8l8v unordered test_enc_dec[0] +=== end 1: t8l8v unordered test_enc_dec[0]
-=== start t8l8v unordered test_enc_dec[1] +=== start 1: t8l8v unordered test_enc_dec[1] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} -=== end t8l8v unordered test_enc_dec[1] +=== end 1: t8l8v unordered test_enc_dec[1]
-=== start t8l8v unordered test_enc_dec[2] +=== start 1: t8l8v unordered test_enc_dec[2] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } -=== end t8l8v unordered test_enc_dec[2] +=== end 1: t8l8v unordered test_enc_dec[2]
-=== start t8l8v unordered test_enc_dec[3] +=== start 1: t8l8v unordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 04 02 00 01 04 02 00 02 04 02 7f ff 04 02 00 17 04 02 00 2a 04 02 01 a7 05 03 03 e9 80 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 1: t8l8v unordered test_enc_dec[3] + +=== start 1: t8l8v unordered test_enc_dec[4] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } osmo_gtlvs_encode() rc = 0 01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 05 03 03 ea 01 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } -=== end t8l8v unordered test_enc_dec[3] +=== end 1: t8l8v unordered test_enc_dec[4]
-=== start t16l16v ordered test_enc_dec[0] +=== start 1: t16l16v ordered test_enc_dec[0] encoded: 'FOO'=23 'BAR'="twentythree" osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" -=== end t16l16v ordered test_enc_dec[0] +=== end 1: t16l16v ordered test_enc_dec[0]
-=== start t16l16v ordered test_enc_dec[1] +=== start 1: t16l16v ordered test_enc_dec[1] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} -=== end t16l16v ordered test_enc_dec[1] +=== end 1: t16l16v ordered test_enc_dec[1]
-=== start t16l16v ordered test_enc_dec[2] +=== start 1: t16l16v ordered test_enc_dec[2] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } -=== end t16l16v ordered test_enc_dec[2] +=== end 1: t16l16v ordered test_enc_dec[2]
-=== start t16l16v ordered test_enc_dec[3] +=== start 1: t16l16v ordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 04 00 02 00 17 00 04 00 02 00 2a 00 04 00 02 01 a7 00 05 00 03 03 e9 80 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 1: t16l16v ordered test_enc_dec[3] + +=== start 1: t16l16v ordered test_enc_dec[4] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 05 00 03 03 ea 01 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } -=== end t16l16v ordered test_enc_dec[3] +=== end 1: t16l16v ordered test_enc_dec[4]
-=== start t16l16v unordered test_enc_dec[0] +=== start 1: t16l16v unordered test_enc_dec[0] encoded: 'FOO'=23 'BAR'="twentythree" osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" -=== end t16l16v unordered test_enc_dec[0] +=== end 1: t16l16v unordered test_enc_dec[0]
-=== start t16l16v unordered test_enc_dec[1] +=== start 1: t16l16v unordered test_enc_dec[1] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} -=== end t16l16v unordered test_enc_dec[1] +=== end 1: t16l16v unordered test_enc_dec[1]
-=== start t16l16v unordered test_enc_dec[2] +=== start 1: t16l16v unordered test_enc_dec[2] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } -=== end t16l16v unordered test_enc_dec[2] +=== end 1: t16l16v unordered test_enc_dec[2]
-=== start t16l16v unordered test_enc_dec[3] +=== start 1: t16l16v unordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 04 00 02 00 17 00 04 00 02 00 2a 00 04 00 02 01 a7 00 05 00 03 03 e9 80 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_INT'={ 23, 42 } 'REPEAT_INT'=423 'REPEAT_STRUCT'={ {1001,true,R_A} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 1: t16l16v unordered test_enc_dec[3] + +=== start 1: t16l16v unordered test_enc_dec[4] encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } osmo_gtlvs_encode() rc = 0 00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 05 00 03 03 ea 01 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . osmo_gtlvs_decode() rc = 0 decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } -=== end t16l16v unordered test_enc_dec[3] +=== end 1: t16l16v unordered test_enc_dec[4] + +=== start 2: t8l8v ordered test_enc_dec[0] +encoded: 'FOO'=23 'BAR'="twentythree" +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" +=== end 2: t8l8v ordered test_enc_dec[0] + +=== start 2: t8l8v ordered test_enc_dec[1] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +=== end 2: t8l8v ordered test_enc_dec[1] + +=== start 2: t8l8v ordered test_enc_dec[2] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +=== end 2: t8l8v ordered test_enc_dec[2] + +=== start 2: t8l8v ordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 04 02 00 17 04 02 00 2a 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 04 02 01 a7 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +=== end 2: t8l8v ordered test_enc_dec[3] + +=== start 2: t8l8v ordered test_enc_dec[4] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 05 03 03 ea 01 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 2: t8l8v ordered test_enc_dec[4] + +=== start 2: t8l8v unordered test_enc_dec[0] +encoded: 'FOO'=23 'BAR'="twentythree" +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" +=== end 2: t8l8v unordered test_enc_dec[0] + +=== start 2: t8l8v unordered test_enc_dec[1] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +=== end 2: t8l8v unordered test_enc_dec[1] + +=== start 2: t8l8v unordered test_enc_dec[2] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +=== end 2: t8l8v unordered test_enc_dec[2] + +=== start 2: t8l8v unordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 04 02 00 17 04 02 00 2a 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 04 02 01 a7 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +=== end 2: t8l8v unordered test_enc_dec[3] + +=== start 2: t8l8v unordered test_enc_dec[4] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +01 02 00 17 02 0b 74 77 65 6e 74 79 74 68 72 65 65 03 02 89 13 04 02 00 01 04 02 00 02 04 02 7f ff 05 03 03 e9 80 05 03 03 ea 01 06 12 01 02 00 2a 02 08 66 6f 72 74 79 74 77 6f 03 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 2: t8l8v unordered test_enc_dec[4] + +=== start 2: t16l16v ordered test_enc_dec[0] +encoded: 'FOO'=23 'BAR'="twentythree" +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" +=== end 2: t16l16v ordered test_enc_dec[0] + +=== start 2: t16l16v ordered test_enc_dec[1] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +=== end 2: t16l16v ordered test_enc_dec[1] + +=== start 2: t16l16v ordered test_enc_dec[2] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +=== end 2: t16l16v ordered test_enc_dec[2] + +=== start 2: t16l16v ordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 04 00 02 00 17 00 04 00 02 00 2a 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 00 04 00 02 01 a7 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +=== end 2: t16l16v ordered test_enc_dec[3] + +=== start 2: t16l16v ordered test_enc_dec[4] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 05 00 03 03 ea 01 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 2: t16l16v ordered test_enc_dec[4] + +=== start 2: t16l16v unordered test_enc_dec[0] +encoded: 'FOO'=23 'BAR'="twentythree" +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" +=== end 2: t16l16v unordered test_enc_dec[0] + +=== start 2: t16l16v unordered test_enc_dec[1] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} +=== end 2: t16l16v unordered test_enc_dec[1] + +=== start 2: t16l16v unordered test_enc_dec[2] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } +=== end 2: t16l16v unordered test_enc_dec[2] + +=== start 2: t16l16v unordered test_enc_dec[3] +encoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 04 00 02 00 17 00 04 00 02 00 2a 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 00 04 00 02 01 a7 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A} } 'REPEAT_INT'={ 23, 42 } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } 'REPEAT_INT'=423 +=== end 2: t16l16v unordered test_enc_dec[3] + +=== start 2: t16l16v unordered test_enc_dec[4] +encoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +osmo_gtlvs_encode() rc = 0 +00 01 00 02 00 17 00 02 00 0b 74 77 65 6e 74 79 74 68 72 65 65 00 03 00 02 89 13 00 04 00 02 00 01 00 04 00 02 00 02 00 04 00 02 7f ff 00 05 00 03 03 e9 80 00 05 00 03 03 ea 01 00 06 00 18 00 01 00 02 00 2a 00 02 00 08 66 6f 72 74 79 74 77 6f 00 03 00 02 10 92 . +osmo_gtlvs_decode() rc = 0 +decoded: 'FOO'=23 'BAR'="twentythree" 'BAZ'={2323,true} 'REPEAT_INT'={ 1, 2, 32767 } 'REPEAT_STRUCT'={ {1001,true,R_A}, {1002,false,R_B} } 'NEST'={ 'FOO'=42 'BAR'="fortytwo" 'BAZ'={4242,false} } +=== end 2: t16l16v unordered test_enc_dec[4]
null-- To view, visit https://gerrit.osmocom.org/c/libosmo-pfcp/+/29043 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-pfcp Gerrit-Branch: master Gerrit-Change-Id: I994d0fb1f1435d2c27a8630a43fe106652ac6e41 Gerrit-Change-Number: 29043 Gerrit-PatchSet: 5 Gerrit-Owner: neels nhofmeyr@sysmocom.de Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge laforge@osmocom.org Gerrit-Reviewer: pespin pespin@sysmocom.de Gerrit-MessageType: merged