diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index ed258ed47c6f0ab6875d15582d5b8879c4b29395..e695be29db0e556e9cab3e183c5cfe42a5ea5529 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -2617,7 +2617,7 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
       dummy[0] = ue->pbch_vars[eNB_id]->decoded_output[2];
       dummy[1] = ue->pbch_vars[eNB_id]->decoded_output[1];
       dummy[2] = ue->pbch_vars[eNB_id]->decoded_output[0];
-      trace_pdu(1, dummy, 3, ue->Mod_id, 0, 0,
+      trace_pdu( DIRECTION_DOWNLINK, dummy, WS_C_RNTI, ue->Mod_id, 0, 0,
           frame_rx, subframe_rx, 0, 0);
       LOG_D(OPT,"[UE %d][PBCH] Frame %d trace pdu for PBCH\n",
           ue->Mod_id, subframe_rx);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 35590ec896716ca9777c774fbe215690a36ae04e..b637a92a9616f53e447cb422087a43dd3789eff4 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -988,9 +988,10 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
 			   payload[0], ra->msg4_TBsize));
 
 		if (opt_enabled == 1) {
-		    trace_pdu(1,
+		    trace_pdu(DIRECTION_DOWNLINK,
 			      (uint8_t *) mac->
-			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], rrc_sdu_length, UE_id, 3,
+			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
+			      rrc_sdu_length, UE_id, WS_C_RNTI,
 			      UE_RNTI(module_idP, UE_id), mac->frame,
 			      mac->subframe, 0, 0);
 		    LOG_D(OPT,
@@ -1193,9 +1194,10 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
 			   payload[0], ra->msg4_TBsize));
 
 		if (opt_enabled == 1) {
-		    trace_pdu(1,
+		    trace_pdu(DIRECTION_DOWNLINK,
 			      (uint8_t *) mac->
-			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0], rrc_sdu_length, UE_id, 3,
+			      UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
+			      rrc_sdu_length, UE_id,  WS_C_RNTI,
 			      UE_RNTI(module_idP, UE_id), mac->frame,
 			      mac->subframe, 0, 0);
 		    LOG_D(OPT,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index d965bc811bf1c07ccf84c5e816a63ce5ffbe1a01..b2b59691f88db67daeafa8dbe2db05a8267bce01 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -281,10 +281,10 @@ schedule_SIB1_BR(module_id_t module_idP,
         eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
 
 	if (opt_enabled == 1) {
-	    trace_pdu(1,
+	    trace_pdu(DIRECTION_DOWNLINK,
 		      &cc->BCCH_BR_pdu[0].payload[0],
 		      bcch_sdu_length,
-		      0xffff, 4, 0xffff, eNB->frame, eNB->subframe, 0, 0);
+		      0xffff, WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0);
 	    LOG_D(OPT,
 		  "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
 		  module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
@@ -472,11 +472,11 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
                         eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
 
 			if (opt_enabled == 1) {
-			    trace_pdu(1,
+			    trace_pdu(DIRECTION_DOWNLINK,
 				      &cc->BCCH_BR_pdu[i + 1].payload[0],
 				      bcch_sdu_length,
 				      0xffff,
-				      4,
+				      WS_SI_RNTI,
 				      0xffff, eNB->frame, eNB->subframe, 0,
 				      0);
 			    LOG_D(OPT,
@@ -759,11 +759,11 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
 		}
 
 		if (opt_enabled == 1) {
-		    trace_pdu(1,
+		    trace_pdu(DIRECTION_DOWNLINK,
 			      &cc->BCCH_pdu.payload[0],
 			      bcch_sdu_length,
 			      0xffff,
-			      4, 0xffff, eNB->frame, eNB->subframe, 0, 0);
+			     WS_SI_RNTI, 0xffff, eNB->frame, eNB->subframe, 0, 0);
 		    LOG_D(OPT,
 			  "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
 			  module_idP, frameP, CC_id, 0xffff,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index df52b83d729b4087ba4d137da71bfcb339440252..da52a8fedcdf9013f47df5231c3f2042fb6353bd 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -1359,9 +1359,9 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
 	  }
 
 	  if (opt_enabled == 1) {
-	    trace_pdu(1, (uint8_t *)
-		      UE_list->DLSCH_pdu[CC_id][0][UE_id].
-		      payload[0], TBS, module_idP, 3,
+	    trace_pdu(DIRECTION_DOWNLINK,
+		      (uint8_t *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+		      TBS, module_idP, WS_C_RNTI,
 		      UE_RNTI(module_idP, UE_id), eNB->frame,
 		      eNB->subframe, 0, 0);
 	    LOG_D(OPT,
@@ -2085,7 +2085,7 @@ void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP)
 	}
 
 	if (opt_enabled == 1) {
-	  trace_pdu(1,
+	  trace_pdu(DIRECTION_DOWNLINK,
 		    &eNB->common_channels[CC_id].PCCH_pdu.payload[0],
 		    pcch_sdu_length,
 		    0xffff,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index 1acf65722099af3c1cf4df99251ebbcbbe591355..e9fdf964e714e9ca1a668b87a5bc9d79eb07b6df 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -1655,8 +1655,8 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
           }
 
           if (opt_enabled == 1) {
-            trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
-                      TBS, module_idP, 3, UE_RNTI(module_idP,UE_id),
+            trace_pdu(DIRECTION_DOWNLINK, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+                      TBS, module_idP, WS_RA_RNTI, UE_RNTI(module_idP,UE_id),
                       eNB->frame, eNB->subframe,0,0);
             LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d  rnti %x  with size %d\n",
                   module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), TBS);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index 63a471177881ab5fafc6cfd71bdecf0825a79265..16953e958a8ffe39ee32593e2a4053f8fb5567f9 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -767,7 +767,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 
 	/* Tracing of PDU is done on UE side */
 	if (opt_enabled == 1) {
-	    trace_pdu(1, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, 6, 0xffff,	// M_RNTI = 6 in wirehsark
+	    trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) cc->MCH_pdu.payload, TBS, module_idP, WS_M_RNTI , 0xffff,	// M_RNTI = 6 in wirehsark
 		      RC.mac[module_idP]->frame,
 		      RC.mac[module_idP]->subframe, 0, 0);
 	    LOG_D(OPT,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 04415a838626df5e9f91b59dd599b7d94245faad..1fe21090db8bfbd5c3da32c189470ea0bfd04fa3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -150,7 +150,7 @@ rx_sdu(const module_id_t enb_mod_idP,
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
     (VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU, 1);
   if (opt_enabled == 1) {
-    trace_pdu(0, sduP, sdu_lenP, 0, 3, current_rnti, frameP, subframeP,
+    trace_pdu(DIRECTION_UPLINK, sduP, sdu_lenP, 0, WS_C_RNTI, current_rnti, frameP, subframeP,
 	      0, 0);
     LOG_D(OPT, "[eNB %d][ULSCH] Frame %d  rnti %x  with size %d\n",
 	  enb_mod_idP, frameP, current_rnti, sdu_lenP);
diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index f5df67ab64d5ce540b14a2fa1c6975bdf9200aa7..aeabbd092a32c02dee9ba16fdabf6deab593b0ec 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -248,7 +248,7 @@ Msg1_transmitted(module_id_t module_idP, uint8_t CC_id,
     UE_mac_inst[module_idP].RA_attempt_number++;
 
     if (opt_enabled) {
-	trace_pdu(0, NULL, 0, module_idP, 0,
+	trace_pdu(DIRECTION_UPLINK, NULL, 0, module_idP, WS_NO_RNTI,
 		  UE_mac_inst[module_idP].RA_prach_resources.
 		  ra_PreambleIndex, UE_mac_inst[module_idP].txFrame,
 		  UE_mac_inst[module_idP].txSubframe, 0,
@@ -277,8 +277,8 @@ Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
     UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1;
 
     if (opt_enabled) {		// msg3
-	trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0],
-		  UE_mac_inst[module_idP].RA_Msg3_size, module_idP, 3,
+      trace_pdu(DIRECTION_UPLINK , &UE_mac_inst[module_idP].CCCH_pdu.payload[0],
+		  UE_mac_inst[module_idP].RA_Msg3_size, module_idP, WS_C_RNTI,
 		  UE_mac_inst[module_idP].crnti,
 		  UE_mac_inst[module_idP].txFrame,
 		  UE_mac_inst[module_idP].txSubframe, 0, 0);
diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c
index b70b3824946cf0271752ff735613fd473e781c99..2e6b47ff60464c320326a8d48455e47fc43792d2 100644
--- a/openair2/LAYER2/MAC/rar_tools.c
+++ b/openair2/LAYER2/MAC/rar_tools.c
@@ -96,7 +96,7 @@ fill_rar(const module_id_t module_idP,
 	((ra->msg3_ULdelay & 1) << 1) | (ra->msg3_cqireq & 1);
 
     if (opt_enabled) {
-	trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1,
+	trace_pdu(DIRECTION_DOWNLINK , dlsch_buffer, input_buffer_length, module_idP,  WS_RA_RNTI , 1,
 		  RC.mac[module_idP]->frame, RC.mac[module_idP]->subframe,
 		  0, 0);
 	LOG_D(OPT,
@@ -181,7 +181,7 @@ fill_rar_br(eNB_MAC_INST * eNB,
 	  ra->preamble_index, ra->timing_offset);
 
     if (opt_enabled) {
-	trace_pdu(1, dlsch_buffer, input_buffer_length, eNB->Mod_id, 2, 1,
+	trace_pdu(DIRECTION_DOWNLINK , dlsch_buffer, input_buffer_length, eNB->Mod_id,  WS_RA_RNTI , 1,
 		  eNB->frame, eNB->subframe, 0, 0);
 	LOG_D(OPT,
 	      "[RAPROC] RAR Frame %d trace pdu for rnti %x and  rapid %d size %d\n",
diff --git a/openair2/LAYER2/MAC/rar_tools_ue.c b/openair2/LAYER2/MAC/rar_tools_ue.c
index 991eaae052b40fe68297927593101cb548f192a6..35d1f7925e55ddc07c0d37dbe4217f19a0910aa0 100644
--- a/openair2/LAYER2/MAC/rar_tools_ue.c
+++ b/openair2/LAYER2/MAC/rar_tools_ue.c
@@ -119,8 +119,8 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
 	LOG_D(OPT,
 	      "[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
 	      module_idP, CC_id, frameP, ra_rnti);
-	trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
-		  module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
+	trace_pdu(DIRECTION_DOWNLINK, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
+		  module_idP, WS_RA_RNTI, ra_rnti, UE_mac_inst[module_idP].rxFrame,
 		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
     }
 
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index dd78da72751db65b3ae551d921b25353e9fcc33f..9558aa596fd21420d46154987f5d24b737e0d4f6 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -420,7 +420,7 @@ ue_send_sdu(module_id_t module_idP,
   //LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
 
     if (opt_enabled) {
-	trace_pdu(1, sdu, sdu_len, module_idP, 3,
+	trace_pdu(DIRECTION_DOWNLINK, sdu, sdu_len, module_idP, WS_C_RNTI,
 		  UE_mac_inst[module_idP].crnti, frameP, subframeP, 0, 0);
 	LOG_D(OPT,
 	      "[UE %d][DLSCH] Frame %d trace pdu for rnti %x  with size %d\n",
@@ -637,11 +637,11 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
     stop_meas(&UE_mac_inst[module_idP].rx_si);
 #endif
     if (opt_enabled == 1) {
-	trace_pdu(0,
+	trace_pdu(DIRECTION_UPLINK,
 		  (uint8_t *) pdu,
 		  len,
 		  module_idP,
-		  4,
+		  WS_SI_RNTI,
 		  0xffff,
 		  UE_mac_inst[module_idP].rxFrame,
 		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
@@ -675,11 +675,11 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
     stop_meas(&UE_mac_inst[module_idP].rx_p);
 #endif
     if (opt_enabled == 1) {
-	trace_pdu(0,
+	trace_pdu(DIRECTION_UPLINK ,
 		  (uint8_t *) pdu,
 		  len,
 		  module_idP,
-		  4,
+		  WS_SI_RNTI,
 		  P_RNTI,
 		  UE_mac_inst[module_idP].rxFrame,
 		  UE_mac_inst[module_idP].rxSubframe, 0, 0);
@@ -2255,7 +2255,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
 #endif
 
     if (opt_enabled) {
-	trace_pdu(0, ulsch_buffer, buflen, module_idP, 3,
+	trace_pdu(DIRECTION_UPLINK, ulsch_buffer, buflen, module_idP, WS_C_RNTI,
 		  UE_mac_inst[module_idP].crnti,
 		  UE_mac_inst[module_idP].txFrame,
 		  UE_mac_inst[module_idP].txSubframe, 0, 0);
diff --git a/openair2/UTIL/OPT/README.txt b/openair2/UTIL/OPT/README.txt
index 7193733d0098a16f4230701a4cf0fc758209ed45..c56aeda93d96902b490d583c034f6101abecd540 100644
--- a/openair2/UTIL/OPT/README.txt
+++ b/openair2/UTIL/OPT/README.txt
@@ -1,9 +1,13 @@
-2012 07 10 - Working version
 How to configure wireshark for dissecting LTE protocols:
 - start the wireshark as a sudoers
+- goto analyze->enabled prototols
+  => enable mac_lte_udp and rlc_lte_udp
 - goto edit/preferences and expand Protocols
 - select UDP and check "try heuristic sub-dissectors first"
 - select MAC-LTE, and check all the options (checkboxes), and set the "which layer info to show in info column" to "MAC info"
 - select RLC-LTE, and check all the options except the "May see RLC headers only", and set the "call PDCP dissector for DRB PDUs" to "12-bit SN". Optionally you may select the sequence analysis for RLC AM/UM.
+
+How to use
+- start eNB or UE with option -W (or -P if you want to make a pcap file)
 - capture on local interface "lo" 
 - filter out the ICMP/DNS/TCP messages (e.g. "!icmp && !dns && !tcp") 
diff --git a/openair2/UTIL/OPT/mac_pcap.h b/openair2/UTIL/OPT/mac_pcap.h
index f1d4b324923f844fc5ba5b45f2ab505c3837acfd..48b31bb3c07395b2b0d6382166356f717706d9d0 100644
--- a/openair2/UTIL/OPT/mac_pcap.h
+++ b/openair2/UTIL/OPT/mac_pcap.h
@@ -42,11 +42,4 @@ typedef struct MAC_Context_Info_t {
   unsigned int   subframesSinceCaptureStart;
 } MAC_Context_Info_t;
 
-pcap_hdr_t file_header = {
-  0xa1b2c3d4,   /* magic number */
-  2, 4,         /* version number is 2.4 */
-  0,            /* timezone */
-  0,            /* sigfigs - apparently all tools do this */
-  65535,        /* snaplen - this should be long enough */
-  MAC_LTE_DLT   /* Data Link Type (DLT).  Set as unused value 147 for now */
-};
+
diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h
index c9340f258e9700baee412b73940e9a946676a589..b4ff3b5006bbf4b5ad9b1d4bdc4ac7c731a9ae1a 100644
--- a/openair2/UTIL/OPT/opt.h
+++ b/openair2/UTIL/OPT/opt.h
@@ -55,6 +55,16 @@ This header file must be included */
 #include "PHY/impl_defs_lte.h"
 #endif
 
+#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
+
+typedef uint8_t  guint8;
+typedef uint16_t guint16;
+typedef uint32_t guint32;
+typedef guint8   gboolean;
+
+#include "packet-mac-lte.h"
+#include "mac_pcap.h"
+
 #ifdef OCP_FRAMEWORK
 #include <enums.h>
 #else
@@ -74,7 +84,7 @@ typedef enum radio_type_e {
 
 extern trace_mode_t opt_type;
 extern char in_ip[40];
-extern char in_path[100];
+extern char in_path[FILENAME_MAX];
 
 /**
  * function def
@@ -84,7 +94,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
                int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
                int oob_event, int oob_event_value);
 
-int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p);
+int init_opt(char *path, char *ip);
 
 void terminate_opt(void);
 
diff --git a/openair2/UTIL/OPT/packet-mac-lte.h b/openair2/UTIL/OPT/packet-mac-lte.h
index d0bb60f6b5cdb942ef7581ba868066434cf9b1fb..4dfbe7912ec484a174567cac076d70627550ebe4 100644
--- a/openair2/UTIL/OPT/packet-mac-lte.h
+++ b/openair2/UTIL/OPT/packet-mac-lte.h
@@ -1,41 +1,36 @@
 /* packet-mac-lte.h
  *
  * Martin Mathieson
- * $Id: packet-mac-lte.h 42240 2012-04-25 20:02:12Z pascal $
  *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  * Copyright 1998 Gerald Combs
  *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
  * This header file may also be distributed under
  * the terms of the BSD Licence as follows:
  *
  * Copyright (C) 2009 Martin Mathieson. All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE
+ * SPDX-License-Identifier: BSD-2-Clause
  */
+ 
+ /* 
+ this is wireshark, commit: commit eda834b6e29c36e05a63a6056afa98390ff79357 
+ Date:   Wed Aug 22 14:36:20 2018 +0200
+ modified to be used in OpenAir to create the LTE MAC/RLC encapsulated in UDP as per Wireshark feature 
+ */
+
+
+#include "ws_symbol_export.h"
+
+/** data structure to hold time values with nanosecond resolution*/
+typedef struct {
+	time_t	secs;
+	int	nsecs;
+} nstime_t;
 
-#ifndef PACKET_MAC_LTE_H_
-#define PACKET_MAC_LTE_H_
 
 /* radioType */
 #define FDD_RADIO 1
@@ -45,105 +40,190 @@
 #define DIRECTION_UPLINK   0
 #define DIRECTION_DOWNLINK 1
 
-/* SR: no need to declare following part: */
+/* rntiType */
+#define WS_NO_RNTI     0
+#define WS_P_RNTI      1
+#define WS_RA_RNTI     2
+#define WS_C_RNTI      3
+#define WS_SI_RNTI     4
+#define WS_SPS_RNTI    5
+#define WS_M_RNTI      6
+#define WS_SL_BCH_RNTI 7
+#define WS_SL_RNTI     8
+#define WS_SC_RNTI     9
+#define WS_G_RNTI      10
+
 typedef enum mac_lte_oob_event {
-  ltemac_send_preamble,
-  ltemac_send_sr,
-  ltemac_sr_failure
+    ltemac_send_preamble,
+    ltemac_send_sr,
+    ltemac_sr_failure
 } mac_lte_oob_event;
 
 typedef enum mac_lte_dl_retx {
-  dl_retx_no,
-  dl_retx_yes,
-  dl_retx_unknown
+    dl_retx_no,
+    dl_retx_yes,
+    dl_retx_unknown
 } mac_lte_dl_retx;
 
 typedef enum mac_lte_crc_status {
-  crc_fail = 0,
-  crc_success = 1,
-  crc_high_code_rate = 2,
-  crc_pdsch_lost = 3,
-  crc_duplicate_nonzero_rv = 4
+    crc_fail = 0,
+    crc_success = 1,
+    crc_high_code_rate = 2,
+    crc_pdsch_lost = 3,
+    crc_duplicate_nonzero_rv = 4,
+    crc_false_dci = 5
 } mac_lte_crc_status;
 
+/* N.B. for SCellIndex-r13 extends to 31 */
+typedef enum mac_lte_carrier_id {
+    carrier_id_primary,
+    carrier_id_secondary_1,
+    carrier_id_secondary_2,
+    carrier_id_secondary_3,
+    carrier_id_secondary_4,
+    carrier_id_secondary_5,
+    carrier_id_secondary_6,
+    carrier_id_secondary_7
+} mac_lte_carrier_id;
+
+typedef enum mac_lte_ce_mode {
+    no_ce_mode = 0,
+    ce_mode_a = 1,
+    ce_mode_b = 2
+} mac_lte_ce_mode;
+
+typedef enum mac_lte_nb_mode {
+    no_nb_mode = 0,
+    nb_mode = 1
+} mac_lte_nb_mode;
+
 /* Context info attached to each LTE MAC frame */
-typedef struct mac_lte_info {
-  /* Needed for decode */
-  guint8          radioType;
-  guint8          direction;
-  guint8          rntiType;
-
-  /* Extra info to display */
-  guint16         rnti;
-  guint16         ueid;
-
-  /* Timing info */
-  guint16         sysframeNumber;
-  guint16         subframeNumber;
-
-  /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
-  gboolean        subframeNumberOfGrantPresent;
-  guint16         subframeNumberOfGrant;
-
-  /* Flag set only if doing PHY-level data test - i.e. there may not be a
-     well-formed MAC PDU so just show as raw data */
-  gboolean        isPredefinedData;
-
-  /* Length of DL PDU or UL grant size in bytes */
-  guint16         length;
-
-  /* UL only.  0=newTx, 1=first-retx, etc */
-  guint8          reTxCount;
-  guint8          isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
-
-  /* UL only.  Indicates if the R10 extendedBSR-Sizes parameter is set */
-  gboolean        isExtendedBSRSizes;
-
-  /* DL only.  Status of CRC check */
-  mac_lte_crc_status   crcStatusValid;
-
-  /* DL only.  Is this known to be a retransmission? */
-  mac_lte_dl_retx dl_retx;
-
-  /* More Physical layer info (see direction above for which side of union to use) */
-  union {
-    struct mac_lte_ul_phy_info {
-      guint8 present;  /* Remaining UL fields are present and should be displayed */
-      guint8 modulation_type;
-      guint8 tbs_index;
-      guint8 resource_block_length;
-      guint8 resource_block_start;
-      guint8 harq_id;
-      gboolean ndi;
-    } ul_info;
-    struct mac_lte_dl_phy_info {
-      guint8 present; /* Remaining UL fields are present and should be displayed */
-      guint8 dci_format;
-      guint8 resource_allocation_type;
-      guint8 aggregation_level;
-      guint8 mcs_index;
-      guint8 redundancy_version_index;
-      guint8 resource_block_length;
-      mac_lte_crc_status crc_status;
-      guint8 harq_id;
-      gboolean ndi;
-      guint8   transport_block;  /* 1..2 */
-    } dl_info;
-  } detailed_phy_info;
-
-  /* Relating to out-of-band events */
-  /* N.B. dissector will only look to these fields if length is 0... */
-  mac_lte_oob_event  oob_event;
-  guint8             rapid;
-  guint8             rach_attempt_number;
-#define MAX_SRs 20
-  guint16            number_of_srs;
-  guint16            oob_ueid[MAX_SRs];
-  guint16            oob_rnti[MAX_SRs];
+typedef struct mac_lte_info
+{
+    /* Needed for decode */
+    guint8          radioType;
+    guint8          direction;
+    guint8          rntiType;
+
+    /* Extra info to display */
+    guint16         rnti;
+    guint16         ueid;
+
+    /* Timing info */
+    guint16         sysframeNumber;
+    guint16         subframeNumber;
+
+    /* Optional field. More interesting for TDD (FDD is always -4 subframeNumber) */
+    gboolean        subframeNumberOfGrantPresent;
+    guint16         subframeNumberOfGrant;
+
+    /* Flag set only if doing PHY-level data test - i.e. there may not be a
+       well-formed MAC PDU so just show as raw data */
+    gboolean        isPredefinedData;
+
+    /* Length of DL PDU or UL grant size in bytes */
+    guint16         length;
+
+    /* 0=newTx, 1=first-retx, etc */
+    guint8          reTxCount;
+    guint8          isPHICHNACK; /* FALSE=PDCCH retx grant, TRUE=PHICH NACK */
+
+    /* UL only.  Indicates if the R10 extendedBSR-Sizes parameter is set */
+    gboolean        isExtendedBSRSizes;
+
+    /* UL only.  Indicates if the R10 simultaneousPUCCH-PUSCH parameter is set for PCell */
+    gboolean        isSimultPUCCHPUSCHPCell;
+
+    /* UL only.  Indicates if the R10 extendedBSR-Sizes parameter is set for PSCell */
+    gboolean        isSimultPUCCHPUSCHPSCell;
+
+    /* Status of CRC check. For UE it is DL only. For eNodeB it is UL
+       only. For an analyzer, it is present for both DL and UL. */
+    gboolean        crcStatusValid;
+    mac_lte_crc_status crcStatus;
+
+    /* Carrier ID */
+    mac_lte_carrier_id   carrierId;
+
+    /* DL only.  Is this known to be a retransmission? */
+    mac_lte_dl_retx dl_retx;
+
+    /* DL only. CE mode to be used for RAR decoding */
+    mac_lte_ce_mode ceMode;
+
+    /* DL and UL. NB-IoT mode of the UE */
+    mac_lte_nb_mode nbMode;
+
+    /* UL only, for now used for CE mode A RAR decoding */
+    guint8          nUlRb;
+
+    /* More Physical layer info (see direction above for which side of union to use) */
+    union {
+        struct mac_lte_ul_phy_info
+        {
+            guint8 present;  /* Remaining UL fields are present and should be displayed */
+            guint8 modulation_type;
+            guint8 tbs_index;
+            guint8 resource_block_length;
+            guint8 resource_block_start;
+            guint8 harq_id;
+            gboolean ndi;
+        } ul_info;
+        struct mac_lte_dl_phy_info
+        {
+            guint8 present; /* Remaining DL fields are present and should be displayed */
+            guint8 dci_format;
+            guint8 resource_allocation_type;
+            guint8 aggregation_level;
+            guint8 mcs_index;
+            guint8 redundancy_version_index;
+            guint8 resource_block_length;
+            guint8 harq_id;
+            gboolean ndi;
+            guint8   transport_block;  /* 0..1 */
+        } dl_info;
+    } detailed_phy_info;
+
+    /* Relating to out-of-band events */
+    /* N.B. dissector will only look to these fields if length is 0... */
+    mac_lte_oob_event  oob_event;
+    guint8             rapid;
+    guint8             rach_attempt_number;
+    #define MAX_SRs 20
+    guint16            number_of_srs;
+    guint16            oob_ueid[MAX_SRs];
+    guint16            oob_rnti[MAX_SRs];
 } mac_lte_info;
 
-/* Accessor function to check if a frame was considered to be ReTx */
-//int is_mac_lte_frame_retx(packet_info *pinfo, guint8 direction);
+
+typedef struct mac_lte_tap_info {
+    /* Info from context */
+    guint16  rnti;
+    guint16  ueid;
+    guint8   rntiType;
+    guint8   isPredefinedData;
+    gboolean crcStatusValid;
+    mac_lte_crc_status   crcStatus;
+    guint8   direction;
+
+    guint8   isPHYRetx;
+    guint16  ueInTTI;
+
+    nstime_t mac_lte_time;
+
+    /* Number of bytes (which part is used depends upon context settings) */
+    guint32  single_number_of_bytes;
+    guint32  bytes_for_lcid[11];
+    guint32  sdus_for_lcid[11];
+    guint8   number_of_rars;
+    guint8   number_of_paging_ids;
+
+    /* Number of padding bytes includes padding subheaders and trailing padding */
+    guint16  padding_bytes;
+    guint16  raw_length;
+} mac_lte_tap_info;
+
+
 
 /*****************************************************************/
 /* UDP framing format                                            */
@@ -153,12 +233,10 @@ typedef struct mac_lte_info {
 /* and implemented by this dissector, using the definitions      */
 /* below. A link to an example program showing you how to encode */
 /* these headers and send LTE MAC PDUs on a UDP socket is        */
-/* provided at http://wiki.wireshark.org/MAC-LTE                 */
+/* provided at https://wiki.wireshark.org/MAC-LTE                */
 /*                                                               */
-/* A heuristic dissecter (enabled by a preference) will          */
-/* recognise a signature at the beginning of these frames   .    */
-/* Until someone is using this format, suggestions for changes   */
-/* are welcome.                                                  */
+/* A heuristic dissector (enabled by a preference) will          */
+/* recognise a signature at the beginning of these frames.       */
 /*****************************************************************/
 
 
@@ -177,7 +255,7 @@ typedef struct mac_lte_info {
    to show you display/filter/plot/add-custom-columns on these fields, so should
    be added if available.
    The format is to have the tag, followed by the value (there is no length field,
-   its implicit from the tag) */
+   it's implicit from the tag) */
 
 #define MAC_LTE_RNTI_TAG            0x02
 /* 2 bytes, network order */
@@ -185,8 +263,8 @@ typedef struct mac_lte_info {
 #define MAC_LTE_UEID_TAG            0x03
 /* 2 bytes, network order */
 
-#define MAC_LTE_SUBFRAME_TAG        0x04
-/* 2 bytes, network order */
+#define MAC_LTE_FRAME_SUBFRAME_TAG  0x04
+/* 2 bytes, network order, SFN is stored in 12 MSB and SF in 4 LSB */
 
 #define MAC_LTE_PREDEFINED_DATA_TAG 0x05
 /* 1 byte */
@@ -200,29 +278,101 @@ typedef struct mac_lte_info {
 #define MAC_LTE_EXT_BSR_SIZES_TAG   0x08
 /* 0 byte */
 
-#define MAC_LTE_OOB_EVENT_TAG   0x09
-/* 3 byte */
+#define MAC_LTE_SEND_PREAMBLE_TAG   0x09
+/* 2 bytes, RAPID value (1 byte) followed by RACH attempt number (1 byte) */
+
+#define MAC_LTE_CARRIER_ID_TAG      0x0A
+/* 1 byte */
+
+#define MAC_LTE_PHY_TAG             0x0B
+/* variable length, length (1 byte) then depending on direction
+   in UL: modulation type (1 byte), TBS index (1 byte), RB length (1 byte),
+          RB start (1 byte), HARQ id (1 byte), NDI (1 byte)
+   in DL: DCI format (1 byte), resource allocation type (1 byte), aggregation level (1 byte),
+          MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte),
+          HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */
+
+#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL_TAG  0x0C
+/* 0 byte */
+
+#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL_TAG 0x0D
+/* 0 byte */
+
+#define MAC_LTE_CE_MODE_TAG         0x0E
+/* 1 byte containing mac_lte_ce_mode enum value */
+
+#define MAC_LTE_NB_MODE_TAG         0x0F
+/* 1 byte containing mac_lte_nb_mode enum value */
+
+#define MAC_LTE_N_UL_RB_TAG         0x10
+/* 1 byte containing the number of UL resource blocks: 6, 15, 25, 50, 75 or 100 */
+
+#define MAC_LTE_SR_TAG              0x11
+/* 2 bytes for the number of items, followed by that number of ueid, rnti (2 bytes each) */
+
 
 /* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU
    continues until the end of the frame) */
 #define MAC_LTE_PAYLOAD_TAG 0x01
 
 
-/* Set details of an LCID -> drb channel mapping.  To be called from
-   configuration protocol (e.g. RRC) */
-/*void set_mac_lte_channel_mapping(guint16 ueid, guint8 lcid,
-                                 guint8  srbid, guint8 drbid,
-                                 guint8  rlcMode, guint8 um_sn_length,
-                                 guint8  ul_priority);
-*/
-/* Functions to be called from outside this module (e.g. in a plugin, where mac_lte_info
-   isn't available) to get/set per-packet data */
-//mac_lte_info *get_mac_lte_proto_data(packet_info *pinfo);
-//void set_mac_lte_proto_data(packet_info *pinfo, mac_lte_info *p_mac_lte_info);
-
-/* Function to attempt to populate p_mac_lte_info using framing definition above */
-/*gboolean dissect_mac_lte_context_fields(struct mac_lte_info  *p_mac_lte_info, tvbuff_t *tvb,
-                                        gint *p_offset);
-*/
-
-#endif /* PACKET_MAC_LTE_H_ */
+/* Type to store parameters for configuring LCID->RLC channel settings for DRB */
+/* Some are optional, and may not be seen (e.g. on reestablishment) */
+typedef struct drb_mapping_t
+{
+    guint16    ueid;                /* Mandatory */
+    guint8     drbid;               /* Mandatory */
+    gboolean   lcid_present;
+    guint8     lcid;                /* Part of LogicalChannelConfig - optional */
+    gboolean   rlcMode_present;
+    guint8     rlcMode;             /* Part of RLC config - optional */
+    gboolean   rlc_ul_ext_li_field; /* Part of RLC config - optional */
+    gboolean   rlc_dl_ext_li_field; /* Part of RLC config - optional */
+    gboolean   rlc_ul_ext_am_sn;    /* Part of RLC config - optional */
+    gboolean   rlc_dl_ext_am_sn;    /* Part of RLC config - optional */
+    gboolean   um_sn_length_present;
+    guint8     um_sn_length;        /* Part of RLC config - optional */
+    gboolean   ul_priority_present;
+    guint8     ul_priority;         /* Part of LogicalChannelConfig - optional */
+    gboolean   pdcp_sn_size_present;
+    guint8     pdcp_sn_size;        /* Part of pdcp-Config - optional */
+} drb_mapping_t;
+
+
+
+/* Dedicated DRX config. Used to verify that a sensible config is given.
+   Also, beginning to configure MAC with this config and (optionally) show
+   DRX config and state (cycles/timers) attached to each UL/DL PDU! */
+typedef struct drx_config_t {
+    gboolean    configured;
+    guint32     frameNum;
+    guint32     previousFrameNum;
+
+    guint32     onDurationTimer;
+    guint32     inactivityTimer;
+    guint32     retransmissionTimer;
+    guint32     longCycle;
+    guint32     cycleOffset;
+    /* Optional Short cycle */
+    gboolean    shortCycleConfigured;
+    guint32     shortCycle;
+    guint32     shortCycleTimer;
+} drx_config_t;
+
+/* RRC can indicate whether simultaneous PUCCH/PUSCH is used */
+typedef enum {
+    SIMULT_PUCCH_PUSCH_PCELL = 0,
+    SIMULT_PUCCH_PUSCH_PSCELL
+} simult_pucch_pusch_cell_type;
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index 2f7dac3d1ed9a7a568af2ecae00d86b58529e7ad..a1e53671682a10f0f984cbcd831b98c0116378e2 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -95,26 +95,22 @@ what about the implementation
 
 int opt_enabled=0;
 
-#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
-
-typedef uint8_t  guint8;
-typedef uint16_t guint16;
-typedef uint32_t guint32;
-typedef guint8   gboolean;
-
-#include "packet-mac-lte.h"
-#include "mac_pcap.h"
-
 //static unsigned char g_PDUBuffer[1600];
 //static unsigned int g_PDUOffset;
 
-
 char in_ip[40];
-char in_path[100];
+char in_path[FILENAME_MAX];
 FILE *file_fd = NULL;
+pcap_hdr_t file_header = {
+  0xa1b2c3d4,   /* magic number */
+  2, 4,         /* version number is 2.4 */
+  0,            /* timezone */
+  0,            /* sigfigs - apparently all tools do this */
+  65535,        /* snaplen - this should be long enough */
+  MAC_LTE_DLT   /* Data Link Type (DLT).  Set as unused value 147 for now */
+};
 
 trace_mode_t opt_type = OPT_NONE;
-static radio_type_t radio_type;
 static unsigned int subframesSinceCaptureStart;
 
 static int g_socksd = -1;/* UDP socket used for sending frames */
@@ -237,22 +233,13 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
                       guint8 oob_event, guint8 oob_event_value,
                       uint8_t *pdu_buffer, unsigned int pdu_buffer_size)
 {
-  #ifdef JUMBO_FRAME
-     static unsigned char frameBuffer[9000];
-  #else
-     static unsigned char frameBuffer[1600];
-  #endif 
-  static unsigned int frameOffset;
+  unsigned char frameBuffer[9000];
+  unsigned int frameOffset;
 
   ssize_t bytesSent;
   frameOffset = 0;
   uint16_t tmp16;
 
-  /********************************************************************/
-  /* Fixed start to each frame (allowing heuristic dissector to work) */
-  /* Not NULL terminated */
-  memset(frameBuffer+frameOffset, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
-
   memcpy(frameBuffer+frameOffset, MAC_LTE_START_STRING,
          strlen(MAC_LTE_START_STRING));
   frameOffset += strlen(MAC_LTE_START_STRING);
@@ -279,7 +266,7 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
   frameOffset += 2;
 
   /* Subframe number */
-  frameBuffer[frameOffset++] = MAC_LTE_SUBFRAME_TAG;
+  frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
   tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
   memcpy(frameBuffer+frameOffset, &tmp16, 2);
   frameOffset += 2;
@@ -313,26 +300,29 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
   if (pdu_buffer_size==0) {
     switch (oob_event) {
     case ltemac_send_preamble :
-      LOG_D(OPT,"oob ltemac_send_preamble event %02x."
+      LOG_D(OPT,"ltemac_send_preamble event %02x."
           //"%02x."
           "%02x.%02x\n",
-          MAC_LTE_OOB_EVENT_TAG,
+          MAC_LTE_SEND_PREAMBLE_TAG,
           //ltemac_send_preamble,
           rnti,
           oob_event_value);
       //frameBuffer[frameOffset++]=0;
       //frameBuffer[frameOffset++]=0;
       //frameBuffer[frameOffset++]=0;
-      frameBuffer[frameOffset++] = MAC_LTE_OOB_EVENT_TAG;
+      frameBuffer[frameOffset++] = MAC_LTE_SEND_PREAMBLE_TAG;
       //frameBuffer[frameOffset++]=ltemac_send_preamble;
       frameBuffer[frameOffset++]=rnti; // is the preamble
       frameBuffer[frameOffset++]=oob_event_value;
       break;
 
     case ltemac_send_sr:
-      frameBuffer[frameOffset++]=ltemac_send_sr;
+      frameBuffer[frameOffset++]=MAC_LTE_SR_TAG ;
       frameOffset+=2;
+      frameBuffer[frameOffset++]=rnti;
+      frameOffset++;
       frameBuffer[frameOffset++]=oob_event_value;
+      frameOffset++;
       break;
 
     case ltemac_sr_failure:
@@ -394,7 +384,7 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
   offset += 2;
 
   /* Subframe number */
-  context_header[offset++] = MAC_LTE_SUBFRAME_TAG;
+  context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
   tmp16 = htons(context->subFrameNumber);
   memcpy(context_header+offset, &tmp16, 2);
   offset += 2;
@@ -423,21 +413,27 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
 
   return 1;
 }
-
+#include <common/ran_context.h>
+extern RAN_CONTEXT_t RC;
+#include <openair1/PHY/phy_extern_ue.h>
 /* Remote serveraddress (where Wireshark is running) */
 void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
                int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
                int oob_event_value)
 {
   MAC_Context_Info_t pdu_context;
-
+  int radioType=FDD_RADIO;
+  if (RC.eNB[0][0]!=NULL)
+    radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
+  if (PHY_vars_UE_g[0][0] != NULL)
+    radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
   switch (opt_type) {
   case OPT_WIRESHARK :
     if (g_socksd == -1) {
       return;
     }
 
-    SendFrame(radio_type,
+    SendFrame( radioType,
               (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
               rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
               1, 0, 1,  //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
@@ -450,7 +446,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
       return;
     }
 
-    pdu_context.radioType = radio_type;
+    pdu_context.radioType =  radioType;
     pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
                             : DIRECTION_UPLINK;
     pdu_context.rntiType = rntiType;
@@ -470,7 +466,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
   }
 }
 /*---------------------------------------------------*/
-int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p)
+int init_opt(char *path, char *ip)
 {
   uint16_t in_port;
   subframesSinceCaptureStart = 0;
@@ -489,13 +485,7 @@ int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p)
     strcpy( in_ip, "127.0.0.1" );
   }
 
-  if (port != NULL) {
-    in_port = atoi(port);
-  } else {
-    in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
-  }
-
-  radio_type = radio_type_p;
+  in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
 
   // trace_mode
   switch (opt_type) {
diff --git a/openair2/UTIL/OPT/ws_compiler_tests.h b/openair2/UTIL/OPT/ws_compiler_tests.h
new file mode 100644
index 0000000000000000000000000000000000000000..46a4ab6099d2d9a2826f42f2884eae962efedff1
--- /dev/null
+++ b/openair2/UTIL/OPT/ws_compiler_tests.h
@@ -0,0 +1,138 @@
+/* ws_compiler_tests.h
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef __WS_COMPILER_TESTS_H__
+#define __WS_COMPILER_TESTS_H__
+
+/*
+ * This was introduced by Clang:
+ *
+ *     http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
+ *
+ * in some version (which version?); it has been picked up by GCC 5.0.
+ */
+#ifndef __has_attribute
+  /*
+   * It's a macro, so you can check whether it's defined to check
+   * whether it's supported.
+   *
+   * If it's not, define it to always return 0, so that we move on to
+   * the fallback checks.
+   */
+  #define __has_attribute(x) 0
+#endif
+
+/*
+ * Note that the C90 spec's "6.8.1 Conditional inclusion" and the
+ * C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say:
+ *
+ *    Prior to evaluation, macro invocations in the list of preprocessing
+ *    tokens that will become the controlling constant expression are
+ *    replaced (except for those macro names modified by the defined unary
+ *    operator), just as in normal text.  If the token "defined" is
+ *    generated as a result of this replacement process or use of the
+ *    "defined" unary operator does not match one of the two specified
+ *    forms prior to macro replacement, the behavior is undefined.
+ *
+ * so you shouldn't use defined() in a #define that's used in #if or
+ * #elif.  Some versions of Clang, for example, will warn about this.
+ *
+ * Instead, we check whether the pre-defined macros for particular
+ * compilers are defined and, if not, define the "is this version XXX
+ * or a later version of this compiler" macros as 0.
+ */
+
+/*
+ * Check whether this is GCC major.minor or a later release, or some
+ * compiler that claims to be "just like GCC" of that version or a
+ * later release.
+ */
+
+#if !defined(__GNUC__)
+  #define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
+#else
+  #define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) \
+	(__GNUC__ > (major) || \
+	 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
+#endif
+
+/*
+ * Check whether this is Clang major.minor or a later release.
+ */
+
+#if !defined(__clang__)
+  #define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
+#else
+  #define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) \
+	(__clang_major__ > (major) || \
+	 (__clang_major__ == (major) && __clang_minor__ >= (minor)))
+#endif
+
+/*
+ * Check whether this is Sun C/SunPro C/Oracle Studio major.minor
+ * or a later release.
+ *
+ * The version number in __SUNPRO_C is encoded in hex BCD, with the
+ * uppermost hex digit being the major version number, the next
+ * one or two hex digits being the minor version number, and
+ * the last digit being the patch version.
+ *
+ * It represents the *compiler* version, not the product version;
+ * see
+ *
+ *    https://sourceforge.net/p/predef/wiki/Compilers/
+ *
+ * for a partial mapping, which we assume continues for later
+ * 12.x product releases.
+ */
+
+#if !defined(__SUNPRO_C)
+  #define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) 0
+#else
+  #define WS_SUNPRO_VERSION_TO_BCD(major, minor) \
+	(((minor) >= 10) ? \
+	    (((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
+	    (((major) << 8) | ((minor) << 4)))
+  #define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) \
+	(__SUNPRO_C >= WS_SUNPRO_VERSION_TO_BCD((major), (minor)))
+#endif
+
+/*
+ * Check whether this is IBM XL C major.minor or a later release.
+ *
+ * The version number in __xlC__ has the major version in the
+ * upper 8 bits and the minor version in the lower 8 bits.
+ */
+
+#if !defined(__xlC__)
+  #define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) 0
+#else
+  #define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+	(__xlC__ >= (((major) << 8) | (minor)))
+#endif
+
+/*
+ * Check whether this is HP aC++/HP C major.minor or a later release.
+ *
+ * The version number in __HP_aCC is encoded in zero-padded decimal BCD,
+ * with the "A." stripped off, the uppermost two decimal digits being
+ * the major version number, the next two decimal digits being the minor
+ * version number, and the last two decimal digits being the patch version.
+ * (Strip off the A., remove the . between the major and minor version
+ * number, and add two digits of patch.)
+ */
+
+#if !defined(__HP_aCC)
+  #define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) 0
+#else
+  #define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) \
+	(__HP_aCC >= ((major)*10000 + (minor)*100))
+#endif
+
+#endif /* __WS_COMPILER_TESTS_H__ */
diff --git a/openair2/UTIL/OPT/ws_symbol_export.h b/openair2/UTIL/OPT/ws_symbol_export.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c7a2f710af741a948163a0efb7892af7be5a662
--- /dev/null
+++ b/openair2/UTIL/OPT/ws_symbol_export.h
@@ -0,0 +1,202 @@
+/*
+ * Cross platform defines for exporting symbols from shared libraries
+ *
+ * Wireshark - Network traffic analyzer
+ * By Balint Reczey <balint@balintreczey.hu>
+ * Copyright 2013 Balint Reczey
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "ws_compiler_tests.h"
+
+/** Reset symbol export behavior.
+ * If you {un}define WS_BUILD_DLL on the fly you'll have to define this
+ * as well.
+ */
+#ifdef RESET_SYMBOL_EXPORT
+
+#ifdef SYMBOL_EXPORT_H
+#undef SYMBOL_EXPORT_H
+#endif
+
+#ifdef WS_DLL_PUBLIC
+#undef WS_DLL_PUBLIC
+#endif
+
+#ifdef WS_DLL_PUBLIC_DEF
+#undef WS_DLL_PUBLIC_DEF
+#endif
+
+#ifdef WS_DLL_LOCAL
+#undef WS_DLL_LOCAL
+#endif
+
+#endif /* RESET_SYMBOL_EXPORT */
+
+#ifndef SYMBOL_EXPORT_H
+#define SYMBOL_EXPORT_H
+
+/*
+ * NOTE: G_HAVE_GNUC_VISIBILITY is defined only if all of
+ *
+ *    __attribute__ ((visibility ("hidden")))
+ *
+ *    __attribute__ ((visibility ("internal")))
+ *
+ *    __attribute__ ((visibility ("protected")))
+ *
+ *    __attribute__ ((visibility ("default")))
+ *
+ * are supported, and at least some versions of GCC from Apple support
+ * "default" and "hidden" but not "internal" or "protected", so it
+ * shouldn't be used to determine whether "hidden" or "default" is
+ * supported.
+ *
+ * This also means that we shouldn't use G_GNUC_INTERNAL instead of
+ * WS_DLL_LOCAL, as GLib uses G_HAVE_GNUC_VISIBILITY to determine
+ * whether to use __attribute__ ((visibility ("hidden"))) for
+ * G_GNUC_INTERNAL, and that will not use it even with compilers
+ * that support it.
+ */
+
+/* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */
+#if defined _WIN32 || defined __CYGWIN__
+  /* Compiling for Windows, so we use the Windows DLL declarations. */
+  #ifdef WS_BUILD_DLL
+    /*
+     * Building a DLL; for all definitions, we want dllexport, and
+     * (presumably so source from DLL and source from a program using the
+     * DLL can both include a header that declares APIs and exported data
+     * for the DLL), for declarations, either dllexport or dllimport will
+     * work (they mean the same thing for a declaration when building a DLL).
+     */
+    #ifdef __GNUC__
+      /* GCC */
+      #define WS_DLL_PUBLIC_DEF __attribute__ ((dllexport))
+    #else /* ! __GNUC__ */
+      /*
+       * Presumably MSVC.
+       * Note: actually gcc seems to also support this syntax.
+       */
+      #define WS_DLL_PUBLIC_DEF __declspec(dllexport)
+    #endif /* __GNUC__ */
+  #else /* WS_BUILD_DLL */
+    /*
+     * Building a program; we should only see declarations, not definitions,
+     * with WS_DLL_PUBLIC, and they all represent APIs or data imported
+     * from a DLL, so use dllimport.
+     *
+     * For functions, export shouldn't be necessary; for data, it might
+     * be necessary, e.g. if what's declared is an array whose size is
+     * not given in the declaration.
+     */
+    #ifdef __GNUC__
+      /* GCC */
+      #define WS_DLL_PUBLIC_DEF __attribute__ ((dllimport))
+    #elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */
+      /*
+       * Presumably MSVC, and we're not building all-static.
+       * Note: actually gcc seems to also support this syntax.
+       */
+      #define WS_DLL_PUBLIC_DEF __declspec(dllimport)
+    #else /* ! __GNUC__  && ENABLE_STATIC */
+      /*
+       * Presumably MSVC, and we're building all-static, so we're
+       * not building any DLLs.
+       */
+      #define WS_DLL_PUBLIC_DEF
+    #endif /* __GNUC__ */
+  #endif /* WS_BUILD_DLL */
+
+  /*
+   * Symbols in a DLL are *not* exported unless they're specifically
+   * flagged as exported, so, for a non-static but non-exported
+   * symbol, we don't have to do anything.
+   */
+  #define WS_DLL_LOCAL
+#else /* defined _WIN32 || defined __CYGWIN__ */
+  /*
+   * Compiling for UN*X, where the dllimport and dllexport stuff
+   * is neither necessary nor supported; just specify the
+   * visibility if we have a compiler that supports doing so.
+   */
+  #if WS_IS_AT_LEAST_GNUC_VERSION(3,4) \
+      || WS_IS_AT_LEAST_XL_C_VERSION(12,0)
+    /*
+     * GCC 3.4 or later, or some compiler asserting compatibility with
+     * GCC 3.4 or later, or XL C 13.0 or later, so we have
+     * __attribute__((visibility()).
+     */
+
+    /*
+     * Symbols exported from libraries.
+     */
+    #define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default")))
+
+    /*
+     * Non-static symbols *not* exported from libraries.
+     */
+    #define WS_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
+  #elif WS_IS_AT_LEAST_SUNC_VERSION(5,5)
+    /*
+     * Sun C 5.5 or later, so we have __global and __hidden.
+     * (Sun C 5.9 and later also have __attribute__((visibility()),
+     * but there's no reason to prefer it with Sun C.)
+     */
+
+    /*
+     * Symbols exported from libraries.
+     */
+    #define WS_DLL_PUBLIC_DEF __global
+
+    /*
+     * Non-static symbols *not* exported from libraries.
+     */
+    #define WS_DLL_LOCAL __hidden
+  #else
+    /*
+     * We have neither a way to make stuff not explicitly marked as
+     * visible invisible outside a library nor a way to make stuff
+     * explicitly marked as local invisible outside the library.
+     */
+
+    /*
+     * Symbols exported from libraries.
+     */
+    #define WS_DLL_PUBLIC_DEF
+
+    /*
+     * Non-static symbols *not* exported from libraries.
+     */
+    #define WS_DLL_LOCAL
+  #endif
+#endif
+
+/*
+ * You *must* use this for exported data *declarations*; if you use
+ * WS_DLL_PUBLIC_DEF, some compilers, such as MSVC++, will complain
+ * about array definitions with no size.
+ *
+ * You must *not* use this for exported data *definitions*, as that
+ * will, for some compilers, cause warnings about items being initialized
+ * and declared extern.
+ *
+ * Either can be used for exported *function* declarations and definitions.
+ */
+#define WS_DLL_PUBLIC  WS_DLL_PUBLIC_DEF extern
+
+#endif /* SYMBOL_EXPORT_H */
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index e84f99e67f4126d2a6ee8b0efe49099a12022a34..628bcc1bee979d963dcc9c70c9d3fcddcfd8182a 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -975,14 +975,7 @@ int main( int argc, char **argv )
 #endif
 
   if (opt_type != OPT_NONE) {
-    radio_type_t radio_type;
-
-    if (frame_parms[0]->frame_type == FDD)
-      radio_type = RADIO_TYPE_FDD;
-    else
-      radio_type = RADIO_TYPE_TDD;
-
-    if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
+    if (init_opt(in_path, in_ip) == -1)
       LOG_E(OPT,"failed to run OPT \n");
   }
 
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index a2a12f9dd9f301a43c0f6a9767db995bc5d2f8a6..ce18ca7456121d7a00115e09f7523d92b5bf7aee 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -862,14 +862,7 @@ int main( int argc, char **argv )
 #endif
 
   if (opt_type != OPT_NONE) {
-    radio_type_t radio_type;
-
-    if (frame_parms[0]->frame_type == FDD)
-      radio_type = RADIO_TYPE_FDD;
-    else
-      radio_type = RADIO_TYPE_TDD;
-
-    if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
+    if (init_opt(in_path, in_ip) == -1)
       LOG_E(OPT,"failed to run OPT \n");
   }