[PATCH] libosmo-netif[master]: osmux: Move examples and tests to use new output APIs

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/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Apr 19 10:30:06 UTC 2018


Review at  https://gerrit.osmocom.org/7876

osmux: Move examples and tests to use new output APIs

Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
---
M examples/osmux-test-output.c
M tests/jibuf/jibuf_tool.c
M tests/osmux/osmux_test.c
3 files changed, 9 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/76/7876/1

diff --git a/examples/osmux-test-output.c b/examples/osmux-test-output.c
index 9b7c113..22e60af 100644
--- a/examples/osmux-test-output.c
+++ b/examples/osmux-test-output.c
@@ -88,7 +88,6 @@
 {
 	struct msgb *msg;
         struct osmux_hdr *osmuxh;
-	struct llist_head list;
 
 	LOGP(DOSMUX_TEST, LOGL_DEBUG, "received message from datagram\n");
 
@@ -107,10 +106,8 @@
 	LOGP(DOSMUX_TEST, LOGL_DEBUG, "received OSMUX message (len=%d) %s\n",
 		msg->len, buf);
 
-	while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) {
-		osmux_xfrm_output(osmuxh, &h_output, &list);
-		osmux_tx_sched(&list, tx_cb, NULL);
-	}
+	while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL)
+		osmux_xfrm_output_sched(&h_output, osmuxh);
 
 	return 0;
 }
@@ -158,7 +155,7 @@
 	 * initialize OSMUX handlers.
 	 */
 	osmux_xfrm_output_init(&h_output, random());
-
+	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 	/*
 	 * initialize datagram server.
 	 */
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c
index 8fa9f2e..c60bb69 100644
--- a/tests/jibuf/jibuf_tool.c
+++ b/tests/jibuf/jibuf_tool.c
@@ -114,7 +114,6 @@
 static struct osmo_pcap osmo_pcap;
 static bool pcap_finished;
 static struct osmux_out_handle pcap_osmux_h;
-static struct llist_head osmux_list;
 /* ----------------------------- */
 
 static void sigalarm_handler(int foo)
@@ -438,10 +437,8 @@
 	struct osmux_hdr *osmuxh;
 
 	/* This code below belongs to the osmux receiver */
-	while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) {
-		osmux_xfrm_output(osmuxh, &pcap_osmux_h, &osmux_list);
-		osmux_tx_sched(&osmux_list, glue_cb, NULL);
-	}
+	while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL)
+		osmux_xfrm_output_sched(&pcap_osmux_h, osmuxh);
 	msgb_free(msg);
 	return 0;
 }
@@ -520,8 +517,8 @@
 	osmo_pcap.timer.cb = pcap_pkt_timer_cb;
 
 	if(opt_osmux) {
-		INIT_LLIST_HEAD(&osmux_list);
 		osmux_xfrm_output_init(&pcap_osmux_h, 0);
+		osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
 	}
 
 	jb = osmo_jibuf_alloc(NULL);
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c
index 631ade8..704ccbc 100644
--- a/tests/osmux/osmux_test.c
+++ b/tests/osmux/osmux_test.c
@@ -103,7 +103,6 @@
 static void osmux_deliver(struct msgb *batch_msg, void *data)
 {
 	struct osmux_hdr *osmuxh;
-	LLIST_HEAD(list);
 	char buf[2048];
 
 	osmux_snprintf(buf, sizeof(buf), batch_msg);
@@ -112,10 +111,8 @@
 	/* For each OSMUX message, extract the RTP messages and put them
 	 * in a list. Then, reconstruct transmission timing.
 	 */
-	while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) {
-		osmux_xfrm_output(osmuxh, &h_output, &list);
-		osmux_tx_sched(&list, tx_cb, NULL);
-	}
+	while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL)
+		osmux_xfrm_output_sched(&h_output, osmuxh);
 	msgb_free(batch_msg);
 }
 
@@ -273,6 +270,7 @@
 	log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
 
 	osmux_xfrm_output_init(&h_output, 0x7000000);
+	osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 
 	/* If the test takes longer than 10 seconds, abort it */
 	alarm(10);

-- 
To view, visit https://gerrit.osmocom.org/7876
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list