Change in osmo-hnodeb[master]: Move rua related code to rua.c/h

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Nov 2 12:00:32 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/25999 )

Change subject: Move rua related code to rua.c/h
......................................................................

Move rua related code to rua.c/h

Change-Id: Ibefe952fe1b642cab5c4abe36383a7ebb05f39c3
---
M include/osmocom/hnodeb/rua.h
M src/osmo-hnodeb/main.c
M src/osmo-hnodeb/rua.c
3 files changed, 66 insertions(+), 64 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved
  laforge: Looks good to me, approved



diff --git a/include/osmocom/hnodeb/rua.h b/include/osmocom/hnodeb/rua.h
index 28d0a1a..9d7cc12 100644
--- a/include/osmocom/hnodeb/rua.h
+++ b/include/osmocom/hnodeb/rua.h
@@ -23,5 +23,4 @@
 
 struct hnb;
 
-void hnb_rua_dt_handle(struct hnb *hnb, struct ANY *in);
-void hnb_rua_cl_handle(struct hnb *hnb, struct ANY *in);
+int hnb_rua_rx(struct hnb *hnb, struct msgb *msg);
diff --git a/src/osmo-hnodeb/main.c b/src/osmo-hnodeb/main.c
index a9c26bf..0fcb909 100644
--- a/src/osmo-hnodeb/main.c
+++ b/src/osmo-hnodeb/main.c
@@ -476,66 +476,6 @@
 
 extern void direct_transfer_nas_pdu_print(ANY_t *in);
 
-int hnb_rua_rx(struct hnb *hnb, struct msgb *msg)
-{
-	RUA_RUA_PDU_t _pdu, *pdu = &_pdu;
-	asn_dec_rval_t dec_ret;
-
-	memset(pdu, 0, sizeof(*pdu));
-	dec_ret = aper_decode(NULL, &asn_DEF_RUA_RUA_PDU, (void **) &pdu,
-			      msg->data, msgb_length(msg), 0, 0);
-	if (dec_ret.code != RC_OK) {
-		LOGP(DMAIN, LOGL_ERROR, "Error in ASN.1 decode\n");
-		return -EINVAL;
-	}
-
-	switch (pdu->present) {
-	case RUA_RUA_PDU_PR_successfulOutcome:
-		printf("RUA_RUA_PDU_PR_successfulOutcome\n");
-		break;
-	case RUA_RUA_PDU_PR_initiatingMessage:
-		printf("RUA_RUA_PDU_PR_initiatingMessage\n");
-		break;
-	case RUA_RUA_PDU_PR_NOTHING:
-		printf("RUA_RUA_PDU_PR_NOTHING\n");
-		break;
-	case RUA_RUA_PDU_PR_unsuccessfulOutcome:
-		printf("RUA_RUA_PDU_PR_unsuccessfulOutcome\n");
-		break;
-	default:
-		printf("Unexpected RUA message received\n");
-		break;
-	}
-
-	switch (pdu->choice.successfulOutcome.procedureCode) {
-	case RUA_ProcedureCode_id_ConnectionlessTransfer:
-		printf("RUA rx Connectionless Transfer\n");
-		hnb_rua_cl_handle(hnb, &pdu->choice.successfulOutcome.value);
-		break;
-	case RUA_ProcedureCode_id_Connect:
-		printf("RUA rx Connect\n");
-		break;
-	case RUA_ProcedureCode_id_DirectTransfer:
-		printf("RUA rx DirectTransfer\n");
-		hnb_rua_dt_handle(hnb, &pdu->choice.successfulOutcome.value);
-		break;
-	case RUA_ProcedureCode_id_Disconnect:
-		printf("RUA rx Disconnect\n");
-		break;
-	case RUA_ProcedureCode_id_ErrorIndication:
-		printf("RUA rx ErrorIndication\n");
-		break;
-	case RUA_ProcedureCode_id_privateMessage:
-		printf("RUA rx privateMessage\n");
-		break;
-	default:
-		printf("RUA rx unknown message\n");
-		break;
-	}
-
-	return 0;
-}
-
 static int hnb_read_cb(struct osmo_fd *fd)
 {
 	struct hnb *hnb = fd->data;
diff --git a/src/osmo-hnodeb/rua.c b/src/osmo-hnodeb/rua.c
index 3db9de7..0839c0d 100644
--- a/src/osmo-hnodeb/rua.c
+++ b/src/osmo-hnodeb/rua.c
@@ -17,6 +17,9 @@
  * along with this program.  If not, see <http://www.gnu.org/lienses/>.
  *
  */
+
+#include <errno.h>
+
 #include <asn1c/ANY.h>
 
 #include <osmocom/rua/rua_ies_defs.h>
@@ -26,7 +29,7 @@
 #include <osmocom/hnodeb/ranap.h>
 
 
-void hnb_rua_dt_handle(struct hnb *hnb, ANY_t *in)
+static void hnb_rua_dt_handle(struct hnb *hnb, ANY_t *in)
 {
 	RUA_DirectTransferIEs_t ies;
 	int rc;
@@ -43,7 +46,7 @@
 	rua_free_directtransferies(&ies);
 }
 
-void hnb_rua_cl_handle(struct hnb *hnb, ANY_t *in)
+static void hnb_rua_cl_handle(struct hnb *hnb, ANY_t *in)
 {
 	RUA_ConnectionlessTransferIEs_t ies;
 	int rc;
@@ -59,3 +62,63 @@
 	/* FIXME: what to do with the asn1c-allocated memory */
 	rua_free_connectionlesstransferies(&ies);
 }
+
+int hnb_rua_rx(struct hnb *hnb, struct msgb *msg)
+{
+	RUA_RUA_PDU_t _pdu, *pdu = &_pdu;
+	asn_dec_rval_t dec_ret;
+
+	memset(pdu, 0, sizeof(*pdu));
+	dec_ret = aper_decode(NULL, &asn_DEF_RUA_RUA_PDU, (void **) &pdu,
+			      msg->data, msgb_length(msg), 0, 0);
+	if (dec_ret.code != RC_OK) {
+		LOGP(DMAIN, LOGL_ERROR, "Error in ASN.1 decode\n");
+		return -EINVAL;
+	}
+
+	switch (pdu->present) {
+	case RUA_RUA_PDU_PR_successfulOutcome:
+		printf("RUA_RUA_PDU_PR_successfulOutcome\n");
+		break;
+	case RUA_RUA_PDU_PR_initiatingMessage:
+		printf("RUA_RUA_PDU_PR_initiatingMessage\n");
+		break;
+	case RUA_RUA_PDU_PR_NOTHING:
+		printf("RUA_RUA_PDU_PR_NOTHING\n");
+		break;
+	case RUA_RUA_PDU_PR_unsuccessfulOutcome:
+		printf("RUA_RUA_PDU_PR_unsuccessfulOutcome\n");
+		break;
+	default:
+		printf("Unexpected RUA message received\n");
+		break;
+	}
+
+	switch (pdu->choice.successfulOutcome.procedureCode) {
+	case RUA_ProcedureCode_id_ConnectionlessTransfer:
+		printf("RUA rx Connectionless Transfer\n");
+		hnb_rua_cl_handle(hnb, &pdu->choice.successfulOutcome.value);
+		break;
+	case RUA_ProcedureCode_id_Connect:
+		printf("RUA rx Connect\n");
+		break;
+	case RUA_ProcedureCode_id_DirectTransfer:
+		printf("RUA rx DirectTransfer\n");
+		hnb_rua_dt_handle(hnb, &pdu->choice.successfulOutcome.value);
+		break;
+	case RUA_ProcedureCode_id_Disconnect:
+		printf("RUA rx Disconnect\n");
+		break;
+	case RUA_ProcedureCode_id_ErrorIndication:
+		printf("RUA rx ErrorIndication\n");
+		break;
+	case RUA_ProcedureCode_id_privateMessage:
+		printf("RUA rx privateMessage\n");
+		break;
+	default:
+		printf("RUA rx unknown message\n");
+		break;
+	}
+
+	return 0;
+}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hnodeb/+/25999
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: Ibefe952fe1b642cab5c4abe36383a7ebb05f39c3
Gerrit-Change-Number: 25999
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211102/ffaeed79/attachment.htm>


More information about the gerrit-log mailing list