uint8_t BuildAndSendUeContextReleaseCommand(uint32_t duId, uint8_t cuUeF1apId, uint8_t duUeF1apId)
{
bool memAllocFailed = false;
- uint8_t ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
+ uint8_t duIdx = 0, ieIdx = 0,elementCnt = 0, ret = RFAILED, bufLen=0;
+ DuDb *duDb;
+ CuUeCb *ueCb;
F1AP_PDU_t *f1apMsg = NULLP;
UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
ueContextReleaseCommand =&f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
- elementCnt = 4;
+ SEARCH_DU_DB(duIdx, duId, duDb);
+ ueCb = &duDb->ueCb[duUeF1apId-1];
+ if(ueCb->state == UE_HANDOVER_IN_PROGRESS)
+ elementCnt = 3;
+ else
+ elementCnt = 4;
+
ueContextReleaseCommand->protocolIEs.list.count = elementCnt;
ueContextReleaseCommand->protocolIEs.list.size = elementCnt*sizeof(UEContextReleaseCommand_t*);
{
break;
}
+
ieIdx=0;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID =duUeF1apId;
+ /* Cause of UE context release */
ieIdx++;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_Cause;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present=\
- UEContextReleaseCommandIEs__value_PR_Cause;
+ UEContextReleaseCommandIEs__value_PR_Cause;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.present = Cause_PR_radioNetwork;
ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.Cause.choice.radioNetwork=\
- CauseRadioNetwork_normal_release;
-
- /* RRC Container for RRC release */
- ieIdx++;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
- UEContextReleaseCommandIEs__value_PR_RRCContainer;
- char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
- bufLen =7;
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
- CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
- ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
- if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
- {
- DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
- break;
+ CauseRadioNetwork_normal_release;
+ if(ueCb->state != UE_HANDOVER_IN_PROGRESS)
+ {
+ /* RRC Container for RRC release */
+ ieIdx++;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_RRCContainer;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->criticality = Criticality_ignore;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.present = \
+ UEContextReleaseCommandIEs__value_PR_RRCContainer;
+ char secModeBuf[7]={ 0x00, 0x05, 0x13, 0x00, 0x00, 0x00, 0x00};
+ bufLen =7;
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size = bufLen;
+ CU_ALLOC(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,
+ ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
+ if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
+ break;
+ }
+ memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
+ memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
}
- memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
- memcpy(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, secModeBuf, bufLen);
-
xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
/* Encode the UE Context Release Command type as APER */