arehbein has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33202 )
Change subject: examples: Add extension header octet to example ......................................................................
examples: Add extension header octet to example
Mainly to make data/packets look (pseudo-)correct in Wireshark
Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502 --- M examples/ipa-stream-client.c M src/stream.c 2 files changed, 16 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/02/33202/1
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 @@ 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 @@ 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 @@ 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 396f344..35a1fc7 100644 --- a/src/stream.c +++ b/src/stream.c @@ -679,8 +679,9 @@ 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) { cli->iofd_read_cb(cli, msg); + } break; default: osmo_panic("osmo_stream_cli_write_cb() called with unexpected state %d\n", cli->state);