aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-02-15 15:42:32 +0100
committerMax <msuraev@sysmocom.de>2018-02-15 16:14:19 +0100
commit3c38e60cd55814a7b4c34f22e0b2e6e671f883c4 (patch)
tree4ae6a8e0167b9829bd9731007b2655a65cd76c62 /src
parentebf149234e1a4966bd74a4200eff21892cceac86 (diff)
Add function to encode classmark
The code is based on Osmocom-BB implementation. Change-Id: I78f6968edaa3ed535673411fb2a80060a472290f
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm48.c16
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index b58e9e2c..d9a55273 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -508,6 +508,22 @@ void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc,
lai48->lac = osmo_htons(lac);
}
+/*! Encode TS 24.008 ยง10.5.1.5 Mobile Station Classmark 1
+ * \param[out] cm caller-provided memory for output
+ * \param[in] rev_lv Revision level
+ * \param[in] es_ind ES IND "Controlled Early Classmark Sending" option
+ * \param[in] a5_1 A5/1 algorithm supported
+ * \param[in] pwr_lv RF power capability
+ */
+void gsm48_encode_classmark1(struct gsm48_classmark1 *cm, uint8_t rev_lv, bool es_ind, bool a5_1, uint8_t rf_pwr)
+{
+ memset(cm, 0, sizeof(*cm));
+ cm->rev_lev = rev_lv;
+ cm->es_ind = es_ind;
+ cm->a5_1 = !a5_1;
+ cm->pwr_lev = rf_pwr;
+}
+
/*! Decode TS 04.08 Location Area Identifier
* \param[in] Location Area Identifier (encoded)
* \param[out] mcc Mobile Country Code
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 7a74718c..b6152cec 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -245,6 +245,7 @@ gsm48_encode_redirecting;
gsm48_encode_signal;
gsm48_encode_ssversion;
gsm48_encode_useruser;
+gsm48_encode_classmark1;
gsm48_generate_lai;
gsm48_generate_mid;
gsm48_generate_mid_from_imsi;