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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged.
Change subject: tests: jibuf_tool: Add OSMUX support
......................................................................
tests: jibuf_tool: Add OSMUX support
Change-Id: I0f02da0329e6739ff340d31113161bb520b1b760
---
M tests/jibuf/jibuf_tool.c
1 file changed, 40 insertions(+), 3 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c
index 7550c1c..ce6632a 100644
--- a/tests/jibuf/jibuf_tool.c
+++ b/tests/jibuf/jibuf_tool.c
@@ -29,6 +29,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/netif/jibuf.h>
#include <osmocom/netif/rtp.h>
+#include <osmocom/netif/osmux.h>
#include "osmo-pcap-test/osmo_pcap.h"
@@ -57,6 +58,7 @@
static bool opt_test_rand;
static bool opt_debug_human;
static bool opt_debug_table;
+static bool opt_osmux;
static char* opt_pcap_file;
/* ----------------------------- */
@@ -106,6 +108,8 @@
/* Used for test pcap: */
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)
@@ -399,9 +403,33 @@
return 0;
}
+void glue_cb(struct msgb *msg, void *data)
+{
+ pcap_generate_pkt_cb(msg);
+}
+
+int pcap_read_osmux(struct msgb *msg)
+{
+ 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);
+ }
+ msgb_free(msg);
+ return 0;
+}
+
void pcap_pkt_timer_cb(void *data)
{
- if (osmo_pcap_test_run(&osmo_pcap, IPPROTO_UDP, pcap_generate_pkt_cb) < 0) {
+ int (*mycb)(struct msgb *msgb);
+ if(opt_osmux)
+ mycb = pcap_read_osmux;
+ else
+ mycb = pcap_generate_pkt_cb;
+
+ if (osmo_pcap_test_run(&osmo_pcap, IPPROTO_UDP, mycb) < 0) {
osmo_pcap_stats_printf();
osmo_pcap_test_close(osmo_pcap.h);
pcap_finished=true;
@@ -466,6 +494,11 @@
osmo_pcap.timer.cb = pcap_pkt_timer_cb;
+ if(opt_osmux) {
+ INIT_LLIST_HEAD(&osmux_list);
+ osmux_xfrm_output_init(&pcap_osmux_h, 0);
+ }
+
jb = osmo_jibuf_alloc(NULL);
osmo_jibuf_set_dequeue_cb(jb, dequeue_cb, NULL);
osmo_jibuf_set_min_delay(jb, 60);
@@ -484,10 +517,11 @@
static void print_help(void)
{
- printf("jibuf_test [-r] [-p pcap] [-d] [-g]\n");
+ printf("jibuf_test [-r] [-p pcap] [-o] [-d] [-g]\n");
printf(" -h Print this help message\n");
printf(" -r Run test with randomly generated jitter\n");
printf(" -p Run test with specified pcap file\n");
+ printf(" -o The pcap contains OSMUX packets isntead of RTP\n");
printf(" -d Enable packet trace debug suitable for humans\n");
printf(" -t Enable packet trace debug suitable for gnuplot\n");
}
@@ -496,7 +530,7 @@
{
int opt;
- while ((opt = getopt(argc, argv, "hdtrp:")) != -1) {
+ while ((opt = getopt(argc, argv, "hdtrop:")) != -1) {
switch (opt) {
case 'h':
print_help();
@@ -510,6 +544,9 @@
case 'r':
opt_test_rand = true;
break;
+ case 'o':
+ opt_osmux = true;
+ break;
case 'p':
opt_pcap_file = strdup(optarg);
break;
--
To view, visit https://gerrit.osmocom.org/7776
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0f02da0329e6739ff340d31113161bb520b1b760
Gerrit-PatchSet: 2
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