aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/bsc-nat/bsc_nat_test.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 18:49:53 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:09 +0800
commit465313e48c62af82bea2862542a62665075c96ff (patch)
tree451ab227c804587c6f0670f0a8ccef69f412e71e /openbsc/tests/bsc-nat/bsc_nat_test.c
parent23fe7be1ca7b2b057ebaf3563cfed56a3056f9e6 (diff)
nat: Look at the assignment command and remember on which timeslot the data is
This information will be needed when we are trying to forward MGCP connections to and from the BSC through the IPA protocol.
Diffstat (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c')
-rw-r--r--openbsc/tests/bsc-nat/bsc_nat_test.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 3a1096001..70e98d721 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -335,6 +335,41 @@ static void test_paging(void)
talloc_free(parsed);
}
+static void test_mgcp(void)
+{
+ struct sccp_connections con;
+ struct bsc_nat_parsed *parsed;
+ struct msgb *msg;
+
+ fprintf(stderr, "Testing MGCP.\n");
+ memset(&con, 0, sizeof(con));
+
+ msg = msgb_alloc(4096, "foo");
+ copy_to_msg(msg, ass_cmd, sizeof(ass_cmd));
+ parsed = bsc_nat_parse(msg);
+ if (bsc_mgcp_assign(&con, msg) != 0) {
+ fprintf(stderr, "Failed to handle assignment.\n");
+ abort();
+ }
+
+ if (con.msc_timeslot != 21) {
+ fprintf(stderr, "Timeslot should be 21.\n");
+ abort();
+ }
+
+ if (con.bsc_timeslot != 21) {
+ fprintf(stderr, "Assigned timeslot should have been 21.\n");
+ abort();
+ }
+ talloc_free(parsed);
+
+ bsc_mgcp_clear(&con);
+ if (con.bsc_timeslot != -1 || con.msc_timeslot != -1) {
+ fprintf(stderr, "Clearing should remove the mapping.\n");
+ abort();
+ }
+}
+
int main(int argc, char **argv)
{
struct debug_target *stderr_target;
@@ -345,9 +380,8 @@ int main(int argc, char **argv)
test_filter();
test_contrack();
-
- debug_set_log_level(stderr_target, 1);
test_paging();
+ test_mgcp();
return 0;
}