aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-05-17 17:11:02 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-05-17 17:12:56 +0200
commitf0f1ebf70ea2222f97bb7445805ec7466dbcd22e (patch)
tree5387a63bfd17c422796183c41d44b700b885a07a
parentfd339712c4bc79e60e257f563771470a5214fbd6 (diff)
osmux: Extend osmux_out_handle and add new API to set rtp payload_typeHEADmaster
Previously payload_type was always hardcoded to 98 for generated rtp packets from incoming osmux frame. Change-Id: I5cbeb494a8932953d9fd2dc24dacf8cd97fd84e4
-rw-r--r--TODO-RELEASE2
-rw-r--r--include/osmocom/netif/osmux.h4
-rw-r--r--src/osmux.c11
-rw-r--r--tests/jibuf/jibuf_tool.c2
-rw-r--r--tests/osmo-pcap-test/osmux_test.c2
-rw-r--r--tests/osmux/osmux_test.c2
-rw-r--r--tests/osmux/osmux_test2.c10
7 files changed, 22 insertions, 11 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..45ebb75 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,5 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+libosmo-netif Add new field to struct osmux_out_handle Breaks ABI with older versions
+libosmo-netif Add new API osmux_xfrm_output_init2 Deprecates old osmux_xfrm_output_init
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index dfed66a..7dee438 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -80,6 +80,7 @@ struct osmux_out_handle {
uint16_t rtp_seq;
uint32_t rtp_timestamp;
uint32_t rtp_ssrc;
+ uint8_t rtp_payload_type;
uint8_t osmux_seq_ack; /* Latest received seq num */
struct osmo_timer_list timer;
struct llist_head list;
@@ -106,7 +107,8 @@ void osmux_xfrm_input_close_circuit(struct osmux_in_handle *h, int ccid);
int osmux_xfrm_input(struct osmux_in_handle *h, struct msgb *msg, int ccid);
void osmux_xfrm_input_deliver(struct osmux_in_handle *h);
-void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc);
+void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc) OSMO_DEPRECATED("Use osmux_xfrm_output_init2() instead");
+void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type);
void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h, void (*tx_cb)(struct msgb *msg, void *data), void *data);
int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, struct llist_head *list) OSMO_DEPRECATED("Use osmux_xfrm_output_sched() instead");
int osmux_xfrm_output_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh);
diff --git a/src/osmux.c b/src/osmux.c
index 7a6ce60..8b6a115 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -146,7 +146,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h, struct osmux_hdr *osmuxh,
rtph->csrc_count = 0;
rtph->extension = 0;
rtph->version = RTP_VERSION;
- rtph->payload_type = 98;
+ rtph->payload_type = h->rtp_payload_type;
/* ... emulate timestamp and ssrc */
rtph->timestamp = htonl(h->rtp_timestamp);
rtph->sequence = htons(h->rtp_seq);
@@ -999,16 +999,23 @@ osmux_tx_sched(struct llist_head *list,
}
}
-void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
+void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type)
{
memset(h, 0, sizeof(*h));
h->rtp_seq = (uint16_t)random();
h->rtp_timestamp = (uint32_t)random();
h->rtp_ssrc = rtp_ssrc;
+ h->rtp_payload_type = rtp_payload_type;
INIT_LLIST_HEAD(&h->list);
osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
}
+void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc)
+{
+ /* backward compatibility with old users, where 98 was harcoded in osmux_rebuild_rtp() */
+ osmux_xfrm_output_init2(h, rtp_ssrc, 98);
+}
+
#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \
if (ret < 0) \
ret = 0; \
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c
index bd444a7..df11131 100644
--- a/tests/jibuf/jibuf_tool.c
+++ b/tests/jibuf/jibuf_tool.c
@@ -517,7 +517,7 @@ void pcap_test() {
osmo_pcap.timer.cb = pcap_pkt_timer_cb;
if(opt_osmux) {
- osmux_xfrm_output_init(&pcap_osmux_h, 0);
+ osmux_xfrm_output_init2(&pcap_osmux_h, 0, 98);
osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
}
diff --git a/tests/osmo-pcap-test/osmux_test.c b/tests/osmo-pcap-test/osmux_test.c
index 7ec78a0..9163753 100644
--- a/tests/osmo-pcap-test/osmux_test.c
+++ b/tests/osmo-pcap-test/osmux_test.c
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
osmo_pcap.timer.cb = osmo_pcap_pkt_timer_cb;
osmux_xfrm_input_init(&h_input);
- osmux_xfrm_output_init(&h_output);
+ osmux_xfrm_output_init2(&h_output, 0, 98);
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
/* first run */
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c
index 704ccbc..e2eb777 100644
--- a/tests/osmux/osmux_test.c
+++ b/tests/osmux/osmux_test.c
@@ -269,7 +269,7 @@ int main(void)
osmo_init_logging2(tall_ctx, &osmux_test_log_info);
log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
/* If the test takes longer than 10 seconds, abort it */
diff --git a/tests/osmux/osmux_test2.c b/tests/osmux/osmux_test2.c
index ecd9296..ffe1101 100644
--- a/tests/osmux/osmux_test2.c
+++ b/tests/osmux/osmux_test2.c
@@ -164,7 +164,7 @@ static void test_output_consecutive(void)
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(32);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
h_output.rtp_seq = (uint16_t)50;
h_output.rtp_timestamp = (uint32_t)500;
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -226,7 +226,7 @@ static void test_output_interleaved(void)
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(32);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
h_output.rtp_seq = (uint16_t)50;
h_output.rtp_timestamp = (uint32_t)500;
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -263,7 +263,7 @@ static void test_output_2together(void)
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(32);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
h_output.rtp_seq = (uint16_t)50;
h_output.rtp_timestamp = (uint32_t)500;
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -297,7 +297,7 @@ static void test_output_frame_lost(void)
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(32);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
h_output.rtp_seq = (uint16_t)50;
h_output.rtp_timestamp = (uint32_t)500;
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);
@@ -329,7 +329,7 @@ static void test_output_flush(void)
clock_override_enable(true);
clock_override_set(0, 0);
osmux_init(32);
- osmux_xfrm_output_init(&h_output, 0x7000000);
+ osmux_xfrm_output_init2(&h_output, 0x7000000, 98);
h_output.rtp_seq = (uint16_t)50;
h_output.rtp_timestamp = (uint32_t)500;
osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, &h_output);