mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-hnodeb.git
synced 2025-10-23 08:22:16 +00:00
Move rua related code to rua.c/h
Change-Id: Ibefe952fe1b642cab5c4abe36383a7ebb05f39c3
This commit is contained in:
@@ -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);
|
||||
|
@@ -476,66 +476,6 @@ int hnb_hnbap_rx(struct hnb *hnb, struct msgb *msg)
|
||||
|
||||
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;
|
||||
|
@@ -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 @@ void hnb_rua_dt_handle(struct hnb *hnb, ANY_t *in)
|
||||
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 @@ void hnb_rua_cl_handle(struct hnb *hnb, ANY_t *in)
|
||||
/* 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user