Code Review
/
o-du
/
l2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implementation of function for filling k0 and k1 table [Issue-ID: ODUHIGH-341]
[o-du/l2.git]
/
src
/
ric_stub
/
ric_e2ap_msg_hdl.c
diff --git
a/src/ric_stub/ric_e2ap_msg_hdl.c
b/src/ric_stub/ric_e2ap_msg_hdl.c
index
9d31df7
..
851fb5d
100644
(file)
--- a/
src/ric_stub/ric_e2ap_msg_hdl.c
+++ b/
src/ric_stub/ric_e2ap_msg_hdl.c
@@
-26,6
+26,8
@@
#include "ric_e2ap_msg_hdl.h"
#include "GlobalE2node-gNB-ID.h"
#include "ProtocolIE-FieldE2.h"
#include "ric_e2ap_msg_hdl.h"
#include "GlobalE2node-gNB-ID.h"
#include "ProtocolIE-FieldE2.h"
+#include "InitiatingMessageE2.h"
+#include "SuccessfulOutcomeE2.h"
#include "E2AP-PDU.h"
#include "du_log.h"
#include "E2AP-PDU.h"
#include "du_log.h"
@@
-60,14
+62,14
@@
S16 SendE2APMsg(Region region, Pool pool)
if(sctpSend(mBuf) != ROK)
{
if(sctpSend(mBuf) != ROK)
{
- DU_LOG("\nE2AP : SCTP Send for E2 failed");
+ DU_LOG("\nE
RROR --> E
2AP : SCTP Send for E2 failed");
ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
}
else
{
- DU_LOG("\nE2AP : ODU_ADD_POST_MSG_MULT failed");
+ DU_LOG("\nE
RROR --> E
2AP : ODU_ADD_POST_MSG_MULT failed");
ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
ODU_PUT_MSG_BUF(mBuf);
return RFAILED;
}
@@
-75,7
+77,7
@@
S16 SendE2APMsg(Region region, Pool pool)
}
else
{
}
else
{
- DU_LOG("\nE2AP : Failed to allocate memory");
+ DU_LOG("\nE
RROR --> E
2AP : Failed to allocate memory");
return RFAILED;
}
return RFAILED;
}
@@
-100,16
+102,16
@@
S16 SendE2APMsg(Region region, Pool pool)
S16 BuildGlobalRicId(GlobalRIC_ID_t *ricId)
{
S16 BuildGlobalRicId(GlobalRIC_ID_t *ricId)
{
-
U8
unused = 4;
-
U8
byteSize = 3;
-
U8 val = 1
;
+
uint8_t
unused = 4;
+
uint8_t
byteSize = 3;
+
uint8_t val = 16
;
if(ricId != NULLP)
{
if(ricId != NULLP)
{
- ricId->pLMN_Identity.size = byteSize * sizeof(
U8
);
+ ricId->pLMN_Identity.size = byteSize * sizeof(
uint8_t
);
RIC_ALLOC(ricId->pLMN_Identity.buf, ricId->pLMN_Identity.size);
buildPlmnId(ricCfgParams.plmn , ricId->pLMN_Identity.buf);
/* fill ric Id */
RIC_ALLOC(ricId->pLMN_Identity.buf, ricId->pLMN_Identity.size);
buildPlmnId(ricCfgParams.plmn , ricId->pLMN_Identity.buf);
/* fill ric Id */
- ricId->ric_ID.size = byteSize * sizeof(
U8
);
+ ricId->ric_ID.size = byteSize * sizeof(
uint8_t
);
RIC_ALLOC(ricId->ric_ID.buf, ricId->ric_ID.size);
fillBitString(&ricId->ric_ID, unused, byteSize, val);
}
RIC_ALLOC(ricId->ric_ID.buf, ricId->ric_ID.size);
fillBitString(&ricId->ric_ID, unused, byteSize, val);
}
@@
-139,23
+141,23
@@
S16 BuildAndSendE2SetupRsp()
E2AP_PDU_t *e2apMsg = NULL;
E2setupResponse_t *e2SetupRsp;
asn_enc_rval_t encRetVal;
E2AP_PDU_t *e2apMsg = NULL;
E2setupResponse_t *e2SetupRsp;
asn_enc_rval_t encRetVal;
-
U8
idx;
-
U8
elementCnt;
+
uint8_t
idx;
+
uint8_t
elementCnt;
- DU_LOG("\nE2AP : Building E2 Setup Response\n");
+ DU_LOG("\n
INFO -->
E2AP : Building E2 Setup Response\n");
RIC_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
if(e2apMsg == NULLP)
{
RIC_ALLOC(e2apMsg, sizeof(E2AP_PDU_t));
if(e2apMsg == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for E2AP-PDU failed");
return RFAILED;
}
e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
RIC_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
if(e2apMsg->choice.successfulOutcome == NULLP)
{
return RFAILED;
}
e2apMsg->present = E2AP_PDU_PR_successfulOutcome;
RIC_ALLOC(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
if(e2apMsg->choice.successfulOutcome == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for E2AP-PDU failed");
RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t));
return RFAILED;
}
RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t));
return RFAILED;
}
@@
-174,7
+176,7
@@
S16 BuildAndSendE2SetupRsp()
e2SetupRsp->protocolIEs.list.size);
if(e2SetupRsp->protocolIEs.list.array == NULLP)
{
e2SetupRsp->protocolIEs.list.size);
if(e2SetupRsp->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for E2ResponseIEs failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for E2ResponseIEs failed");
RIC_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t));
return RFAILED;
RIC_FREE(e2apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcomeE2_t));
RIC_FREE(e2apMsg, sizeof(E2AP_PDU_t));
return RFAILED;
@@
-211,23
+213,23
@@
S16 BuildAndSendE2SetupRsp()
/* Check encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
/* Check encode results */
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nE2AP : Could not encode E2SetupResponse structure (at %s)\n",\
+ DU_LOG("\nE
RROR --> E
2AP : Could not encode E2SetupResponse structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
return RFAILED;
}
else
{
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
return RFAILED;
}
else
{
- DU_LOG("\nE2AP : Created APER encoded buffer for E2SetupResponse\n");
+ DU_LOG("\n
DEBUG -->
E2AP : Created APER encoded buffer for E2SetupResponse\n");
for(int i=0; i< encBufSize; i++)
{
for(int i=0; i< encBufSize; i++)
{
-
printf
("%x",encBuf[i]);
+
DU_LOG
("%x",encBuf[i]);
}
}
if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK)
{
}
}
if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK)
{
- DU_LOG("\nE2AP : Sending E2 Setup Response failed");
+ DU_LOG("\nE
RROR --> E
2AP : Sending E2 Setup Response failed");
return RFAILED;
}
return RFAILED;
}
@@
-334,14
+336,14
@@
S16 fillSubsDetails(RICaction_ToBeSetup_ItemIEs_t *items)
S16 BuildRicSubsDetails(RICsubscriptionDetails_t *subsDetails)
{
S16 BuildRicSubsDetails(RICsubscriptionDetails_t *subsDetails)
{
-
U8
elementCnt;
+
uint8_t
elementCnt;
if(subsDetails != NULLP)
{
/* Octet string to be build here */
/* Sending PLMN as Octect string */
if(subsDetails != NULLP)
{
/* Octet string to be build here */
/* Sending PLMN as Octect string */
-
U8
byteSize = 3;
- subsDetails->ricEventTriggerDefinition.size = byteSize * sizeof(
U8
);
+
uint8_t
byteSize = 3;
+ subsDetails->ricEventTriggerDefinition.size = byteSize * sizeof(
uint8_t
);
RIC_ALLOC(subsDetails->ricEventTriggerDefinition.buf, subsDetails->ricEventTriggerDefinition.size);
buildPlmnId(ricCfgParams.plmn, subsDetails->ricEventTriggerDefinition.buf);
elementCnt = 1;
RIC_ALLOC(subsDetails->ricEventTriggerDefinition.buf, subsDetails->ricEventTriggerDefinition.size);
buildPlmnId(ricCfgParams.plmn, subsDetails->ricEventTriggerDefinition.buf);
elementCnt = 1;
@@
-352,7
+354,7
@@
S16 BuildRicSubsDetails(RICsubscriptionDetails_t *subsDetails)
subsDetails->ricAction_ToBeSetup_List.list.size);
if(subsDetails->ricAction_ToBeSetup_List.list.array == NULLP)
{
subsDetails->ricAction_ToBeSetup_List.list.size);
if(subsDetails->ricAction_ToBeSetup_List.list.array == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for RICactionToBeSetup Items failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for RICactionToBeSetup Items failed");
return RFAILED;
}
RIC_ALLOC(subsDetails->ricAction_ToBeSetup_List.list.array[0],\
return RFAILED;
}
RIC_ALLOC(subsDetails->ricAction_ToBeSetup_List.list.array[0],\
@@
-380,21
+382,21
@@
S16 BuildRicSubsDetails(RICsubscriptionDetails_t *subsDetails)
S16 BuildAndSendRicSubscriptionReq()
{
S16 BuildAndSendRicSubscriptionReq()
{
- E2AP_PDU_t *e2apRicMsg = NULL;
+ E2AP_PDU_t
*e2apRicMsg = NULL;
RICsubscriptionRequest_t *ricSubscriptionReq;
RICsubscriptionRequest_t *ricSubscriptionReq;
-
U8
elementCnt;
-
U8
idx;
-
U8
ieId;
- S16 ret;
- asn_enc_rval_t
encRetVal; /* Encoder return value */
+
uint8_t
elementCnt;
+
uint8_t
idx;
+
uint8_t
ieId;
+ S16
ret;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
ricSubsStatus = TRUE;
ricSubsStatus = TRUE;
- DU_LOG("\nE2AP : Building RIC Subscription Request\n");
+ DU_LOG("\n
INFO -->
E2AP : Building RIC Subscription Request\n");
RIC_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t));
if(e2apRicMsg == NULLP)
{
RIC_ALLOC(e2apRicMsg, sizeof(E2AP_PDU_t));
if(e2apRicMsg == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for E2AP-PDU failed");
return RFAILED;
}
return RFAILED;
}
@@
-402,7
+404,7
@@
S16 BuildAndSendRicSubscriptionReq()
RIC_ALLOC(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
if(e2apRicMsg->choice.initiatingMessage == NULLP)
{
RIC_ALLOC(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
if(e2apRicMsg->choice.initiatingMessage == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for E2AP-PDU failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for E2AP-PDU failed");
RIC_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
return RFAILED;
}
RIC_FREE(e2apRicMsg, sizeof(E2AP_PDU_t));
return RFAILED;
}
@@
-422,7
+424,7
@@
S16 BuildAndSendRicSubscriptionReq()
ricSubscriptionReq->protocolIEs.list.size);
if(ricSubscriptionReq->protocolIEs.list.array == NULLP)
{
ricSubscriptionReq->protocolIEs.list.size);
if(ricSubscriptionReq->protocolIEs.list.array == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation for RICSubscriptionRequestIEs failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation for RICSubscriptionRequestIEs failed");
RIC_FREE(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
RIC_FREE(e2apRicMsg, (Size)sizeof(E2AP_PDU_t));
return RFAILED;
RIC_FREE(e2apRicMsg->choice.initiatingMessage, sizeof(InitiatingMessageE2_t));
RIC_FREE(e2apRicMsg, (Size)sizeof(E2AP_PDU_t));
return RFAILED;
@@
-486,16
+488,16
@@
S16 BuildAndSendRicSubscriptionReq()
encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
encBuf);
if(encRetVal.encoded == ENCODE_FAIL)
{
- DU_LOG("\nE2AP : Could not encode RicSubscriptionRequest structure (at %s)\n",\
+ DU_LOG("\nE
RROR --> E
2AP : Could not encode RicSubscriptionRequest structure (at %s)\n",\
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
return RFAILED;
}
else
{
encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
return RFAILED;
}
else
{
- DU_LOG("\nE2AP : Created APER encoded buffer for RicSubscriptionRequest\n");
+ DU_LOG("\n
DEBUG -->
E2AP : Created APER encoded buffer for RicSubscriptionRequest\n");
for(int i=0; i< encBufSize; i++)
{
for(int i=0; i< encBufSize; i++)
{
-
printf
("%x",encBuf[i]);
+
DU_LOG
("%x",encBuf[i]);
}
}
}
}
@@
-503,7
+505,7
@@
S16 BuildAndSendRicSubscriptionReq()
/* Sending msg */
if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK)
{
/* Sending msg */
if(SendE2APMsg(RIC_APP_MEM_REG, RIC_POOL) != ROK)
{
- DU_LOG("\nE2AP : Sending RIC subscription Request failed");
+ DU_LOG("\nE
RROR --> E
2AP : Sending RIC subscription Request failed");
return RFAILED;
}
return RFAILED;
}
@@
-530,15
+532,15
@@
S16 BuildAndSendRicSubscriptionReq()
* ****************************************************************/
void E2APMsgHdlr(Buffer *mBuf)
{
* ****************************************************************/
void E2APMsgHdlr(Buffer *mBuf)
{
- int i;
- char *recvBuf;
- MsgLen copyCnt;
- MsgLen recvBufLen;
- E2AP_PDU_t *e2apMsg;
- asn_dec_rval_t rval; /* Decoder return value */
- E2AP_PDU_t e2apasnmsg ;
+ int
i;
+ char
*recvBuf;
+ MsgLen
copyCnt;
+ MsgLen
recvBufLen;
+ E2AP_PDU_t
*e2apMsg;
+ asn_dec_rval_t
rval; /* Decoder return value */
+ E2AP_PDU_t
e2apasnmsg ;
- DU_LOG("\nE2AP : Received E2AP message buffer");
+ DU_LOG("\n
INFO -->
E2AP : Received E2AP message buffer");
ODU_PRINT_MSG(mBuf, 0,0);
/* Copy mBuf into char array to decode it */
ODU_PRINT_MSG(mBuf, 0,0);
/* Copy mBuf into char array to decode it */
@@
-547,19
+549,19
@@
void E2APMsgHdlr(Buffer *mBuf)
if(recvBuf == NULLP)
{
if(recvBuf == NULLP)
{
- DU_LOG("\nE2AP : Memory allocation failed");
+ DU_LOG("\nE
RROR --> E
2AP : Memory allocation failed");
return;
}
if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
{
return;
}
if(ODU_COPY_MSG_TO_FIX_BUF(mBuf, 0, recvBufLen, (Data *)recvBuf, ©Cnt) != ROK)
{
- DU_LOG("\nE2AP : Failed while copying %d", copyCnt);
+ DU_LOG("\nE
RROR --> E
2AP : Failed while copying %d", copyCnt);
return;
}
return;
}
-
printf("\n
E2AP : Received flat buffer to be decoded : ");
+
DU_LOG("\nDEBUG -->
E2AP : Received flat buffer to be decoded : ");
for(i=0; i< recvBufLen; i++)
{
for(i=0; i< recvBufLen; i++)
{
-
printf
("%x",recvBuf[i]);
+
DU_LOG
("%x",recvBuf[i]);
}
/* Decoding flat buffer into E2AP messsage */
}
/* Decoding flat buffer into E2AP messsage */
@@
-571,10
+573,10
@@
void E2APMsgHdlr(Buffer *mBuf)
if(rval.code == RC_FAIL || rval.code == RC_WMORE)
{
if(rval.code == RC_FAIL || rval.code == RC_WMORE)
{
- DU_LOG("\nE2AP : ASN decode failed");
+ DU_LOG("\nE
RROR --> E
2AP : ASN decode failed");
return;
}
return;
}
-
printf
("\n");
+
DU_LOG
("\n");
xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
switch(e2apMsg->present)
xer_fprint(stdout, &asn_DEF_E2AP_PDU, e2apMsg);
switch(e2apMsg->present)
@@
-585,18
+587,18
@@
void E2APMsgHdlr(Buffer *mBuf)
{
case InitiatingMessageE2__value_PR_E2setupRequest:
{
{
case InitiatingMessageE2__value_PR_E2setupRequest:
{
- DU_LOG("\nE2AP : E2 setup request received");
+ DU_LOG("\n
INFO -->
E2AP : E2 setup request received");
BuildAndSendE2SetupRsp();
break;
}
case InitiatingMessageE2__value_PR_RICindication:
{
BuildAndSendE2SetupRsp();
break;
}
case InitiatingMessageE2__value_PR_RICindication:
{
- DU_LOG("\nE2AP : RIC Indication Acknowledged");
+ DU_LOG("\n
INFO -->
E2AP : RIC Indication Acknowledged");
break;
}
default:
{
break;
}
default:
{
- DU_LOG("\nE2AP : Invalid type of intiating message [%d]",e2apMsg->choice.initiatingMessage->value.present);
+ DU_LOG("\nE
RROR --> E
2AP : Invalid type of intiating message [%d]",e2apMsg->choice.initiatingMessage->value.present);
return;
}
}/* End of switch(initiatingMessage) */
return;
}
}/* End of switch(initiatingMessage) */
@@
-608,12
+610,12
@@
void E2APMsgHdlr(Buffer *mBuf)
{
case SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse:
{
{
case SuccessfulOutcomeE2__value_PR_RICsubscriptionResponse:
{
- DU_LOG("\nE2AP : RICsubscriptionResponse Msg Acknowledged");
+ DU_LOG("\n
INFO -->
E2AP : RICsubscriptionResponse Msg Acknowledged");
break;
}
default:
{
break;
}
default:
{
- DU_LOG("\nE2AP : Invalid type of successfulOutcome message [%d]",e2apMsg->choice.successfulOutcome->value.present);
+ DU_LOG("\nE
RROR --> E
2AP : Invalid type of successfulOutcome message [%d]",e2apMsg->choice.successfulOutcome->value.present);
return;
}
break;
return;
}
break;
@@
-622,7
+624,7
@@
void E2APMsgHdlr(Buffer *mBuf)
}
default:
{
}
default:
{
- DU_LOG("\nE2AP : Invalid type message type ");
+ DU_LOG("\nE
RROR --> E
2AP : Invalid type message type ");
return;
}
return;
}