Change in libosmocore[master]: rest_octets: Add function to parse SI3 rest octets

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue May 28 22:34:34 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14236 )

Change subject: rest_octets: Add function to parse SI3 rest octets
......................................................................

rest_octets: Add function to parse SI3 rest octets

Change-Id: I690cf308311f910005a325d50f5d5d825678d2b2
Related: OS#3075
Related: OS#4023
---
M include/osmocom/gsm/gsm48_rest_octets.h
M src/gsm/gsm48_rest_octets.c
M src/gsm/libosmogsm.map
3 files changed, 82 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/gsm/gsm48_rest_octets.h b/include/osmocom/gsm/gsm48_rest_octets.h
index 3029ac5..bc5023a 100644
--- a/include/osmocom/gsm/gsm48_rest_octets.h
+++ b/include/osmocom/gsm/gsm48_rest_octets.h
@@ -87,3 +87,6 @@
 
 /* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
 int osmo_gsm48_rest_octets_si13_encode(uint8_t *data, const struct osmo_gsm48_si13_info *si13);
+
+/* Parse SI3 Rest Octets */
+void osmo_gsm48_rest_octets_si3_decode(struct osmo_gsm48_si_ro_info *si3, const uint8_t *data);
diff --git a/src/gsm/gsm48_rest_octets.c b/src/gsm/gsm48_rest_octets.c
index b9d5275..d5c93fe 100644
--- a/src/gsm/gsm48_rest_octets.c
+++ b/src/gsm/gsm48_rest_octets.c
@@ -951,3 +951,81 @@
 	bitvec_spare_padding(&bv, (bv.data_len*8)-1);
 	return bv.data_len;
 }
+
+
+/***********************************************************************
+ * Decoder
+ ***********************************************************************/
+
+/*! Decode SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72).
+ *  \param[out] si3 decoded SI3 rest octets
+ *  \param[in] encoded SI3 rest octets, 4 octets long */
+void osmo_gsm48_rest_octets_si3_decode(struct osmo_gsm48_si_ro_info *si3, const uint8_t *data)
+{
+	struct osmo_gsm48_si_selection_params *sp = &si3->selection_params;
+	struct osmo_gsm48_si_power_offset *po = &si3->power_offset;
+	struct osmo_gsm48_si3_gprs_ind *gi = &si3->gprs_ind;
+	struct bitvec bv;
+
+	memset(&bv, 0, sizeof(bv));
+	bv.data = (uint8_t *) data;
+	bv.data_len = 4;
+
+	memset(si3, 0, sizeof(*si3));
+
+	/* Optional Selection Paraosmo_gsm48_si_ro_infometers */
+	if (bitvec_get_bit_high(&bv) == H) {
+		sp->present = 1;
+		sp->cbq = bitvec_get_uint(&bv, 1);
+		sp->cell_resel_off = bitvec_get_uint(&bv, 6);
+		sp->temp_offs = bitvec_get_uint(&bv, 3);
+		sp->penalty_time = bitvec_get_uint(&bv, 5);
+	} else
+		sp->present = 0;
+
+	/* Optional Power Offset */
+	if (bitvec_get_bit_high(&bv) == H) {
+		po->present = 1;
+		po->power_offset = bitvec_get_uint(&bv, 2);
+	} else
+		po->present = 0;
+
+	/* System Information 2ter Indicator */
+	if (bitvec_get_bit_high(&bv) == H)
+		si3->si2ter_indicator = 1;
+	else
+		si3->si2ter_indicator = 0;
+
+	/* Early Classmark Sending Control */
+	if (bitvec_get_bit_high(&bv) == H)
+		si3->early_cm_ctrl = 1;
+	else
+		si3->early_cm_ctrl = 0;
+
+	/* Scheduling if and where */
+	if (bitvec_get_bit_high(&bv) == H) {
+		si3->scheduling.present = 1;
+		si3->scheduling.where = bitvec_get_uint(&bv, 3);
+	} else
+		si3->scheduling.present = 0;
+
+	/* GPRS Indicator */
+	if (bitvec_get_bit_high(&bv) == H) {
+		gi->present = 1;
+		gi->ra_colour = bitvec_get_uint(&bv, 3);
+		gi->si13_position = bitvec_get_uint(&bv, 1);
+	} else
+		gi->present = 0;
+
+	/* 3G Early Classmark Sending Restriction. If H, then controlled by
+	 * early_cm_ctrl above */
+	if (bitvec_get_bit_high(&bv) == H)
+		si3->early_cm_restrict_3g = 1;
+	else
+		si3->early_cm_restrict_3g = 0;
+
+	if (bitvec_get_bit_high(&bv) == H)
+		si3->si2quater_indicator = 1;
+	else
+		si3->si2quater_indicator = 0;
+}
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 56fed0f..84d71e6 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -309,6 +309,7 @@
 osmo_gsm48_rest_octets_si3_encode;
 osmo_gsm48_rest_octets_si4_encode;
 osmo_gsm48_rest_octets_si13_encode;
+osmo_gsm48_rest_octets_si3_decode;
 gsm48_rr_msg_name;
 gsm48_cc_state_name;
 gsm48_construct_ra;

-- 
To view, visit https://gerrit.osmocom.org/14236
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I690cf308311f910005a325d50f5d5d825678d2b2
Gerrit-Change-Number: 14236
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190528/0bd62103/attachment.html>


More information about the gerrit-log mailing list