aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/bsc-nat
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-01 10:16:28 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:10 +0800
commit3c3bce10bd76f59f899fd6bad8a6f8085d1e01f1 (patch)
tree3043ab995961605e834195ae4a84e3829635b9a1 /openbsc/tests/bsc-nat
parenta128d91f9881936c3c292e5c8efe84dd8d5bdb89 (diff)
nat: Return MGCP messages to the call agent
Attempt to find the message by transaction id, then patch the response and use the IP/PORT of the local network, update the ci with the one from the BSC. This is currently not tracking any state of the MGCP and will not handle two bsc's... this will need to happen later. With this in we should be feature complete and now enter the mode of making all of this work reliable and fixing thinko's and other bugs.
Diffstat (limited to 'openbsc/tests/bsc-nat')
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index c3b86c060..10b876b37 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -456,6 +456,35 @@ static void test_mgcp_rewrite(void)
msgb_free(input);
}
+static void test_mgcp_parse(void)
+{
+ int code, ci;
+ char transaction[60];
+
+ fprintf(stderr, "Test MGCP response parsing.\n");
+
+ if (bsc_mgcp_parse_response(crcx_resp, &code, transaction) != 0) {
+ fprintf(stderr, "Failed to parse CRCX resp.\n");
+ abort();
+ }
+
+ if (code != 200) {
+ fprintf(stderr, "Failed to parse the CODE properly. Got: %d\n", code);
+ abort();
+ }
+
+ if (strcmp(transaction, "23265295") != 0) {
+ fprintf(stderr, "Failed to parse transaction id: '%s'\n", transaction);
+ abort();
+ }
+
+ ci = bsc_mgcp_extract_ci(crcx_resp);
+ if (ci != 1) {
+ fprintf(stderr, "Failed to parse the CI. Got: %d\n", ci);
+ abort();
+ }
+}
+
int main(int argc, char **argv)
{
struct debug_target *stderr_target;
@@ -470,6 +499,7 @@ int main(int argc, char **argv)
test_mgcp_ass_tracking();
test_mgcp_find();
test_mgcp_rewrite();
+ test_mgcp_parse();
return 0;
}