summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-14 14:36:56 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-15 13:14:19 +0100
commit372a3bd346d481bec4fd754b46ff7c8e380c012c (patch)
tree8f4f4293dfde3111e56082671318a244bd37e9ba
parent51bf76ef478085a030382e91212e108f71537ccc (diff)
04.08: apply new transaction id inline functions
libosmocore recently added inline functions to relieve callers from applying bitmasks and bit shifts to access the transaction id of a GSM 04.08 header. Apply these functions.
-rw-r--r--openbsc/src/gprs/gprs_gmm.c8
-rw-r--r--openbsc/src/libmsc/gsm_04_08.c2
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c2
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_ussd.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 9275e05a5..e7ce0ee5d 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -2014,7 +2014,7 @@ static int do_act_pdp_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg)
uint8_t req_qos_len, req_pdpa_len;
uint8_t *req_qos, *req_pdpa;
struct tlv_parsed tp;
- uint8_t transaction_id = (gh->proto_discr >> 4);
+ uint8_t transaction_id = gsm48_hdr_trans_id(gh);
struct sgsn_ggsn_ctx *ggsn;
struct sgsn_pdp_ctx *pdp;
enum gsm48_gsm_cause gsm_cause;
@@ -2184,7 +2184,7 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
msg = gprs_msgb_copy(_msg, __func__);
if (!msg) {
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(_msg);
- uint8_t transaction_id = (gh->proto_discr >> 4);
+ uint8_t transaction_id = gsm48_hdr_trans_id(gh);
LOGMMCTXP(LOGL_ERROR, mmctx, "-> ACTIVATE PDP CONTEXT REQ failed copy.\n");
/* Send reject with GSM_CAUSE_INV_MAND_INFO */
@@ -2202,7 +2202,7 @@ static int gsm48_rx_gsm_act_pdp_req(struct sgsn_mm_ctx *mmctx,
static int gsm48_rx_gsm_deact_pdp_req(struct sgsn_mm_ctx *mm, struct msgb *msg)
{
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
- uint8_t transaction_id = (gh->proto_discr >> 4);
+ uint8_t transaction_id = gsm48_hdr_trans_id(gh);
struct sgsn_pdp_ctx *pdp;
LOGMMCTXP(LOGL_INFO, mm, "-> DEACTIVATE PDP CONTEXT REQ (cause: %s)\n",
@@ -2223,7 +2223,7 @@ static int gsm48_rx_gsm_deact_pdp_req(struct sgsn_mm_ctx *mm, struct msgb *msg)
static int gsm48_rx_gsm_deact_pdp_ack(struct sgsn_mm_ctx *mm, struct msgb *msg)
{
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
- uint8_t transaction_id = (gh->proto_discr >> 4);
+ uint8_t transaction_id = gsm48_hdr_trans_id(gh);
struct sgsn_pdp_ctx *pdp;
LOGMMCTXP(LOGL_INFO, mm, "-> DEACTIVATE PDP CONTEXT ACK\n");
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index f7ecae4a7..51e5f249a 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -3499,7 +3499,7 @@ static int gsm0408_rcv_cc(struct gsm_subscriber_connection *conn, struct msgb *m
{
struct gsm48_hdr *gh = msgb_l3(msg);
uint8_t msg_type = gsm48_hdr_msg_type(gh);
- uint8_t transaction_id = ((gh->proto_discr & 0xf0) ^ 0x80) >> 4; /* flip */
+ uint8_t transaction_id = gsm48_hdr_trans_id_flip_ti(gh);
struct gsm_trans *trans = NULL;
int i, rc = 0;
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 6e48c1576..9b75fd105 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -780,7 +780,7 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
{
struct gsm48_hdr *gh = msgb_l3(msg);
uint8_t msg_type = gh->msg_type;
- uint8_t transaction_id = ((gh->proto_discr >> 4) ^ 0x8); /* flip */
+ uint8_t transaction_id = gsm48_hdr_trans_id_flip_ti(gh);
struct gsm_trans *trans;
int new_trans = 0;
int rc = 0;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index 2905c85b0..e0809059a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -409,7 +409,7 @@ int bsc_ussd_check(struct nat_sccp_connection *con, struct bsc_nat_parsed *parse
proto = gsm48_hdr_pdisc(hdr48);
msg_type = gsm48_hdr_msg_type(hdr48);
- ti = (hdr48->proto_discr & 0x70) >> 4;
+ ti = gsm48_hdr_trans_id_no_ti(hdr48);
if (proto != GSM48_PDISC_NC_SS)
return 0;