diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test-ranap.c | 29 | ||||
-rw-r--r-- | src/tests/test-ranap.ok | 23 |
2 files changed, 46 insertions, 6 deletions
diff --git a/src/tests/test-ranap.c b/src/tests/test-ranap.c index acdf05b..5c30edf 100644 --- a/src/tests/test-ranap.c +++ b/src/tests/test-ranap.c @@ -27,6 +27,7 @@ #include <osmocom/ranap/ranap_common.h> #include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_msg_factory.h> +#include <osmocom/ranap/RANAP_MaxBitrate.h> #include "test_common.h" @@ -36,6 +37,22 @@ int asn1_xer_print = 1; extern void *tall_msgb_ctx; +static void test_aper_int(uint32_t inp) +{ + RANAP_MaxBitrate_t mbr = inp; + asn_enc_rval_t rv; + uint8_t buf[32]; + + memset(buf, 0, sizeof(buf)); + + rv = aper_encode_to_buffer(&asn_DEF_RANAP_MaxBitrate, &mbr, buf, sizeof(buf)); + if (rv.encoded == -1) { + fprintf(stderr, "Failed\n"); + return; + } + printf("Encoded MaxBitRate %u to %s\n", mbr, osmo_hexdump(buf, rv.encoded/8)); +} + int main(int argc, char **argv) { uint8_t nas_buf[] = { 0xaa, 0xbb, 0xcc }; @@ -56,6 +73,18 @@ int main(int argc, char **argv) test_common_init(); + test_aper_int(1); + test_aper_int(2); + test_aper_int(3); + test_aper_int(255); + test_aper_int(256); + test_aper_int(257); + test_aper_int(64000); + test_aper_int(0xffff); + test_aper_int(0xffff+1); + test_aper_int(0xffff+2); + test_aper_int(16000000); + for (i = 0; i < 1; i++) { printf("\n==> DIRECT TRANSFER\n"); msg = ranap_new_msg_dt(0, nas_buf, sizeof(nas_buf)); diff --git a/src/tests/test-ranap.ok b/src/tests/test-ranap.ok index 3e9bcda..430535c 100644 --- a/src/tests/test-ranap.ok +++ b/src/tests/test-ranap.ok @@ -1,3 +1,14 @@ +Encoded MaxBitRate 1 to 00 00 +Encoded MaxBitRate 2 to 00 01 +Encoded MaxBitRate 3 to 00 02 +Encoded MaxBitRate 255 to 00 fe +Encoded MaxBitRate 256 to 00 ff +Encoded MaxBitRate 257 to 40 01 00 +Encoded MaxBitRate 64000 to 40 f9 ff +Encoded MaxBitRate 65535 to 40 ff fe +Encoded MaxBitRate 65536 to 40 ff ff +Encoded MaxBitRate 65537 to 80 01 00 00 +Encoded MaxBitRate 16000000 to 80 f4 23 ff ==> DIRECT TRANSFER <RANAP_IE> @@ -77,7 +88,7 @@ <firstValue> 38 02 D8 01 2F A7 20 2F A8 00 00 F4 4C 08 0A 02 80 00 51 40 00 27 20 28 14 00 67 40 00 00 22 28 - 14 00 3C 40 00 00 00 50 3D 02 00 02 0D C0 35 00 + 14 00 3C 40 00 00 00 50 3D 02 02 00 0D C0 35 00 01 0A 0B 0C 0D 40 00 00 00 01 </firstValue> <secondCriticality><ignore/></secondCriticality> @@ -90,11 +101,11 @@ 00 00 01 00 35 00 3A 38 02 D8 01 2F A7 20 2F A8 00 00 F4 4C 08 0A 02 80 00 51 40 00 27 20 28 14 00 67 40 00 00 22 28 14 00 3C 40 00 00 00 50 3D - 02 00 02 0D C0 35 00 01 0A 0B 0C 0D 40 00 00 00 + 02 02 00 0D C0 35 00 01 0A 0B 0C 0D 40 00 00 00 01 40 01 00 </value> </RANAP_IE> -00 00 00 4b 00 00 01 00 36 40 44 00 00 01 00 35 00 3a 38 02 d8 01 2f a7 20 2f a8 00 00 f4 4c 08 0a 02 80 00 51 40 00 27 20 28 14 00 67 40 00 00 22 28 14 00 3c 40 00 00 00 50 3d 02 00 02 0d c0 35 00 01 0a 0b 0c 0d 40 00 00 00 01 40 01 00 +00 00 00 4b 00 00 01 00 36 40 44 00 00 01 00 35 00 3a 38 02 d8 01 2f a7 20 2f a8 00 00 f4 4c 08 0a 02 80 00 51 40 00 27 20 28 14 00 67 40 00 00 22 28 14 00 3c 40 00 00 00 50 3d 02 02 00 0d c0 35 00 01 0a 0b 0c 0d 40 00 00 00 01 40 01 00 ==> RAB ASSIGNMENT COMMAND (DATA) <RANAP_ProtocolIE-FieldPair> @@ -102,7 +113,7 @@ <firstCriticality><reject/></firstCriticality> <firstValue> 38 04 10 DE 18 69 FF 80 0C 34 FF 00 1F 40 08 06 - 08 9E 00 00 04 1B 80 35 00 01 1A 1B 1C 1D 00 11 + 08 9E 00 04 00 1B 80 35 00 01 1A 1B 1C 1D 00 11 22 33 44 </firstValue> <secondCriticality><ignore/></secondCriticality> @@ -113,12 +124,12 @@ <criticality><ignore/></criticality> <value> 00 00 01 00 35 00 23 38 04 10 DE 18 69 FF 80 0C - 34 FF 00 1F 40 08 06 08 9E 00 00 04 1B 80 35 00 + 34 FF 00 1F 40 08 06 08 9E 00 04 00 1B 80 35 00 01 1A 1B 1C 1D 00 11 22 33 44 40 06 78 1C 00 00 00 00 </value> </RANAP_IE> -00 00 00 39 00 00 01 00 36 40 32 00 00 01 00 35 00 23 38 04 10 de 18 69 ff 80 0c 34 ff 00 1f 40 08 06 08 9e 00 00 04 1b 80 35 00 01 1a 1b 1c 1d 00 11 22 33 44 40 06 78 1c 00 00 00 00 +00 00 00 39 00 00 01 00 36 40 32 00 00 01 00 35 00 23 38 04 10 de 18 69 ff 80 0c 34 ff 00 1f 40 08 06 08 9e 00 04 00 1b 80 35 00 01 1a 1b 1c 1d 00 11 22 33 44 40 06 78 1c 00 00 00 00 ==> RESET CMD <RANAP_IE> |