gsup: factor out header composition & sending.
Move IPA header composition and sending to new static gsup_client_send() (so I
can use it in the upcoming OAP code).
Sponsored-by: On-Waves ehf
diff --git a/openbsc/src/gprs/gprs_gsup_client.c b/openbsc/src/gprs/gprs_gsup_client.c
index 807b0c1..1f9e34c 100644
--- a/openbsc/src/gprs/gprs_gsup_client.c
+++ b/openbsc/src/gprs/gprs_gsup_client.c
@@ -100,6 +100,14 @@
gsup_client_connect(gsupc);
}
+static void gsup_client_send(struct gprs_gsup_client *gsupc, int proto_ext, struct msgb *msg_tx)
+{
+ ipa_prepend_header_ext(msg_tx, proto_ext);
+ ipa_msg_push_header(msg_tx, IPAC_PROTO_OSMO);
+ ipa_client_conn_send(gsupc->link, msg_tx);
+ /* msg_tx is now queued and will be freed. */
+}
+
static void gsup_client_updown_cb(struct ipa_client_conn *link, int up)
{
struct gprs_gsup_client *gsupc = link->data;
@@ -275,9 +283,7 @@
return -EAGAIN;
}
- ipa_prepend_header_ext(msg, IPAC_PROTO_EXT_GSUP);
- ipa_msg_push_header(msg, IPAC_PROTO_OSMO);
- ipa_client_conn_send(gsupc->link, msg);
+ gsup_client_send(gsupc, IPAC_PROTO_EXT_GSUP, msg);
return 0;
}