Copy latest code to master

Change-Id: Ia3dc1891e8489b0241a45d54ac13da427337a682
Signed-off-by: ss412g <shuky.har-noy@intl.att.com>
diff --git a/RIC-E2-TERMINATION/TEST/e2sm.c b/RIC-E2-TERMINATION/TEST/e2sm.c
index 9915948..12d6097 100644
--- a/RIC-E2-TERMINATION/TEST/e2sm.c
+++ b/RIC-E2-TERMINATION/TEST/e2sm.c
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-/*
+ 
+ /*
  * This source code is part of the near-RT RIC (RAN Intelligent Controller)
  * platform project (RICP).
  */
 
-
 //
 // Created by adi ENZEL on 6/19/19.
 //
@@ -56,7 +55,7 @@
     clock_gettime(CLOCK_MONOTONIC, &end);
     if (er.encoded == -1) {
         mdclog_write(MDCLOG_ERR, "encoding of %s failed, %s", asn_DEF_E2SM_gNB_X2_eventTriggerDefinition.name, strerror(errno));
-    } else if (er.encoded > buffer_size) {
+    } else if (er.encoded > (ssize_t)buffer_size) {
         mdclog_write(MDCLOG_ERR, "Buffer of size %d is to small for %s", (int) buffer_size,
                      typeDescriptor->name);
     } else if (mdclog_level_get() >= MDCLOG_DEBUG) {
@@ -82,7 +81,7 @@
 }
 
 PLMN_Identity_t *createPLMN_ID(const unsigned char *data) {
-    printEntry("PLMN_Identity_t", __func__);
+    printEntry("PLMN_Identity_t", __func__)
     PLMN_Identity_t *plmnId = calloc(1, sizeof(PLMN_Identity_t));
     ASN_STRUCT_RESET(asn_DEF_PLMN_Identity, plmnId);
     plmnId->size = 3;
@@ -97,9 +96,12 @@
 }
 
 ENB_ID_t *createENB_ID(ENB_ID_PR enbType, unsigned char *data) {
-    printEntry("ENB_ID_t", __func__);
+    printEntry("ENB_ID_t", __func__)
     ENB_ID_t *enb = calloc(1, sizeof(ENB_ID_t));
     ASN_STRUCT_RESET(asn_DEF_ENB_ID, enb);
+
+    enb->present = enbType;
+
     switch (enbType) {
         case ENB_ID_PR_macro_eNB_ID: { // 20 bit 3 bytes
             enb->choice.macro_eNB_ID.size = 3;
@@ -160,7 +162,7 @@
 }
 
 GNB_ID_t *createGnb_id(const unsigned char *data, int numOfBits) {
-    printEntry("GNB_ID_t", __func__);
+    printEntry("GNB_ID_t", __func__)
     if (numOfBits < 22 || numOfBits > 32) {
         mdclog_write(MDCLOG_ERR, "GNB_ID_t number of bits = %d, needs to be 22 .. 32", numOfBits);
         return NULL;
@@ -170,7 +172,7 @@
 
     gnb->present = GNB_ID_PR_gNB_ID;
     gnb->choice.gNB_ID.size = numOfBits % 8 == 0 ? (unsigned int)(numOfBits / 8) : (unsigned int)(numOfBits / 8 + 1);
-    gnb->choice.gNB_ID.bits_unused = gnb->choice.gNB_ID.size * 8 - numOfBits;
+    gnb->choice.gNB_ID.bits_unused = (int)gnb->choice.gNB_ID.size * 8 - numOfBits;
     gnb->choice.gNB_ID.buf = calloc(1, gnb->choice.gNB_ID.size);
     memcpy(gnb->choice.gNB_ID.buf, data, gnb->choice.gNB_ID.size);
     gnb->choice.gNB_ID.buf[gnb->choice.gNB_ID.size - 1] =
@@ -186,7 +188,7 @@
 }
 
 GlobalENB_ID_t *createGlobalENB_ID(PLMN_Identity_t *plmnIdentity, ENB_ID_t *enbId) {
-    printEntry("GlobalENB_ID_t", __func__);
+    printEntry("GlobalENB_ID_t", __func__)
     GlobalENB_ID_t *genbId = calloc(1, sizeof(GlobalENB_ID_t));
     ASN_STRUCT_RESET(asn_DEF_GlobalENB_ID, genbId);
     memcpy(&genbId->pLMN_Identity, plmnIdentity, sizeof(PLMN_Identity_t));
@@ -199,7 +201,7 @@
 }
 
 GlobalGNB_ID_t *createGlobalGNB_ID(PLMN_Identity_t *plmnIdentity, GNB_ID_t *gnb) {
-    printEntry("GlobalGNB_ID_t", __func__);
+    printEntry("GlobalGNB_ID_t", __func__)
     GlobalGNB_ID_t *ggnbId = calloc(1, sizeof(GlobalGNB_ID_t));
     ASN_STRUCT_RESET(asn_DEF_GlobalGNB_ID, ggnbId);
 
@@ -215,7 +217,7 @@
 
 
 Interface_ID_t *createInterfaceIDForGnb(GlobalGNB_ID_t *gnb) {
-    printEntry("Interface_ID_t", __func__);
+    printEntry("Interface_ID_t", __func__)
     Interface_ID_t *interfaceId = calloc(1, sizeof(Interface_ID_t));
     ASN_STRUCT_RESET(asn_DEF_Interface_ID, interfaceId);
 
@@ -231,7 +233,7 @@
 }
 
 Interface_ID_t *createInterfaceIDForEnb(GlobalENB_ID_t *enb) {
-    printEntry("Interface_ID_t", __func__);
+    printEntry("Interface_ID_t", __func__)
     Interface_ID_t *interfaceId = calloc(1, sizeof(Interface_ID_t));
     ASN_STRUCT_RESET(asn_DEF_Interface_ID, interfaceId);
 
@@ -249,7 +251,7 @@
 
 
 InterfaceMessageType_t *createInterfaceMessageInitiating(long procedureCode) {
-    printEntry("InterfaceMessageType_t", __func__);
+    printEntry("InterfaceMessageType_t", __func__)
     InterfaceMessageType_t *intMsgT = calloc(1, sizeof(InterfaceMessageType_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceMessageType, intMsgT);
 
@@ -264,7 +266,7 @@
 }
 
 InterfaceMessageType_t *createInterfaceMessageSuccsesful(long procedureCode) {
-    printEntry("InterfaceMessageType_t", __func__);
+    printEntry("InterfaceMessageType_t", __func__)
     InterfaceMessageType_t *intMsgT = calloc(1, sizeof(InterfaceMessageType_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceMessageType, intMsgT);
 
@@ -279,7 +281,7 @@
 }
 
 InterfaceMessageType_t *createInterfaceMessageUnsuccessful(long procedureCode) {
-    printEntry("InterfaceMessageType_t", __func__);
+    printEntry("InterfaceMessageType_t", __func__)
     InterfaceMessageType_t *intMsgT = calloc(1, sizeof(InterfaceMessageType_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceMessageType, intMsgT);
 
@@ -294,7 +296,7 @@
 }
 
 InterfaceProtocolIE_Value_t *createInterfaceProtocolValueInt(long number) {
-    printEntry("InterfaceProtocolIE_Value_t", __func__);
+    printEntry("InterfaceProtocolIE_Value_t", __func__)
     InterfaceProtocolIE_Value_t *value = calloc(1, sizeof(InterfaceProtocolIE_Value_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceProtocolIE_Value, value);
 
@@ -309,7 +311,7 @@
 }
 
 InterfaceProtocolIE_Value_t *createInterfaceProtocolValueEnum(long number) {
-    printEntry("InterfaceProtocolIE_Value_t", __func__);
+    printEntry("InterfaceProtocolIE_Value_t", __func__)
     InterfaceProtocolIE_Value_t *value = calloc(1, sizeof(InterfaceProtocolIE_Value_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceProtocolIE_Value, value);
 
@@ -324,7 +326,7 @@
 }
 
 InterfaceProtocolIE_Value_t *createInterfaceProtocolValueBool(int val) {
-    printEntry("InterfaceProtocolIE_Value_t", __func__);
+    printEntry("InterfaceProtocolIE_Value_t", __func__)
     InterfaceProtocolIE_Value_t *value = calloc(1, sizeof(InterfaceProtocolIE_Value_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceProtocolIE_Value, value);
 
@@ -340,7 +342,7 @@
 
 
 InterfaceProtocolIE_Value_t *createInterfaceProtocolValueBitString(unsigned char *buf, int numOfBits) {
-    printEntry("InterfaceProtocolIE_Value_t", __func__);
+    printEntry("InterfaceProtocolIE_Value_t", __func__)
     size_t size = numOfBits % 8 == 0 ? (unsigned int)(numOfBits / 8) : (unsigned int)(numOfBits / 8 + 1);
     if (strlen((const char *)buf) < size) {
         mdclog_write(MDCLOG_ERR, "size of buffer is small : %d needs to be %d in %s", (int)strlen((const char *)buf), (int)size, __func__);
@@ -351,7 +353,7 @@
     value->present = InterfaceProtocolIE_Value_PR_valueBitS;
     value->choice.valueBitS.size = numOfBits % 8 == 0 ? (unsigned int)(numOfBits / 8) : (unsigned int)(numOfBits / 8 + 1);
     value->choice.valueBitS.buf = calloc(1, value->choice.valueBitS.size);
-    int bits_unused = value->choice.valueBitS.size * 8 - numOfBits;
+    int bits_unused = (int)value->choice.valueBitS.size * 8 - numOfBits;
     value->choice.valueBitS.bits_unused = bits_unused;
 
     memcpy(value->choice.valueBitS.buf, buf, value->choice.valueBitS.size);
@@ -366,7 +368,7 @@
 
 
 InterfaceProtocolIE_Value_t *createInterfaceProtocolValueOCTETS(uint8_t *buf) {
-    printEntry("InterfaceProtocolIE_Value_t", __func__);
+    printEntry("InterfaceProtocolIE_Value_t", __func__)
     size_t size = strlen((const char *)buf);
     InterfaceProtocolIE_Value_t *value = calloc(1, sizeof(InterfaceProtocolIE_Value_t));
     ASN_STRUCT_RESET(asn_DEF_InterfaceProtocolIE_Value, value);
@@ -385,7 +387,7 @@
 
 
 InterfaceProtocolIE_Item_t *createInterfaceProtocolIE_Item(long id, long test, InterfaceProtocolIE_Value_t *value) {
-    printEntry("InterfaceProtocolIE_Item_t", __func__);
+    printEntry("InterfaceProtocolIE_Item_t", __func__)
     if (test < InterfaceProtocolIE_Test_equal || test > InterfaceProtocolIE_Test_present) {
         mdclog_write(MDCLOG_ERR, "InterfaceProtocolIE_Item_t test value is %ld,  out of scope %d .. %d ",
                 test, InterfaceProtocolIE_Test_equal, InterfaceProtocolIE_Test_present);
@@ -412,7 +414,7 @@
 
 
 ActionParameter_Value_t *createActionParameterValue_Int(long number) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
 
@@ -427,7 +429,7 @@
 }
 
 ActionParameter_Value_t *createActionParameterValue_Enum(long number) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
 
@@ -442,7 +444,7 @@
 }
 
 ActionParameter_Value_t *createActionParameterValue_Bool(int val) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
 
@@ -458,12 +460,12 @@
 
 
 ActionParameter_Value_t *createActionParameterValue_Bit_String(unsigned char *buf, int numOfBits) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     size_t size = numOfBits % 8 == 0 ? (unsigned int)(numOfBits / 8) : (unsigned int)(numOfBits / 8 + 1);
     if (strlen((const char *)buf) < size) {
         mdclog_write(MDCLOG_ERR, "size of buffer is small : %d needs to be %d in %s", (int)strlen((const char *)buf), (int)size, __func__);
     }
-    int bits_unused = size * 8 - numOfBits;
+    int bits_unused = (int)size * 8 - numOfBits;
 
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
@@ -485,7 +487,7 @@
 
 
 ActionParameter_Value_t *createActionParameterValue_OCTETS(uint8_t *buf) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     size_t size = strlen((const char *)buf);
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
@@ -508,7 +510,7 @@
  * @return ActionParameter_Value_t *
  */
 ActionParameter_Value_t *createActionParameterValue_PRINTS(char *buf) {
-    printEntry("ActionParameter_Value_t", __func__);
+    printEntry("ActionParameter_Value_t", __func__)
     size_t size = strlen((const char *)buf);
     ActionParameter_Value_t *value = calloc(1, sizeof(ActionParameter_Value_t));
     ASN_STRUCT_RESET(asn_DEF_ActionParameter_Value, value);
@@ -526,7 +528,7 @@
 }
 
 ActionParameter_Item_t *creatActionParameter_Item(long id, ActionParameter_Value_t *val) {
-    printEntry("ActionParameter_Item_t", __func__);
+    printEntry("ActionParameter_Item_t", __func__)
     if (id < 0 || id > 255) {
         mdclog_write(MDCLOG_ERR, "ActionParameter_Item_t id = %ld, values are 0 .. 255", id);
         return NULL;
@@ -561,7 +563,7 @@
                           int listSize,
                           uint8_t *buffer,
                           size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_eventTriggerDefinition_t", __func__);
+    printEntry("E2SM_gNB_X2_eventTriggerDefinition_t", __func__)
     if (direction < InterfaceDirection_incoming || direction > InterfaceDirection_outgoing) {
         mdclog_write(MDCLOG_ERR, "E2SM_gNB_X2_eventTriggerDefinition_t direction = %ld, values are %d .. %d",
                      direction, InterfaceDirection_incoming, InterfaceDirection_outgoing);
@@ -592,7 +594,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_eventTriggerDefinition,
                                  eventTrigger,
                                  buf1,
@@ -607,7 +609,7 @@
 size_t createActionDefinition(long styleId, ActionParameter_Item_t actionParamList[], int listSize,
                                                        uint8_t *buffer,
                                                        size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_actionDefinition_t", __func__);
+    printEntry("E2SM_gNB_X2_actionDefinition_t", __func__)
     E2SM_gNB_X2_actionDefinition_t *actDef = calloc(1, sizeof(E2SM_gNB_X2_actionDefinition_t));
     ASN_STRUCT_RESET(asn_DEF_E2SM_gNB_X2_actionDefinition, actDef);
 
@@ -628,7 +630,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_actionDefinition,
                    actDef,
                    buf1,
@@ -645,7 +647,7 @@
                                           int size,
                                           uint8_t *buffer,
                                           size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_indicationHeader_t", __func__);
+    printEntry("E2SM_gNB_X2_indicationHeader_t", __func__)
     if (direction < InterfaceDirection_incoming || direction > InterfaceDirection_outgoing) {
         mdclog_write(MDCLOG_ERR, "E2SM_gNB_X2_indicationHeader_t direction = %ld, values are %d .. %d",
                      direction, InterfaceDirection_incoming, InterfaceDirection_outgoing);
@@ -674,7 +676,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_indicationHeader,
                    indiHead,
                    buf1,
@@ -688,7 +690,7 @@
 size_t createE2SM_gNB_X2_indicationMessage(uint8_t *message, uint msgSize,
                                                                      uint8_t *buffer,
                                                                      size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_indicationMessage_t", __func__);
+    printEntry("E2SM_gNB_X2_indicationMessage_t", __func__)
     if (msgSize <= 0) {
         mdclog_write(MDCLOG_ERR, "E2SM_gNB_X2_indicationMessage_t failed messsage size =  %d", msgSize);
         return -1;
@@ -713,7 +715,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_indicationMessage,
                    indicationMessage,
                    buf1,
@@ -728,7 +730,7 @@
 size_t createE2SM_gNB_X2_callProcessID(long callProcess_Id,
                                                              uint8_t *buffer,
                                                              size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_callProcessID_t", __func__);
+    printEntry("E2SM_gNB_X2_callProcessID_t", __func__)
     E2SM_gNB_X2_callProcessID_t *callProcessId = calloc(1, sizeof(E2SM_gNB_X2_callProcessID_t));
     ASN_STRUCT_RESET(asn_DEF_E2SM_gNB_X2_callProcessID, callProcessId);
 
@@ -746,7 +748,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_callProcessID,
                    callProcessId,
                    buf1,
@@ -760,7 +762,7 @@
 size_t createE2SM_gNB_X2_controlHeader(Interface_ID_t *interfaceId, long direction,
                                                              uint8_t *buffer,
                                                              size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_controlHeader_t", __func__);
+    printEntry("E2SM_gNB_X2_controlHeader_t", __func__)
     if (direction < InterfaceDirection_incoming || direction > InterfaceDirection_outgoing) {
         mdclog_write(MDCLOG_ERR, "E2SM_gNB_X2_controlHeader_t direction = %ld, values are %d .. %d",
                      direction, InterfaceDirection_incoming, InterfaceDirection_outgoing);
@@ -784,7 +786,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_controlHeader,
                    controlHeader,
                    buf1,
@@ -799,7 +801,7 @@
 size_t createE2SM_gNB_X2_controlMessage(uint8_t *message, uint msgSize,
                                                                uint8_t *buffer,
                                                                size_t buffer_size) {
-    printEntry("E2SM_gNB_X2_controlMessage_t", __func__);
+    printEntry("E2SM_gNB_X2_controlMessage_t", __func__)
     E2SM_gNB_X2_controlMessage_t *controlMsg = calloc(1, sizeof(E2SM_gNB_X2_controlMessage_t));
     ASN_STRUCT_RESET(asn_DEF_E2SM_gNB_X2_controlMessage, controlMsg);
 
@@ -819,7 +821,7 @@
 
     if (mdclog_level_get() >= MDCLOG_INFO) {
         uint8_t buf1[4096];
-        asn_enc_rval_t er1;
+        //asn_enc_rval_t er1;
         encodebuff(ATS_BASIC_XER, &asn_DEF_E2SM_gNB_X2_controlMessage,
                    controlMsg,
                    buf1,
@@ -828,4 +830,4 @@
     }
 
     return len;
-}
\ No newline at end of file
+}