Use GNB-CU-UP E1 Setup Response enc/dec lib in stack
This commit is contained in:
+15
-43
@@ -162,30 +162,10 @@ int e1ap_send_ERROR_INDICATION(instance_t instance, E1AP_ErrorIndication_t *Erro
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void fill_SETUP_RESPONSE(const e1ap_setup_resp_t *e1ap_setup_resp, E1AP_E1AP_PDU_t *pdu)
|
||||
{
|
||||
/* Create */
|
||||
/* 0. pdu Type */
|
||||
pdu->present = E1AP_E1AP_PDU_PR_successfulOutcome;
|
||||
asn1cCalloc(pdu->choice.successfulOutcome, initMsg);
|
||||
initMsg->procedureCode = E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup;
|
||||
initMsg->criticality = E1AP_Criticality_reject;
|
||||
initMsg->value.present = E1AP_SuccessfulOutcome__value_PR_GNB_CU_UP_E1SetupResponse;
|
||||
E1AP_GNB_CU_UP_E1SetupResponse_t *out = &pdu->choice.successfulOutcome->value.choice.GNB_CU_UP_E1SetupResponse;
|
||||
/* mandatory */
|
||||
/* c1. Transaction ID (integer value) */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, E1AP_GNB_CU_UP_E1SetupResponseIEs_t, ieC1);
|
||||
ieC1->id = E1AP_ProtocolIE_ID_id_TransactionID;
|
||||
ieC1->criticality = E1AP_Criticality_reject;
|
||||
ieC1->value.present = E1AP_GNB_CU_UP_E1SetupResponseIEs__value_PR_TransactionID;
|
||||
ieC1->value.choice.TransactionID = e1ap_setup_resp->transac_id;
|
||||
}
|
||||
|
||||
void e1ap_send_SETUP_RESPONSE(sctp_assoc_t assoc_id, const e1ap_setup_resp_t *e1ap_setup_resp)
|
||||
{
|
||||
E1AP_E1AP_PDU_t pdu = {0};
|
||||
fill_SETUP_RESPONSE(e1ap_setup_resp, &pdu);
|
||||
e1ap_encode_send(CPtype, assoc_id, &pdu, 0, __func__);
|
||||
E1AP_E1AP_PDU_t *pdu = encode_e1ap_cuup_setup_response(e1ap_setup_resp);
|
||||
e1ap_encode_send(CPtype, assoc_id, pdu, 0, __func__);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,28 +243,19 @@ int e1apCUCP_handle_SETUP_REQUEST(sctp_assoc_t assoc_id, e1ap_upcp_inst_t *inst,
|
||||
|
||||
int e1apCUUP_handle_SETUP_RESPONSE(sctp_assoc_t assoc_id, e1ap_upcp_inst_t *inst, const E1AP_E1AP_PDU_t *pdu)
|
||||
{
|
||||
LOG_D(E1AP, "%s\n", __func__);
|
||||
DevAssert(pdu->present == E1AP_E1AP_PDU_PR_successfulOutcome);
|
||||
DevAssert(pdu->choice.successfulOutcome->procedureCode == E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup);
|
||||
DevAssert(pdu->choice.successfulOutcome->criticality == E1AP_Criticality_reject);
|
||||
DevAssert(pdu->choice.successfulOutcome->value.present == E1AP_SuccessfulOutcome__value_PR_GNB_CU_UP_E1SetupResponse);
|
||||
const E1AP_GNB_CU_UP_E1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.GNB_CU_UP_E1SetupResponse;
|
||||
E1AP_GNB_CU_UP_E1SetupResponseIEs_t *ie;
|
||||
|
||||
/* transac_id */
|
||||
long transaction_id;
|
||||
// Decode E1 CU-UP Setup Response
|
||||
e1ap_setup_resp_t out = {0};
|
||||
if (!decode_e1ap_cuup_setup_response(pdu, &out)) {
|
||||
free_e1ap_cuup_setup_response(&out);
|
||||
return -1;
|
||||
}
|
||||
long old_transaction_id = inst->cuup.setupReq.transac_id;
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(E1AP_GNB_CU_UP_E1SetupResponseIEs_t, ie, in, E1AP_ProtocolIE_ID_id_TransactionID, true);
|
||||
transaction_id = ie->value.choice.TransactionID;
|
||||
LOG_D(E1AP, "gNB CU UP E1 setup response transaction ID: %ld\n", transaction_id);
|
||||
|
||||
if (old_transaction_id != transaction_id)
|
||||
LOG_E(E1AP, "Transaction IDs do not match %ld != %ld\n", old_transaction_id, transaction_id);
|
||||
|
||||
E1AP_free_transaction_identifier(transaction_id);
|
||||
|
||||
/* do the required processing */
|
||||
|
||||
if (old_transaction_id != out.transac_id) {
|
||||
LOG_E(E1AP, "Transaction IDs do not match %ld != %ld\n", old_transaction_id, out.transac_id);
|
||||
free_e1ap_cuup_setup_response(&out);
|
||||
return -1;
|
||||
}
|
||||
free_e1ap_cuup_setup_response(&out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1295,6 +1266,7 @@ void *E1AP_CUCP_task(void *arg)
|
||||
|
||||
case E1AP_SETUP_RESP:
|
||||
e1ap_send_SETUP_RESPONSE(assoc_id, &E1AP_SETUP_RESP(msg));
|
||||
free_e1ap_cuup_setup_response(&E1AP_SETUP_RESP(msg));
|
||||
break;
|
||||
|
||||
case E1AP_SETUP_FAIL:
|
||||
|
||||
Reference in New Issue
Block a user