dexter has uploaded this change for review.

View Change

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
---
M include/osmocom/gprs/gprs_bssgp_rim.h
M src/gb/gprs_bssgp_rim.c
M src/gb/libosmogb.map
3 files changed, 39 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/17/34117/1
diff --git a/include/osmocom/gprs/gprs_bssgp_rim.h b/include/osmocom/gprs/gprs_bssgp_rim.h
index 5f397c9..4c0a57b 100644
--- a/include/osmocom/gprs/gprs_bssgp_rim.h
+++ b/include/osmocom/gprs/gprs_bssgp_rim.h
@@ -270,3 +270,4 @@
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 d6f1fb6..03e31ba 100644
--- a/src/gb/gprs_bssgp_rim.c
+++ b/src/gb/gprs_bssgp_rim.c
@@ -1180,6 +1180,25 @@
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 e02273d..7dc427b 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -56,6 +56,7 @@
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;

To view, visit change 34117. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id4a793bbaf32d7b9d894dcc5be3faaf2f2d91d82
Gerrit-Change-Number: 34117
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: newchange