diff options
author | arehbein <arehbein@sysmocom.de> | 2023-06-24 19:42:24 +0200 |
---|---|---|
committer | daniel <dwillmann@sysmocom.de> | 2023-10-02 13:40:01 +0000 |
commit | bc496b1db06a3833ab5855a0bfd61a01d72ea227 (patch) | |
tree | 46e6801de32cb0a0e49e18135c371248da4e2a06 /examples | |
parent | 82e1ae260f6cd60d86623b92482e8792a1720512 (diff) |
stream: Add client-side (segmentation) support for IPA
With this commit, IPA segmentation is taken care of by setting the
segmentation callback provided by libosmo-netif.
The ipa-stream-server example needs to prepend IPA headers now because
those are stripped by the segm. cb on both sides.
Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f
Related: OS#5753, OS#5751
Change-Id: I822abf52c6ae396c90b5c50228a0a39c848d3de6
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ipa-stream-client.c | 6 | ||||
-rw-r--r-- | examples/ipa-stream-server.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index 10eb786..db7d441 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -106,7 +106,7 @@ static int connect_cb(struct osmo_stream_cli *conn) static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) { - LOGP(DIPATEST, LOGL_DEBUG, "received message from stream (len=%d)\n", msgb_length(msg)); + LOGP(DIPATEST, LOGL_DEBUG, "received message from stream (payload len=%d)\n", msgb_length(msg)); if (osmo_ipa_process_msg(msg) < 0) { LOGP(DIPATEST, LOGL_ERROR, "bad IPA message\n"); @@ -116,7 +116,7 @@ static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) int num; struct msg_sent *cur, *tmp, *found = NULL; - num = ntohl(*((int *)(msg->data + sizeof(struct ipa_head) + sizeof(struct ipa_head_ext)))); + num = osmo_load32be(msg->data); LOGP(DLINP, LOGL_DEBUG, "received msg number %d\n", num); llist_for_each_entry_safe(cur, tmp, &msg_sent_list, head) { @@ -184,6 +184,8 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + osmo_stream_cli_set_segmentation_cb(conn, osmo_ipa_segmentation_cb); + LOGP(DIPATEST, LOGL_NOTICE, "Entering main loop\n"); while(1) { diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c index 1caef96..d31b752 100644 --- a/examples/ipa-stream-server.c +++ b/examples/ipa-stream-server.c @@ -49,7 +49,10 @@ void sighandler(int foo) int read_cb(struct osmo_stream_srv *conn, struct msgb *msg) { - LOGP(DSTREAMTEST, LOGL_DEBUG, "received message from stream (len=%d)\n", msgb_length(msg)); + LOGP(DSTREAMTEST, LOGL_DEBUG, "received message from stream (payload len=%d)\n", msgb_length(msg)); + + ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_MGCP); + osmo_ipa_msg_push_header(msg, IPAC_PROTO_OSMO); osmo_stream_srv_send(conn, msg); return 0; |