Change in libosmocore[master]: gsm0808_utils: add gsm0808_cell_id_lists_same()

neels gerrit-no-reply at lists.osmocom.org
Tue Mar 9 15:55:49 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/23297 )


Change subject: gsm0808_utils: add gsm0808_cell_id_lists_same()
......................................................................

gsm0808_utils: add gsm0808_cell_id_lists_same()

Change-Id: I16bc903f9c5820ad00d588e59a4a6923d1f3f542
---
M include/osmocom/gsm/gsm0808_utils.h
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
3 files changed, 25 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/23297/1

diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index 76e9064..53e22f9 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -91,6 +91,7 @@
 bool gsm0808_cell_ids_match(const struct gsm0808_cell_id *id1, const struct gsm0808_cell_id *id2, bool exact_match);
 int gsm0808_cell_id_matches_list(const struct gsm0808_cell_id *id, const struct gsm0808_cell_id_list2 *list,
 				 unsigned int match_nr, bool exact_match);
+bool gsm0808_cell_id_lists_same(const struct gsm0808_cell_id_list2 *a, const struct gsm0808_cell_id_list2 *b);
 void gsm0808_cell_id_from_cgi(struct gsm0808_cell_id *cid, enum CELL_IDENT id_discr,
 			      const struct osmo_cell_global_id *cgi);
 int gsm0808_cell_id_to_cgi(struct osmo_cell_global_id *cgi, const struct gsm0808_cell_id *cid);
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index dda73ad..7d7934a 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -1787,6 +1787,29 @@
 	return -1;
 }
 
+/*! Determine whether two cell id lists are exactly identical, in ordering, id_discr and values.
+ * \param[in] a  Cell ID list to compare.
+ * \param[in] b  Other cell ID list to compare.
+ * \returns true when both lists are identical.
+ */
+bool gsm0808_cell_id_lists_same(const struct gsm0808_cell_id_list2 *a, const struct gsm0808_cell_id_list2 *b)
+{
+	int i;
+	if (a == b)
+		return true;
+	if (a->id_list_len != b->id_list_len)
+		return false;
+	if (a->id_discr != b->id_discr)
+		return false;
+	for (i = 0; i < a->id_list_len; i++) {
+		if (!gsm0808_cell_id_u_match(a->id_discr, &a->id_list[i],
+					     b->id_discr, &b->id_list[i],
+					     true))
+			return false;
+	}
+	return true;
+}
+
 /*! Copy information from a CGI to form a Cell Identifier of the specified kind.
  * \param [out] cid  Compose new Cell Identifier here.
  * \param [in] id_discr  Which kind of Cell Identifier to compose.
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 0ea0678..f43713a 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -238,6 +238,7 @@
 gsm0808_cell_id_u_name;
 gsm0808_cell_ids_match;
 gsm0808_cell_id_matches_list;
+gsm0808_cell_id_lists_same;
 gsm0808_chan_type_to_speech_codec;
 gsm0808_speech_codec_from_chan_type;
 gsm0808_sc_cfg_from_gsm48_mr_cfg;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I16bc903f9c5820ad00d588e59a4a6923d1f3f542
Gerrit-Change-Number: 23297
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210309/b32cb242/attachment.htm>


More information about the gerrit-log mailing list