+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills the initiating IE for E2 Setup Request
+ *
+ * @details
+ *
+ * Function : fillE2SetupReq
+ *
+ * Functionality:Fills the Initiating message for
+ * E2SetupRequest
+ *
+ * @params[in] E2setupRequest_t *e2SetupReq,
+ * uint8_t *idx
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ ******************************************************************/
+
+uint16_t fillE2SetupReq(E2setupRequest_t **e2SetupReq, uint8_t *idx)
+{
+ uint8_t elementCnt = 0;
+ uint8_t idx2 = 0;
+ uint8_t ret = ROK;
+
+ if(*e2SetupReq != NULLP)
+ {
+ elementCnt = 1;
+ (*e2SetupReq)->protocolIEs.list.count = elementCnt;
+ (*e2SetupReq)->protocolIEs.list.size = \
+ elementCnt * sizeof(E2setupRequestIEs_t);
+
+ /* Initialize the E2Setup members */
+ DU_ALLOC((*e2SetupReq)->protocolIEs.list.array, \
+ (*e2SetupReq)->protocolIEs.list.size);
+ if((*e2SetupReq)->protocolIEs.list.array == NULLP)
+ {
+ DU_LOG("\nE2AP : Memory allocation failed for array elements");
+ ret = RFAILED;
+ }
+ else
+ {
+ for(*idx = 0; *idx < elementCnt; (*idx)++)
+ {
+ DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[*idx],\
+ sizeof(E2setupRequestIEs_t));
+ if((*e2SetupReq)->protocolIEs.list.array[*idx] == NULLP)
+ {
+ DU_LOG("\nE2AP : Memory allocation failed for arrayidx [%d]", *idx);
+ ret = RFAILED;
+ }
+ else
+ {
+ /* GlobalE2node_gNB_ID */
+ (*e2SetupReq)->protocolIEs.list.array[idx2]->id = \
+ ProtocolIE_IDE2_id_GlobalE2node_ID;
+ (*e2SetupReq)->protocolIEs.list.array[idx2]->criticality = \
+ CriticalityE2_reject;
+ (*e2SetupReq)->protocolIEs.list.array[idx2]->value.present =\
+ E2setupRequestIEs__value_PR_GlobalE2node_ID;
+ (*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+ GlobalE2node_ID.present = GlobalE2node_ID_PR_gNB;
+
+ DU_ALLOC((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+ GlobalE2node_ID.choice.gNB, sizeof(GlobalE2node_gNB_ID_t));
+ if((*e2SetupReq)->protocolIEs.list.array[idx2]->value.choice.\
+ GlobalE2node_ID.choice.gNB == NULLP)
+ {
+ DU_LOG("\nE2AP : Memory allocation failed for gNbId");
+ ret = RFAILED;
+ }
+ else
+ {
+ ret = BuildGlobalgNBId((*e2SetupReq)->protocolIEs.list.array[idx2]->value.\
+ choice.GlobalE2node_ID.choice.gNB);
+ if(ret != ROK)
+ {
+ ret = RFAILED;
+ }
+ }
+
+ }
+ }
+ }
+ }
+ else
+ {
+ ret = RFAILED;
+ DU_LOG("\nE2AP : Passed e2SetupReq is NULL");
+ }
+ return ret;