From 6853567564cef62a73a1cd2a6ce8af23bba5029f Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 24 Nov 2011 11:07:37 +0100 Subject: bss: Patch CC messages with bearer capabilities to contain AMR 3 * This changes bss_patch_filter_msg to return -1 or BSS_FILTER_DTAP for DTAP messages. This way app_forward_sccp should continue to behave the same besides now looking into DTAP messages. * Introduce a direction in case we want to advertize FR into the BSS side and HR into the other direction. * Patch AMR HR3 and Fullrate/Halfrate capabilities in the Bearer Capabilities. Add a test case that is patching the bearer capabilities --- tests/patching/patching_test.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/patching/patching_test.c b/tests/patching/patching_test.c index 0456f0f..6a02e83 100644 --- a/tests/patching/patching_test.c +++ b/tests/patching/patching_test.c @@ -118,6 +118,16 @@ static uint8_t cr2_without_poi[] = { 0x18, 0x93, 0x08, 0x29, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00}; +static uint8_t dt1_cc_confirmed[] = { +0x06, 0x01, 0x0b, 0xef, 0x00, 0x01, 0x0e, 0x01, +0x00, 0x0b, 0x83, 0x48, 0x04, 0x04, 0x20, 0x02, +0x00, 0x81, 0x15, 0x01, 0x01}; + +static uint8_t dt1_cc_confirmed_hr3[] = { +0x06, 0x01, 0x0b, 0xef, 0x00, 0x01, 0x0e, 0x01, +0x00, 0x0b, 0x83, 0x48, 0x04, 0x04, 0x40, 0x05, +0x00, 0x81, 0x15, 0x01, 0x01}; + static struct result rewrite_results_to_msc[] = { { .input = udt_with_poi, @@ -139,6 +149,13 @@ static struct result rewrite_results_to_msc[] = { .expected = cr2_without_poi, .exp_len = sizeof(cr2_without_poi), }, + + { + .input = dt1_cc_confirmed, + .inp_len = sizeof(dt1_cc_confirmed), + .expected = dt1_cc_confirmed_hr3, + .exp_len = sizeof(dt1_cc_confirmed_hr3), + }, }; @@ -177,7 +194,7 @@ static void test_patch_filter(void) msgb_put(msg, 1); msg->l2h = msgb_put(msg, results[i].inp_len); memcpy(msg->l2h, results[i].input, msgb_l2len(msg)); - rc = bss_patch_filter_msg(msg, &result); + rc = bss_patch_filter_msg(msg, &result, BSS_DIR_ANY); if (memcmp(msg->l2h, results[i].expected, results[i].exp_len) != 0) { printf("Failed to patch the packet.\n"); @@ -209,7 +226,7 @@ static void test_rewrite_msc(void) inp->l2h = msgb_put(inp, rewrite_results_to_msc[i].inp_len); memcpy(inp->l2h, rewrite_results_to_msc[i].input, msgb_l2len(inp)); - rc = bss_patch_filter_msg(inp, &result); + rc = bss_patch_filter_msg(inp, &result, BSS_DIR_MSC); if (rc < 0) { printf("Failed to parse header msg: %d\n", i); abort(); @@ -218,7 +235,7 @@ static void test_rewrite_msc(void) bss_rewrite_header_for_msc(rc, outp, inp, &result); memset(&result, 0, sizeof(result)); - rc = bss_patch_filter_msg(outp, &result); + rc = bss_patch_filter_msg(outp, &result, BSS_DIR_MSC); if (rc < 0) { printf("Patched message doesn't work: %d\n", i); printf("hex: %s\n", osmo_hexdump(outp->l2h, msgb_l2len(outp))); -- cgit v1.2.3