aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorarehbein <arehbein@sysmocom.de>2023-05-22 17:09:49 +0200
committerDaniel Willmann <dwillmann@sysmocom.de>2023-08-07 16:50:22 +0200
commit8712af589cb0a9a5d73e10957e696cd05f9fdc68 (patch)
tree69bf24c16ddee091b1b95625a1bb37c3bc401fa4 /examples
parent7fe21f67f647a1cede87042911588e57b17580c6 (diff)
examples: Add extension header octet to example
Mainly to make data/packets look (pseudo-)correct in Wireshark. Also: Add helper for allocating message buffers with extended headroom for IPA. Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502
Diffstat (limited to 'examples')
-rw-r--r--examples/ipa-stream-client.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index b66d93a..10eb786 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_ext_msg_alloc(0);
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) {