diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 9be860aaf472c2c916e04293c18dd15170b6cb4e..95e9805cab10134b1f7d2f0001e092073e459095 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -171,7 +171,7 @@ int config_check_unknown_cmdlineopt(char *prefix) {
     if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
       finalcheck = 1;
     else if (strlen(prefix) > 0) {
-      sprintf(testprefix,"--%s.",prefix);
+      sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-1,prefix);
     }
   }
 
diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c
index b3cf7c02c5b8320a5ae529beed215798cfa5b86f..a6316d6c3f61fa3c844e01079cd6536c073b6554 100644
--- a/common/config/config_load_configmodule.c
+++ b/common/config/config_load_configmodule.c
@@ -345,7 +345,7 @@ void free_configmodule(void) {
 
     if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
 
-    printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
+    printf ("[CONFIG] free %i config parameter pointers\n",cfgptr->num_cfgP);
 
     for (int i=0; i<cfgptr->num_cfgP; i++) {
       if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
diff --git a/common/utils/T/T.c b/common/utils/T/T.c
index 8a84cba1f8123accf0fddad47aa78e8a98e61bac..8ee359b77f491518e4aa934851f087bc040175c7 100644
--- a/common/utils/T/T.c
+++ b/common/utils/T/T.c
@@ -202,9 +202,9 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork) {
 }
 
 void T_Config_Init(void) {
-  int T_port;         /* by default we wait for the tracer */
-  int T_nowait;       /* default port to listen to to wait for the tracer */
-  int T_dont_fork;    /* default is to fork, see 'T_init' to understand */
+  int T_port=TTRACER_DEFAULT_PORTNUM; /* by default we wait for the tracer */
+  int T_nowait=0;                     /* default port to listen to to wait for the tracer */
+  int T_dont_fork=0;                  /* default is to fork, see 'T_init' to understand */
   paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
   /* for a cleaner config file, TTracer params should be defined in a
    * specific section...
diff --git a/common/utils/T/T.h b/common/utils/T/T.h
index 18e4a590d9444d12257d5207b4e00446d2811f6b..626dbafd2586840657e515ca66a6f5ab8776080b 100644
--- a/common/utils/T/T.h
+++ b/common/utils/T/T.h
@@ -8,7 +8,7 @@
 #include "T_defs.h"
 
 #ifdef T_SEND_TIME
-#include <time.h>
+  #include <time.h>
 #endif
 
 /* T message IDs */
@@ -76,13 +76,13 @@
                              T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \
     if (T_PUT_len < 0) { \
       printf("%s:%d:%s: you can't read this, or can you?", \
-               __FILE__, __LINE__, __FUNCTION__); \
+             __FILE__, __LINE__, __FUNCTION__); \
       abort(); \
     } \
     if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \
       printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
-               ", consider increasing T_BUFFER_MAX (%d)\n", \
-               __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
+             ", consider increasing T_BUFFER_MAX (%d)\n", \
+             __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
       abort(); \
     } \
     T_LOCAL_size += T_PUT_len + 1; \
@@ -97,9 +97,9 @@ struct T_header;
 /* T macro tricks */
 extern int T_stdout;
 #define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
-        20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
+                     20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
 #define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
-        n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
+             n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
 #define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
 
 /* type used to send arbitrary buffer data */
@@ -119,30 +119,30 @@ extern int *T_active;
  */
 #if BASIC_SIMULATOR
 #  define T_GET_SLOT \
-     do { \
-       extern volatile uint64_t T_next_id; \
-       extern volatile uint64_t T_active_id; \
-       uint64_t id; \
-       /* get a ticket */ \
-       id = __sync_fetch_and_add(&T_next_id, 1); \
-       /* wait for our turn */ \
-       while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
-       /* this is our turn, try to acquire the slot until it's free */ \
-       do { \
-         T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
-         if (T_LOCAL_busy & 0x01) usleep(100); \
-       } while (T_LOCAL_busy & 0x01); \
-       /* check that there are still some tickets */ \
-       if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
-         printf("T: reached the end of times, bye...\n"); \
-         abort(); \
-       } \
-       /* free our ticket, which signals the next waiter that it's its turn */ \
-       (void)__sync_fetch_and_add(&T_active_id, 1); \
-     } while (0)
+  do { \
+    extern volatile uint64_t T_next_id; \
+    extern volatile uint64_t T_active_id; \
+    uint64_t id; \
+    /* get a ticket */ \
+    id = __sync_fetch_and_add(&T_next_id, 1); \
+    /* wait for our turn */ \
+    while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
+    /* this is our turn, try to acquire the slot until it's free */ \
+    do { \
+      T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
+      if (T_LOCAL_busy & 0x01) usleep(100); \
+    } while (T_LOCAL_busy & 0x01); \
+    /* check that there are still some tickets */ \
+    if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
+      printf("T: reached the end of times, bye...\n"); \
+      abort(); \
+    } \
+    /* free our ticket, which signals the next waiter that it's its turn */ \
+    (void)__sync_fetch_and_add(&T_active_id, 1); \
+  } while (0)
 #else
 #  define T_GET_SLOT \
-     T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
+  T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
 #endif
 
 /* used at header of Tn, allocates buffer */
@@ -172,8 +172,8 @@ extern int *T_active;
 #define T_CHECK_SIZE(len, argnum) \
   if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
     printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
-             ", consider increasing T_BUFFER_MAX (%d)\n", \
-             __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
+           ", consider increasing T_BUFFER_MAX (%d)\n", \
+           __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
     abort(); \
   }
 
@@ -598,20 +598,21 @@ extern int *T_active;
 
 
 #define TTRACER_CONFIG_PREFIX   "TTracer"
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                            configuration parameters for TTRACE utility                                                   */
-/*   optname                     helpstr                paramflags           XXXptr           defXXXval         type       numelt           */
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                            configuration parameters for TTRACE utility                                                          */
+/*   optname                     helpstr                paramflags           XXXptr           defXXXval                         type       numelt  */
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define TTRACER_DEFAULT_PORTNUM 2021
 #define CMDLINE_TTRACEPARAMS_DESC {  \
-{"T_port",                     CONFIG_HLP_TPORT,      0,                iptr:&T_port,        defintval:2021,     TYPE_INT,   0},           \
-{"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,   iptr:&T_nowait,      defintval:0,        TYPE_INT,   0},           \
-{"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,   iptr:&T_dont_fork,   defintval:0,        TYPE_INT,   0},           \
-{"T_stdout",                   CONFIG_HLP_STDOUT,     PARAMFLAG_BOOL,   iptr:&T_stdout,      defintval:1,        TYPE_INT,   0},           \
-} 
+    {"T_port",                     CONFIG_HLP_TPORT,      0,                iptr:&T_port,        defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT,   0},\
+    {"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,   iptr:&T_nowait,      defintval:0,                       TYPE_INT,   0},\
+    {"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,   iptr:&T_dont_fork,   defintval:0,                       TYPE_INT,   0},\
+    {"T_stdout",                   CONFIG_HLP_STDOUT,     PARAMFLAG_BOOL,   iptr:&T_stdout,      defintval:1,                       TYPE_INT,   0},\
+  }
 
 
 
-        /* log on stdout */
+/* log on stdout */
 void T_init(int remote_port, int wait_for_tracer, int dont_fork);
 void T_Config_Init(void);
 #else /* T_TRACER */
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 4c9e3827b069ee20ced71cbb6304533551c3e937..7cb6da21b513b99f6a9f184131df47c5893812bf 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -49,7 +49,7 @@
 
 //-------------------------------
 
-FILE*    g_msc_fd;
+FILE    *g_msc_fd;
 char     g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
 
 
@@ -70,15 +70,11 @@ void *msc_task(void *args_p)
 //------------------------------------------------------------------------------
 {
   MessageDef         *received_message_p    = NULL;
-//  const char         *msg_name = NULL;
-//  instance_t          instance  = 0;
+  //  const char         *msg_name = NULL;
+  //  instance_t          instance  = 0;
   long                timer_id;
-
   itti_mark_task_ready(TASK_MSC);
-
   msc_start_use();
-
-
   timer_setup(0, // seconds
               50000, // usec
               TASK_MSC,
@@ -91,20 +87,18 @@ void *msc_task(void *args_p)
     itti_receive_msg(TASK_MSC, &received_message_p);
 
     if (received_message_p != NULL) {
-//      msg_name = ITTI_MSG_NAME (received_message_p);
-//      instance = ITTI_MSG_INSTANCE (received_message_p);
-      
+      //      msg_name = ITTI_MSG_NAME (received_message_p);
+      //      instance = ITTI_MSG_INSTANCE (received_message_p);
       switch (ITTI_MSG_ID(received_message_p)) {
-
         case TIMER_HAS_EXPIRED: {
-    	  msc_flush_messages();
+          msc_flush_messages();
         }
         break;
 
         case TERMINATE_MESSAGE: {
           fprintf(stderr, " *** Exiting MSC thread\n");
           timer_remove(timer_id);
-    	  msc_end();
+          msc_end();
           itti_exit_task();
         }
         break;
@@ -119,6 +113,7 @@ void *msc_task(void *args_p)
       }
     }
   }
+
   fprintf(stderr, "Task MSC exiting\n");
   return NULL;
 }
@@ -132,15 +127,16 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
   void *pointer_p;
   char  msc_filename[256];
   fprintf(stderr, "Initializing MSC logs\n");
+  rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%i.log", envP); // TODO NAME
 
-  rv = snprintf(msc_filename, 256, "/tmp/openair.msc.%u.log", envP); // TODO NAME
-  if ((0 >= rv) || (256 < rv)){
+  if ((0 >= rv) || (256 < rv)) {
     fprintf(stderr, "Error in MSC log file name");
   }
+
   g_msc_fd = fopen(msc_filename,"w");
   AssertFatal(g_msc_fd != NULL, "Could not open MSC log file %s : %s", msc_filename, strerror(errno));
-
   rv = lfds611_stack_new(&g_msc_memory_stack_p, (lfds611_atom_t)max_threadsP + 2);
+
   if (0 >= rv) {
     AssertFatal (0, "lfds611_stack_new failed!\n");
   }
@@ -153,7 +149,7 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
   for (i=0; i < max_threadsP * 30; i++) {
     pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
     AssertFatal (pointer_p, "malloc failed!\n");
- 	rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
+    rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
     AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
   }
 
@@ -161,182 +157,335 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
     switch (i) {
       case MSC_IP_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_IP_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if (envP == MSC_E_UTRAN_LIPA) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_NAS_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_RRC_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_PDCP_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_RLC_UE:
-    	rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
-    	if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
-    	if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
+        rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_UE");
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
+        if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_MAC_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
-      	  msc_log_declare_proto(i);
+          msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_PHY_UE:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_UE");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_PHY_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PHY_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_MAC_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MAC_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_RLC_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RLC_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_PDCP_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "PDCP_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_RRC_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_S1AP_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW)  || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_GTPU_ENB:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_ENB");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_GTPU_SGW:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "GTPU_SGW");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_S1AP_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S1AP_MME");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME) || (envP == MSC_E_UTRAN) || (envP == MSC_E_UTRAN_LIPA)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_MMEAPP_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "MME_APP");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_NAS_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_MME");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         msc_log_declare_proto(i);
         break;
+
       case MSC_NAS_EMM_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_EMM");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_NAS_ESM_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_ESM");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_SP_GWAPP_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "SP_GW_MME");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if (envP == MSC_MME_GW) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_S11_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S11_MME");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if (envP == MSC_MME) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_S6A_MME:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "S6A");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       case MSC_HSS:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "HSS");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
+
         if ((envP == MSC_MME_GW) || (envP == MSC_MME)) {
           msc_log_declare_proto(i);
         }
+
         break;
+
       default:
         rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
-        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
+
+        if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {
+          g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;
+        }
     }
   }
+
   rv = itti_create_task (TASK_MSC, msc_task, NULL);
   AssertFatal (rv == 0, "Create task for MSC failed!\n");
   fprintf(stderr, "Initializing MSC logs Done\n");
@@ -359,15 +508,17 @@ void msc_flush_messages(void)
   int               rv;
   msc_queue_item_t *item_p = NULL;
 
-  while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void**)&item_p )) == 1) {
-	if (NULL != item_p->message_str) {
-	  fputs(item_p->message_str, g_msc_fd);
-	  // TODO BIN DATA
-	  rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
-	}
-	// TODO FREE BIN DATA
-	free(item_p);
+  while ((rv = lfds611_queue_dequeue( g_msc_message_queue_p, (void **)&item_p )) == 1) {
+    if (NULL != item_p->message_str) {
+      fputs(item_p->message_str, g_msc_fd);
+      // TODO BIN DATA
+      rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, item_p->message_str );
+    }
+
+    // TODO FREE BIN DATA
+    free(item_p);
   }
+
   fflush(g_msc_fd);
 }
 
@@ -377,23 +528,27 @@ void msc_end(void)
 //------------------------------------------------------------------------------
 {
   int rv;
+
   if (NULL != g_msc_fd ) {
-	msc_flush_messages();
+    msc_flush_messages();
     rv = fflush(g_msc_fd);
-	if (rv != 0) {
-	  fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
+
+    if (rv != 0) {
+      fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
     }
+
     rv = fclose(g_msc_fd);
+
     if (rv != 0) {
-     fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
+      fprintf(stderr, "Error while closing MSC log file: %s", strerror(errno));
     }
   }
 }
 
 //------------------------------------------------------------------------------
 void msc_log_declare_proto(
-    const msc_proto_t  protoP
-  )
+  const msc_proto_t  protoP
+)
 //------------------------------------------------------------------------------
 {
   int               rv             = 0;
@@ -401,47 +556,55 @@ void msc_log_declare_proto(
   char             *char_message_p = NULL;
 
   if ((MIN_MSC_PROTOS <= protoP) && (MAX_MSC_PROTOS > protoP)) {
-	// may be build a memory pool for that also ?
-	new_item_p = malloc(sizeof(msc_queue_item_t));
-	if (NULL != new_item_p) {
-
-	  rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
-	  if (0 == rv) {
-		  msc_flush_messages();
-		  rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
-	  }
-	  if (1 == rv) {
+    // may be build a memory pool for that also ?
+    new_item_p = malloc(sizeof(msc_queue_item_t));
+
+    if (NULL != new_item_p) {
+      rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+
+      if (0 == rv) {
+        msc_flush_messages();
+        rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+      }
+
+      if (1 == rv) {
         rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [PROTO] %d %s\n", __sync_fetch_and_add (&g_message_number, 1), protoP, &g_msc_proto2str[protoP][0]);
+
         if (0 > rv) {
           fprintf(stderr, "Error while declaring new protocol in MSC: %s", strerror(errno));
         }
+
         new_item_p->message_str       = char_message_p;
         new_item_p->message_str_size  = rv;
         new_item_p->message_bin       = NULL;
         new_item_p->message_bin_size  = 0;
         rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
-	    if (0 == rv) {
-	      rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
-		  if (0 == rv) {
+
+        if (0 == rv) {
+          rv = lfds611_queue_guaranteed_enqueue(g_msc_message_queue_p, new_item_p );
+
+          if (0 == rv) {
             fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
-      	    rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
-      	    free(new_item_p);
-		  }
-	    }
-	    return;
-	  } else {
-	      fprintf(stderr, "Error while lfds611_stack_pop()\n");
-	  }
+            rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+            free(new_item_p);
+          }
+        }
+
+        return;
+      } else {
+        fprintf(stderr, "Error while lfds611_stack_pop()\n");
+      }
+
       free(new_item_p);
-	} else {
+    } else {
       fprintf(stderr, "Error while malloc in MSC");
-	}
+    }
   }
 }
 //------------------------------------------------------------------------------
 void msc_log_event(
-    const msc_proto_t  protoP,
-    char *format, ...)
+  const msc_proto_t  protoP,
+  char *format, ...)
 //------------------------------------------------------------------------------
 {
   va_list           args;
@@ -450,52 +613,62 @@ void msc_log_event(
   msc_queue_item_t *new_item_p     = NULL;
   char             *char_message_p = NULL;
 
-
   if ((MIN_MSC_PROTOS > protoP) || (MAX_MSC_PROTOS <= protoP)) {
-      return;
+    return;
   }
+
   new_item_p = malloc(sizeof(msc_queue_item_t));
+
   if (NULL != new_item_p) {
+    rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
 
-    rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
     if (0 == rv) {
       msc_flush_messages();
-      rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
+      rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
     }
+
     if (1 == rv) {
       rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [EVENT] %d ",  __sync_fetch_and_add (&g_message_number, 1), protoP);
+
       if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
         fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
         goto error_event;
       }
+
       va_start(args, format);
       rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv,  format, args);
       va_end(args);
+
       if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
         fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
         goto error_event;
       }
+
       rv += rv2;
       rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+
       if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
         fprintf(stderr, "Error while logging MSC event : %s", &g_msc_proto2str[protoP][0]);
         goto error_event;
       }
+
       rv += rv2;
       new_item_p->message_str       = char_message_p;
       new_item_p->message_str_size  = rv;
       new_item_p->message_bin       = NULL;
       new_item_p->message_bin_size  = 0;
       rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
-	  if (0 == rv) {
+
+      if (0 == rv) {
         fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
-    	rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
-    	free(new_item_p);
-	  }
+        rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+        free(new_item_p);
+      }
     } else {
       fprintf(stderr, "Error while lfds611_stack_pop()\n");
-	}
+    }
   }
+
   return;
 error_event:
   rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
@@ -503,12 +676,12 @@ error_event:
 }
 //------------------------------------------------------------------------------
 void msc_log_message(
-    const char * const message_operationP,
-    const msc_proto_t  proto1P,
-    const msc_proto_t  proto2P,
-    const uint8_t * const bytesP,
-    const unsigned int num_bytes,
-    char *format, ...)
+  const char *const message_operationP,
+  const msc_proto_t  proto1P,
+  const msc_proto_t  proto2P,
+  const uint8_t *const bytesP,
+  const unsigned int num_bytes,
+  char *format, ...)
 //------------------------------------------------------------------------------
 {
   va_list           args;
@@ -518,56 +691,65 @@ void msc_log_message(
   msc_queue_item_t *new_item_p     = NULL;
   char             *char_message_p = NULL;
 
-
   if ((MIN_MSC_PROTOS > proto1P) || (MAX_MSC_PROTOS <= proto1P) ||
-	  (MIN_MSC_PROTOS > proto2P)   || (MAX_MSC_PROTOS <= proto2P)  ) {
+      (MIN_MSC_PROTOS > proto2P)   || (MAX_MSC_PROTOS <= proto2P)  ) {
     return;
   }
 
   new_item_p = malloc(sizeof(msc_queue_item_t));
+
   if (NULL != new_item_p) {
+    rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
 
-    rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
     if (0 == rv) {
       msc_flush_messages();
-      rv = lfds611_stack_pop(g_msc_memory_stack_p, (void**)&char_message_p);
-	}
+      rv = lfds611_stack_pop(g_msc_memory_stack_p, (void **)&char_message_p);
+    }
+
     if (1 == rv) {
       rv = snprintf(char_message_p, MSC_MAX_MESSAGE_LENGTH, "%"PRIu64" [MESSAGE] %d %s %d %"PRIu64" ",
-    		  __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
+                    __sync_fetch_and_add (&g_message_number, 1), proto1P, message_operationP, proto2P, mac);
+
       if ((0 > rv) || (MSC_MAX_MESSAGE_LENGTH < rv)) {
         fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
         goto error_event;
       }
+
       va_start(args, format);
       rv2 = vsnprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv,  format, args);
       va_end(args);
+
       if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
         fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
         goto error_event;
       }
+
       rv += rv2;
       rv2 = snprintf(&char_message_p[rv],MSC_MAX_MESSAGE_LENGTH - rv, "\n");
+
       if ((0 > rv2) || ((MSC_MAX_MESSAGE_LENGTH - rv) < rv2)) {
         fprintf(stderr, "Error while logging MSC message : %s/%s", &g_msc_proto2str[proto1P][0], &g_msc_proto2str[proto2P][0]);
         goto error_event;
       }
+
       rv += rv2;
       new_item_p->message_str       = char_message_p;
       new_item_p->message_str_size  = rv;
       new_item_p->message_bin       = NULL; // TO DO
       new_item_p->message_bin_size  = 0;    // TO DO
       rv = lfds611_queue_enqueue( g_msc_message_queue_p, new_item_p );
-	  if (0 == rv) {
+
+      if (0 == rv) {
         fprintf(stderr, "Error while lfds611_queue_guaranteed_enqueue message %s in MSC", char_message_p);
-    	rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
-    	free(new_item_p);
-	  }
+        rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
+        free(new_item_p);
+      }
     } else {
       fprintf(stderr, "Error while lfds611_stack_pop()\n");
       msc_flush_messages();
-  	}
+    }
   }
+
   return;
 error_event:
   rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, char_message_p );
@@ -578,8 +760,7 @@ error_event:
 //  function called when oai loader loads the msc shared lib
 int msc_autoinit(msc_interface_t *msc_interface)
 //------------------------------------------------------------------------------
- {
-
+{
   msc_interface->msc_init = msc_init;
   msc_interface->msc_start_use = msc_start_use;
   msc_interface->msc_end = msc_end;
@@ -587,4 +768,4 @@ int msc_autoinit(msc_interface_t *msc_interface)
   msc_interface->msc_log_message = msc_log_message;
   msc_interface->msc_loaded = 1;
   return 0;
- }
+}