pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29260 )
Change subject: osmux: Allow specifying extra headroom & tailroom in generated rtp msgb
......................................................................
Patch Set 1: Code-Review-2
(1 comment)
Patchset:
PS1:
Don't merge this one yet. I may need to add a msgb_alloc_cb instead of specifying headroom & tailroom, since otherwise after msgb_push()ing the l1sap header i get a lot of misaligned ptr runtime errors.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29260
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I632654221826340423e1e97b0f8ed9a2baf6c6c3
Gerrit-Change-Number: 29260
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 31 Aug 2022 18:59:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-netif/+/29256
to look at the new patch set (#2).
Change subject: osmux: Drop long time deprecated APIs
......................................................................
osmux: Drop long time deprecated APIs
Those APIs where deprecated 4 years ago (end of Aug 2018), and they have
been used since around that time. Hence it can be considered safe to
drop them, since they only make the whole code more complex to
understand.
API osmux_xfrm_output_init() is left since openbsc.git is still using
it.
Related: OS#5987
Change-Id: Icbdd364a8161a8113dbf1406716946f684d0a853
---
M include/osmocom/netif/osmux.h
M src/osmux.c
2 files changed, 0 insertions(+), 122 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/56/29256/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29256
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Icbdd364a8161a8113dbf1406716946f684d0a853
Gerrit-Change-Number: 29256
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/29259
to look at the new patch set (#2).
Change subject: osmux: Use new osmux APIs to let libosmo-netif alloc struct osmux_out_handle
......................................................................
osmux: Use new osmux APIs to let libosmo-netif alloc struct osmux_out_handle
This way we don't need to worry about implementation details (struct
size) in the future in case they change (they will).
Related: OS#5987
Requires: libosmo-netif.git Change-Id Ie8df581f375c9a183a7af60b431561bda82f6e34
Change-Id: I2d0d8c152b8f1234ddfcd74d6cb04b1818b41510
---
M TODO-RELEASE
M include/osmocom/mgcp/mgcp_conn.h
M src/libosmo-mgcp/mgcp_osmux.c
3 files changed, 13 insertions(+), 13 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/59/29259/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29259
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2d0d8c152b8f1234ddfcd74d6cb04b1818b41510
Gerrit-Change-Number: 29259
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-netif/+/29258
to look at the new patch set (#3).
Change subject: osmux: Allocate struct osmux_out_handle through API
......................................................................
osmux: Allocate struct osmux_out_handle through API
Until now, the osmux_out_handle was allocated by the client, and passed
to the API to initialize it. This makes it really hard to improve the
implementation without breaking the ABI.
Let's break the ABI now one last time (hopefully) by allocating the
struct through an API. With only this change, the already built users
(osmo-mgw, openbsc) can still work fine, since there's no change on the
struct osmux_out_handle. However, they will somehow break next time the
struct is changed until they are ported to the same API (easy to do).
Related: OS#5987
Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
---
M TODO-RELEASE
M examples/osmux-test-output.c
M include/osmocom/netif/osmux.h
M src/osmux.c
M tests/jibuf/jibuf_tool.c
M tests/osmux/osmux_test.c
M tests/osmux/osmux_test2.c
7 files changed, 145 insertions(+), 72 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/58/29258/3
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29258
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
Gerrit-Change-Number: 29258
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-netif/+/29258
to look at the new patch set (#2).
Change subject: osmux: Allocate struct osmux_out_handle through API
......................................................................
osmux: Allocate struct osmux_out_handle through API
Until now, the osmux_out_handle was allocated by the client, and passed
to the API to initialize it. This makes it really hard to improve the
implementation without breaking the ABI.
Let's break the ABI now one last time (hopefully) by allocating the
struct through an API. With only this change, the already built users
(osmo-mgw, openbsc) can still work fine, since there's no change on the
struct osmux_out_handle. However, they will somehow break next time the
struct is changed until they are ported to the same API (easy to do).
Related: OS#5987
Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
---
M TODO-RELEASE
M examples/osmux-test-output.c
M include/osmocom/netif/osmux.h
M src/osmux.c
M tests/jibuf/jibuf_tool.c
M tests/osmux/osmux_test.c
M tests/osmux/osmux_test2.c
7 files changed, 145 insertions(+), 72 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/58/29258/2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29258
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
Gerrit-Change-Number: 29258
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29258 )
Change subject: osmux: Allocate struct osmux_out_handle through API
......................................................................
osmux: Allocate struct osmux_out_handle through API
Until now, the osmux_out_handle was allocated by the client, and passed
to the API to initialize it. This makes it really hard to improve the
implementation without breaking the ABI.
Let's break the ABI now one last time (hopefully) by allocating the
struct through an API. With only this change, the already built users
(osmo-mgw, openbsc) can still work fine, since there's no change on the
struct osmux_out_handle. However, they will somehow break next time the
struct is changed until they are ported to the same API (easy to do).
Related: OS#5987
Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
---
M TODO-RELEASE
M examples/osmux-test-output.c
M include/osmocom/netif/osmux.h
M src/osmux.c
4 files changed, 50 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/58/29258/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..52a8c49 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# 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 osmux new osmux_xfrm_output_* APIs
diff --git a/examples/osmux-test-output.c b/examples/osmux-test-output.c
index d39277b..3f0e5a2 100644
--- a/examples/osmux-test-output.c
+++ b/examples/osmux-test-output.c
@@ -42,7 +42,7 @@
* This is the output handle for osmux, it stores last RTP sequence and
* timestamp that has been used. There should be one per circuit ID.
*/
-static struct osmux_out_handle h_output;
+static struct osmux_out_handle *h_output;
static int fd;
@@ -107,7 +107,7 @@
msg->len, buf);
while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL)
- osmux_xfrm_output_sched(&h_output, osmuxh);
+ osmux_xfrm_output_sched(h_output, osmuxh);
return 0;
}
@@ -117,7 +117,7 @@
LOGP(DOSMUX_TEST, LOGL_NOTICE, "closing OSMUX.\n");
osmo_dgram_close(conn);
osmo_dgram_destroy(conn);
- osmux_xfrm_output_flush(&h_output);
+ talloc_free(h_output);
osmo_rtp_handle_free(rtp);
amr_close();
exit(EXIT_SUCCESS);
@@ -155,8 +155,10 @@
/*
* initialize OSMUX handlers.
*/
- osmux_xfrm_output_init2(&h_output, random(), 98);
- osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
+ h_output = osmux_xfrm_output_alloc(NULL);
+ osmux_xfrm_output_set_rtp_ssrc(h_output, random());
+ osmux_xfrm_output_set_rtp_pl_type(h_output, 98);
+ osmux_xfrm_output_set_tx_cb(h_output, tx_cb, NULL);
/*
* initialize datagram server.
*/
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index 8d39344..8742797 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -107,8 +107,11 @@
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) 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);
+struct osmux_out_handle *osmux_xfrm_output_alloc(void *ctx);
+void osmux_xfrm_output_init(struct osmux_out_handle *h, uint32_t rtp_ssrc) OSMO_DEPRECATED("Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead");
+void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type) OSMO_DEPRECATED("Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead");
+void osmux_xfrm_output_set_rtp_ssrc(struct osmux_out_handle *h, uint32_t rtp_ssrc);
+void osmux_xfrm_output_set_rtp_pl_type(struct osmux_out_handle *h, uint32_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_sched(struct osmux_out_handle *h, struct osmux_hdr *osmuxh);
void osmux_xfrm_output_flush(struct osmux_out_handle *h);
diff --git a/src/osmux.c b/src/osmux.c
index 7d26fe8..c9b20aa 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -870,6 +870,33 @@
void *data;
};
+static int osmux_xfrm_output_talloc_destructor(struct osmux_out_handle *h)
+{
+ osmux_xfrm_output_flush(h);
+ return 0;
+}
+
+/* Returned pointer can be freed with regular talloc_free, queue will be flushed
+ * and all internal data will be freed. */
+struct osmux_out_handle *osmux_xfrm_output_alloc(void *ctx)
+{
+ struct osmux_out_handle *h;
+
+ h = talloc_zero(ctx, struct osmux_out_handle);
+ OSMO_ASSERT(h);
+
+ h->rtp_seq = (uint16_t)random();
+ h->rtp_timestamp = (uint32_t)random();
+ h->rtp_ssrc = (uint32_t)random();
+ h->rtp_payload_type = 98;
+ INIT_LLIST_HEAD(&h->list);
+ osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
+
+ talloc_set_destructor(h, osmux_xfrm_output_talloc_destructor);
+ return h;
+}
+
+/* DEPRECATED: Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead */
void osmux_xfrm_output_init2(struct osmux_out_handle *h, uint32_t rtp_ssrc, uint8_t rtp_payload_type)
{
memset(h, 0, sizeof(*h));
@@ -881,6 +908,7 @@
osmo_timer_setup(&h->timer, osmux_xfrm_output_trigger, h);
}
+/* DEPRECATED: Use osmux_xfrm_output_alloc() and osmux_xfrm_output_set_rtp_*() instead */
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() */
@@ -903,6 +931,15 @@
h->data = data;
}
+void osmux_xfrm_output_set_rtp_ssrc(struct osmux_out_handle *h, uint32_t rtp_ssrc)
+{
+ h->rtp_ssrc = rtp_ssrc;
+}
+void osmux_xfrm_output_set_rtp_pl_type(struct osmux_out_handle *h, uint32_t rtp_payload_type)
+{
+ h->rtp_payload_type = rtp_payload_type;
+}
+
#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \
if (ret < 0) \
ret = 0; \
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29258
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ie8df581f375c9a183a7af60b431561bda82f6e34
Gerrit-Change-Number: 29258
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/29257 )
Change subject: osmux: Move osmux_xfrm_output_set_tx_cb() further down to the xfrm_output section
......................................................................
osmux: Move osmux_xfrm_output_set_tx_cb() further down to the xfrm_output section
Change-Id: I46628d1f712e9c5c56c306e27c34ff45731c0172
---
M src/osmux.c
1 file changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/57/29257/1
diff --git a/src/osmux.c b/src/osmux.c
index 990216e..7d26fe8 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -831,22 +831,6 @@
LOGP(DLMUX, LOGL_DEBUG, "initialized osmux input converter\n");
}
-/*! \brief Set transmission callback to call when a generated RTP packet is to be transmitted
- * \param[in] h the osmux out handle handling a specific CID
- * \param[in] osmuxh Buffer pointing to osmux frame header structure and AMR payload
- * \return Number of generated RTP packets
- *
- * This Function sets the callback called by the interal timer set by
- * osmux_xfrm_out_sched function.
- */
-void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h,
- void (*tx_cb)(struct msgb *msg, void *data),
- void *data)
-{
- h->tx_cb = tx_cb;
- h->data = data;
-}
-
int osmux_xfrm_input_open_circuit(struct osmux_in_handle *h, int ccid,
int dummy)
{
@@ -903,6 +887,22 @@
osmux_xfrm_output_init2(h, rtp_ssrc, 98);
}
+/*! \brief Set transmission callback to call when a generated RTP packet is to be transmitted
+ * \param[in] h the osmux out handle handling a specific CID
+ * \param[in] osmuxh Buffer pointing to osmux frame header structure and AMR payload
+ * \return Number of generated RTP packets
+ *
+ * This Function sets the callback called by the interal timer set by
+ * osmux_xfrm_out_sched function.
+ */
+void osmux_xfrm_output_set_tx_cb(struct osmux_out_handle *h,
+ void (*tx_cb)(struct msgb *msg, void *data),
+ void *data)
+{
+ h->tx_cb = tx_cb;
+ h->data = data;
+}
+
#define SNPRINTF_BUFFER_SIZE(ret, remain, offset) \
if (ret < 0) \
ret = 0; \
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29257
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I46628d1f712e9c5c56c306e27c34ff45731c0172
Gerrit-Change-Number: 29257
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange