aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-05-29 21:00:56 +0200
committerHarald Welte <laforge@gnumonks.org>2018-05-30 01:36:04 +0200
commit64e807c4bc81624651b970290db1c6a0b03d8eef (patch)
tree44dfe95316676870c856d411e8914059d8e65e53
parent2f51684e635e38371d2fb3513a8bc1eb42421e4f (diff)
gsm0808: Add encoding functions for LCLS BSSMAP messages
-rw-r--r--include/osmocom/gsm/gsm0808.h5
-rw-r--r--src/gsm/gsm0808.c60
-rw-r--r--src/gsm/libosmogsm.map3
3 files changed, 68 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 5c03400c..84029575 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -80,6 +80,11 @@ struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
const struct gsm0808_cell_id_list *cil,
const uint8_t *chan_needed)
OSMO_DEPRECATED("use gsm0808_create_paging2 instead");
+struct msgb *gsm0808_create_lcls_conn_ctrl(enum gsm0808_lcls_config *config,
+ enum gsm0808_lcls_control *control);
+struct msgb *gsm0808_create_lcls_conn_ctrl_ack(enum gsm0808_lcls_status status);
+struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req);
+
/*! 3GPP TS 48.008 ยง3.2.2.5.8 Old BSS to New BSS information */
struct gsm0808_old_bss_to_new_bss_info {
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 5af53ee6..347e9855 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -282,6 +282,66 @@ struct msgb *gsm0808_create_cipher_reject(uint8_t cause)
return msg;
}
+/*! Create BSSMAP LCLS CONNECT CONTROL message (TS 48.008 3.2.1.91).
+ * \param[in] config LCLS Configuration
+ * \param[in] control LCLS Connection Status Control
+ * \returns callee-allocated msgb with BSSMAP LCLS NOTIFICATION */
+struct msgb *gsm0808_create_lcls_conn_ctrl(enum gsm0808_lcls_config *config,
+ enum gsm0808_lcls_control *control)
+{
+ struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+ "bssmap: LCLS CONN CTRL");
+ if (!msg)
+ return NULL;
+
+ msgb_v_put(msg, BSS_MAP_MSG_LCLS_CONNECT_CTRL);
+ if (config)
+ msgb_tv_put(msg, GSM0808_IE_LCLS_CONFIG, *config);
+ if (control)
+ msgb_tv_put(msg, GSM0808_IE_LCLS_CONFIG, *control);
+ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+ return msg;
+}
+
+/*! Create BSSMAP LCLS CONNECT CONTROL ACK message (TS 48.008 3.2.1.92).
+ * \param[in] status LCLS BSS Status
+ * \returns callee-allocated msgb with BSSMAP LCLS NOTIFICATION */
+struct msgb *gsm0808_create_lcls_conn_ctrl_ack(enum gsm0808_lcls_status status)
+{
+ struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+ "bssmap: LCLS CONN CTRL ACK");
+ if (!msg)
+ return NULL;
+
+ msgb_v_put(msg, BSS_MAP_MSG_LCLS_CONNECT_CTRL_ACK);
+ msgb_tv_put(msg, GSM0808_IE_LCLS_BSS_STATUS, status);
+ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+ return msg;
+}
+
+/*! Create BSSMAP LCLS NOTIFICATION message (TS 48.008 3.2.1.93).
+ * \param[in] status LCLS BSS Status
+ * \param[in] break_req Include the LCLS BREAK REQ IE (true) or not (false)
+ * \returns callee-allocated msgb with BSSMAP LCLS NOTIFICATION */
+struct msgb *gsm0808_create_lcls_notification(enum gsm0808_lcls_status status, bool break_req)
+{
+ struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+ "bssmap: LCLS NOTIFICATION");
+ if (!msg)
+ return NULL;
+
+ msgb_v_put(msg, BSS_MAP_MSG_LCLS_NOTIFICATION);
+ msgb_tv_put(msg, GSM0808_IE_LCLS_BSS_STATUS, status);
+ if (break_req)
+ msgb_v_put(msg, GSM0808_IE_LCLS_BREAK_REQ);
+ msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+ return msg;
+}
+
+
/*! Create BSSMAP Classmark Update message
* \param[in] cm2 Classmark 2
* \param[in] cm2_len length (in octets) of \a cm2
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 3b9fbfdd..c05b4eeb 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -158,6 +158,9 @@ gsm0808_create_dtap;
gsm0808_create_layer3;
gsm0808_create_layer3_aoip;
gsm0808_create_layer3_2;
+gsm0808_create_lcls_conn_ctrl;
+gsm0808_create_lcls_conn_ctrl_ack;
+gsm0808_create_lcls_notification;
gsm0808_create_reset;
gsm0808_create_reset_ack;
gsm0808_create_sapi_reject;