Use F1 UE Context Release Command in stack
Use the new type and remove the old one.
This commit is contained in:
@@ -199,6 +199,7 @@ void *F1AP_CU_task(void *arg) {
|
||||
case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc
|
||||
CU_send_UE_CONTEXT_RELEASE_COMMAND(assoc_id,
|
||||
&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg));
|
||||
free_ue_context_rel_cmd(&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg));
|
||||
break;
|
||||
|
||||
case F1AP_PAGING_IND:
|
||||
|
||||
@@ -104,93 +104,19 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CU_send_UE_CONTEXT_RELEASE_COMMAND(sctp_assoc_t assoc_id, f1ap_ue_context_release_cmd_t *cmd)
|
||||
int CU_send_UE_CONTEXT_RELEASE_COMMAND(sctp_assoc_t assoc_id, f1ap_ue_context_rel_cmd_t *cmd)
|
||||
{
|
||||
F1AP_F1AP_PDU_t pdu= {0};
|
||||
F1AP_UEContextReleaseCommand_t *out;
|
||||
uint8_t *buffer=NULL;
|
||||
uint32_t len=0;
|
||||
/* Create */
|
||||
/* 0. Message Type */
|
||||
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
|
||||
asn1cCalloc(pdu.choice.initiatingMessage, tmp);
|
||||
tmp->procedureCode = F1AP_ProcedureCode_id_UEContextRelease;
|
||||
tmp->criticality = F1AP_Criticality_reject;
|
||||
tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand;
|
||||
out = &tmp->value.choice.UEContextReleaseCommand;
|
||||
/* mandatory */
|
||||
/* c1. GNB_CU_UE_F1AP_ID */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie1);
|
||||
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
|
||||
ie1->criticality = F1AP_Criticality_reject;
|
||||
ie1->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID;
|
||||
ie1->value.choice.GNB_CU_UE_F1AP_ID = cmd->gNB_CU_ue_id;
|
||||
/* mandatory */
|
||||
/* c2. GNB_DU_UE_F1AP_ID */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie2);
|
||||
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
|
||||
ie2->criticality = F1AP_Criticality_reject;
|
||||
ie2->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
|
||||
ie2->value.choice.GNB_DU_UE_F1AP_ID = cmd->gNB_DU_ue_id;
|
||||
/* mandatory */
|
||||
/* c3. Cause */
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie3);
|
||||
ie3->id = F1AP_ProtocolIE_ID_id_Cause;
|
||||
ie3->criticality = F1AP_Criticality_ignore;
|
||||
ie3->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause;
|
||||
F1AP_F1AP_PDU_t *pdu = encode_ue_context_rel_cmd(cmd);
|
||||
|
||||
switch (cmd->cause) {
|
||||
case F1AP_CAUSE_RADIO_NETWORK:
|
||||
ie3->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork;
|
||||
ie3->value.choice.Cause.choice.radioNetwork = cmd->cause_value;
|
||||
break;
|
||||
|
||||
case F1AP_CAUSE_TRANSPORT:
|
||||
ie3->value.choice.Cause.present = F1AP_Cause_PR_transport;
|
||||
ie3->value.choice.Cause.choice.transport = cmd->cause_value;
|
||||
break;
|
||||
|
||||
case F1AP_CAUSE_PROTOCOL:
|
||||
ie3->value.choice.Cause.present = F1AP_Cause_PR_protocol;
|
||||
ie3->value.choice.Cause.choice.protocol = cmd->cause_value;
|
||||
break;
|
||||
|
||||
case F1AP_CAUSE_MISC:
|
||||
ie3->value.choice.Cause.present = F1AP_Cause_PR_misc;
|
||||
ie3->value.choice.Cause.choice.misc = cmd->cause_value;
|
||||
break;
|
||||
|
||||
case F1AP_CAUSE_NOTHING:
|
||||
default:
|
||||
ie3->value.choice.Cause.present = F1AP_Cause_PR_NOTHING;
|
||||
break;
|
||||
}
|
||||
|
||||
/* optional */
|
||||
/* c4. RRCContainer */
|
||||
if(cmd->rrc_container!=NULL){
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie4);
|
||||
ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer;
|
||||
ie4->criticality = F1AP_Criticality_ignore;
|
||||
ie4->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer;
|
||||
OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *)cmd->rrc_container,
|
||||
cmd->rrc_container_length);
|
||||
|
||||
// conditionally have SRBID if RRC Container
|
||||
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie5);
|
||||
ie5->id = F1AP_ProtocolIE_ID_id_SRBID;
|
||||
ie5->criticality = F1AP_Criticality_ignore;
|
||||
ie5->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_SRBID;
|
||||
ie5->value.choice.SRBID = cmd->srb_id;
|
||||
}
|
||||
|
||||
/* encode */
|
||||
if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) {
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t len = 0;
|
||||
if (f1ap_encode_pdu(pdu, &buffer, &len) < 0) {
|
||||
LOG_E(F1AP, "Failed to encode F1 context release command\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
f1ap_itti_send_sctp_data_req(assoc_id, buffer, len);
|
||||
ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc
|
||||
/*
|
||||
* UE Context Release (gNB-CU initiated)
|
||||
*/
|
||||
int CU_send_UE_CONTEXT_RELEASE_COMMAND(sctp_assoc_t assoc_id,
|
||||
f1ap_ue_context_release_cmd_t *cmd);
|
||||
int CU_send_UE_CONTEXT_RELEASE_COMMAND(sctp_assoc_t assoc_id, f1ap_ue_context_rel_cmd_t *cmd);
|
||||
|
||||
int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu);
|
||||
|
||||
|
||||
@@ -94,61 +94,15 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_context_re
|
||||
|
||||
int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
F1AP_UEContextReleaseCommand_t *container;
|
||||
F1AP_UEContextReleaseCommandIEs_t *ie;
|
||||
|
||||
f1ap_ue_context_release_cmd_t ue_context_release = {0};
|
||||
f1ap_ue_context_release_cmd_t *f1ap_ue_context_release_cmd = &ue_context_release;
|
||||
|
||||
DevAssert(pdu);
|
||||
container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
|
||||
// GNB_CU_UE_F1AP_ID
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
|
||||
f1ap_ue_context_release_cmd->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
|
||||
// GNB_DU_UE_F1AP_ID
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
f1ap_ue_context_release_cmd->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
|
||||
|
||||
// We don't need the Cause
|
||||
// Optional RRC Container: if present, send to UE
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_RRCContainer, false);
|
||||
|
||||
if (ie != NULL) {
|
||||
f1ap_ue_context_release_cmd->rrc_container = malloc(ie->value.choice.RRCContainer.size);
|
||||
AssertFatal(f1ap_ue_context_release_cmd->rrc_container != NULL, "out of memory\n");
|
||||
memcpy(f1ap_ue_context_release_cmd->rrc_container, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size);
|
||||
f1ap_ue_context_release_cmd->rrc_container_length = ie->value.choice.RRCContainer.size;
|
||||
|
||||
// conditionally have SRB ID if there is RRC container
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true);
|
||||
f1ap_ue_context_release_cmd->srb_id = ie->value.choice.SRBID;
|
||||
f1ap_ue_context_rel_cmd_t cmd = {0};
|
||||
if (!decode_ue_context_rel_cmd(pdu, &cmd)) {
|
||||
LOG_E(F1AP, "cannot decode F1 UE Context Release Command\n");
|
||||
free_ue_context_rel_cmd(&cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_Cause, true);
|
||||
switch (ie->value.choice.Cause.present){
|
||||
case F1AP_Cause_PR_radioNetwork:
|
||||
f1ap_ue_context_release_cmd->cause = F1AP_CAUSE_RADIO_NETWORK;
|
||||
break;
|
||||
case F1AP_Cause_PR_transport:
|
||||
f1ap_ue_context_release_cmd->cause = F1AP_CAUSE_TRANSPORT;
|
||||
break;
|
||||
case F1AP_Cause_PR_protocol:
|
||||
f1ap_ue_context_release_cmd->cause = F1AP_CAUSE_PROTOCOL;
|
||||
break;
|
||||
case F1AP_Cause_PR_misc:
|
||||
f1ap_ue_context_release_cmd->cause = F1AP_CAUSE_MISC;
|
||||
break;
|
||||
default:
|
||||
LOG_W(F1AP, "Unknown cause for UE context release command\n");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
ue_context_release_command(f1ap_ue_context_release_cmd);
|
||||
ue_context_release_command(&cmd);
|
||||
free_ue_context_rel_cmd(&cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user