[PATCH 1/6] mgcp/rtp: Add more test cases for RTP header patching

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Dec 3 16:17:04 UTC 2013


This patch extends the existing RTP error check test by adding
support for selectively enabling/disabling SSRC and timestamp
patching. The test is repeated for all combinations thereof.

Sponsored-by: On-Waves ehf
---
 openbsc/tests/mgcp/mgcp_test.c  |   13 +++++++----
 openbsc/tests/mgcp/mgcp_test.ok |   48 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index c58f52d..4326738 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -516,7 +516,7 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
 			  struct mgcp_rtp_end *rtp_end, struct sockaddr_in *addr,
 			  char *data, int len);
 
-static void test_packet_error_detection(void)
+static void test_packet_error_detection(int patch_ssrc, int patch_ts)
 {
 	int i;
 
@@ -527,7 +527,9 @@ static void test_packet_error_detection(void)
 	struct sockaddr_in addr = {0};
 	char buffer[4096];
 
-	printf("Testing packet error detection.\n");
+	printf("Testing packet error detection%s%s.\n",
+	       patch_ssrc ? ", patch SSRC" : "",
+	       patch_ts ? ", patch timestamps" : "");
 
 	memset(&trunk, 0, sizeof(trunk));
 	memset(&endp, 0, sizeof(endp));
@@ -545,7 +547,7 @@ static void test_packet_error_detection(void)
 	mgcp_free_endp(&endp);
 
 	rtp->payload_type = 98;
-	endp.allow_patch = 1;
+	endp.allow_patch = patch_ssrc;
 
 	for (i = 0; i < ARRAY_SIZE(test_rtp_packets1); ++i) {
 		struct rtp_packet_info *info = test_rtp_packets1 + i;
@@ -575,7 +577,10 @@ int main(int argc, char **argv)
 	test_packet_loss_calc();
 	test_rqnt_cb();
 	test_mgcp_stats();
-	test_packet_error_detection();
+	test_packet_error_detection(1, 0);
+	test_packet_error_detection(0, 0);
+	test_packet_error_detection(0, 1);
+	test_packet_error_detection(1, 1);
 
 	printf("Done\n");
 	return EXIT_SUCCESS;
diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok
index 3bfd78b..71293ad 100644
--- a/openbsc/tests/mgcp/mgcp_test.ok
+++ b/openbsc/tests/mgcp/mgcp_test.ok
@@ -42,6 +42,22 @@ Testing packet loss calculation.
 Testing stat parsing
 Parsing result: 0
 Parsing result: 0
+Testing packet error detection, patch SSRC.
+TS: 0, dTS: 0, TS Errs: in 0, out 0
+TS: 160, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 1, out 1
+TS: 480, dTS: 160, TS Errs: in 1, out 1
+TS: 640, dTS: 160, TS Errs: in 1, out 1
+TS: 960, dTS: 320, TS Errs: in 2, out 2
+TS: 1120, dTS: 160, TS Errs: in 3, out 3
+TS: 1280, dTS: 160, TS Errs: in 3, out 3
+TS: 1400, dTS: 120, TS Errs: in 4, out 4
+TS: 1560, dTS: 160, TS Errs: in 5, out 5
+TS: 1720, dTS: 160, TS Errs: in 5, out 5
+TS: 1880, dTS: 160, TS Errs: in 5, out 5
+TS: 2040, dTS: 160, TS Errs: in 5, out 5
+TS: 2200, dTS: 160, TS Errs: in 5, out 5
 Testing packet error detection.
 TS: 0, dTS: 0, TS Errs: in 0, out 0
 TS: 160, dTS: 160, TS Errs: in 0, out 0
@@ -55,6 +71,38 @@ TS: 1280, dTS: 160, TS Errs: in 3, out 3
 TS: 1400, dTS: 120, TS Errs: in 4, out 4
 TS: 1560, dTS: 160, TS Errs: in 5, out 5
 TS: 1720, dTS: 160, TS Errs: in 5, out 5
+TS: 34688, dTS: 160, TS Errs: in 5, out 5
+TS: 34848, dTS: 160, TS Errs: in 5, out 5
+TS: 35008, dTS: 160, TS Errs: in 5, out 5
+Testing packet error detection, patch timestamps.
+TS: 0, dTS: 0, TS Errs: in 0, out 0
+TS: 160, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 1, out 1
+TS: 480, dTS: 160, TS Errs: in 1, out 1
+TS: 640, dTS: 160, TS Errs: in 1, out 1
+TS: 960, dTS: 320, TS Errs: in 2, out 2
+TS: 1120, dTS: 160, TS Errs: in 3, out 3
+TS: 1280, dTS: 160, TS Errs: in 3, out 3
+TS: 1400, dTS: 120, TS Errs: in 4, out 4
+TS: 1560, dTS: 160, TS Errs: in 5, out 5
+TS: 1720, dTS: 160, TS Errs: in 5, out 5
+TS: 34688, dTS: 160, TS Errs: in 5, out 5
+TS: 34848, dTS: 160, TS Errs: in 5, out 5
+TS: 35008, dTS: 160, TS Errs: in 5, out 5
+Testing packet error detection, patch SSRC, patch timestamps.
+TS: 0, dTS: 0, TS Errs: in 0, out 0
+TS: 160, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 0, out 0
+TS: 320, dTS: 160, TS Errs: in 1, out 1
+TS: 480, dTS: 160, TS Errs: in 1, out 1
+TS: 640, dTS: 160, TS Errs: in 1, out 1
+TS: 960, dTS: 320, TS Errs: in 2, out 2
+TS: 1120, dTS: 160, TS Errs: in 3, out 3
+TS: 1280, dTS: 160, TS Errs: in 3, out 3
+TS: 1400, dTS: 120, TS Errs: in 4, out 4
+TS: 1560, dTS: 160, TS Errs: in 5, out 5
+TS: 1720, dTS: 160, TS Errs: in 5, out 5
 TS: 1880, dTS: 160, TS Errs: in 5, out 5
 TS: 2040, dTS: 160, TS Errs: in 5, out 5
 TS: 2200, dTS: 160, TS Errs: in 5, out 5
-- 
1.7.9.5





More information about the OpenBSC mailing list