diff --git a/src/tests/test-helpers.c b/src/tests/test-helpers.c index 96540dc0..5b5004a7 100644 --- a/src/tests/test-helpers.c +++ b/src/tests/test-helpers.c @@ -319,6 +319,34 @@ void test_ranap_new_transp_info_gtp(void) OSMO_ASSERT(tli == NULL); } +void test_ranap_transp_layer_addr_decode(void) +{ + int rc; + char addr[100]; + RANAP_TransportLayerAddress_t trasp_layer_addr = { 0 }; + uint8_t encoded_addr_x213_nsap[] = { + 0x35, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; + uint8_t encoded_addr[] = { 0x01, 0x02, 0x03, 0x04 }; + + printf("Testing function ranap_transp_layer_addr_decode()\n"); + + printf(" ipv4, x213_nsap\n"); + trasp_layer_addr.buf = encoded_addr_x213_nsap; + trasp_layer_addr.size = sizeof(encoded_addr_x213_nsap); + rc = ranap_transp_layer_addr_decode(addr, sizeof(addr), &trasp_layer_addr); + printf(" addr=%s\n", addr); + OSMO_ASSERT(rc == 0); + + printf(" ipv4\n"); + trasp_layer_addr.buf = encoded_addr; + trasp_layer_addr.size = sizeof(encoded_addr); + rc = ranap_transp_layer_addr_decode(addr, sizeof(addr), &trasp_layer_addr); + printf(" addr=%s\n", addr); + OSMO_ASSERT(rc == 0); +} + int main(int argc, char **argv) { asn1_xer_print = 0; @@ -331,6 +359,7 @@ int main(int argc, char **argv) test_ranap_common(); test_ranap_new_transp_info_gtp(); test_ranap_new_transp_info_rtp(); + test_ranap_transp_layer_addr_decode(); test_common_cleanup(); return 0; diff --git a/src/tests/test-helpers.ok b/src/tests/test-helpers.ok index 049fbb41..fe082878 100644 --- a/src/tests/test-helpers.ok +++ b/src/tests/test-helpers.ok @@ -51,3 +51,8 @@ Testing function ranap_new_transp_info_rtp() transportLayerAddress = f11ff22ff33ff44ff55ff66ff77ff88f bindingID = 11220000 unsupported address family +Testing function ranap_transp_layer_addr_decode() + ipv4, x213_nsap + addr=1.2.3.4 + ipv4 + addr=1.2.3.4