diff options
-rw-r--r-- | examples/ipa-stream-client.c | 5 | ||||
-rw-r--r-- | include/osmocom/netif/ipa.h | 2 | ||||
-rw-r--r-- | src/ipa.c | 5 |
3 files changed, 10 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) { diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h index 0d1085f..7494d8d 100644 --- a/include/osmocom/netif/ipa.h +++ b/include/osmocom/netif/ipa.h @@ -19,6 +19,8 @@ struct ipa_head_ext { } __attribute__ ((packed)); struct msgb *osmo_ipa_msg_alloc(int headroom); +struct msgb *osmo_ipa_ext_msg_alloc(size_t headroom); + void osmo_ipa_msg_push_header(struct msgb *msg, uint8_t proto); int osmo_ipa_process_msg(struct msgb *msg); @@ -97,6 +97,11 @@ struct msgb *osmo_ipa_msg_alloc(int headroom) return msg; } +struct msgb *osmo_ipa_ext_msg_alloc(size_t headroom) +{ + return osmo_ipa_msg_alloc(sizeof(struct ipa_head_ext) + headroom); +} + void osmo_ipa_msg_push_header(struct msgb *msg, uint8_t proto) { struct ipa_head *hh; |