lynxis lazus has submitted this change. (
https://gerrit.osmocom.org/c/libosmocore/+/37794?usp=email )
Change subject: gb: add bssgp_parse_cell_id2/bssgp_create_cell_id2
......................................................................
gb: add bssgp_parse_cell_id2/bssgp_create_cell_id2
Add bssgp_cell_id functions which use the new struct osmo_routing_area_id.
Related: OS#6536
Change-Id: I6cdae75a32547968add2421a07d287a0a42bdbc0
---
M TODO-RELEASE
M include/osmocom/gprs/gprs_bssgp.h
M src/gb/gprs_bssgp.c
M src/gb/libosmogb.map
4 files changed, 44 insertions(+), 0 deletions(-)
Approvals:
pespin: Looks good to me, approved
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..904d9e0 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# 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
diff --git a/include/osmocom/gprs/gprs_bssgp.h
b/include/osmocom/gprs/gprs_bssgp.h
index 6c04332..dff7268 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -182,6 +182,12 @@
int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
uint16_t cid);
+int bssgp_parse_cell_id2(struct osmo_routing_area_id *raid, uint16_t *cid,
+ const uint8_t *buf, size_t buf_len);
+int bssgp_create_cell_id2(uint8_t *buf, size_t buf_len,
+ const struct osmo_routing_area_id *raid,
+ uint16_t cid);
+
/* Wrapper around TLV parser to parse BSSGP IEs */
static inline int bssgp_tlv_parse(struct tlv_parsed *tp, const uint8_t *buf,
int len)
{
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 7abef80..d436f0a 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -354,6 +354,24 @@
return osmo_load16be(buf+6);
}
+/*! Parse the value of a BSSGP Cell identity (04.08 RAI + Cell Id) */
+int bssgp_parse_cell_id2(struct osmo_routing_area_id *raid, uint16_t *cid,
+ const uint8_t *buf, size_t buf_len)
+{
+ if (buf_len < 8)
+ return -EINVAL;
+
+ /* 6 octets RAC */
+ if (raid)
+ osmo_routing_area_id_decode(raid, buf, buf_len);
+
+ /* 2 octets CID */
+ if (cid)
+ *cid = osmo_load16be(buf + sizeof(struct gsm48_ra_id));
+
+ return 0;
+}
+
int bssgp_create_cell_id(uint8_t *buf, const struct gprs_ra_id *raid,
uint16_t cid)
{
@@ -365,6 +383,23 @@
return 8;
}
+/*! Encode the 04.08 RAI, Cell Id into BSSGP Cell identity */
+int bssgp_create_cell_id2(uint8_t *buf, size_t buf_len,
+ const struct osmo_routing_area_id *raid,
+ const uint16_t cid)
+{
+ if (buf_len < 8)
+ return -ENOMEM;
+
+ /* 6 octets RAC */
+ osmo_routing_area_id_encode_buf(buf, buf_len, raid);
+
+ /* 2 octets CID */
+ osmo_store16be(cid, buf + sizeof(struct gsm48_ra_id));
+
+ return 8;
+}
+
/* Chapter 8.4 BVC-Reset Procedure */
static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
uint16_t ns_bvci)
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index e5a5c8f..f1a6bd6 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -2,6 +2,7 @@
global:
bssgp_cause_str;
bssgp_create_cell_id;
+bssgp_create_cell_id2;
bssgp_create_rim_ri;
bssgp_dec_app_err_cont_nacc;
bssgp_dec_ran_inf_ack_rim_cont;
@@ -32,6 +33,7 @@
bssgp_msgb_ra_put;
bssgp_nacc_cause_strs;
bssgp_parse_cell_id;
+bssgp_parse_cell_id2;
bssgp_parse_rim_pdu;
bssgp_parse_rim_ri;
bssgp_parse_rim_ra;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37794?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: I6cdae75a32547968add2421a07d287a0a42bdbc0
Gerrit-Change-Number: 37794
Gerrit-PatchSet: 7
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]>