Change in libosmocore[master]: add gsm0808_cell_id_to_list()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sat May 26 21:14:24 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/9333


Change subject: add gsm0808_cell_id_to_list()
......................................................................

add gsm0808_cell_id_to_list()

The idea is to be able to add a gsm0808_cell_id to a gsm0808_cell_id_list2:
first convert it to a list, then re-use gsm0808_cell_id_list_add(). It will be
used by osmo-bsc to manage neighbor-BSS cell identifiers from VTY.

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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/9333/1

diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h
index 24c139a..6555734 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -98,6 +98,7 @@
 			     const uint8_t *elem, uint8_t len)
 			     OSMO_DEPRECATED("use gsm0808_dec_cell_id_list2 instead");
 int gsm0808_cell_id_list_add(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id_list2 *src);
+void gsm0808_cell_id_to_list(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id *src);
 uint8_t gsm0808_enc_cell_id(struct msgb *msg, const struct gsm0808_cell_id *ci);
 int gsm0808_dec_cell_id(struct gsm0808_cell_id *ci, const uint8_t *elem, uint8_t len);
 int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch);
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 2c659bb..080fc95 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -988,6 +988,37 @@
 	return added;
 }
 
+/*! Convert a single Cell Identifier to a Cell Identifier List with one entry.
+ * \param dst[out]  Overwrite this list.
+ * \param src[in]   Set \a dst to contain exactly this item.
+ */
+void gsm0808_cell_id_to_list(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id *src)
+{
+	if (!dst)
+		return;
+	if (!src) {
+		*dst = (struct gsm0808_cell_id_list2){
+			.id_discr = CELL_IDENT_NO_CELL,
+		};
+		return;
+	}
+
+	*dst = (struct gsm0808_cell_id_list2){
+		.id_discr = src->id_discr,
+		.id_list = { src->id },
+		.id_list_len = 1,
+	};
+
+	switch (src->id_discr) {
+	case CELL_IDENT_NO_CELL:
+	case CELL_IDENT_BSS:
+		dst->id_list_len = 0;
+		break;
+	default:
+		break;
+	}
+}
+
 /*! Encode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).
  *  \param[out] msg Message Buffer to which IE is to be appended
  *  \param[in] ci Cell ID to be encoded
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index c4b1b75..5a57429 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -177,6 +177,7 @@
 gsm0808_dec_cell_id_list;
 gsm0808_dec_cell_id_list2;
 gsm0808_cell_id_list_add;
+gsm0808_cell_id_to_list;
 gsm0808_enc_cell_id;
 gsm0808_dec_cell_id;
 gsm0808_cell_id_name;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf746ac60b1b1e920baf494b396658a5ceabd788
Gerrit-Change-Number: 9333
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180526/92667a10/attachment.htm>


More information about the gerrit-log mailing list