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.orgPau Espin Pedrol has submitted this change and it was merged.
Change subject: osmux: Move examples and tests to use new output APIs
......................................................................
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/osmo-pcap-test/osmux_test.c
M tests/osmux/osmux_test.c
4 files changed, 17 insertions(+), 24 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/examples/osmux-test-output.c b/examples/osmux-test-output.c
index 9b7c113..0ab03a7 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;
}
@@ -120,6 +117,7 @@
LOGP(DOSMUX_TEST, LOGL_NOTICE, "closing OSMUX.\n");
osmo_dgram_close(conn);
osmo_dgram_destroy(conn);
+ osmux_xfrm_output_flush(&h_output);
osmo_rtp_handle_free(rtp);
amr_close();
exit(EXIT_SUCCESS);
@@ -158,7 +156,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..bd444a7 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);
@@ -533,8 +530,11 @@
/* first run */
pcap_pkt_timer_cb(NULL);
- while(!pcap_finished || !osmo_jibuf_empty(jb))
+ while(!pcap_finished || !osmo_jibuf_empty(jb)) {
+ if (pcap_finished && opt_osmux) /* Flushing once should be enough */
+ osmux_xfrm_output_flush(&pcap_osmux_h);
osmo_select_main(0);
+ }
osmo_jibuf_delete(jb);
diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c
index 463b212..7ec78a0 100644
--- a/tests/osmo-pcap-test/osmux_test.c
+++ b/tests/osmo-pcap-test/osmux_test.c
@@ -52,16 +52,12 @@
static void deliver(struct msgb *batch_msg)
{
struct osmux_hdr *osmuxh;
- struct llist_head list;
printf("sending batch (len=%d) [emulated]\n", batch_msg->len);
/* This code below belongs to the osmux receiver */
- 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);
}
@@ -194,6 +190,7 @@
osmux_xfrm_input_init(&h_input);
osmux_xfrm_output_init(&h_output);
+ osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
/* first run */
osmo_pcap_pkt_timer_cb(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: merged
Gerrit-Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
Gerrit-PatchSet: 4
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>