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
This commit is contained in:
Neels Hofmeyr 2015-10-01 15:23:51 +02:00 committed by Holger Hans Peter Freyther
parent 8b4e584621
commit 06cfe00c71
1 changed files with 9 additions and 3 deletions

View File

@ -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;
}