summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-14 16:06:48 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-15 14:11:49 +0100
commitda7bf4d55a896034320aa4466b9644083093acd1 (patch)
treebc3149272eb6e1081c154bae968b62b6e2858a7a /include
parentc656faed122b8d858e937d3262acb1925ed6e3d1 (diff)
04.08: add inline funcs for transaction id bits
Various users of gsm48_hdr apply the same hardcoded shifts/bitmasks to obtain the transaction ID encoded in the upper nibble of the protocol discriminator. Centralize. Patch for openbsc.git will follow.
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/gsm/protocol/gsm_04_08.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 49e977b0..d49b77fe 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -763,6 +763,25 @@ static inline uint8_t gsm48_hdr_pdisc(const struct gsm48_hdr *hdr)
return pdisc;
}
+static inline uint8_t gsm48_hdr_trans_id(const struct gsm48_hdr *hdr)
+{
+ /*
+ * 3GPP TS 24.007 version 12.0.0 Release 12,
+ * 11.2.3.1.3 Transaction identifier
+ */
+ return (hdr->proto_discr & 0xf0) >> 4;
+}
+
+static inline uint8_t gsm48_hdr_trans_id_flip_ti(const struct gsm48_hdr *hdr)
+{
+ return gsm48_hdr_trans_id(hdr) ^ 0x08;
+}
+
+static inline uint8_t gsm48_hdr_trans_id_no_ti(const struct gsm48_hdr *hdr)
+{
+ return gsm48_hdr_trans_id(hdr) & 0x07;
+}
+
static inline uint8_t gsm48_hdr_msg_type_r98(const struct gsm48_hdr *hdr)
{
/*