From 9e7554413756121f15a114aa38a12318d857c0bd Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 9 Aug 2023 16:39:06 +0200 Subject: [PATCH] gprs_bssgp_rim: allow sending of encoded RIM messages The API function bssgp_tx_rim() accepts decoded RIM PDU structs, encodes them and eventually sends them. However, there may be cases where the RIM PCU already exists in its encoded form. (This is in particular the case when the RIM PDU is forwarded from GTP to BSSGP) Lets add an API function bssgp_tx_rim_encoded to allow sending of already encoded RIM PDUs Related: OS#6095 Change-Id: Id4a793bbaf32d7b9d894dcc5be3faaf2f2d91d82 --- include/osmocom/gprs/gprs_bssgp_rim.h | 1 + src/gb/gprs_bssgp_rim.c | 19 +++++++++++++++++++ src/gb/libosmogb.map | 1 + 3 files changed, 21 insertions(+) diff --git a/include/osmocom/gprs/gprs_bssgp_rim.h b/include/osmocom/gprs/gprs_bssgp_rim.h index 5f397c98a..4c0a57b4a 100644 --- a/include/osmocom/gprs/gprs_bssgp_rim.h +++ b/include/osmocom/gprs/gprs_bssgp_rim.h @@ -270,3 +270,4 @@ int bssgp_parse_rim_pdu(struct bssgp_ran_information_pdu *pdu, const struct msgb struct msgb *bssgp_encode_rim_pdu(const struct bssgp_ran_information_pdu *pdu); int bssgp_tx_rim(const struct bssgp_ran_information_pdu *pdu, uint16_t nsei); +int bssgp_tx_rim_encoded(struct msgb *msg, uint16_t nsei); diff --git a/src/gb/gprs_bssgp_rim.c b/src/gb/gprs_bssgp_rim.c index 55609edba..d7b19e7f9 100644 --- a/src/gb/gprs_bssgp_rim.c +++ b/src/gb/gprs_bssgp_rim.c @@ -1179,6 +1179,25 @@ int bssgp_tx_rim(const struct bssgp_ran_information_pdu *pdu, uint16_t nsei) return bssgp_ns_send(bssgp_ns_send_data, msg); } +/*! Send encoded RAN TRANSPARENT CONTAINER via BSSGP (3GPP TS 29.060, section 7.7.43). + * \param[in] msg user provided memory for the encoded RAN TRANSPARENT CONTAINER to be sent. + * (this function will take ownership of msg). + * \param[in] nsei BSSGP network service entity identifier (NSEI). + * \returns 0 on sccess, -EINVAL on error. */ +int bssgp_tx_rim_encoded(struct msgb *msg, uint16_t nsei) +{ + struct bssgp_normal_hdr *bgph; + + msgb_nsei(msg) = nsei; + msgb_bvci(msg) = 0; /* Signalling */ + + bgph = (struct bssgp_normal_hdr *)msgb_bssgph(msg); + DEBUGP(DLBSSGP, "BSSGP BVCI=0 NSEI=%u Tx RIM-PDU:%s\n", + nsei, bssgp_pdu_str(bgph->pdu_type)); + + return bssgp_ns_send(bssgp_ns_send_data, msg); +} + /* For internal use only (called from gprs_bssgp.c) */ int bssgp_rx_rim(struct msgb *msg, struct tlv_parsed *tp, uint16_t bvci) { diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map index e02273d91..7dc427b74 100644 --- a/src/gb/libosmogb.map +++ b/src/gb/libosmogb.map @@ -56,6 +56,7 @@ bssgp_tx_resume; bssgp_tx_resume_ack; bssgp_tx_resume_nack; bssgp_tx_rim; +bssgp_tx_rim_encoded; bssgp_tx_simple_bvci; bssgp_tx_status; bssgp_tx_suspend;