lynxis lazus has submitted this change. (
https://gerrit.osmocom.org/c/libosmocore/+/37831?usp=email )
Change subject: add convert functions for old gprs_ra_id and the new
osmo_routing_area_id
......................................................................
add convert functions for old gprs_ra_id and the new osmo_routing_area_id
There are some parts which still depend on the old gprs_ra_id (e.g. BSSGP, Iu).
Related: OS#6536
Change-Id: Iaef54cac541913534af00f40483723e9952a6807
---
M TODO-RELEASE
M include/osmocom/gsm/gsm48.h
M src/gsm/gsm48.c
M src/gsm/libosmogsm.map
4 files changed, 33 insertions(+), 0 deletions(-)
Approvals:
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
lynxis lazus: Looks good to me, approved
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 904d9e0..8a1e0dc 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
# If any interfaces have been removed or changed since the last public
release: c:r:0.
#library what description / commit summary line
gb ADD add
bssgp_parse_cell_id2/bssgp_create_cell_id2
+gsm ADD add osmo_rai_to_gprs/gprs_rai_to_osmo
diff --git a/include/osmocom/gsm/gsm48.h b/include/osmocom/gsm/gsm48.h
index 00fb6f4..d36b85c 100644
--- a/include/osmocom/gsm/gsm48.h
+++ b/include/osmocom/gsm/gsm48.h
@@ -42,6 +42,8 @@
const char *osmo_rai_name(const struct gprs_ra_id *rai);
char *osmo_rai_name_buf(char *buf, size_t buf_len, const struct gprs_ra_id
*rai);
char *osmo_rai_name_c(const void *ctx, const struct gprs_ra_id *rai);
+void osmo_rai_to_gprs(struct gprs_ra_id *dest, const struct
osmo_routing_area_id *src);
+void gprs_rai_to_osmo(struct osmo_routing_area_id *dest, const struct
gprs_ra_id *src);
int gsm48_decode_lai(struct gsm48_loc_area_id *lai, uint16_t *mcc,
uint16_t *mnc, uint16_t *lac)
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 64b1765..1201595 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -222,6 +222,34 @@
return osmo_rai_name_buf(buf, 32, rai);
}
+/*! Convert osmo_routing_area_id (new) into gprs_ra_id (old) */
+void osmo_rai_to_gprs(struct gprs_ra_id *dest, const struct
osmo_routing_area_id *src)
+{
+ OSMO_ASSERT(src);
+ OSMO_ASSERT(dest);
+
+ dest->mcc = src->lac.plmn.mcc;
+ dest->mnc = src->lac.plmn.mnc;
+ dest->mnc_3_digits = src->lac.plmn.mnc_3_digits;
+
+ dest->lac = src->lac.lac;
+ dest->rac = src->rac;
+}
+
+/*! Convert gprs_ra_id (old) into osmo_routing_area_id (new) */
+void gprs_rai_to_osmo(struct osmo_routing_area_id *dest, const struct
gprs_ra_id *src)
+{
+ OSMO_ASSERT(src);
+ OSMO_ASSERT(dest);
+
+ dest->lac.plmn.mcc = src->mcc;
+ dest->lac.plmn.mnc = src->mnc;
+ dest->lac.plmn.mnc_3_digits = src->mnc_3_digits;
+
+ dest->lac.lac = src->lac;
+ dest->rac = src->rac;
+}
+
/* FIXME: convert to value_string */
static const char *cc_state_names[32] = {
"NULL",
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 2c4c621..3bc8309 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -487,6 +487,8 @@
osmo_rai_name2;
osmo_rai_name2_buf;
osmo_rai_name2_c;
+osmo_rai_to_gprs;
+gprs_rai_to_osmo;
osmo_cgi_cmp;
osmo_cgi_name;
osmo_cgi_name_buf;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37831?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iaef54cac541913534af00f40483723e9952a6807
Gerrit-Change-Number: 37831
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>