uint8_t BuildDLRRCContainer(uint8_t rrcMsgType, RRCContainer_t *rrcContainer)
{
- uint8_t ret = ROK;
-
+ uint8_t ret, idx2, bufLen;
+
+ ret =ROK;
if(rrcMsgType == RRC_SETUP)
{
ret = fillDlCcchRrcMsg(rrcContainer);
if(ret == RFAILED)
- DU_LOG("\n F1AP: Failed to fill DL-CCCH Msg at BuildDLRRCContainer()");
+ DU_LOG("\n F1AP: Failed to fill DL-CCCH Msg at RRC SETUP");
+ }
+ else if(rrcMsgType == REGISTRATION_ACCEPT)
+ {
+ /*Hardcoded RRC Container from reference logs*/
+ char buf[14] ={0x00, 0x03, 0x2a, 0x80, 0xaf, 0xc0, 0x08, 0x40, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00};
+ bufLen =14;
+ rrcContainer->size = bufLen;
+ CU_ALLOC(rrcContainer->buf, rrcContainer->size);
+ if(rrcContainer->buf != NULLP)
+ {
+ memset(rrcContainer->buf, 0, encBufSize);
+ for(idx2 = 0; idx2 < encBufSize; idx2++)
+ {
+ rrcContainer->buf[idx2] = buf[idx2];
+ }
+ }
}
else if(rrcMsgType == RRC_RECONFIG)
{
- ret = fillDlDcchRrcMsg(rrcContainer);
- if(ret == RFAILED)
- DU_LOG("\n F1AP: Failed at fill DL-DCCH Msg at BuildDLRRCContainer()");
+ /*Hardcoded RRC Container from reference logs*/
+ char buf[196]= {
+ 0x00, 0x04, 0x00, 0xaa, 0x80, 0x40, 0x9a, 0x05, 0x20, 0x00, 0x05, 0xeb, 0xc0, 0x51, 0x50, 0x00,
+ 0x03, 0x00, 0x03, 0xf7, 0x56, 0xec, 0x7f, 0x08, 0x42, 0x10, 0x80, 0x00, 0x10, 0x21, 0x47, 0x84,
+ 0xd1, 0x00, 0x00, 0x00, 0x02, 0x81, 0x5d, 0x10, 0x0a, 0xc2, 0x44, 0x40, 0x2b, 0xb2, 0x07, 0x41,
+ 0x87, 0xa8, 0x02, 0xc7, 0x00, 0x88, 0x05, 0x76, 0x40, 0xe8, 0x30, 0xf5, 0x40, 0x4c, 0x00, 0x10,
+ 0x02, 0x00, 0xa5, 0x83, 0xe0, 0x60, 0x02, 0x10, 0x72, 0x01, 0x0c, 0xa0, 0xa0, 0xd8, 0x00, 0x00,
+ 0x00, 0x01, 0x0f, 0x02, 0x3c, 0x01, 0x80, 0x10, 0x82, 0xb0, 0x40, 0x00, 0x00, 0x02, 0x1e, 0x04,
+ 0x78, 0x07, 0x00, 0x21, 0x05, 0x61, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x08, 0xf0, 0x16, 0x00, 0x42,
+ 0x0a, 0xc3, 0x00, 0x00, 0x00, 0x08, 0x78, 0x11, 0xe0, 0x3c, 0x00, 0x84, 0x14, 0x00, 0x07, 0xe5,
+ 0xc0, 0xa0, 0xd8, 0x42, 0x20, 0x02, 0x80, 0xa0, 0x02, 0x24, 0x47, 0xa0, 0x20, 0x27, 0xa1, 0x22,
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x41, 0x20, 0xc0, 0x80, 0x00, 0x20, 0x80,
+ 0x00, 0x25, 0x20, 0xa0, 0x38, 0x00, 0x00, 0x00, 0x44, 0xa2, 0x82, 0x69, 0xee, 0x0c, 0xad, 0xca,
+ 0x4c, 0x2c, 0x8d, 0x2e, 0x6f, 0x2e, 0x69, 0x2d, 0xce, 0x8c, 0xae, 0x4d, 0xcc, 0xae, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00};
+ bufLen =196;
+ rrcContainer->size = bufLen;
+ CU_ALLOC(rrcContainer->buf, rrcContainer->size);
+ if(rrcContainer->buf != NULLP)
+ {
+ memset(rrcContainer->buf, 0, encBufSize);
+ for(idx2 = 0; idx2 < encBufSize; idx2++)
+ {
+ rrcContainer->buf[idx2] = buf[idx2];
+ }
+ }
}
+
return ret;
}
* RFAILED - failure
*
* ****************************************************************/
-uint8_t BuildAndSendDLRRCMessageTransfer(uint8_t rrcMsgType)
+uint8_t BuildAndSendDLRRCMessageTransfer(uint8_t srbId, uint8_t rrcMsgType)
{
uint8_t elementCnt = 0;
uint8_t ieId;
dlRRCMsg->protocolIEs.list.array[idx]->criticality = Criticality_reject;
dlRRCMsg->protocolIEs.list.array[idx]->value.present = \
DLRRCMessageTransferIEs__value_PR_SRBID;
- dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = SRB0;
+ dlRRCMsg->protocolIEs.list.array[idx]->value.choice.SRBID = srbId;
/* RRCContainer */
idx++;
case RRC_SETUP:
rrcMsgType = RRC_SETUP;
break;
- case RRC_SECURITY_MODE_COMMAND:
- rrcMsgType = RRC_SECURITY_MODE_COMMAND;
+ case REGISTRATION_ACCEPT:
+ rrcMsgType = REGISTRATION_ACCEPT;
+ break;
+ case UE_CONTEXT_SETUP_REQ:
+ rrcMsgType = UE_CONTEXT_SETUP_REQ;
break;
case RRC_RECONFIG:
rrcMsgType = RRC_RECONFIG;
{
f1apMsgDb.dlRrcMsgCount++;
rrcMsgType = setDlRRCMsgType();
- ret = BuildAndSendDLRRCMessageTransfer(rrcMsgType);
+ ret = BuildAndSendDLRRCMessageTransfer(SRB0, rrcMsgType);
}
return ret;
}
uint8_t SplCellListret;
uint8_t SrbSetupret;
uint8_t elementCnt;
- uint8_t idx;
+ uint8_t idx, bufLen;
uint8_t idx1;
F1AP_PDU_t *f1apMsg = NULLP;
UEContextSetupRequest_t *ueSetReq = NULLP;
{
break;
}
-
- /* RRC Container */
+ /* RRC Container for security mode */
idx++;
ueSetReq->protocolIEs.list.array[idx]->id = ProtocolIE_ID_id_RRCContainer;
ueSetReq->protocolIEs.list.array[idx]->criticality = Criticality_reject;
ueSetReq->protocolIEs.list.array[idx]->value.present = \
UEContextSetupRequestIEs__value_PR_RRCContainer;
- ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = rrcContLen;
+ char buf[9]={0x00, 0x02, 0x22, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00};
+ bufLen =9;
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size = bufLen;
CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,
ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf)
DU_LOG(" F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed");
break;
}
- memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
- rrcContainer, ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+ memset(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, 0, encBufSize);
+ for(idx1 = 0; idx1 < encBufSize; idx1++)
+ {
+ ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf[idx1] = buf[idx1];
+ }
/* RRC delivery status request */
idx++;
{
f1apMsgDb.dlRrcMsgCount++;
rrcMsgType = setDlRRCMsgType();
- if(rrcMsgType == RRC_SECURITY_MODE_COMMAND)
+ if(rrcMsgType == REGISTRATION_ACCEPT)
{
- ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId, rrcContLen, rrcContainer);
+ DU_LOG("\nSending DL RRC MSG for RRC Registration Complete");
+ ret = BuildAndSendDLRRCMessageTransfer(srbId, rrcMsgType);
}
- if(rrcMsgType == RRC_RECONFIG)
+ if(rrcMsgType == UE_CONTEXT_SETUP_REQ)
{
- ret = BuildAndSendDLRRCMessageTransfer(rrcMsgType);
+ DU_LOG("\nSending Ue Context Setup Req");
+ ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId,\
+ rrcContLen, rrcContainer);
}
}
return ret;
}
case SuccessfulOutcome__value_PR_UEContextSetupResponse:
{
+ uint8_t rrcMsgType;
+
DU_LOG("\nF1AP : UE ContextSetupResponse received");
+ f1apMsgDb.dlRrcMsgCount++;
+ rrcMsgType = setDlRRCMsgType();
+ if(rrcMsgType == RRC_RECONFIG)
+ {
+ DU_LOG("\nImplementing DL RRC MSG for RRC Reconfig Complete");
+ BuildAndSendDLRRCMessageTransfer(SRB1, rrcMsgType);
+ }
break;
}
default:
{
msg3Sent = true;
type = MSG_TYPE_MSG3;
+ sleep(2);
}
else if(!msg5ShortBsrSent)
{
msg5Sent = true;
type = MSG_TYPE_MSG5;
}
+ else if(!msgRegistrationComp)
+ {
+ msgRegistrationComp = true;
+ type = MSG_TYPE_REGISTRATION_COMPLETE;
+ }
else if(!msgSecurityModeComp)
{
msgSecurityModeComp = true;
type = MSG_TYPE_SECURITY_MODE_COMPLETE;
}
+ else if(!msgRrcReconfiguration)
+ {
+ msgRrcReconfiguration = true;
+ type = MSG_TYPE_RRC_RECONFIG_COMPLETE;
+ }
else
return RFAILED;
break;
}
-
case MSG_TYPE_SHORT_BSR:
- {
- DU_LOG("\nPHY_STUB: Forming SHORT BSR PDU ");
- uint8_t lcgId = 0;
- uint8_t bufferSizeIdx = 6;
-
- /* For Short BSR
- MAC subheader format is R/R/LcId (1Byte)
- LCId is 61
- From 38.321 section 6.1.1
- */
- pdu[byteIdx++] = 61; // LCID
- pdu[byteIdx++] = (lcgId << 5) | bufferSizeIdx;
+ {
+ DU_LOG("\nPHY_STUB: Forming SHORT BSR PDU ");
+ uint8_t lcgId = 0;
+ uint8_t bufferSizeIdx = 6;
+
+ /* For Short BSR
+ MAC subheader format is R/R/LcId (1Byte)
+ LCId is 61
+ From 38.321 section 6.1.1
+ */
+ pdu[byteIdx++] = 61; // LCID
+ pdu[byteIdx++] = (lcgId << 5) | bufferSizeIdx;
- break;
- }
+ break;
+ }
case MSG_TYPE_MSG5:
- {
- DU_LOG("\nPHY_STUB: Forming MSG5 PDU");
- uint8_t msg5PduLen = 33;
- /* For RRC setup complete
- MAC subheader format is R/F/LCId/L (2/3 bytes)
- LCId is 1 for SRB1
- L is length of PDU i.e 6bytes here
- From 38.321 section 6.1.1
- */
- uint8_t msg5[] = {1, msg5PduLen, 0, 0, 16, 0, 5, 223, 128, 16, 94, \
- 64, 3, 64, 89, 61, 138, 64, 0, 0, 0, 4, 0, 0, 4, 68, 11, 128, \
+ {
+ DU_LOG("\nPHY_STUB: Forming MSG5 PDU");
+ uint8_t msg5PduLen = 33;
+ /* For RRC setup complete
+ MAC subheader format is R/F/LCId/L (2/3 bytes)
+ LCId is 1 for SRB1
+ L is length of PDU i.e 6bytes here
+ From 38.321 section 6.1.1
+ */
+ uint8_t msg5[] = {1, msg5PduLen, 0, 0, 16, 0, 5, 223, 128, 16, 94, \
+ 64, 3, 64, 89, 61, 138, 64, 0, 0, 0, 4, 0, 0, 4, 68, 11, 128, \
184, 56, 0, 0, 0, 0, 0};
- msg5PduLen += 2; /* 2bytes of header */
- memcpy(pdu, &msg5, msg5PduLen);
- byteIdx += msg5PduLen; /* 2 bytes of header */
- break;
- }
+ msg5PduLen += 2; /* 2bytes of header */
+ memcpy(pdu, &msg5, msg5PduLen);
+ byteIdx += msg5PduLen; /* 2 bytes of header */
+ break;
+ }
case MSG_TYPE_SECURITY_MODE_COMPLETE:
- {
- DU_LOG("\nPHY_STUB: Forming SECURITY MODE COMPLETE PDU");
- uint8_t pduLen = 33;
- /* For security mode complete
- MAC subheader format is R/F/LCId/L (2/3 bytes)
- LCId is 1 for SRB1
- L is length of PDU i.e 6bytes here
- From 38.321 section 6.1.1
- */
- uint8_t msg[] = {1, pduLen, 0, 0, 16, 0, 5, 223, 128, 16, 94, \
- 64, 3, 64, 89, 61, 138, 64, 0, 0, 0, 4, 0, 0, 4, 68, 11, 128, \
- 184, 56, 0, 0, 0, 0, 0};
+ {
+ DU_LOG("\nPHY_STUB: Forming SECURITY MODE COMPLETE PDU");
+ uint8_t pduLen = 12;
+ /* For security mode complete where RRC Container is dummy
+ MAC subheader format is R/F/LCId/L (2/3 bytes)
+ LCId is 1 for SRB1
+ L is length of PDU i.e 6bytes here
+ From 38.321 section 6.1.1
+ */
+ uint8_t msg[] = {1, pduLen, 0, 3, 0x2a, 0x40, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ pduLen += 2; /* 2bytes of header */
+ memcpy(pdu, &msg, pduLen);
+ byteIdx += pduLen; /* 2 bytes of header */
+ break;
+ }
+ case MSG_TYPE_REGISTRATION_COMPLETE:
+ {
+
+ DU_LOG("\nPHY_STUB: Forming RRC REGISTRATION COMPLETE PDU");
+ uint8_t pduLen = 12;
+ /* For rrc reconfig complete where RRC Container is dummy
+ MAC subheader format is R/F/LCId/L (2/3 bytes)
+ LCId is 1 for SRB1
+ L is length of PDU i.e 6bytes here
+ From 38.321 section 6.1.1
+ */
+ uint8_t msg[] = {1, pduLen, 0, 0x04, 0x3a, 0x81, 0xbf, 0, 0x21, 0x80, 0, \
+ 0, 0, 0};
+
+ pduLen += 2; /* 2bytes of header */
+ memcpy(pdu, &msg, pduLen);
+ byteIdx += pduLen; /* 2 bytes of header */
+ break;
+ }
+ case MSG_TYPE_RRC_RECONFIG_COMPLETE:
+ {
+ DU_LOG("\nPHY_STUB: Forming RRC RECONFIGURATION PDU");
+ uint8_t pduLen = 14;
+ /* For rrc reconfig complete where RRC Container is dummy
+ MAC subheader format is R/F/LCId/L (2/3 bytes)
+ LCId is 1 for SRB1
+ L is length of PDU i.e 6bytes here
+ From 38.321 section 6.1.1
+ */
+ uint8_t msg[] = {1, pduLen, 0, 6, 8, 64, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0};
+
+ pduLen += 2; /* 2bytes of header */
+ memcpy(pdu, &msg, pduLen);
+ byteIdx += pduLen; /* 2 bytes of header */
+ break;
- pduLen += 2; /* 2bytes of header */
- memcpy(pdu, &msg, pduLen);
- byteIdx += pduLen; /* 2 bytes of header */
- break;
- }
+ }
+
default:
break;
} /* End of switch(type) */
}
if(ulTtiReq->pdus[numPdus-1].pduType == 1)
{
- DU_LOG("\nPHY STUB: PUSCH PDU");
- l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
+ DU_LOG("\nPHY STUB: PUSCH PDU");
+ l1BuildAndSendRxDataInd(ulTtiReq->slot, ulTtiReq->sfn, \
ulTtiReq->pdus[numPdus-1].pdu.pusch_pdu);
}
if(ulTtiReq->pdus[numPdus-1].pduType == 2)