aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarehbein <arehbein@sysmocom.de>2023-05-22 17:09:49 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2023-05-31 12:25:11 +0200
commit4c47f51767d3ff78ffdb5d7a6b9cb0dc4bec72fa (patch)
tree7f5a68a4fe266417ea478a9cd02e4dfe9f80b022
parentb6badfb96625056d3ea4294e83be306ea6c1c303 (diff)
examples: Add extension header octet to example
Mainly to make data/packets look (pseudo-)correct in Wireshark Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502
-rw-r--r--examples/ipa-stream-client.c5
-rw-r--r--src/stream.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index 48421b7..c3bb2a3 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -74,7 +74,7 @@ static int connect_cb(struct osmo_stream_cli *conn)
char *ptr;
int x;
- msg = osmo_ipa_msg_alloc(0);
+ msg = osmo_ipa_msg_alloc(sizeof(struct ipa_head_ext));
if (msg == NULL) {
LOGP(DLINP, LOGL_ERROR, "cannot alloc msg\n");
return -1;
@@ -93,6 +93,7 @@ static int connect_cb(struct osmo_stream_cli *conn)
msg_sent->num = i;
llist_add(&msg_sent->head, &msg_sent_list);
+ ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_MGCP);
osmo_ipa_msg_push_header(msg, IPAC_PROTO_OSMO);
osmo_stream_cli_send(conn, msg);
@@ -115,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))));
+ num = ntohl(*((int *)(msg->data + sizeof(struct ipa_head) + sizeof(struct ipa_head_ext))));
LOGP(DLINP, LOGL_DEBUG, "received msg number %d\n", num);
llist_for_each_entry_safe(cur, tmp, &msg_sent_list, head) {
diff --git a/src/stream.c b/src/stream.c
index 4e57e03..150b85f 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -688,8 +688,11 @@ static void stream_cli_iofd_read_cb(struct osmo_io_fd *iofd, int res, struct msg
case STREAM_CLI_STATE_CONNECTED:
if (res == 0)
osmo_stream_cli_reconnect(cli);
- else if (cli->iofd_read_cb)
+ else if (cli->iofd_read_cb) {
+ // if (cli->stream_proto == OSMO_STREAM_IPAC)
+ // ipa_check_pull_headers(
cli->iofd_read_cb(cli, msg);
+ }
break;
default:
osmo_panic("osmo_stream_cli_write_cb() called with unexpected state %d\n", cli->state);