[PATCH 2/8] gsup: factor out header composition & sending.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Thu Oct 1 13:23:51 UTC 2015


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
---
 openbsc/src/gprs/gprs_gsup_client.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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 @@ static void connect_timer_cb(void *gsupc_)
 	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 @@ int gprs_gsup_client_send(struct gprs_gsup_client *gsupc, struct msgb *msg)
 		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;
 }
-- 
2.1.4




More information about the OpenBSC mailing list