aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-01-07 21:55:48 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-01-19 18:04:13 +0100
commit7741bc320c42244a87e0369961b13a87d98ca844 (patch)
tree0988765b9d2b03d25feb9898a62aecf6aebe0e51 /include/osmocom
parentaca31b8b2ddd63bc5f9f8db020cffb699672477b (diff)
gprs_bssgp: add utilities to send and parse BSSGP rim PDUs
At the moment libosmogb offers no convinient way to send RIM PDUs. Also parsing an incoming RIM messages into destination, source routing info and RIM container is not available. Change-Id: I18134fd9938040d2facb6beee3732628b167ce8c Related: SYS#5103
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/gprs/gprs_bssgp.h35
-rw-r--r--include/osmocom/gprs/gprs_bssgp_rim.h4
2 files changed, 39 insertions, 0 deletions
diff --git a/include/osmocom/gprs/gprs_bssgp.h b/include/osmocom/gprs/gprs_bssgp.h
index 92556615..a7b363bd 100644
--- a/include/osmocom/gprs/gprs_bssgp.h
+++ b/include/osmocom/gprs/gprs_bssgp.h
@@ -11,6 +11,7 @@
#include <osmocom/gprs/protocol/gsm_08_18.h>
#include <osmocom/gprs/protocol/gsm_24_301.h>
+#include <osmocom/gprs/gprs_bssgp_rim.h>
/* gprs_bssgp_util.c */
@@ -41,6 +42,39 @@ int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei,
/* Chapter 10.4.14: Status */
int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg);
+/* Chapter 10.6.1: RAN-INFORMATION-REQUEST */
+struct bssgp_ran_information_pdu {
+ struct bssgp_rim_routing_info routing_info_dest;
+ struct bssgp_rim_routing_info routing_info_src;
+
+ /* Encoded variant of the RIM container */
+ uint8_t rim_cont_iei;
+ const uint8_t *rim_cont;
+ unsigned int rim_cont_len;
+
+ /* Decoded variant of the RIM container */
+ bool decoded_present;
+ union {
+ struct bssgp_ran_inf_req_rim_cont req_rim_cont;
+ struct bssgp_ran_inf_rim_cont rim_cont;
+ struct bssgp_ran_inf_ack_rim_cont ack_rim_cont;
+ struct bssgp_ran_inf_err_rim_cont err_rim_cont;
+ struct bssgp_ran_inf_app_err_rim_cont app_err_rim_cont;
+ } decoded;
+
+ /* When receiving a PDU from BSSGP the encoded variant of the RIM
+ * container will always be present. The decoded variant will be
+ * present in addition whenever BSSGP was able to decode the container.
+ *
+ * When sending a PDU to BSSGP, then the decoded variant is used when
+ * it is available. The encoded variant (if present) will be ignored
+ * then. */
+};
+int bssgp_tx_rim(const struct bssgp_ran_information_pdu *pdu, uint16_t nsei);
+
+int bssgp_parse_rim_pdu(struct bssgp_ran_information_pdu *pdu, const struct msgb *msg);
+struct msgb *bssgp_encode_rim_pdu(const struct bssgp_ran_information_pdu *pdu);
+
enum bssgp_prim {
PRIM_BSSGP_DL_UD,
PRIM_BSSGP_UL_UD,
@@ -75,6 +109,7 @@ struct osmo_bssgp_prim {
struct {
uint8_t suspend_ref;
} resume;
+ struct bssgp_ran_information_pdu rim_pdu;
} u;
};
diff --git a/include/osmocom/gprs/gprs_bssgp_rim.h b/include/osmocom/gprs/gprs_bssgp_rim.h
index 7f3a0e43..7e9efcd7 100644
--- a/include/osmocom/gprs/gprs_bssgp_rim.h
+++ b/include/osmocom/gprs/gprs_bssgp_rim.h
@@ -54,6 +54,10 @@ struct bssgp_rim_routing_info {
};
};
+/* The encoded result of the rim routing information is, depending on the
+ * address type (discr) of variable length. */
+#define BSSGP_RIM_ROUTING_INFO_MAXLEN 14
+
int bssgp_parse_rim_ri(struct bssgp_rim_routing_info *ri, const uint8_t *buf, unsigned int len);
int bssgp_create_rim_ri(uint8_t *buf, const struct bssgp_rim_routing_info *ri);