aboutsummaryrefslogtreecommitdiffstats
path: root/src/gsm/gsm0808.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-02-15 18:28:04 +0100
committerStefan Sperling <ssperling@sysmocom.de>2018-03-13 14:28:15 +0100
commit11a4d9dd91216fe353e94bfdbbab53bc4f891c0d (patch)
tree21f0639b659ab4a77ab25727895875bc6fdb5e43 /src/gsm/gsm0808.c
parentb10ec0be5ffcd8759bb8b1461549a7eaf570bd9b (diff)
support for more cell ID list types in libosmocore
Introduce gsm0808_dec_cell_id_list2() with supports additional types of cell identifier lists. The new parsing routines are based on similar routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c. Likewise, introduce gsm0808_enc_cell_id_list2() with support for the same additional types of cell identifier lists. The old API using struct gsm0808_cell_id_list is deprecated. The previous definition was insufficient because it assumed that all decoded cell ID types could be represented with a single uint16_t. It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h) despite being a host-side representation of data in an IE. The only user I am aware of is in osmo-msc, where this struct is used for one local variable. osmo-msc releases >= 1.1.0 make use of this API. While here, fix a small bug in a test: test_gsm0808_enc_dec_cell_id_list_bss() set the cell ID type to 'LAC' but obviously wants to use type 'BSS'. Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb Related: OS#2847
Diffstat (limited to 'src/gsm/gsm0808.c')
-rw-r--r--src/gsm/gsm0808.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index b43e0e63..3003284b 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -521,16 +521,16 @@ struct msgb *gsm0808_create_clear_rqst(uint8_t cause)
* \param[in] cil Cell Identity List (where to page)
* \param[in] chan_needed Channel Type needed
* \returns callee-allocated msgb with BSSMAP PAGING message */
-struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
- const struct gsm0808_cell_id_list *cil,
- const uint8_t *chan_needed)
+struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
+ const struct gsm0808_cell_id_list2 *cil,
+ const uint8_t *chan_needed)
{
struct msgb *msg;
uint8_t mid_buf[GSM48_MI_SIZE + 2];
int mid_len;
uint32_t tmsi_sw;
- /* Mandatory emelents! */
+ /* Mandatory elements! */
OSMO_ASSERT(imsi);
OSMO_ASSERT(cil);
@@ -558,7 +558,7 @@ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
/* Cell Identifier List 3.2.2.27 */
if (cil)
- gsm0808_enc_cell_id_list(msg, cil);
+ gsm0808_enc_cell_id_list2(msg, cil);
/* Channel Needed 3.2.2.36 */
if (chan_needed) {
@@ -573,6 +573,32 @@ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
return msg;
}
+/*! DEPRECATED: Use gsm0808_create_paging2 instead.
+ * Create BSSMAP PAGING message.
+ * \param[in] imsi Mandatory paged IMSI in string representation
+ * \param[in] tmsi Optional paged TMSI
+ * \param[in] cil Cell Identity List (where to page)
+ * \param[in] chan_needed Channel Type needed
+ * \returns callee-allocated msgb with BSSMAP PAGING message */
+struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
+ const struct gsm0808_cell_id_list *cil,
+ const uint8_t *chan_needed)
+{
+ struct gsm0808_cell_id_list2 cil2 = {};
+
+ /* Mandatory emelents! */
+ OSMO_ASSERT(cil);
+
+ if (cil->id_list_len > GSM0808_CELL_ID_LIST2_MAXLEN)
+ return NULL;
+
+ cil2.id_discr = cil->id_discr;
+ memcpy(cil2.id_list, cil->id_list_lac, cil->id_list_len * sizeof(cil2.id_list[0].lac));
+ cil2.id_list_len = cil->id_list_len;
+
+ return gsm0808_create_paging2(imsi, tmsi, &cil2, chan_needed);
+}
+
/*! Prepend a DTAP header to given Message Buffer
* \param[in] msgb Message Buffer
* \param[in] link_id Link Identifier */