+ mib->spare.size = sizeof(uint8_t);
+ DU_ALLOC(mib->spare.buf,sizeof(uint8_t));
+ if(!mib->spare.buf)
+ {
+ DU_LOG("DU APP: MIB msg memory allocation failure");
+ return RFAILED;
+ }
+ *(mib->spare.buf) = SPARE;
+ mib->spare.bits_unused = ODU_VALUE_SEVEN;
+ return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Builds MIB PDU for broadcast
+ *
+ * @details
+ *
+ * Function : BuildMibPdu
+ *
+ * Functionality: Building MIB PDU for system broadcast
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int BuildMibPdu()
+{
+ BCCH_BCH_Message_t *bcchMsg;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_ALLOC(bcchMsg, sizeof(BCCH_BCH_Message_t));
+ if(!bcchMsg)
+ {
+ DU_LOG("\nMemory allocation failure in BuildMibPdu");
+ return RFAILED;
+ }
+
+ bcchMsg->message.present = BCCH_BCH_MessageType_PR_mib;
+ DU_ALLOC(bcchMsg->message.choice.mib, sizeof(MIB_t));
+ if(!bcchMsg->message.choice.mib)
+ {
+ DU_LOG("\nMemory allocation failure in BuildMibPdu");
+ return RFAILED;
+ }
+ BuildMib(bcchMsg->message.choice.mib);
+ xer_fprint(stdout, &asn_DEF_BCCH_BCH_Message, bcchMsg);
+ cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
+ encBufSize = 0;
+ encRetVal = aper_encode(&asn_DEF_BCCH_BCH_Message, 0,
+ bcchMsg, PrepFinalEncBuf, encBuf);
+ printf("\nencbufSize:%d\n", encBufSize);
+ if(encRetVal.encoded == -1)
+ {
+ DU_LOG("\nDU APP: Could not encode BCCH BCH Message Type structure(at %s)\n",
+ encRetVal.failed_type?\
+ encRetVal.failed_type->name
+ :"unknown");
+ return RFAILED;
+ }
+
+ /* Print encoded buffer */
+ for(int i=0; i< encBufSize; i++)
+ {
+ printf("%x\t",encBuf[i]);
+ }
+ printf("\n");
+
+ /* Free allocated memory */
+ DU_FREE(bcchMsg->message.choice.mib->systemFrameNumber.buf,
+ bcchMsg->message.choice.mib->systemFrameNumber.size);
+ DU_FREE(bcchMsg->message.choice.mib->spare.buf,
+ bcchMsg->message.choice.mib->spare.size);
+ DU_FREE(bcchMsg->message.choice.mib, sizeof(MIB_t));
+ DU_FREE(bcchMsg, sizeof(BCCH_BCH_MessageType_t));
+
+ return ROK;
+
+}
+/*******************************************************************
+ *
+ * @brief Builds MIB message in Served Cell Info
+ *
+ * @details
+ *
+ * Function : BuildMibMsg
+ *
+ * Functionality: Building MIB message in Served Cell Info
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+int BuildMibMsg()
+{
+ MIB_t *mibMsg;
+ asn_enc_rval_t encRetVal; /* Encoder return value */
+
+ DU_ALLOC(mibMsg, sizeof(MIB_t));
+ if(!mibMsg)