From 9feaf7b78cdde2db6ea3b8a8657942b80d2e3384 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Mon, 3 Mar 2014 16:17:22 +0000
Subject: [PATCH] Minor updates, updated link register with 3GPP_ADDR

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5105 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../LTE_RAL_ENB/INCLUDE/lteRALenb_constants.h |   2 +-
 .../LTE_RAL_ENB/INCLUDE/lteRALenb_mih_msg.h   |   1 +
 .../LTE_RAL_ENB/SRC/lteRALenb_action.c        |  12 +-
 .../LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c       | 407 ++++++++++--------
 .../LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c       |  82 +++-
 .../LTE_RAL_UE/INCLUDE/lteRALue_constants.h   |   5 +-
 .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c  |   2 +-
 .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c    |   6 +-
 .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c |  69 +--
 .../LTE_RAL_UE/SRC/lteRALue_parameters.c      |   3 +-
 .../RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c |  76 ++--
 .../LTE_RAL_UE/SRC/lteRALue_subscribe.c       |  28 +-
 .../LTE_RAL_UE/SRC/lteRALue_thresholds.c      |  75 ++--
 13 files changed, 432 insertions(+), 336 deletions(-)

diff --git a/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_constants.h b/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_constants.h
index 4dea1e0508..bf13e10cfc 100755
--- a/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_constants.h
+++ b/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_constants.h
@@ -35,7 +35,7 @@
 #define ENB_DEFAULT_LINK_ID_RAL       "enb_lte_link"
 #define ENB_DEFAULT_LINK_ADDRESS_RAL  "060080149150"
 #define ENB_DEFAULT_MIHF_ID           "mihf_enb"
-#define ENB_DEFAULT_ADDRESS_3GPP      "0335060080149150"
+#define ENB_DEFAULT_3GPP_ADDRESS      "0000000000000000"
 
 
 //-----------------------------------------------------------------------------
diff --git a/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_mih_msg.h b/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_mih_msg.h
index 5266f64f84..ade575f269 100755
--- a/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_mih_msg.h
+++ b/openair3/RAL-LTE/LTE_RAL_ENB/INCLUDE/lteRALenb_mih_msg.h
@@ -69,6 +69,7 @@
 /****************************************************************************/
 /******************  E X P O R T E D    F U N C T I O N S  ******************/
 /****************************************************************************/
+protected_lteralenb_mih_msg(void eRAL_MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_enb_instance_t instanceP, MIH_C_3GPP_ADDR_T* _3gpp_addr_pP, u_int8_t* str_pP));
 
 protected_lteralenb_mih_msg(int eRAL_mihf_connect(ral_enb_instance_t instanceP);)
 
diff --git a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_action.c b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_action.c
index bcec754301..44048b34b0 100755
--- a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_action.c
+++ b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_action.c
@@ -485,11 +485,11 @@ MIH_C_LINK_AC_RESULT_T eRAL_action_link_flow_attr(ral_enb_instance_t instanceP)
 MIH_C_LINK_AC_RESULT_T eRAL_action_link_activate_resources(ral_enb_instance_t instanceP){
     //---------------------------------------------------------------------------
     MIH_C_RESOURCE_DESC_T *res = &g_link_action.link_ac_param._union.resource_desc;
-    MIH_C_COS_T classIdDL = 0;
-    MIH_C_COS_T classIdUL = 0;
+    MIH_C_COS_T            classIdDL = 0;
+    MIH_C_COS_T            classIdUL = 0;
     MIH_C_LINK_DATA_RATE_T resBitrateDL = 0;
     MIH_C_LINK_DATA_RATE_T resBitrateUL = 0;
-    MIH_C_BOOLEAN_T multicast = MIH_C_BOOLEAN_FALSE;
+    MIH_C_BOOLEAN_T        multicast = MIH_C_BOOLEAN_FALSE;
 
     /* TODO: To be initialized downlink/uplink */
     if (res->choice_qos) {
@@ -765,10 +765,10 @@ MIH_C_LINK_AC_RESULT_T eRAL_action_link_activate_resources(ral_enb_instance_t in
  ***************************************************************************/
 MIH_C_LINK_AC_RESULT_T eRAL_action_link_deactivate_resources(ral_enb_instance_t instanceP)
 {
-    MIH_C_RESOURCE_DESC_T *res = &g_link_action.link_ac_param._union.resource_desc;
+    MIH_C_RESOURCE_DESC_T  *res = &g_link_action.link_ac_param._union.resource_desc;
     struct ral_lte_channel *currChannel;
-    int mt_ix, ch_ix, f_ix;
-    int cnxid;
+    int                     mt_ix, ch_ix, f_ix;
+    int                     cnxid;
 
     /* Get the connection identifier */
     f_ix = eRAL_action_get_channel_id(instanceP, &res->flow_id, &cnxid);
diff --git a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c
index d96499fabe..e29867ccf9 100755
--- a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c
+++ b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c
@@ -56,6 +56,32 @@ static char g_msg_print_buffer[8192] = {};
 static char g_msg_codec_print_buffer[8192] = {};
 
 
+//-----------------------------------------------------------------------------
+void eRAL_MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_enb_instance_t instanceP, MIH_C_3GPP_ADDR_T* _3gpp_addr_pP, u_int8_t* str_pP)
+//-----------------------------------------------------------------------------
+{
+    int           i, l;
+    u_int8_t      val_temp;
+    unsigned char address_3gpp[32];
+    unsigned char buf[3];
+    u_int8_t      _3gpp_byte_address[8];
+    module_id_t   mod_id = instanceP;
+
+    strcpy((char *)address_3gpp, (char *)str_pP);
+    for(l=0; l<8; l++)
+    {
+        i=l*2;
+        buf[0]= address_3gpp[i];
+        buf[1]= address_3gpp[i+1];
+        buf[2]= '\0';
+        //sscanf((const char *)buf,"%02x", &val_temp);
+        sscanf((const char *)buf,"%hhx", &val_temp);
+        _3gpp_byte_address[l] = val_temp;
+    }
+    _3gpp_byte_address[7] += mod_id;
+    MIH_C_3GPP_ADDR_set(_3gpp_addr_pP, _3gpp_byte_address, 8);
+}
+
 /****************************************************************************/
 /******************  E X P O R T E D    F U N C T I O N S  ******************/
 /****************************************************************************/
@@ -73,21 +99,22 @@ static char g_msg_codec_print_buffer[8192] = {};
  **   about which technology it supports and which interface it manages.   **
  **      Upon receiving this message the MIHF executes its Link SAPs       **
  **   discovery procedure in order to get the full link capabilities.      **
- ** Inputs:  tidP  Transaction identifier                                  **
+ ** Inputs:  tid_pP  Transaction identifier                                  **
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id, ralpriv                              **
  ** Outputs:  None                                                         **
  **     Others: g_msg_codec_send_buffer                                    **
  ***************************************************************************/
-void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP)
+void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP)
 {
     MIH_C_Message_Link_Register_indication_t  message;
-    Bit_Buffer_t                             *bb;
+    Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
+    module_id_t                               mod_id = instanceP;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_REGISTER_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Register_indication_t));
 
@@ -100,29 +127,35 @@ void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
     message.header.service_identifier   = (MIH_C_SID_T)1;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)6;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
-    MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
+    MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[mod_id].link_id, strlen(g_enb_ral_obj[mod_id].link_id));
 
-    MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
+    MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[mod_id].mihf_id, strlen(g_enb_ral_obj[mod_id].mihf_id));
 
-    message.primitive.Link_Id.link_type        = MIH_C_WIRELESS_UMTS;
+    message.primitive.Link_Id.link_type        = MIH_C_WIRELESS_LTE; //MIH_C_WIRELESS_UMTS;
+    #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
+    message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
+    eRAL_MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)ENB_DEFAULT_3GPP_ADDRESS);
+    #else
     message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_3G_CELL_ID;
-
-    Bit_Buffer_t *plmn = new_BitBuffer_0();
-    BitBuffer_wrap(plmn, (unsigned char*) &g_enb_ral_obj[instanceP].plmn_id, DEFAULT_PLMN_SIZE);
-    MIH_C_PLMN_ID_decode(plmn, &message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.plmn_id);
-    message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
-    free_BitBuffer(plmn);
-
-    message_total_length = MIH_C_Link_Message_Encode_Link_Register_indication(bb, &message);
-
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    memcpy(message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_enb_ral_obj[mod_id].plmn_id, 3);
+    message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[mod_id].cell_id;
+    //Bit_Buffer_t *plmn = new_BitBuffer_0();
+    //BitBuffer_wrap(plmn, (unsigned char*) &g_enb_ral_obj[instanceP].plmn_id, DEFAULT_PLMN_SIZE);
+    //MIH_C_PLMN_ID_decode(plmn, &message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.plmn_id);
+    //message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[instanceP].cell_id;
+    //free_BitBuffer(plmn);
+    #endif
+
+    message_total_length = MIH_C_Link_Message_Encode_Link_Register_indication(bb_p, &message);
+
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Register.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Register.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -132,7 +165,7 @@ void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
  ** Description: Sends capability discover service management response to  **
  **   the MIH-F.                                                **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     levt_listP: List of events supported by the link layer **
  **     lcmd_listP: List of commands supported by the link     **
@@ -144,19 +177,19 @@ void eRAL_send_link_register_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP,
+void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP,
         MIH_C_STATUS_T          *statusP,
         MIH_C_LINK_EVENT_LIST_T *link_evt_listP,
         MIH_C_LINK_CMD_LIST_T   *link_cmd_listP)
 {
     MIH_C_Message_Link_Capability_Discover_confirm_t  message;
-    Bit_Buffer_t                                      *bb;
+    Bit_Buffer_t                                      *bb_p;
     int                                               message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Capability_Discover_confirm_t));
 
@@ -169,7 +202,7 @@ void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_T
     message.header.service_identifier   = (MIH_C_SID_T)1;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)1;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
     MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
@@ -178,14 +211,14 @@ void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_T
     message.primitive.SupportedLinkEventList   = link_evt_listP;
     message.primitive.SupportedLinkCommandList = link_cmd_listP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Capability_Discover_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Capability_Discover_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Capability_Discover.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Capability_Discover.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -197,7 +230,7 @@ void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_T
  **   This primitive is generated in response to a Link_Event_  **
  **   Subscribe.request.                                        **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     levt_listP: List of successfully subscribed link events**
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id                       **
@@ -207,18 +240,18 @@ void eRAL_send_capability_discover_confirm(ral_enb_instance_t instanceP, MIH_C_T
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP,
+void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP,
         MIH_C_STATUS_T          *statusP,
         MIH_C_LINK_EVENT_LIST_T *levt_listP)
 {
     MIH_C_Message_Link_Event_Subscribe_confirm_t  message;
-    Bit_Buffer_t                                 *bb;
+    Bit_Buffer_t                                 *bb_p;
     int                                           message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Event_Subscribe_confirm_t));
 
@@ -231,7 +264,7 @@ void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANS
     message.header.service_identifier   = (MIH_C_SID_T)1;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)4;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -240,14 +273,14 @@ void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANS
     message.primitive.Status                   = *statusP;
     message.primitive.ResponseLinkEventList    = levt_listP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Event_Subscribe_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Event_Subscribe_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Event_Subscribe.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Event_Subscribe.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -260,7 +293,7 @@ void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANS
  **   This primitive is generated in response to a Link_Event_  **
  **   Unsubscribe.request.                                      **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     levt_listP: List of successfully subscribed link events**
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id                       **
@@ -270,18 +303,18 @@ void eRAL_send_event_subscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANS
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP,
+void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP,
         MIH_C_STATUS_T          *statusP,
         MIH_C_LINK_EVENT_LIST_T *levt_listP)
 {
     MIH_C_Message_Link_Event_Unsubscribe_confirm_t  message;
-    Bit_Buffer_t                                   *bb;
+    Bit_Buffer_t                                   *bb_p;
     int                                             message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Event_Unsubscribe_confirm_t));
 
@@ -294,7 +327,7 @@ void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRA
     message.header.service_identifier   = (MIH_C_SID_T)1;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)5;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -303,14 +336,14 @@ void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRA
     message.primitive.Status                   = *statusP;
     message.primitive.ResponseLinkEventList    = levt_listP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Event_Unsubscribe_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Event_Unsubscribe_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Event_Unsubscribe.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Event_Unsubscribe.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /*
@@ -331,7 +364,7 @@ void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRA
  **   network are discovered during the active connection on    **
  **   that link.                                                **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     linfoP: Information of the detected link           **
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id                       **
  **                                                                        **
@@ -340,9 +373,9 @@ void eRAL_send_event_unsubscribe_confirm(ral_enb_instance_t instanceP, MIH_C_TRA
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP, MIH_C_LINK_DET_INFO_T   *linfoP){
+void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP, MIH_C_LINK_DET_INFO_T   *linfoP){
     MIH_C_Message_Link_Detected_indication_t  message;
-    Bit_Buffer_t                             *bb;
+    Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
 
     if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_DETECTED)) {
@@ -351,8 +384,8 @@ void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_DETECTED_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Detected_indication_t));
 
@@ -365,7 +398,7 @@ void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
     message.header.service_identifier   = (MIH_C_SID_T)2;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)1;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -374,14 +407,14 @@ void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
     memcpy(&message.primitive.LinkDetectedInfo, linfoP,
             sizeof(MIH_C_LINK_DET_INFO_T));
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Detected_indication(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Detected_indication(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Detected.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Detected.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -390,34 +423,35 @@ void eRAL_send_link_detected_indication(ral_enb_instance_t instanceP, MIH_C_TRAN
  **                                                                        **
  **   This notification is generated when a layer 2 connection is          **
  **   established for the specified link interface.                        **
- ** Inputs:  tidP  Transaction identifier                                  **
- **          lidP:  Link identifier                                        **
- **          old_arP: Old access router link address                       **
+ ** Inputs:  tid_pP  Transaction identifier                                  **
+ **          lid_pP:  Link identifier                                        **
+ **          old_ar_pP: Old access router link address                       **
  **          new_arP: New access router link address                       **
  **          flagP:  Indicates whether the MN needs to change IP Address   **
  **                  in the new PoA                                        **
  **          mobil_mngtP: Indicates the type of Mobility Management        **
  **                       Protocol supported by the new PoA                **
  ***************************************************************************/
-void eRAL_send_link_up_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tidP,
-        MIH_C_LINK_TUPLE_ID_T   *lidP,
-        MIH_C_LINK_ADDR_T       *old_arP,
+void eRAL_send_link_up_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T  *tid_pP,
+        MIH_C_LINK_TUPLE_ID_T   *lid_pP,
+        MIH_C_LINK_ADDR_T       *old_ar_pP,
         MIH_C_LINK_ADDR_T       *new_arP,
         MIH_C_IP_RENEWAL_FLAG_T *flagP,
         MIH_C_IP_MOB_MGMT_T     *mobil_mngtP)
 {
     MIH_C_Message_Link_Up_indication_t  message;
-    Bit_Buffer_t                        *bb;
+    Bit_Buffer_t                       *bb_p = NULL;
     int                                 message_total_length;
+    module_id_t                         mod_id = instanceP;
 
-    if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_UP)) {
+    if (!(g_enb_ral_obj[mod_id].mih_supported_link_event_list & MIH_C_BIT_LINK_UP)) {
         return;
     }
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_UP_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Up_indication_t));
 
@@ -430,27 +464,27 @@ void eRAL_send_link_up_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTIO
     message.header.service_identifier   = (MIH_C_SID_T)2;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)2;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
-    MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
+    MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[mod_id].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
-    MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
+    MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[mod_id].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
 
-    memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
+    memcpy(&message.primitive.LinkIdentifier, lid_pP, sizeof(MIH_C_LINK_TUPLE_ID_T));
 
-    message.primitive.OldAccessRouter            = old_arP;
+    message.primitive.OldAccessRouter            = old_ar_pP;
     message.primitive.NewAccessRouter            = new_arP;
     message.primitive.IPRenewalFlag              = flagP;
     message.primitive.MobilityManagementSupport  = mobil_mngtP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Up_indication(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Up_indication(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Up.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Up.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -463,18 +497,18 @@ void eRAL_send_link_up_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTIO
  **   loss of link connectivity due to successive time-outs for            **
  **   acknowledgements of retransmitted packets along with loss  of        **
  **   reception of broadcast frames.                                       **
- ** Inputs:  tidP  Transaction identifier                                  **
- **          lidP:  Link identifier                                        **
- **          old_arP: Old access router link address                       **
+ ** Inputs:  tid_pP  Transaction identifier                                  **
+ **          lid_pP:  Link identifier                                        **
+ **          old_ar_pP: Old access router link address                       **
  **          reason_codeP: Reason why the link went down                   **
  ***************************************************************************/
-void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
-        MIH_C_LINK_TUPLE_ID_T  *lidP,
-        MIH_C_LINK_ADDR_T      *old_arP,
+void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tid_pP,
+        MIH_C_LINK_TUPLE_ID_T  *lid_pP,
+        MIH_C_LINK_ADDR_T      *old_ar_pP,
         MIH_C_LINK_DN_REASON_T *reason_codeP)
 {
     MIH_C_Message_Link_Down_indication_t      message;
-    Bit_Buffer_t                             *bb;
+    Bit_Buffer_t                             *bb_p = NULL;
     int                                       message_total_length;
 
     if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_DOWN)) {
@@ -483,8 +517,8 @@ void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACT
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_DOWN_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Going_Down_indication_t));
 
@@ -492,24 +526,24 @@ void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACT
     message.header.service_identifier   = (MIH_C_SID_T)2;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)3;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
     MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
 
-    memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
-    message.primitive.OldAccessRouter = old_arP;
+    memcpy(&message.primitive.LinkIdentifier, lid_pP, sizeof(MIH_C_LINK_TUPLE_ID_T));
+    message.primitive.OldAccessRouter = old_ar_pP;
     memcpy(&message.primitive.ReasonCode, reason_codeP, sizeof(MIH_C_LINK_DN_REASON_T));
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Down_indication(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Down_indication(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Down.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Down.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -524,8 +558,8 @@ void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACT
  **   by a user configurable timer or when it crosses a confi-  **
  **   gured threshold.                                          **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
- **     lidP:  Link identifier                            **
+ ** Inputs:  tid_pP  Transaction identifier                     **
+ **     lid_pP:  Link identifier                            **
  **     lparam_listP: List of link parameter reports             **
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id                       **
  **                                                                        **
@@ -534,12 +568,12 @@ void eRAL_send_link_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACT
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
-        MIH_C_LINK_TUPLE_ID_T       *lidP,
+void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tid_pP,
+        MIH_C_LINK_TUPLE_ID_T       *lid_pP,
         MIH_C_LINK_PARAM_RPT_LIST_T *lparam_listP)
 {
     MIH_C_Message_Link_Parameters_Report_indication_t  message;
-    Bit_Buffer_t                                       *bb;
+    Bit_Buffer_t                                       *bb_p;
     int                                                message_total_length;
 
     if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_PARAMETERS_REPORT)) {
@@ -548,8 +582,8 @@ void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, M
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_PARAMETERS_REPORT_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Parameters_Report_indication_t));
 
@@ -562,24 +596,24 @@ void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, M
     message.header.service_identifier   = (MIH_C_SID_T)2;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)5;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
     MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
 
 
-    memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
+    memcpy(&message.primitive.LinkIdentifier, lid_pP, sizeof(MIH_C_LINK_TUPLE_ID_T));
     memcpy(&message.primitive.LinkParametersReportList_list, lparam_listP, sizeof(MIH_C_LINK_PARAM_RPT_LIST_T));
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Parameters_Report_indication(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Parameters_Report_indication(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Parameters_Report.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Parameters_Report.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -593,8 +627,8 @@ void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, M
  **   received within specified time interval then actions due  **
  **   to previous Link_Going_Down are ignored.                  **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
- **     lidP:  Link identifier                            **
+ ** Inputs:  tid_pP  Transaction identifier                     **
+ **     lid_pP:  Link identifier                            **
  **     timeP:  The time interval (ms) at which the link   **
  **    is expected to go down (0 if unknown)      **
  **     lreasonP: Reason why the link is going to be down    **
@@ -605,13 +639,13 @@ void eRAL_send_link_parameters_report_indication(ral_enb_instance_t instanceP, M
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
-        MIH_C_LINK_TUPLE_ID_T  *lidP,
+void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tid_pP,
+        MIH_C_LINK_TUPLE_ID_T  *lid_pP,
         MIH_C_UNSIGNED_INT2_T  *timeP,
         MIH_C_LINK_GD_REASON_T *lreasonP)
 {
     MIH_C_Message_Link_Going_Down_indication_t  message;
-    Bit_Buffer_t                                *bb;
+    Bit_Buffer_t                                *bb_p;
     int                                         message_total_length;
 
     if (!(g_enb_ral_obj[instanceP].mih_supported_link_event_list & MIH_C_BIT_LINK_GOING_DOWN)) {
@@ -620,8 +654,8 @@ void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TR
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_GOING_DOWN_INDICATION\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Going_Down_indication_t));
 
@@ -634,26 +668,26 @@ void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TR
     message.header.service_identifier   = (MIH_C_SID_T)2;
     message.header.operation_code       = (MIH_C_OPCODE_T)3;
     message.header.action_identifier    = (MIH_C_AID_T)6;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
     MIH_C_MIHF_ID_set(&message.destination, (u_int8_t*)g_enb_ral_obj[instanceP].mihf_id, strlen(g_enb_ral_obj[instanceP].mihf_id));
 
 
-    memcpy(&message.primitive.LinkIdentifier, lidP, sizeof(MIH_C_LINK_TUPLE_ID_T));
+    memcpy(&message.primitive.LinkIdentifier, lid_pP, sizeof(MIH_C_LINK_TUPLE_ID_T));
     message.primitive.TimeInterval = *timeP;
     memcpy(&message.primitive.LinkGoingDownReason, lreasonP,
             sizeof(MIH_C_LINK_GD_REASON_T));
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Going_Down_indication(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Going_Down_indication(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Going_Down.indication\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Going_Down.indication\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /*
@@ -671,7 +705,7 @@ void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TR
  **   This primitive is generated in response to a Link_Get_    **
  **   Parameters.request.                                       **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     lparam_listP: List of measurable link parameters and     **
  **    their current values                       **
@@ -684,20 +718,20 @@ void eRAL_send_link_going_down_indication(ral_enb_instance_t instanceP, MIH_C_TR
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T       *tidP,
+void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T       *tid_pP,
         MIH_C_STATUS_T               *statusP,
         MIH_C_LINK_PARAM_LIST_T      *lparam_listP,
         MIH_C_LINK_STATES_RSP_LIST_T *lstates_listP,
         MIH_C_LINK_DESC_RSP_LIST_T   *ldesc_listP)
 {
     MIH_C_Message_Link_Get_Parameters_confirm_t  message;
-    Bit_Buffer_t                                *bb;
+    Bit_Buffer_t                                *bb_p;
     int                                          message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_GET_PARAMETERS_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Get_Parameters_confirm_t));
 
@@ -710,7 +744,7 @@ void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSA
     message.header.service_identifier   = (MIH_C_SID_T)3;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)1;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -721,14 +755,14 @@ void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSA
     message.primitive.LinkStatesResponse_list       = lstates_listP;
     message.primitive.LinkDescriptorsResponse_list  = ldesc_listP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Get_Parameters_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Get_Parameters_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Get_Parameters.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Get_Parameters.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -741,7 +775,7 @@ void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSA
  **   This primitive is generated in response to a Link_        **
  **   Configure_Thresholds.request.                             **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     lstatus_listP: List of link configure status              **
  **     Others: g_enb_ral_obj[instanceP].link_id, g_enb_ral_obj[instanceP].mihf_id                       **
@@ -751,18 +785,18 @@ void eRAL_send_get_parameters_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSA
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tidP,
+void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T *tid_pP,
         MIH_C_STATUS_T               *statusP,
         MIH_C_LINK_CFG_STATUS_LIST_T *lstatus_listP)
 {
     MIH_C_Message_Link_Configure_Thresholds_confirm_t  message;
-    Bit_Buffer_t                                      *bb;
+    Bit_Buffer_t                                      *bb_p;
     int                                                message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Configure_Thresholds_confirm_t));
 
@@ -775,7 +809,7 @@ void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_
     message.header.service_identifier   = (MIH_C_SID_T)3;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)2;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -784,14 +818,14 @@ void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_
     message.primitive.Status                        = *statusP;
     message.primitive.LinkConfigureStatusList_list  =  lstatus_listP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Configure_Thresholds_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Configure_Thresholds_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Configure_Threshold.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Configure_Threshold.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -803,7 +837,7 @@ void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_
  **   This primitive is generated to communicate the result of  **
  **   the action executed on the link-layer connection.         **
  **                                                                        **
- ** Inputs:  tidP  Transaction identifier                     **
+ ** Inputs:  tid_pP  Transaction identifier                     **
  **     statusP: Status of operation                        **
  **     response_setP: List of discovered links and related       **
  **    information                                **
@@ -816,19 +850,21 @@ void eRAL_send_configure_thresholds_confirm(ral_enb_instance_t instanceP, MIH_C_
  **     Others: g_msg_codec_send_buffer                    **
  **                                                                        **
  ***************************************************************************/
-void eRAL_send_link_action_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTION_ID_T     *tidP,
+void eRAL_send_link_action_confirm(
+        ral_enb_instance_t instanceP,
+        MIH_C_TRANSACTION_ID_T     *tid_pP,
         MIH_C_STATUS_T             *statusP,
         MIH_C_LINK_SCAN_RSP_LIST_T *response_setP,
         MIH_C_LINK_AC_RESULT_T     *action_resultP)
 {
     MIH_C_Message_Link_Action_confirm_t       message;
-    Bit_Buffer_t                             *bb;
+    Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
 
     LOG_D(RAL_ENB, " Send MIH_C_MESSAGE_LINK_ACTION_CONFIRM\n");
 
-    bb = new_BitBuffer_0();
-    BitBuffer_wrap(bb, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
+    bb_p = new_BitBuffer_0();
+    BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
 
     memset(&message, 0, sizeof (MIH_C_Message_Link_Action_confirm_t));
 
@@ -841,7 +877,7 @@ void eRAL_send_link_action_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTI
     message.header.service_identifier   = (MIH_C_SID_T)3;
     message.header.operation_code       = (MIH_C_OPCODE_T)0;
     message.header.action_identifier    = (MIH_C_AID_T)3;
-    message.header.transaction_id       = *tidP;
+    message.header.transaction_id       = *tid_pP;
 
     MIH_C_MIHF_ID_set(&message.source, (u_int8_t*)g_enb_ral_obj[instanceP].link_id, strlen(g_enb_ral_obj[instanceP].link_id));
 
@@ -851,14 +887,14 @@ void eRAL_send_link_action_confirm(ral_enb_instance_t instanceP, MIH_C_TRANSACTI
     message.primitive.ScanResponseSet_list         = response_setP;
     message.primitive.LinkActionResult             = action_resultP;
 
-    message_total_length = MIH_C_Link_Message_Encode_Link_Action_confirm(bb, &message);
+    message_total_length = MIH_C_Link_Message_Encode_Link_Action_confirm(bb_p, &message);
 
-    if (eRAL_send_to_mih( instanceP, bb->m_buffer, message_total_length) < 0) {
+    if (eRAL_send_to_mih( instanceP, bb_p->m_buffer, message_total_length) < 0) {
         LOG_E(RAL_ENB, ": Send Link_Action.confirm\n");
     } else {
         LOG_D(RAL_ENB, ": Sent Link_Action.confirm\n");
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
 }
 
 /****************************************************************************
@@ -1012,7 +1048,7 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
     int                      nb_bytes_decoded  ;
     int                      total_bytes_to_decode ;
     int                      status ;
-    Bit_Buffer_t            *bb;
+    Bit_Buffer_t            *bb_p;
     struct sockaddr_in       udp_socket;
     socklen_t                sockaddr_len;
 
@@ -1020,7 +1056,7 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
     total_bytes_to_decode = 0;
     nb_bytes_received     = 0;
 
-    bb = new_BitBuffer_0();
+    bb_p = new_BitBuffer_0();
 
     nb_bytes_received = recvfrom(g_enb_ral_obj[instanceP].mih_sock_desc,
             (void *)g_msg_codec_recv_buffer,
@@ -1034,11 +1070,11 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
         LOG_D(RAL_ENB, " %s Received %d bytes\n", __FUNCTION__, nb_bytes_received);
         eRAL_print_buffer(g_msg_codec_recv_buffer, nb_bytes_received);
         total_bytes_to_decode += nb_bytes_received;
-        BitBuffer_wrap(bb, g_msg_codec_recv_buffer, total_bytes_to_decode);
+        BitBuffer_wrap(bb_p, g_msg_codec_recv_buffer, total_bytes_to_decode);
         /* Decode the message received from the MIHF */
-        status  = eRAL_mih_link_msg_decode(instanceP, bb, &message_wrapper);
+        status  = eRAL_mih_link_msg_decode(instanceP, bb_p, &message_wrapper);
         if (status == MIH_MESSAGE_DECODE_OK) {
-            nb_bytes_decoded = BitBuffer_getPosition(bb);
+            nb_bytes_decoded = BitBuffer_getPosition(bb_p);
             if (nb_bytes_decoded > 0) {
                 total_bytes_to_decode = total_bytes_to_decode - nb_bytes_decoded;
                 // if remaining bytes to decode
@@ -1061,7 +1097,7 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
         } else if (status == MIH_MESSAGE_DECODE_BAD_PARAMETER) {
         }
     }
-    free_BitBuffer(bb);
+    free_BitBuffer(bb_p);
     return 0;
 }
 
@@ -1075,7 +1111,7 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
  **                                                                        **
  ** Description: Print the content of a buffer in hexadecimal.             **
  **                                                                        **
- ** Inputs:  bufferP: Pointer to the buffer to print             **
+ ** Inputs:  buffer_pP: Pointer to the buffer to print             **
  **     lengthP: Length of the buffer to print              **
  **     Others: g_msg_codec_print_buffer                   **
  **                                                                        **
@@ -1084,7 +1120,7 @@ int eRAL_mih_link_process_message(ral_enb_instance_t instanceP){
  **     Others: None                                       **
  **                                                                        **
  ***************************************************************************/
-void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
+void eRAL_print_buffer(const u_int8_t * buffer_pP, int lenP)
 {
     char          c;
     unsigned int  buffer_index = 0;
@@ -1092,7 +1128,7 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
     unsigned int  octet_index  = 0;
     unsigned long char_index   = 0;
 
-    if (bufferP == NULL) {
+    if (buffer_pP == NULL) {
         return;
     }
 
@@ -1104,7 +1140,7 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
             if (octet_index != 0) {
                 buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " | ");
                 for (char_index = octet_index - 16; char_index < octet_index; char_index++) {
-                    c = (char) bufferP[char_index] & 0177;
+                    c = (char) buffer_pP[char_index] & 0177;
                     if (iscntrl(c) || isspace(c)) {
                         buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " ");
                     } else {
@@ -1118,7 +1154,7 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
         /*
          * Print every single octet in hexadecimal form
          */
-        buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " %02x", (u_int8_t)(bufferP[octet_index] & 0x00FF));
+        buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " %02x", (u_int8_t)(buffer_pP[octet_index] & 0x00FF));
     }
 
     /*
@@ -1132,7 +1168,7 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
     buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " | ");
     for (char_index = (octet_index / 16) * 16; char_index < octet_index; char_index++)
     {
-        c = (char) bufferP[char_index] & 0177;
+        c = (char) buffer_pP[char_index] & 0177;
         if (iscntrl(c) || isspace(c)) {
             buffer_index += sprintf(&g_msg_codec_print_buffer[buffer_index], " ");
         } else {
@@ -1155,7 +1191,7 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
  **                                                                        **
  ** Description: Sends a buffered message to the MIH-F.                    **
  **                                                                        **
- ** Inputs:  bufferP: Pointer to the buffered buffer to send     **
+ ** Inputs:  buffer_pP: Pointer to the buffered buffer to send     **
  **     lenP:  Length of the buffered buffer to send      **
  **     Others: g_sockd_mihf                               **
  **                                                                        **
@@ -1164,11 +1200,11 @@ void eRAL_print_buffer(const u_int8_t * bufferP, int lenP)
  **     Others: None                                       **
  **                                                                        **
  ***************************************************************************/
-int eRAL_send_to_mih(ral_enb_instance_t instanceP, const u_int8_t *bufferP, int lenP)
+int eRAL_send_to_mih(ral_enb_instance_t instanceP, const u_int8_t *buffer_pP, int lenP)
 {
     int result;
-    eRAL_print_buffer(bufferP, lenP);
-    result = send(g_enb_ral_obj[instanceP].mih_sock_desc, (const void *)bufferP, lenP, 0);
+    eRAL_print_buffer(buffer_pP, lenP);
+    result = send(g_enb_ral_obj[instanceP].mih_sock_desc, (const void *)buffer_pP, lenP, 0);
     if (result != lenP) {
         LOG_E(RAL_ENB, " %s : %d bytes failed, returned %d: %s\n",
                 __FUNCTION__, lenP, result, strerror(errno));
@@ -1179,27 +1215,22 @@ int eRAL_send_to_mih(ral_enb_instance_t instanceP, const u_int8_t *bufferP, int
 /****************************************************************************
  ** Name:  eRAL_mih_link_msg_decode()                                   **
  ** Description: Decode messages received from the MIH-F.                  **
- ** Inputs:  bbP:  Pointer to the buffer to decode                         **
- ** Outputs:  message_wrapperP:                                            **
+ ** Inputs:  bb_pP:  Pointer to the buffer to decode                         **
+ ** Outputs:  message_wrapper_pP:                                            **
  **    Pointer to the message wrapper                                      **
  **   Return: < 0 on failure, 0 otherwise                                  **
  ***************************************************************************/
-int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP){
+int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bb_pP, MIH_C_Message_Wrapper_t *message_wrapper_pP){
     //---------------------------------------------------------------------------
-    int  status = MIH_MESSAGE_DECODE_FAILURE;
+    int            status = MIH_MESSAGE_DECODE_FAILURE;
     MIH_C_HEADER_T header;
     MIH_C_STATUS_T mih_status;
-#ifdef MSCGEN_PYTOOL
-    char msg_src[32];
-    char msg_dst[32];
-    int  i;
-#endif
 
-    if ((bbP != NULL) && (message_wrapperP != NULL)){
+    if ((bb_pP != NULL) && (message_wrapper_pP != NULL)){
         /*
          * Decode MIH protocol header
          */
-        status = MIH_C_Link_Header_Decode(bbP, &header);
+        status = MIH_C_Link_Header_Decode(bb_pP, &header);
         if (status == MIH_HEADER_DECODE_TOO_SHORT) {
             return MIH_MESSAGE_DECODE_TOO_SHORT;
         } else if (status == MIH_HEADER_DECODE_FAILURE) {
@@ -1207,12 +1238,12 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
         } else if (status == MIH_HEADER_DECODE_BAD_PARAMETER) {
             return MIH_MESSAGE_DECODE_BAD_PARAMETER;
         }
-        message_wrapperP->message_id = MIH_C_MESSAGE_ID(header.service_identifier, header.operation_code, header.action_identifier);
+        message_wrapper_pP->message_id = MIH_C_MESSAGE_ID(header.service_identifier, header.operation_code, header.action_identifier);
 
         /*
          * Decode MIH primitives
          */
-        switch (message_wrapperP->message_id) {
+        switch (message_wrapper_pP->message_id) {
 
             case MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST_ID:
                 /*
@@ -1223,19 +1254,19 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * Discover.confirm primitive.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_CAPABILITY_DISCOVER_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_capability_discover_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_capability_discover_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Capability_Discover.request */
-                status = MIH_C_Link_Message_Decode_Link_Capability_Discover_request(bbP, &message_wrapperP->_union_message.link_capability_discover_request);
+                status = MIH_C_Link_Message_Decode_Link_Capability_Discover_request(bb_pP, &message_wrapper_pP->_union_message.link_capability_discover_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
 
                     /* Process Link_Capability_Discover.request */
-                    MIH_C_Link_Message_Link_Capability_Discover_request2String(&message_wrapperP->_union_message.link_capability_discover_request, g_msg_print_buffer);
+                    MIH_C_Link_Message_Link_Capability_Discover_request2String(&message_wrapper_pP->_union_message.link_capability_discover_request, g_msg_print_buffer);
                     LOG_D(RAL_ENB, " %s", g_msg_print_buffer);
                     mih_status = MIH_C_STATUS_SUCCESS;
                     LOG_D(RAL_ENB, "**\n");
                     /* Send Link_Capability_Discover.confirm */
-                    eRAL_send_capability_discover_confirm(instanceP, &message_wrapperP->_union_message.link_capability_discover_request.header.transaction_id,
+                    eRAL_send_capability_discover_confirm(instanceP, &message_wrapper_pP->_union_message.link_capability_discover_request.header.transaction_id,
                             &mih_status,
                             &g_enb_ral_obj[instanceP].mih_supported_link_event_list,
                             &g_enb_ral_obj[instanceP].mih_supported_link_command_list);
@@ -1252,14 +1283,14 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * confirm primitive.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_EVENT_SUBSCRIBE_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_event_subscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_event_subscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Event_Subscribe.request */
-                status = MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(bbP, &message_wrapperP->_union_message.link_event_subscribe_request);
+                status = MIH_C_Link_Message_Decode_Link_Event_Subscribe_request(bb_pP, &message_wrapper_pP->_union_message.link_event_subscribe_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
                     /* Process Link_Event_Subscribe.request */
                     LOG_D(RAL_ENB, "**\n");
-                    eRAL_subscribe_request(instanceP, &message_wrapperP->_union_message.link_event_subscribe_request);
+                    eRAL_subscribe_request(instanceP, &message_wrapper_pP->_union_message.link_event_subscribe_request);
 
                 } else {
                 }
@@ -1274,14 +1305,14 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * Unsubscribe.confirm primitive.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_EVENT_UNSUBSCRIBE_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_event_unsubscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_event_unsubscribe_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Event_Unsubscribe.request */
-                status = MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(bbP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
+                status = MIH_C_Link_Message_Decode_Link_Event_Unsubscribe_request(bb_pP, &message_wrapper_pP->_union_message.link_event_unsubscribe_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
                     LOG_D(RAL_ENB, "**\n");
                     /* Process Link_Event_Unsubscribe.request */
-                    eRAL_unsubscribe_request(instanceP, &message_wrapperP->_union_message.link_event_unsubscribe_request);
+                    eRAL_unsubscribe_request(instanceP, &message_wrapper_pP->_union_message.link_event_unsubscribe_request);
 
                 } else {
                 }
@@ -1295,14 +1326,14 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * primitive.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_GET_PARAMETERS_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_get_parameters_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_get_parameters_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Get_Parameters.request */
-                status = MIH_C_Link_Message_Decode_Link_Get_Parameters_request(bbP, &message_wrapperP->_union_message.link_get_parameters_request);
+                status = MIH_C_Link_Message_Decode_Link_Get_Parameters_request(bb_pP, &message_wrapper_pP->_union_message.link_get_parameters_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
                     LOG_D(RAL_ENB, "**\n");
                     /* Process Link_Get_Parameters.request */
-                    eRAL_get_parameters_request(instanceP, &message_wrapperP->_union_message.link_get_parameters_request);
+                    eRAL_get_parameters_request(instanceP, &message_wrapper_pP->_union_message.link_get_parameters_request);
                 } else {
                 }
                 break;
@@ -1315,14 +1346,14 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * Thresholds.confirm primitive.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_CONFIGURE_THRESHOLDS_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_configure_thresholds_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_configure_thresholds_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Configure_Thresholds.request */
-                status = MIH_C_Link_Message_Decode_Link_Configure_Thresholds_request(bbP, &message_wrapperP->_union_message.link_configure_thresholds_request);
+                status = MIH_C_Link_Message_Decode_Link_Configure_Thresholds_request(bb_pP, &message_wrapper_pP->_union_message.link_configure_thresholds_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
                     LOG_D(RAL_ENB, "**\n");
                     /* Process Link_Configure_Thresholds.request */
-                    eRAL_configure_thresholds_request(instanceP, &message_wrapperP->_union_message.link_configure_thresholds_request);
+                    eRAL_configure_thresholds_request(instanceP, &message_wrapper_pP->_union_message.link_configure_thresholds_request);
                 } else {
                 }
                 break;
@@ -1337,14 +1368,14 @@ int eRAL_mih_link_msg_decode(ral_enb_instance_t instanceP, Bit_Buffer_t* bbP, MI
                  * connection.
                  */
                 LOG_D(RAL_ENB, " %s Received MIH_C_MESSAGE_LINK_ACTION_REQUEST\n", __FUNCTION__);
-                memcpy(&message_wrapperP->_union_message.link_action_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
+                memcpy(&message_wrapper_pP->_union_message.link_action_request.header, (const void *)&header, sizeof(MIH_C_HEADER_T));
 
                 /* Decode Link_Action.request */
-                status = MIH_C_Link_Message_Decode_Link_Action_request(bbP, &message_wrapperP->_union_message.link_action_request);
+                status = MIH_C_Link_Message_Decode_Link_Action_request(bb_pP, &message_wrapper_pP->_union_message.link_action_request);
                 if (status == MIH_MESSAGE_DECODE_OK) {
                     LOG_D(RAL_ENB, "**\n");
                     /* Process Link_Action.request */
-                    eRAL_action_request(instanceP, &message_wrapperP->_union_message.link_action_request);
+                    eRAL_action_request(instanceP, &message_wrapper_pP->_union_message.link_action_request);
                 } else {
                 }
                 break;
diff --git a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c
index 80581f2a24..6150bc1f6c 100755
--- a/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c
+++ b/openair3/RAL-LTE/LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c
@@ -33,29 +33,35 @@ static int ueid2eui48(uint8_t *euiP, uint8_t* ue_idP)
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_system_configuration_indication(instance_t instanceP, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_system_configuration_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
-    g_enb_ral_obj[instanceP].plmn_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_p).plmn_id;
-    g_enb_ral_obj[instanceP].cell_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_p).cell_id;
+    module_id_t           mod_id = instanceP;
+    g_enb_ral_obj[mod_id].plmn_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_pP).plmn_id;
+    g_enb_ral_obj[mod_id].cell_id = RRC_RAL_SYSTEM_CONFIGURATION_IND(msg_pP).cell_id;
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_LINK_TUPLE_ID_T link_tuple_id;
+#ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     uint8_t               ue_id_array[MIH_C_3GPP_ADDR_LENGTH];
     uint8_t               mn_link_addr[MIH_C_3GPP_ADDR_LENGTH];
     uint64_t              ue_id; //EUI-64
     int                   i;
+#endif
+    module_id_t           mod_id = instanceP;
 
     // The LINK_ID contains the MN LINK_ADDR
+    link_tuple_id.choice                                            = MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR;
     link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
-    link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_ADDR;
+#ifdef USE_3GPP_ADDR_AS_LINK_ADDR
+    link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
+
     memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH);
-#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t"
-    ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_p).ue_id;
+    ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_pP).ue_id;
     for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) {
         ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF);
         ue_id = ue_id >> 8;
@@ -63,8 +69,23 @@ void eRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M
     ueid2eui48(mn_link_addr, ue_id_array);
     MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8);
 
-    //The optional LINK_ADDR may contains a link address of PoA.
-    link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
+    // The optional LINK_ADDR contains a link address of PoA.
+    eRAL_MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_tuple_id._union.link_addr._union._3gpp_addr, (uint8_t*)ENB_DEFAULT_3GPP_ADDRESS);
+#else
+#warning TO DO UE ID
+    // preserve byte order of plmn id
+    memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_enb_ral_obj[mod_id].plmn_id, 3);
+    link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_enb_ral_obj[mod_id].cell_id;
+
+    LOG_D(RAL_ENB, "PLMN ID %d.%d.%d\n",
+        link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0],
+        link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
+        link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]);
+
+    LOG_D(RAL_ENB, "CELL ID %d\n",
+        link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id);
+#endif
+
 
     eRAL_send_link_up_indication(instanceP, &g_enb_ral_obj[instanceP].transaction_id,
             &link_tuple_id,
@@ -77,27 +98,62 @@ void eRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M
 
 }
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instance, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
+  module_id_t           mod_id = instanceP;
 #warning "TO DO ral_rx_rrc_ral_connection_reestablishment_indication"
 }
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instance, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
+  MIH_C_LINK_TUPLE_ID_T link_tuple_id;
+  uint8_t               ue_id_array[MIH_C_3GPP_ADDR_LENGTH];
+  uint8_t               mn_link_addr[MIH_C_3GPP_ADDR_LENGTH];
+  uint64_t              ue_id; //EUI-64
+  int                   i;
+  module_id_t           mod_id = instanceP;
+
+  // The LINK_ID contains the MN LINK_ADDR
+  link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
+  link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_ADDR;
+  memset(ue_id_array, 0, MIH_C_3GPP_ADDR_LENGTH);
+#warning "TO DO FIX UE_ID TYPE in rrc_ral_connection_establishment_ind_t"
+  ue_id = (uint64_t)RRC_RAL_CONNECTION_ESTABLISHMENT_IND(msg_pP).ue_id;
+  for (i = 0; i < MIH_C_3GPP_ADDR_LENGTH; i++) {
+      ue_id_array[MIH_C_3GPP_ADDR_LENGTH-1-i] = (ue_id & 0x00000000000000FF);
+      ue_id = ue_id >> 8;
+  }
+  ueid2eui48(mn_link_addr, ue_id_array);
+  MIH_C_3GPP_ADDR_set(&(link_tuple_id.link_id.link_addr._union._3gpp_addr), NULL, 8);
+
+  //The optional LINK_ADDR may contains a link address of PoA.
+  link_tuple_id.choice = MIH_C_LINK_TUPLE_ID_CHOICE_NULL;
+
+  eRAL_send_link_up_indication(instanceP, &g_enb_ral_obj[instanceP].transaction_id,
+          &link_tuple_id,
+          NULL,   //MIH_C_LINK_ADDR_T       *old_arP,(Optional) Old Access Router link address.
+          NULL,   //MIH_C_LINK_ADDR_T       *new_arP,(Optional) New Access Router link address.
+          NULL,   //MIH_C_IP_RENEWAL_FLAG_T *flagP, (Optional) Indicates whether the MN needs to change IP Address in the new PoA.
+          NULL);  //MIH_C_IP_MOB_MGMT_T     *mobil_mngtP, (Optional) Indicates the type of Mobility Management Protocol supported by the new PoA.
+
+  g_enb_ral_obj[mod_id].transaction_id ++;
+
 
 }
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_measurement_report_indication(instance_t instance, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_measurement_report_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
+  module_id_t           mod_id = instanceP;
 
 }
 //---------------------------------------------------------------------------------------------------------------------
-void eRAL_rx_rrc_ral_connection_release_indication(instance_t instance, MessageDef *msg_p)
+void eRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
+  module_id_t           mod_id = instanceP;
 
 }
 
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h
index afdb6083b0..5334bc43c1 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h
+++ b/openair3/RAL-LTE/LTE_RAL_UE/INCLUDE/lteRALue_constants.h
@@ -44,10 +44,9 @@
 #define UE_DEFAULT_LINK_ID_RAL       "ue_lte_link"
 #define UE_DEFAULT_LINK_ADDRESS_RAL  "060080149150"
 #define UE_DEFAULT_MIHF_ID           "mihf2_ue"
-#define DEFAULT_ADDRESS_3GPP      "0335060080149150"
-#define DEFAULT_ADDRESS_eNB       "0000000000000001"
+//#define UE_DEFAULT_3GPP_ADDRESS      "0335060080149150"
+#define UE_DEFAULT_3GPP_ADDRESS      "0000000000000000"
 
-#define USE_3GPP_ADDR_AS_LINK_ADDR 1
 //-----------------------------------------------------------------------------
 // Constants for scenario
 #define PREDEFINED_MIH_PLMN_ID    503
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c
index 3de006face..1a87916117 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_action.c
@@ -50,7 +50,7 @@ void mRAL_action_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Action_
     MessageDef                            *message_p = NULL;
     rrc_ral_connection_release_req_t       release_req;
     rrc_ral_connection_establishment_req_t connection_establishment_req;
-    unsigned int                           mod_id = instanceP - NB_eNB_INST;
+    module_id_t                            mod_id = instanceP - NB_eNB_INST;
 
     status             = MIH_C_STATUS_SUCCESS;
     link_action_result = MIH_C_LINK_AC_RESULT_SUCCESS;
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c
index 270e5cdd37..1439b43e9a 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_main.c
@@ -151,8 +151,8 @@ void mRAL_init_default_values(void)
 //---------------------------------------------------------------------------
 int mRAL_initialize(void) {
     //---------------------------------------------------------------------------
-    ral_ue_instance_t  instance = 0;
-    unsigned int       mod_id   = 0;
+    ral_ue_instance_t  instance  = 0;
+    module_id_t        mod_id    = 0;
     char               *char_tmp = NULL;
 
     MIH_C_init();
@@ -163,7 +163,7 @@ int mRAL_initialize(void) {
 
     g_ue_ral_fd2instance = hashtable_create (32, NULL, hash_free_int_func);
 
-    for (mod_id = 0; mod_id < oai_emulation.info.nb_ue_local; mod_id++) {
+    for (mod_id = oai_emulation.info.first_ue_local; mod_id < oai_emulation.info.first_ue_local+ oai_emulation.info.nb_ue_local; mod_id++) {
 
         instance = mod_id + NB_eNB_INST;
         char_tmp                                       = calloc(1, strlen(g_conf_ue_ral_listening_port) + 3); // 2 digits + \0 ->99 mod_ids
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c
index d2f241b0f3..dd99d57ac0 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_mih_msg.c
@@ -57,8 +57,8 @@ static char g_msg_codec_print_buffer[8192] = {};
 //-----------------------------------------------------------------------------
 int mRAL_send_to_mih(ral_ue_instance_t instanceP, u_int8_t  *buffer_pP, size_t lenP) {
 //-----------------------------------------------------------------------------
-    int result;
-    unsigned int mod_id = instanceP - NB_eNB_INST;
+    int          result;
+    module_id_t  mod_id = instanceP - NB_eNB_INST;
     result = send(g_ue_ral_obj[mod_id].mih_sock_desc, (const void *)buffer_pP, lenP, 0);
     if (result != lenP) {
         LOG_E(RAL_UE, "send_to_mih %d bytes failed, returned %d: %s\n", lenP, result, strerror(errno));
@@ -73,7 +73,7 @@ int mRAL_mihf_connect(ral_ue_instance_t instanceP){
     struct addrinfo *addr, *rp; /* endpoint address  */
     int              rc;  /* returned error code  */
     int              optval;  /* socket option value  */
-    unsigned int     mod_id = instanceP - NB_eNB_INST;
+    module_id_t      mod_id = instanceP - NB_eNB_INST;
 
     unsigned char buf[sizeof(struct sockaddr_in6)];
 
@@ -195,7 +195,8 @@ void MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_ue_instance_t instanceP, MIH_C_3G
     u_int8_t      val_temp;
     unsigned char address_3gpp[32];
     unsigned char buf[3];
-    u_int8_t _3gpp_byte_address[8];
+    u_int8_t      _3gpp_byte_address[8];
+    module_id_t   mod_id = instanceP - NB_eNB_INST;
 
     strcpy((char *)address_3gpp, (char *)str_pP);
     for(l=0; l<8; l++)
@@ -208,7 +209,7 @@ void MIH_C_3GPP_ADDR_load_3gpp_str_address(ral_ue_instance_t instanceP, MIH_C_3G
         sscanf((const char *)buf,"%hhx", &val_temp);
         _3gpp_byte_address[l] = val_temp;
     }
-    _3gpp_byte_address[7] += instanceP;
+    _3gpp_byte_address[7] += mod_id;
     MIH_C_3GPP_ADDR_set(_3gpp_addr_pP, _3gpp_byte_address, 8);
 }
 
@@ -224,7 +225,7 @@ void mRAL_send_link_register_indication(ral_ue_instance_t        instanceP,
     MIH_C_Message_Link_Register_indication_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -246,13 +247,16 @@ void mRAL_send_link_register_indication(ral_ue_instance_t        instanceP,
     message.primitive.Link_Id.link_type        = MIH_C_WIRELESS_LTE; //MIH_C_WIRELESS_UMTS;
     #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
     #else
-    message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_LINK_TUPLE_ID_CHOICE_NULL;//MIH_C_CHOICE_3GPP_ADDR;
+    message.primitive.Link_Id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_3G_CELL_ID;
+    memcpy(message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3);
+    message.primitive.Link_Id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id;
     #endif
-    //MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_ue_ral_obj[instanceP].ipv6_l2id[0]), strlen(DEFAULT_ADDRESS_3GPP));
-    ////MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP, strlen(DEFAULT_ADDRESS_3GPP));
-    ////MIH_C_3GPP_ADDR_load_3gpp_str_address(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    //MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)&(g_ue_ral_obj[instanceP].ipv6_l2id[0]), strlen(UE_DEFAULT_3GPP_ADDRESS));
+    ////MIH_C_3GPP_ADDR_set(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS, strlen(UE_DEFAULT_3GPP_ADDRESS));
+    ////MIH_C_3GPP_ADDR_load_3gpp_str_address(&message.primitive.Link_Id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
+
 
     message_total_length = MIH_C_Link_Message_Encode_Link_Register_indication(bb_p, &message);
 
@@ -279,7 +283,7 @@ void mRAL_send_link_detected_indication(ral_ue_instance_t        instanceP,
     MIH_C_Message_Link_Detected_indication_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -321,7 +325,7 @@ void mRAL_send_link_up_indication(ral_ue_instance_t          instanceP,
     MIH_C_Message_Link_Up_indication_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -365,10 +369,7 @@ void mRAL_send_link_parameters_report_indication(ral_ue_instance_t            in
     MIH_C_Message_Link_Parameters_Report_indication_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
-    #ifdef MSCGEN_PYTOOL
-    unsigned int                              index;
-    #endif
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -410,7 +411,7 @@ void mRAL_send_link_going_down_indication(ral_ue_instance_t            instanceP
     MIH_C_Message_Link_Going_Down_indication_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -454,7 +455,7 @@ void mRAL_send_link_down_indication(ral_ue_instance_t            instanceP,
     MIH_C_Message_Link_Down_indication_t      message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -498,7 +499,7 @@ void mRAL_send_link_action_confirm(ral_ue_instance_t           instanceP,
     MIH_C_Message_Link_Action_confirm_t       message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
 
     bb_p = new_BitBuffer_0();
@@ -534,7 +535,7 @@ void mRAL_send_link_action_confirm(ral_ue_instance_t           instanceP,
 }
 
 //-----------------------------------------------------------------------------
-void mRAL_send_capability_discover_confirm(ral_ue_instance_t        instanceP,
+void mRAL_send_capability_discover_confirm(ral_ue_instance_t          instanceP,
                                              MIH_C_TRANSACTION_ID_T  *transaction_id_pP,
                                              MIH_C_STATUS_T          *status_pP,
                                              MIH_C_LINK_EVENT_LIST_T *supported_link_event_list_pP,
@@ -543,7 +544,7 @@ void mRAL_send_capability_discover_confirm(ral_ue_instance_t        instanceP,
     MIH_C_Message_Link_Capability_Discover_confirm_t  message;
     Bit_Buffer_t                             *bb_p;
     int                                       message_total_length;
-    unsigned int                              mod_id = instanceP - NB_eNB_INST;
+    module_id_t                               mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -575,7 +576,7 @@ void mRAL_send_capability_discover_confirm(ral_ue_instance_t        instanceP,
 }
 
 //-----------------------------------------------------------------------------
-void mRAL_send_event_subscribe_confirm(ral_ue_instance_t        instanceP,
+void mRAL_send_event_subscribe_confirm(ral_ue_instance_t          instanceP,
                                          MIH_C_TRANSACTION_ID_T  *transaction_id_pP,
                                          MIH_C_STATUS_T          *status_pP,
                                          MIH_C_LINK_EVENT_LIST_T *response_link_event_list_pP) {
@@ -583,7 +584,7 @@ void mRAL_send_event_subscribe_confirm(ral_ue_instance_t        instanceP,
     MIH_C_Message_Link_Event_Subscribe_confirm_t  message;
     Bit_Buffer_t                                 *bb_p;
     int                                           message_total_length;
-    unsigned int                                  mod_id = instanceP - NB_eNB_INST;
+    module_id_t                                   mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -614,7 +615,7 @@ void mRAL_send_event_subscribe_confirm(ral_ue_instance_t        instanceP,
 }
 
 //-----------------------------------------------------------------------------
-void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t        instanceP,
+void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t          instanceP,
                                            MIH_C_TRANSACTION_ID_T  *transaction_id_pP,
                                            MIH_C_STATUS_T          *status_pP,
                                            MIH_C_LINK_EVENT_LIST_T *response_link_event_list_pP) {
@@ -622,7 +623,7 @@ void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t        instanceP,
     MIH_C_Message_Link_Event_Unsubscribe_confirm_t  message;
     Bit_Buffer_t                                   *bb_p;
     int                                             message_total_length;
-    unsigned int                                    mod_id = instanceP - NB_eNB_INST;
+    module_id_t                                     mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -653,7 +654,7 @@ void mRAL_send_event_unsubscribe_confirm(ral_ue_instance_t        instanceP,
 }
 
 //-----------------------------------------------------------------------------
-void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t             instanceP,
+void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t               instanceP,
                                               MIH_C_TRANSACTION_ID_T       *transaction_id_pP,
                                               MIH_C_STATUS_T               *status_pP,
                                               MIH_C_LINK_CFG_STATUS_LIST_T *link_configure_status_list_pP) {
@@ -661,7 +662,7 @@ void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t             instan
     MIH_C_Message_Link_Configure_Thresholds_confirm_t  message;
     Bit_Buffer_t                                      *bb_p;
     int                                                message_total_length;
-    unsigned int                                       mod_id = instanceP - NB_eNB_INST;
+    module_id_t                                        mod_id = instanceP - NB_eNB_INST;
 
     bb_p = new_BitBuffer_0();
     BitBuffer_wrap(bb_p, g_msg_codec_send_buffer, (unsigned int)MSG_CODEC_SEND_BUFFER_SIZE);
@@ -692,7 +693,7 @@ void mRAL_send_configure_thresholds_confirm(ral_ue_instance_t             instan
 }
 
 //-----------------------------------------------------------------------------
-void mRAL_send_get_parameters_confirm     (ral_ue_instance_t             instanceP,
+void mRAL_send_get_parameters_confirm     (ral_ue_instance_t               instanceP,
                                              MIH_C_TRANSACTION_ID_T       *transaction_id_pP,
                                              MIH_C_STATUS_T               *status_pP,
                                              MIH_C_LINK_PARAM_LIST_T      *link_parameters_status_list_pP,
@@ -702,7 +703,7 @@ void mRAL_send_get_parameters_confirm     (ral_ue_instance_t             instanc
     MIH_C_Message_Link_Get_Parameters_confirm_t  message;
     Bit_Buffer_t                                *bb_p;
     int                                          message_total_length;
-    unsigned int                                 mod_id = instanceP - NB_eNB_INST;
+    module_id_t                                  mod_id = instanceP - NB_eNB_INST;
 
 
     bb_p = new_BitBuffer_0();
@@ -740,12 +741,14 @@ void mRAL_send_get_parameters_confirm     (ral_ue_instance_t             instanc
  ***************************************************************************/
 
 //-----------------------------------------------------------------------------
-int mRAL_mih_link_msg_decode(ral_ue_instance_t instanceP, Bit_Buffer_t* bbP, MIH_C_Message_Wrapper_t *message_wrapperP) {
+int mRAL_mih_link_msg_decode(ral_ue_instance_t        instanceP,
+                             Bit_Buffer_t            *bbP,
+                             MIH_C_Message_Wrapper_t *message_wrapperP) {
 //-----------------------------------------------------------------------------
     int                                      status = MIH_MESSAGE_DECODE_FAILURE;
     MIH_C_HEADER_T                           header;
     MIH_C_STATUS_T                           mih_status;
-    unsigned int                             mod_id = instanceP - NB_eNB_INST;
+    module_id_t                              mod_id = instanceP - NB_eNB_INST;
 
 
     if ((bbP != NULL) && (message_wrapperP != NULL)) {
@@ -860,7 +863,7 @@ int mRAL_mih_link_process_message(ral_ue_instance_t instanceP){
     Bit_Buffer_t            *bb_p;
     struct sockaddr_in       udp_socket;
     socklen_t                sockaddr_len;
-    unsigned int             mod_id = instanceP - NB_eNB_INST;
+    module_id_t              mod_id = instanceP - NB_eNB_INST;
 
     total_bytes_to_decode = 0;
     nb_bytes_received     = 0;
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_parameters.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_parameters.c
index 110b37c923..f02e4e6e1e 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_parameters.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_parameters.c
@@ -40,7 +40,8 @@
 #include "lteRALue.h"
 
 //-----------------------------------------------------------------------------
-void mRAL_get_parameters_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Get_Parameters_request_t* messageP) {
+void mRAL_get_parameters_request(ral_ue_instance_t                            instanceP,
+                                 MIH_C_Message_Link_Get_Parameters_request_t *messageP) {
 //-----------------------------------------------------------------------------
     MIH_C_STATUS_T                      status;
     MIH_C_LINK_PARAM_LIST_T             link_parameters_status_list;
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c
index 0d8c8ca488..dee48a8510 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_rrc_msg.c
@@ -35,9 +35,9 @@ static int ueid2eui48(uint8_t *euiP, uint8_t* ue_idP)
     return 0;
 }
 
-
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP,
+                                  MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_STATUS_T             status;
@@ -49,19 +49,19 @@ void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p)
     ac_result = MIH_C_LINK_AC_RESULT_SUCCESS;
     memset(&scan_rsp_list, 0, sizeof(MIH_C_LINK_SCAN_RSP_LIST_T));
 
-    for (i = 0 ; i < RRC_RAL_SCAN_CONF (msg_p).num_scan_resp; i++) {
+    for (i = 0 ; i < RRC_RAL_SCAN_CONF (msg_pP).num_scan_resp; i++) {
         // TO DO
-        memcpy(&scan_rsp_list.val[i].link_addr, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].link_addr, sizeof(MIH_C_LINK_ADDR_T));
+        memcpy(&scan_rsp_list.val[i].link_addr, &RRC_RAL_SCAN_CONF (msg_pP).link_scan_resp[i].link_addr, sizeof(MIH_C_LINK_ADDR_T));
         // TO DO
-        memcpy(&scan_rsp_list.val[i].network_id, &RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].network_id, sizeof(MIH_C_NETWORK_ID_T));
+        memcpy(&scan_rsp_list.val[i].network_id, &RRC_RAL_SCAN_CONF (msg_pP).link_scan_resp[i].network_id, sizeof(MIH_C_NETWORK_ID_T));
 
-        scan_rsp_list.val[i].sig_strength.choice = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength.choice;
+        scan_rsp_list.val[i].sig_strength.choice = RRC_RAL_SCAN_CONF (msg_pP).link_scan_resp[i].sig_strength.choice;
         switch (scan_rsp_list.val[i].sig_strength.choice) {
             case RAL_SIG_STRENGTH_CHOICE_DBM:
-                scan_rsp_list.val[i].sig_strength._union.dbm = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.dbm;
+                scan_rsp_list.val[i].sig_strength._union.dbm = RRC_RAL_SCAN_CONF (msg_pP).link_scan_resp[i].sig_strength._union.dbm;
                 break;
             case RAL_SIG_STRENGTH_CHOICE_PERCENTAGE:
-                scan_rsp_list.val[i].sig_strength._union.percentage = RRC_RAL_SCAN_CONF (msg_p).link_scan_resp[i].sig_strength._union.percentage;
+                scan_rsp_list.val[i].sig_strength._union.percentage = RRC_RAL_SCAN_CONF (msg_pP).link_scan_resp[i].sig_strength._union.percentage;
                 break;
             default:
                 LOG_E(RAL_UE, "INVALID RRC_RAL_SCAN_CONF field sig_strength.choice %d\n", scan_rsp_list.val[i].sig_strength.choice);
@@ -70,7 +70,7 @@ void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p)
         scan_rsp_list.length += 1;
     }
     mRAL_send_link_action_confirm(instanceP,
-            &RRC_RAL_SCAN_CONF (msg_p).transaction_id,
+            &RRC_RAL_SCAN_CONF (msg_pP).transaction_id,
             &status,
             &scan_rsp_list,
             &ac_result);
@@ -78,30 +78,31 @@ void mRAL_rx_rrc_ral_scan_confirm(instance_t instanceP, MessageDef *msg_p)
 
 
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_system_information_indication(instance_t  instanceP,
+                                                   MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_LINK_DET_INFO_T   link_det_info;
     int                     i;
-    unsigned int            mod_id = instanceP - NB_eNB_INST;
+    module_id_t             mod_id = instanceP - NB_eNB_INST;
 
     memset(&link_det_info, 0, sizeof(MIH_C_LINK_DET_INFO_T));
 
     // save cell parameters
-    g_ue_ral_obj[mod_id].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id;
-    memcpy(&g_ue_ral_obj[mod_id].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, sizeof(g_ue_ral_obj[mod_id].plmn_id));
+    g_ue_ral_obj[mod_id].cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).cell_id;
+    memcpy(&g_ue_ral_obj[mod_id].plmn_id, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).plmn_id, sizeof(g_ue_ral_obj[mod_id].plmn_id));
 
     // link id
     link_det_info.link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
     #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     link_det_info.link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
     #else
     link_det_info.link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_3G_CELL_ID;
 
     // preserve byte order of plmn id
-    memcpy(link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).plmn_id, 3);
-    link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).cell_id;
+    memcpy(link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).plmn_id, 3);
+    link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).cell_id;
 
     LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0],
             link_det_info.link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
@@ -116,11 +117,11 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message
     MIH_C_NET_AUX_ID_set(&link_det_info.net_aux_id, (u_int8_t *)PREDEFINED_MIH_NETAUX_ID, strlen(PREDEFINED_MIH_NETAUX_ID));
 
     link_det_info.sig_strength.choice     = MIH_C_SIG_STRENGTH_CHOICE_DBM;
-    link_det_info.sig_strength._union.dbm = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).dbm;
+    link_det_info.sig_strength._union.dbm = RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).dbm;
 
-    link_det_info.sinr                    = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).sinr;
+    link_det_info.sinr                    = RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).sinr;
 
-    link_det_info.link_data_rate          = RRC_RAL_SYSTEM_INFORMATION_IND(msg_p).link_data_rate;
+    link_det_info.link_data_rate          = RRC_RAL_SYSTEM_INFORMATION_IND(msg_pP).link_data_rate;
 
     link_det_info.link_mihcap_flag        = g_ue_ral_obj[mod_id].link_mihcap_flag;
 
@@ -132,18 +133,19 @@ void mRAL_rx_rrc_ral_system_information_indication(instance_t instanceP, Message
 
 }
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t  instanceP,
+                                                         MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_LINK_TUPLE_ID_T link_tuple_id;
-    unsigned int          mod_id = instanceP - NB_eNB_INST;
+    module_id_t           mod_id = instanceP - NB_eNB_INST;
 
     memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T));
     // The LINK_ID contains the MN LINK_ADDR
     link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
     #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
     #else
     link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_3G_CELL_ID;
     memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3);
@@ -167,11 +169,12 @@ void mRAL_rx_rrc_ral_connection_establishment_indication(instance_t instanceP, M
 
 }
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t  instanceP,
+                                                           MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_LINK_TUPLE_ID_T link_tuple_id;
-    unsigned int          mod_id = instanceP - NB_eNB_INST;
+    module_id_t           mod_id = instanceP - NB_eNB_INST;
 
     memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T));
     //The optional LINK_ADDR may contains a link address of PoA.
@@ -179,13 +182,12 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP,
     link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
     #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
     #else
     link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_3G_CELL_ID;
     // preserve byte order of plmn id
     memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3);
     link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id;
-    // TEST END
 
     LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0],
             link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
@@ -193,8 +195,8 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP,
     LOG_D(RAL_UE, "CELL ID %d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id);
     #endif
 
-    LOG_D(RAL_UE, "RRC_RAL_CONNECTION_ESTABLISHMENT_IND num srb %d num drb %d\n", RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb,RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb);
-    if ((RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_drb > 0) && (RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_p).num_srb > 0)) {
+    LOG_D(RAL_UE, "RRC_RAL_CONNECTION_ESTABLISHMENT_IND num srb %d num drb %d\n", RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_pP).num_srb,RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_pP).num_drb);
+    if ((RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_pP).num_drb > 0) && (RRC_RAL_CONNECTION_REESTABLISHMENT_IND(msg_pP).num_srb > 0)) {
         mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id,
             &link_tuple_id,
             NULL,   //MIH_C_LINK_ADDR_T       *old_arP,(Optional) Old Access Router link address.
@@ -211,11 +213,12 @@ void mRAL_rx_rrc_ral_connection_reestablishment_indication(instance_t instanceP,
     }
     g_ue_ral_obj[mod_id].transaction_id ++;}
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t  instanceP,
+                                                           MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_LINK_TUPLE_ID_T link_tuple_id;
-    unsigned int          mod_id = instanceP - NB_eNB_INST;
+    module_id_t           mod_id = instanceP - NB_eNB_INST;
 
     memset(&link_tuple_id, 0, sizeof(MIH_C_LINK_TUPLE_ID_T));
     //The optional LINK_ADDR may contains a link address of PoA.
@@ -223,12 +226,11 @@ void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP,
     link_tuple_id.link_id.link_type                                 = MIH_C_WIRELESS_LTE;
     #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
     #else
     // preserve byte order of plmn id
     memcpy(link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val, &g_ue_ral_obj[mod_id].plmn_id, 3);
     link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id;
-    // TEST END
 
     LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0],
             link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
@@ -237,11 +239,11 @@ void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP,
     #endif
 
     LOG_D(RAL_UE, "RRC_RAL_CONNECTION_RECONFIGURATION_IND num srb %d num drb %d\n",
-            RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_srb,
-            RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_drb);
+            RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_pP).num_srb,
+            RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_pP).num_drb);
 
-    if ((RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_drb > 0) &&
-            (RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_p).num_srb > 0)) {
+    if ((RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_pP).num_drb > 0) &&
+            (RRC_RAL_CONNECTION_RECONFIGURATION_IND(msg_pP).num_srb > 0)) {
         mRAL_send_link_up_indication(instanceP, &g_ue_ral_obj[mod_id].transaction_id,
             &link_tuple_id,
             NULL,   //MIH_C_LINK_ADDR_T       *old_arP,(Optional) Old Access Router link address.
@@ -259,7 +261,7 @@ void mRAL_rx_rrc_ral_connection_reconfiguration_indication(instance_t instanceP,
     g_ue_ral_obj[mod_id].transaction_id ++;
 }
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_connection_release_indication(instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
 
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c
index 5963556554..b8d3de98e6 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_subscribe.c
@@ -51,7 +51,7 @@
  **   indications and sends Link Event Subscribe confirmation              **
  **   to the MIH-F.                                                        **
  **                                                                        **
- ** Inputs:  msgP:  Pointer to the received MIH message                    **
+ ** Inputs:  msg_pP:  Pointer to the received MIH message                    **
  **     Others: None                                                       **
  **                                                                        **
  ** Outputs:  None                                                         **
@@ -59,28 +59,29 @@
  **     Others: ralpriv                                                    **
  **                                                                        **
  ***************************************************************************/
-void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Subscribe_request_t* msgP)
+void mRAL_subscribe_request(ral_ue_instance_t                             instanceP,
+                            MIH_C_Message_Link_Event_Subscribe_request_t *msg_pP)
 {
-    unsigned int   mod_id = instanceP - NB_eNB_INST;
+    module_id_t    mod_id = instanceP - NB_eNB_INST;
     MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
     /* Check whether the action request is supported */
     if (g_ue_ral_obj[mod_id].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_SUBSCRIBE)
     {
         MIH_C_LINK_EVENT_LIST_T mih_subscribed_req_event_list;
 
-        g_ue_ral_obj[mod_id].mih_subscribe_req_event_list |= (msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list);
+        g_ue_ral_obj[mod_id].mih_subscribe_req_event_list |= (msg_pP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list);
 
-        mih_subscribed_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list & msgP->primitive.RequestedLinkEventList;
+        mih_subscribed_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list & msg_pP->primitive.RequestedLinkEventList;
 
         status = MIH_C_STATUS_SUCCESS;
 
-        mRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
+        mRAL_send_event_subscribe_confirm(instanceP, &msg_pP->header.transaction_id,
                 &status,
                 &mih_subscribed_req_event_list);
     }
     else
     {
-        mRAL_send_event_subscribe_confirm(instanceP, &msgP->header.transaction_id,
+        mRAL_send_event_subscribe_confirm(instanceP, &msg_pP->header.transaction_id,
                 &status,
                 NULL);
     }
@@ -94,7 +95,7 @@ void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Even
  **   indications and sends Link Event Unsubscribe confirmation            **
  **   to the MIH-F.                                                        **
  **                                                                        **
- ** Inputs:  msgP:  Pointer to the received MIH message                    **
+ ** Inputs:  msg_pP:  Pointer to the received MIH message                    **
  **     Others: None                                                       **
  **                                                                        **
  ** Outputs:  None                                                         **
@@ -102,10 +103,11 @@ void mRAL_subscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Even
  **     Others: ralpriv                                                    **
  **                                                                        **
  ***************************************************************************/
-void mRAL_unsubscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Event_Unsubscribe_request_t* msgP)
+void mRAL_unsubscribe_request(ral_ue_instance_t                               instanceP,
+                              MIH_C_Message_Link_Event_Unsubscribe_request_t *msg_pP)
 {
     MIH_C_STATUS_T status = MIH_C_STATUS_REJECTED;
-    unsigned int   mod_id = instanceP - NB_eNB_INST;
+    module_id_t    mod_id = instanceP - NB_eNB_INST;
 
     /* Check whether the action request is supported */
     if (g_ue_ral_obj[mod_id].mih_supported_link_command_list & MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE)
@@ -115,18 +117,18 @@ void mRAL_unsubscribe_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Ev
 
         saved_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list;
 
-        g_ue_ral_obj[mod_id].mih_subscribe_req_event_list &= ~(msgP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list);
+        g_ue_ral_obj[mod_id].mih_subscribe_req_event_list &= ~(msg_pP->primitive.RequestedLinkEventList & g_ue_ral_obj[mod_id].mih_supported_link_event_list);
         mih_unsubscribed_req_event_list = g_ue_ral_obj[mod_id].mih_subscribe_req_event_list ^ saved_req_event_list;
 
         status = MIH_C_STATUS_SUCCESS;
 
-        mRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
+        mRAL_send_event_unsubscribe_confirm(instanceP, &msg_pP->header.transaction_id,
                 &status,
                 &mih_unsubscribed_req_event_list);
     }
     else
     {
-        mRAL_send_event_unsubscribe_confirm(instanceP, &msgP->header.transaction_id,
+        mRAL_send_event_unsubscribe_confirm(instanceP, &msg_pP->header.transaction_id,
                 &status,
                 NULL);
     }
diff --git a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c
index c1da6ec37b..797bbed101 100755
--- a/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c
+++ b/openair3/RAL-LTE/LTE_RAL_UE/SRC/lteRALue_thresholds.c
@@ -50,7 +50,7 @@ extern unsigned char NB_eNB_INST;
  ** Description: Forwards the Link_Configure_Thresholds.request message    **
  **   to the RRC layer.                                                    **
  **                                                                        **
- ** Inputs:  msgP:  Pointer to the received message                        **
+ ** Inputs:  msg_pP:  Pointer to the received message                        **
  **     Others:                                                            **
  **                                                                        **
  ** Outputs:  None                                                         **
@@ -58,7 +58,8 @@ extern unsigned char NB_eNB_INST;
  ** Others:   None                                                         **
  **                                                                        **
  ***************************************************************************/
-void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Message_Link_Configure_Thresholds_request_t* msgP)
+void mRAL_configure_thresholds_request(ral_ue_instance_t                                  instanceP,
+                                       MIH_C_Message_Link_Configure_Thresholds_request_t* msg_pP)
 {
     unsigned int                             index;
     unsigned int                             th_index;
@@ -76,31 +77,31 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
     memset(&configure_threshold_req, 0, sizeof(rrc_ral_configure_threshold_req_t));
 
     // copy transaction id
-    configure_threshold_req.transaction_id      = msgP->header.transaction_id;
+    configure_threshold_req.transaction_id      = msg_pP->header.transaction_id;
 
     global_status = MIH_C_STATUS_SUCCESS;
 
     // configure_threshold_req.num_link_cfg_params = 0; // done
-    for (index = 0; index < msgP->primitive.LinkConfigureParameterList_list.length; index++) {
+    for (index = 0; index < msg_pP->primitive.LinkConfigureParameterList_list.length; index++) {
 
         status = MIH_C_STATUS_SUCCESS;
 
         // copy link_param_type
-        configure_threshold_req.link_cfg_params[index].link_param_type.choice = msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type.choice;
+        configure_threshold_req.link_cfg_params[index].link_param_type.choice = msg_pP->primitive.LinkConfigureParameterList_list.val[index].link_param_type.choice;
         switch (configure_threshold_req.link_cfg_params[index].link_param_type.choice) {
             case  RAL_LINK_PARAM_TYPE_CHOICE_GEN:
                 memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_gen,
-                        &msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_gen,
+                        &msg_pP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_gen,
                         sizeof(ral_link_param_gen_t));
                 break;
             case  RAL_LINK_PARAM_TYPE_CHOICE_QOS:
                 memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_qos,
-                        &msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_qos,
+                        &msg_pP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_qos,
                         sizeof(ral_link_param_qos_t));
                 break;
             case  RAL_LINK_PARAM_TYPE_CHOICE_LTE:
                 memcpy(&configure_threshold_req.link_cfg_params[index].link_param_type._union.link_param_lte,
-                        &msgP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_lte,
+                        &msg_pP->primitive.LinkConfigureParameterList_list.val[index].link_param_type._union.link_param_lte,
                         sizeof(ral_link_param_lte_t));
                 break;
             default:
@@ -113,7 +114,7 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
         configure_threshold_req.num_link_cfg_params += 1;
 
         // copy choice
-        configure_threshold_req.link_cfg_params[index].union_choice = msgP->primitive.LinkConfigureParameterList_list.val[index].choice;
+        configure_threshold_req.link_cfg_params[index].union_choice = msg_pP->primitive.LinkConfigureParameterList_list.val[index].choice;
 
         // copy _union
         switch (configure_threshold_req.link_cfg_params[index].union_choice) {
@@ -121,7 +122,7 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
                 configure_threshold_req.link_cfg_params[index]._union.null_attr = 0;
                 break;
             case RAL_LINK_CFG_PARAM_CHOICE_TIMER:
-                configure_threshold_req.link_cfg_params[index]._union.timer_interval = msgP->primitive.LinkConfigureParameterList_list.val[index]._union.timer_interval;
+                configure_threshold_req.link_cfg_params[index]._union.timer_interval = msg_pP->primitive.LinkConfigureParameterList_list.val[index]._union.timer_interval;
                 break;
             default:
                 printf("ERROR RAL_UE, : mRAL_configure_thresholds_request unknown configure_threshold_req.link_cfg_params[index].union_choice %d\n",
@@ -131,12 +132,12 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
         }
 
         // copy th_action
-        configure_threshold_req.link_cfg_params[index].th_action = msgP->primitive.LinkConfigureParameterList_list.val[index].th_action;
+        configure_threshold_req.link_cfg_params[index].th_action = msg_pP->primitive.LinkConfigureParameterList_list.val[index].th_action;
 
         // configure_threshold_req.link_cfg_params[index].num_thresholds = 0; // done
-        for (th_index = 0; th_index < msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.length;th_index++) {
-            configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_val  = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_val;
-            configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_xdir = msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_xdir;
+        for (th_index = 0; th_index < msg_pP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.length;th_index++) {
+            configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_val  = msg_pP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_val;
+            configure_threshold_req.link_cfg_params[index].thresholds[th_index].threshold_xdir = msg_pP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index].threshold_xdir;
             configure_threshold_req.link_cfg_params[index].num_thresholds += 1;
 
             // Fill ConfigureThreshold_confirm
@@ -146,7 +147,7 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
                         sizeof(ral_link_param_type_t));
 
                 memcpy(&link_configure_status_list.val[link_configure_status_list.length].threshold,
-                        &msgP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index],
+                        &msg_pP->primitive.LinkConfigureParameterList_list.val[index].threshold_list.val[th_index],
                         sizeof(ral_link_param_type_t));
 
                 link_configure_status_list.val[link_configure_status_list.length].config_status = status;
@@ -164,12 +165,12 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
         itti_send_msg_to_task (TASK_RRC_UE, instanceP, message_p);
 
         mRAL_send_configure_thresholds_confirm(instanceP,
-                &msgP->header.transaction_id,
+                &msg_pP->header.transaction_id,
                 &global_status,
                 &link_configure_status_list);
     } else {
         mRAL_send_configure_thresholds_confirm(instanceP,
-                &msgP->header.transaction_id,
+                &msg_pP->header.transaction_id,
                 &global_status,
                 NULL);
 
@@ -179,7 +180,7 @@ void mRAL_configure_thresholds_request(ral_ue_instance_t instanceP, MIH_C_Messag
 }
 
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_configure_threshold_conf(ral_ue_instance_t instance, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_configure_threshold_conf(ral_ue_instance_t instance, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_STATUS_T                      status;
@@ -187,46 +188,46 @@ void mRAL_rx_rrc_ral_configure_threshold_conf(ral_ue_instance_t instance, Messag
     MIH_C_LINK_CFG_STATUS_LIST_T        link_cfg_status_list;
     unsigned int                        i;
 
-    status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).status;
+    status = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).status;
     if (status == RAL_STATUS_SUCCESS) {
         link_cfg_status_list.length = 0;
-        for (i = 0; i < RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).num_link_cfg_params; i++) {
-            link_cfg_status_list.val[i].link_param_type.choice = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type.choice;
+        for (i = 0; i < RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).num_link_cfg_params; i++) {
+            link_cfg_status_list.val[i].link_param_type.choice = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].link_param_type.choice;
             switch (link_cfg_status_list.val[i].link_param_type.choice) {
                 case  RAL_LINK_PARAM_TYPE_CHOICE_GEN:
                     memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_gen,
-                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_gen,
+                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].link_param_type._union.link_param_gen,
                             sizeof(ral_link_param_gen_t));
                     break;
                 case  RAL_LINK_PARAM_TYPE_CHOICE_QOS:
                     memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_qos,
-                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_qos,
+                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].link_param_type._union.link_param_qos,
                             sizeof(ral_link_param_qos_t));
                     break;
                 case  RAL_LINK_PARAM_TYPE_CHOICE_LTE:
                     memcpy(&link_cfg_status_list.val[i].link_param_type._union.link_param_lte,
-                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].link_param_type._union.link_param_lte,
+                            &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].link_param_type._union.link_param_lte,
                             sizeof(ral_link_param_lte_t));
                     break;
                 default:
                     assert(1==0);
             }
-            link_cfg_status_list.val[i].threshold.threshold_val  = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_val;
-            link_cfg_status_list.val[i].threshold.threshold_xdir = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].threshold.threshold_xdir;
-            link_cfg_status_list.val[i].config_status            = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).cfg_status[i].config_status;
+            link_cfg_status_list.val[i].threshold.threshold_val  = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].threshold.threshold_val;
+            link_cfg_status_list.val[i].threshold.threshold_xdir = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].threshold.threshold_xdir;
+            link_cfg_status_list.val[i].config_status            = RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).cfg_status[i].config_status;
             link_cfg_status_list.length += 1;
         }
-        mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, &link_cfg_status_list);
+        mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).transaction_id, &status, &link_cfg_status_list);
     } else {
-        mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_p).transaction_id, &status, NULL);
+        mRAL_send_configure_thresholds_confirm(instance, &RRC_RAL_CONFIGURE_THRESHOLD_CONF(msg_pP).transaction_id, &status, NULL);
     }
 }
 //---------------------------------------------------------------------------------------------------------------------
-void mRAL_rx_rrc_ral_measurement_report_indication(ral_ue_instance_t instanceP, MessageDef *msg_p)
+void mRAL_rx_rrc_ral_measurement_report_indication(ral_ue_instance_t instanceP, MessageDef *msg_pP)
 //---------------------------------------------------------------------------------------------------------------------
 {
     MIH_C_TRANSACTION_ID_T           transaction_id;
-    unsigned int                     mod_id;
+    module_id_t                      mod_id;
     MIH_C_LINK_TUPLE_ID_T            link_tuple_id;
     LIST(MIH_C_LINK_PARAM_RPT,  link_parameters_report);
 
@@ -238,7 +239,7 @@ void mRAL_rx_rrc_ral_measurement_report_indication(ral_ue_instance_t instanceP,
     link_tuple_id.link_id.link_type     = MIH_C_WIRELESS_LTE;
 #ifdef USE_3GPP_ADDR_AS_LINK_ADDR
     link_tuple_id.link_id.link_addr.choice = (MIH_C_CHOICE_T)MIH_C_CHOICE_3GPP_ADDR;
-    MIH_C_3GPP_ADDR_load_3gpp_str_address(instanceP, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)DEFAULT_ADDRESS_3GPP);
+    MIH_C_3GPP_ADDR_load_3gpp_str_address(mod_id, &link_tuple_id.link_id.link_addr._union._3gpp_addr, (u_int8_t*)UE_DEFAULT_3GPP_ADDRESS);
 #else
     link_tuple_id.link_id.link_addr.choice                          = MIH_C_CHOICE_3GPP_3G_CELL_ID;
 
@@ -247,22 +248,22 @@ void mRAL_rx_rrc_ral_measurement_report_indication(ral_ue_instance_t instanceP,
     link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id = g_ue_ral_obj[mod_id].cell_id;
 
     LOG_D(RAL_UE, "PLMN ID %d.%d.%d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[0],
-            ink_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
+            link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[1],
             link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.plmn_id.val[2]);
     LOG_D(RAL_UE, "CELL ID %d\n", link_tuple_id.link_id.link_addr._union._3gpp_3g_cell_id.cell_id);
 #endif
 
     MIH_C_LINK_PARAM_RPT_LIST_init(&link_parameters_report_list);
     memcpy(&link_parameters_report_list.val[0].link_param,
-            &RRC_RAL_MEASUREMENT_REPORT_IND(msg_p).link_param,
+            &RRC_RAL_MEASUREMENT_REPORT_IND(msg_pP).link_param,
             sizeof(MIH_C_LINK_PARAM_T));
 
-    if (RRC_RAL_MEASUREMENT_REPORT_IND(msg_p).threshold.threshold_xdir == RAL_NO_THRESHOLD) {
+    if (RRC_RAL_MEASUREMENT_REPORT_IND(msg_pP).threshold.threshold_xdir == RAL_NO_THRESHOLD) {
         link_parameters_report_list.val[0].choice = MIH_C_LINK_PARAM_RPT_CHOICE_NULL;
     } else {
         link_parameters_report_list.val[0].choice = MIH_C_LINK_PARAM_RPT_CHOICE_THRESHOLD;
-        link_parameters_report_list.val[0]._union.threshold.threshold_val  = RRC_RAL_MEASUREMENT_REPORT_IND(msg_p).threshold.threshold_val;
-        link_parameters_report_list.val[0]._union.threshold.threshold_xdir = RRC_RAL_MEASUREMENT_REPORT_IND(msg_p).threshold.threshold_xdir;
+        link_parameters_report_list.val[0]._union.threshold.threshold_val  = RRC_RAL_MEASUREMENT_REPORT_IND(msg_pP).threshold.threshold_val;
+        link_parameters_report_list.val[0]._union.threshold.threshold_xdir = RRC_RAL_MEASUREMENT_REPORT_IND(msg_pP).threshold.threshold_xdir;
     }
     link_parameters_report_list.length += 1;
 
-- 
GitLab