aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-01-06 20:40:23 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-01-18 21:11:44 +0100
commit9828d28fc37cf12a447759335c56573671700c18 (patch)
treea85cac03e1b48c45e835103714f7c43282acd27f /include/osmocom
parent3221f878ee1970bbad6e51162516932318f7a22f (diff)
bssgp_rim: add encoder/decoder for NACC related RIM containers
BSSGP RIM uses a number of nested containers to signal RIM application specific payload information in a generic way. Lets add the container structurs required for NACC. Depends: libosmocore If48f412c32e8e5a3e604a78d12b74787a4786374 Change-Id: Ibbc7fd67658e3040c12abb5706fe9d1f31894352 Related: SYS#5103
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/gprs/gprs_bssgp_rim.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp_rim.h b/include/osmocom/gprs/gprs_bssgp_rim.h
new file mode 100644
index 00000000..0612a910
--- /dev/null
+++ b/include/osmocom/gprs/gprs_bssgp_rim.h
@@ -0,0 +1,182 @@
+/*! \file gprs_bssgp.h
+ * GPRS BSSGP RIM protocol implementation as per 3GPP TS 48.018. */
+/*
+ * (C) 2020-2021 by sysmocom - s.f.m.c. GmbH
+ * Author: Philipp Maier <pmaier@sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include <osmocom/gprs/protocol/gsm_08_18.h>
+
+/* 3GPP TS 48.018, table 11.3.63.1.1: RAN-INFORMATION-REQUEST Application Container coding for NACC */
+struct bssgp_ran_inf_req_app_cont_nacc {
+ struct osmo_cell_global_id_ps reprt_cell;
+};
+
+int bssgp_dec_ran_inf_req_app_cont_nacc(struct bssgp_ran_inf_req_app_cont_nacc *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_req_app_cont_nacc(uint8_t *buf, size_t len, const struct bssgp_ran_inf_req_app_cont_nacc *cont);
+
+/* Length of NACC system information, see also: 3GPP TS 48.018 11.3.63.2.1 */
+#define BSSGP_RIM_SI_LEN 21
+#define BSSGP_RIM_PSI_LEN 22
+
+/* 3GPP TS 48.018, table 11.3.63.2.1.a: RAN-INFORMATION Application Container coding for NACC */
+struct bssgp_ran_inf_app_cont_nacc {
+ struct osmo_cell_global_id_ps reprt_cell;
+ bool type_psi;
+ uint8_t num_si;
+
+ /* Pointer to system information messages */
+ const uint8_t *si[127];
+};
+
+int bssgp_dec_ran_inf_app_cont_nacc(struct bssgp_ran_inf_app_cont_nacc *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_app_cont_nacc(uint8_t *buf, size_t len, const struct bssgp_ran_inf_app_cont_nacc *cont);
+
+/* 3GPP TS 48.018, table 11.3.64.1.b, NACC Cause coding */
+enum bssgp_nacc_cause {
+ BSSGP_NACC_CAUSE_UNSPEC,
+ BSSGP_NACC_CAUSE_SYNTAX_ERR,
+ BSSGP_NACC_CAUSE_RPRT_CELL_MISSMTCH,
+ BSSGP_NACC_CAUSE_SIPSI_TYPE_ERR,
+ BSSGP_NACC_CAUSE_SIPSI_LEN_ERR,
+ BSSGP_NACC_CAUSE_SIPSI_SET_ERR,
+};
+
+/* 3GPP TS 48.018, table 11.3.64.1.a, Application Error Container coding for NACC */
+struct bssgp_app_err_cont_nacc {
+ enum bssgp_nacc_cause nacc_cause;
+
+ /* Pointer to errornous application container */
+ const uint8_t *err_app_cont;
+ size_t err_app_cont_len;
+};
+
+int bssgp_dec_app_err_cont_nacc(struct bssgp_app_err_cont_nacc *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_app_err_cont_nacc(uint8_t *buf, size_t len, const struct bssgp_app_err_cont_nacc *cont);
+
+/* 3GPP TS 48.018, table 11.3.61.b: RIM Application Identity coding */
+enum bssgp_ran_inf_app_id {
+ BSSGP_RAN_INF_APP_ID_NACC = 1,
+ BSSGP_RAN_INF_APP_ID_SI3 = 2,
+ BSSGP_RAN_INF_APP_ID_MBMS = 3,
+ BSSGP_RAN_INF_APP_ID_SON = 4,
+ BSSGP_RAN_INF_APP_ID_UTRA_SI = 5,
+};
+
+/* 3GPP TS 48.018, table 11.3.62a.1.b: RAN-INFORMATION-REQUEST RIM Container Contents */
+struct bssgp_ran_inf_req_rim_cont {
+ enum bssgp_ran_inf_app_id app_id;
+ uint32_t seq_num;
+ struct bssgp_rim_pdu_ind pdu_ind;
+ uint8_t prot_ver;
+
+ /* Nested application container */
+ union {
+ struct bssgp_ran_inf_req_app_cont_nacc app_cont_nacc;
+ /* TODO: add containers for Si3, MBMS, SON, UTRA-SI */
+ } u;
+
+ /* Pointer to SON-transfer application identity, only present if app_id is indicating "son-transfer",
+ * see also 3GPP TS 48.018, section 11.3.108 and 3GPP TS 36.413 annex B.1.1 */
+ const uint8_t *son_trans_app_id;
+ size_t son_trans_app_id_len;
+};
+
+int bssgp_dec_ran_inf_req_rim_cont(struct bssgp_ran_inf_req_rim_cont *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_req_rim_cont(uint8_t *buf, size_t len, const struct bssgp_ran_inf_req_rim_cont *cont);
+
+/* 3GPP TS 48.018, table 11.3.62a.2.b: RAN-INFORMATION RIM Container Contents */
+struct bssgp_ran_inf_rim_cont {
+ enum bssgp_ran_inf_app_id app_id;
+ uint32_t seq_num;
+ struct bssgp_rim_pdu_ind pdu_ind;
+ uint8_t prot_ver;
+ bool app_err;
+
+ /* Nested application container */
+ union {
+ struct bssgp_ran_inf_app_cont_nacc app_cont_nacc;
+ struct bssgp_app_err_cont_nacc app_err_cont_nacc;
+ /* TODO: add containers for Si3, MBMS, SON, UTRA-SI */
+ } u;
+
+ /* Pointer to SON-transfer application identity, only present if app_id is indicating "son-transfer",
+ * see also 3GPP TS 48.018, section 11.3.108 and 3GPP TS 36.413 annex B.1.1 */
+ const uint8_t *son_trans_app_id;
+ size_t son_trans_app_id_len;
+};
+
+int bssgp_dec_ran_inf_rim_cont(struct bssgp_ran_inf_rim_cont *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_rim_cont(uint8_t *buf, size_t len, const struct bssgp_ran_inf_rim_cont *cont);
+
+/* 3GPP TS 48.018, table 11.3.62a.3.b: RAN-INFORMATION-ACK RIM Container Contents */
+struct bssgp_ran_inf_ack_rim_cont {
+ enum bssgp_ran_inf_app_id app_id;
+ uint32_t seq_num;
+ uint8_t prot_ver;
+
+ /* Pointer to SON-transfer application identity, only present if app_id is indicating "son-transfer",
+ * see also 3GPP TS 48.018, section 11.3.108 and 3GPP TS 36.413 annex B.1.1 */
+ const uint8_t *son_trans_app_id;
+ size_t son_trans_app_id_len;
+};
+
+int bssgp_dec_ran_inf_ack_rim_cont(struct bssgp_ran_inf_ack_rim_cont *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_ack_rim_cont(uint8_t *buf, size_t len, const struct bssgp_ran_inf_ack_rim_cont *cont);
+
+/* 3GPP TS 48.018, table 11.3.62a.4.b: RAN-INFORMATION-ERROR RIM Container Contents */
+struct bssgp_ran_inf_err_rim_cont {
+ enum bssgp_ran_inf_app_id app_id;
+ uint8_t cause;
+ uint8_t prot_ver;
+
+ /* Pointer to (encoded) errornous PDU,
+ * see also: 3GPP TS 48.018, section 11.3.24 */
+ const uint8_t *err_pdu;
+ size_t err_pdu_len;
+
+ /* Pointer to SON-transfer application identity, only present if app_id is indicating "son-transfer",
+ * see also 3GPP TS 48.018, section 11.3.108 and 3GPP TS 36.413 annex B.1.1 */
+ const uint8_t *son_trans_app_id;
+ size_t son_trans_app_id_len;
+};
+
+int bssgp_dec_ran_inf_err_rim_cont(struct bssgp_ran_inf_err_rim_cont *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_err_rim_cont(uint8_t *buf, size_t len, const struct bssgp_ran_inf_err_rim_cont *cont);
+
+/* 3GPP TS 48.018, table 11.3.62a.5.b: RAN-INFORMATION-APPLICATION-ERROR RIM Container Contents */
+struct bssgp_ran_inf_app_err_rim_cont {
+ enum bssgp_ran_inf_app_id app_id;
+ uint32_t seq_num;
+ struct bssgp_rim_pdu_ind pdu_ind;
+ uint8_t prot_ver;
+
+ /* Nested application container */
+ union {
+ struct bssgp_app_err_cont_nacc app_err_cont_nacc;
+ /* TODO: add containers for Si3, MBMS, SON, UTRA-SI */
+ } u;
+};
+
+int bssgp_dec_ran_inf_app_err_rim_cont(struct bssgp_ran_inf_app_err_rim_cont *cont, const uint8_t *buf, size_t len);
+int bssgp_enc_ran_inf_app_err_rim_cont(uint8_t *buf, size_t len, const struct bssgp_ran_inf_app_err_rim_cont *cont);