From Lars Ruoff:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 22 Feb 2012 08:37:46 +0000 (08:37 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 22 Feb 2012 08:37:46 +0000 (08:37 +0000)
Dissector for Alcatel-Lucent Enterprise Universal Alcatel- and NOE protocol
families.
Meant as a replacement for existing UA-dissector in trunk because of better
feature set:
- latest protocol specifiaction
- more detailed dissection and filtering possibilities on subprotocols
- RTP stream setup
- NOE over SIP

Lars Ruoff
On behalf of Alcatel-Lucent Enterprise

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6844

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@41134 f5534014-38df-0310-8fa8-9805f1628bb7

AUTHORS
epan/CMakeLists.txt
epan/dissectors/Makefile.common
epan/dissectors/packet-noe.c [new file with mode: 0644]
epan/dissectors/packet-ua.c
epan/dissectors/packet-ua3g.c [new file with mode: 0644]
epan/dissectors/packet-uasip.c [new file with mode: 0644]
epan/dissectors/packet-uaudp.c
epan/dissectors/packet-uaudp.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 43e2c91bc161ac844a550b28355f005e9d161f5e..27103290c68ae4e297fae6d23d42ad264f9456f8 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -2014,7 +2014,7 @@ Graeme Reid             <graeme.reid [AT] norwoodsystems.com> {
        H.450 support
 }
 
-Lars Ruoff              <lars.ruoff [AT] sxb.bsf.alcatel.fr> {
+Lars Ruoff              <lars.ruoff [AT] alcatel-lucent.com> {
        Rewritten RTP analysis tap
 }
 
index c49fa094919cc9791fe431330ebb0678987b9043..dba8e70631ce5b17d8d1ac088421b43b8021a69d 100644 (file)
@@ -1084,8 +1084,11 @@ set(DISSECTOR_SRC
        dissectors/packet-turnchannel.c
        dissectors/packet-tuxedo.c
        dissectors/packet-tzsp.c
-       dissectors/packet-ua.c
        dissectors/packet-uaudp.c
+       dissectors/packet-ua.c
+       dissectors/packet-ua3g.c
+       dissectors/packet-noe.c
+       dissectors/packet-uasip.c
        dissectors/packet-ucp.c
        dissectors/packet-udld.c
        dissectors/packet-udp.c
index 2e32105f3516d003dfbc4ce2a9396e778b9441b9..2a73b12dad711ce2278561e3866cf3be9e8e97ce 100644 (file)
@@ -1002,8 +1002,11 @@ DISSECTOR_SRC = \
        packet-turnchannel.c    \
        packet-tuxedo.c         \
        packet-tzsp.c           \
-       packet-ua.c             \
        packet-uaudp.c          \
+       packet-ua.c                     \
+       packet-ua3g.c           \
+       packet-noe.c            \
+       packet-uasip.c          \
        packet-ucp.c            \
        packet-udld.c           \
        packet-udp.c            \
diff --git a/epan/dissectors/packet-noe.c b/epan/dissectors/packet-noe.c
new file mode 100644 (file)
index 0000000..d4a8d78
--- /dev/null
@@ -0,0 +1,1740 @@
+/* packet-noe.c
+ * Routines for UA/UDP (Universal Alcatel over UDP) and NOE packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
+ *
+ * $Id: 
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib.h>
+#include "epan/packet.h"
+#include "epan/prefs.h"
+#include "epan/tap.h"
+#include "epan/value_string.h"
+
+#define OPCODE_C_context 0
+#define OPCODE_C_terminal 1
+#define OPCODE_C_keyboard 2
+#define OPCODE_C_audioconfig 3
+#define OPCODE_C_security 4
+#define OPCODE_C_leds 5
+#define OPCODE_C_screen 6
+#define OPCODE_C_date 7
+#define OPCODE_C_AOMV 8
+#define OPCODE_C_bluetooth 9
+#define OPCODE_C_callstate 12
+#define OPCODE_C_resource 13
+#define OPCODE_C_widgets_default 14
+#define OPCODE_C_framebox 128
+#define OPCODE_C_tabbox 129
+#define OPCODE_C_listbox 130
+#define OPCODE_C_actionlistbox 131
+#define OPCODE_C_textbox 132
+#define OPCODE_C_actionbox 133
+#define OPCODE_C_inputbox 134
+#define OPCODE_C_checkbox 135
+#define OPCODE_C_datebox 136
+#define OPCODE_C_timerbox 137
+#define OPCODE_C_popupbox 138
+#define OPCODE_C_dialogbox 139
+#define OPCODE_C_sliderbar 140
+#define OPCODE_C_progressbar 141
+#define OPCODE_C_imagebox 142
+#define OPCODE_C_iconbox 143
+#define OPCODE_C_AOMVbox 144
+#define OPCODE_C_telephonicbox 145
+#define OPCODE_C_keyboard_context 146
+#define OPCODE_C_AOMEL 147
+#define OPCODE_C_AOM10 148
+#define OPCODE_C_AOM40 149
+#define OPCODE_C_idletimer 150
+#define OPCODE_C_telephonicboxitem 151
+#define OPCODE_C_bluetooth_device 152
+#define OPCODE_C_headerbox 153
+#define OPCODE_C_ime_context 154
+
+static const value_string val_str_class[] = {
+  {OPCODE_C_context, "Context"},
+  {OPCODE_C_terminal, "Terminal"},
+  {OPCODE_C_keyboard, "Keyboard"},
+  {OPCODE_C_audioconfig, "AudioConfig"},
+  {OPCODE_C_security, "Security"},
+  {OPCODE_C_leds, "Leds"},
+  {OPCODE_C_screen, "Screen"},
+  {OPCODE_C_date, "Date"},
+  {OPCODE_C_AOMV, "AOMV"},
+  {OPCODE_C_bluetooth, "Bluetooth"},
+  {OPCODE_C_callstate, "Callstate"},
+  {OPCODE_C_framebox, "FrameBox"},
+  {OPCODE_C_tabbox, "TabBox"},
+  {OPCODE_C_listbox, "ListBox"},
+  {OPCODE_C_actionlistbox, "ActionlistBox"},
+  {OPCODE_C_textbox, "TextBox"},
+  {OPCODE_C_actionbox, "ActionBox"},
+  {OPCODE_C_inputbox, "InputBox"},
+  {OPCODE_C_checkbox, "CheckBox"},
+  {OPCODE_C_datebox, "DateBox"},
+  {OPCODE_C_timerbox, "TimerBox"},
+  {OPCODE_C_popupbox, "PopupBox"},
+  {OPCODE_C_dialogbox, "DialogBox"},
+  {OPCODE_C_sliderbar, "SliderBar"},
+  {OPCODE_C_progressbar, "ProgressBar"},
+  {OPCODE_C_imagebox, "ImageBox"},
+  {OPCODE_C_iconbox, "IconBox"},
+  {OPCODE_C_AOMVbox, "AOMVBox"},
+  {OPCODE_C_telephonicbox, "TelephonicBox"},
+  {OPCODE_C_keyboard_context, "Keyboard_context"},
+  {OPCODE_C_AOMEL, "AOMEL"},
+  {OPCODE_C_AOM10, "AOM10"},
+  {OPCODE_C_AOM40, "AOM40"},
+  {OPCODE_C_idletimer, "IdleTimer"},
+  {OPCODE_C_telephonicboxitem, "TelephonicBoxItem"},
+  {OPCODE_C_bluetooth_device, "Bluetooth_device"},
+  {OPCODE_C_headerbox, "HeaderBox"},
+  {OPCODE_C_ime_context, "ime_context"}
+};
+
+#define OPCODE_P_B_objectid 0
+#define OPCODE_P_B_ownership 1
+#define OPCODE_P_B_reset_mode 2
+#define OPCODE_P_B_mtu 3
+#define OPCODE_P_B_negative_ack 4
+#define OPCODE_P_B_type 5
+#define OPCODE_P_B_help_timeout 6
+#define OPCODE_P_B_longpress 7
+#define OPCODE_P_B_count 8
+#define OPCODE_P_B_eventmode 9
+#define OPCODE_P_B_numpad_ownership 10
+#define OPCODE_P_B_navigator_ownership 11
+#define OPCODE_P_B_telephony_ownership 12
+#define OPCODE_P_B_progkeys_ownership 13
+#define OPCODE_P_B_alphakeys_ownership 14
+#define OPCODE_P_B_numpad_eventmode 15
+#define OPCODE_P_B_onoff 16
+#define OPCODE_P_B_bpp 17
+#define OPCODE_P_B_w 18
+#define OPCODE_P_B_h 19
+#define OPCODE_P_B_contrast 20
+#define OPCODE_P_B_clearscreen 21
+#define OPCODE_P_B_year 24
+#define OPCODE_P_B_month 25
+#define OPCODE_P_B_day 26
+#define OPCODE_P_B_m 27
+#define OPCODE_P_B_s 28
+#define OPCODE_P_B_enable 29
+#define OPCODE_P_B_address 30
+#define OPCODE_P_B_port 31
+#define OPCODE_P_B_protocol 32
+#define OPCODE_P_B_name 33
+#define OPCODE_P_B_checked 34
+#define OPCODE_P_B_unchecked 35
+#define OPCODE_P_B_anchorid 36
+#define OPCODE_P_B_grid 37
+#define OPCODE_P_B_x 38
+#define OPCODE_P_B_y 39
+#define OPCODE_P_B_visible 40
+#define OPCODE_P_B_border 41
+#define OPCODE_P_B_fontid 42
+#define OPCODE_P_B_active 43
+#define OPCODE_P_B_halign 44
+#define OPCODE_P_B_valign 45
+#define OPCODE_P_B_size 46
+#define OPCODE_P_B_mode 47
+#define OPCODE_P_B_showevent 48
+#define OPCODE_P_B_showactive 49
+#define OPCODE_P_B_action_active 50
+#define OPCODE_P_B_action_count 51
+#define OPCODE_P_B_foreground 52
+#define OPCODE_P_B_background 53
+#define OPCODE_P_B_icon 54
+#define OPCODE_P_B_label 55
+#define OPCODE_P_B_value 56
+#define OPCODE_P_B_password 57
+#define OPCODE_P_B_cursor 58
+#define OPCODE_P_B_mask 59
+#define OPCODE_P_B_qos_ticket 60
+#define OPCODE_P_B_focus 61
+#define OPCODE_P_B_state 62
+#define OPCODE_P_B_format 63
+#define OPCODE_P_B_incdec 64
+#define OPCODE_P_B_value_notify 65
+#define OPCODE_P_B_timeout 66
+#define OPCODE_P_B_min 67
+#define OPCODE_P_B_max 68
+#define OPCODE_P_B_data 69
+#define OPCODE_P_B_custversion 70
+#define OPCODE_P_B_L10Nversion 71
+#define OPCODE_P_B_append 72
+#define OPCODE_P_B_shortpress 73
+#define OPCODE_P_B_autorepeat 74
+#define OPCODE_P_B_repetition 75
+#define OPCODE_P_B_vsplit 76
+#define OPCODE_P_B_accesskey 77
+#define OPCODE_P_B_realcount 78
+#define OPCODE_P_B_start 79
+#define OPCODE_P_B_modal 80
+#define OPCODE_P_B_session_timeout 81
+#define OPCODE_P_B_softkeys_ownership 82
+#define OPCODE_P_B_ringings_count 83
+#define OPCODE_P_B_cod 84
+#define OPCODE_P_B_bonded 85
+#define OPCODE_P_B_link_key 86
+#define OPCODE_P_B_pin 87
+#define OPCODE_P_B_term_type 88
+#define OPCODE_P_B_link_type 89
+#define OPCODE_P_B_circular 90
+#define OPCODE_P_B_autospread 91
+#define OPCODE_P_B_backlight_timeout 92
+#define OPCODE_P_B_screensaver_timeout 93
+#define OPCODE_P_B_cycling 94
+#define OPCODE_P_B_CS_idle_state 95
+#define OPCODE_P_B_PS_idle_state 96
+#define OPCODE_P_B_bonded_devices 97
+#define OPCODE_P_B_serialnum 98
+#define OPCODE_P_B_hardversion 99
+#define OPCODE_P_B_softversion 100
+#define OPCODE_P_B_rom_size 101
+#define OPCODE_P_B_ram_size 102
+#define OPCODE_P_B_reset_cause 103
+#define OPCODE_P_B_cycling_time 104
+#define OPCODE_P_B_inputborder 106
+#define OPCODE_P_B_disablelongpress 107
+#define OPCODE_P_B_all_icons_off 108
+#define OPCODE_P_B_all_labels_off 109
+#define OPCODE_P_B_widgets_size 110
+#define OPCODE_P_B_list_type 111
+#define OPCODE_P_B_frame_type 112
+#define OPCODE_P_B_bth_ringing 113
+#define OPCODE_P_B_URI 114
+#define OPCODE_P_B_fetch_timeout 115
+#define OPCODE_P_B_mask_subst 116
+#define OPCODE_P_B_use_customisation 117
+#define OPCODE_P_B_ADTTS_request 118
+#define OPCODE_P_B_AP_mac_notify 119
+#define OPCODE_P_B_page_active 120
+#define OPCODE_P_B_overwrite 121
+#define OPCODE_P_B_ime_lock 122
+#define OPCODE_P_B_method 123
+#define OPCODE_P_B_login 124
+#define OPCODE_P_B_binary_suffix 125
+#define OPCODE_P_B_binary_count 126
+#define OPCODE_P_B_SIPCversion 127
+#define OPCODE_P_A_dflt 128
+#define OPCODE_P_A_shift 129
+#define OPCODE_P_A_alt 130
+#define OPCODE_P_A_key_ownership 131
+#define OPCODE_P_A_key_eventmode 132
+#define OPCODE_P_A_value 133
+#define OPCODE_P_A_mode 134
+#define OPCODE_P_A_color 135
+#define OPCODE_P_A_type 136
+#define OPCODE_P_A_icon 137
+#define OPCODE_P_A_label 138
+#define OPCODE_P_A_ownership 139
+#define OPCODE_P_A_enable 140
+#define OPCODE_P_A_state 141
+#define OPCODE_P_A_name 142
+#define OPCODE_P_A_number 143
+#define OPCODE_P_A_action_icon 144
+#define OPCODE_P_A_action_label 145
+#define OPCODE_P_A_action_value 146
+#define OPCODE_P_A_today 147
+#define OPCODE_P_A_tomorrow 148
+#define OPCODE_P_A_action_key 149
+#define OPCODE_P_A_code 150
+#define OPCODE_P_A_data 151
+#define OPCODE_P_A_delay_max_handset 152
+#define OPCODE_P_A_delay_max_handsfree 153
+#define OPCODE_P_A_delay_tx 154
+#define OPCODE_P_A_delay_rx 155
+#define OPCODE_P_A_pem_data 156
+#define OPCODE_P_A_serial_number 157
+#define OPCODE_P_A_owner_name 158
+#define OPCODE_P_A_issuer_name 159
+#define OPCODE_P_A_end_date 160
+
+static const value_string val_str_props[] = {
+  {OPCODE_P_B_objectid, "objectid"},
+  {OPCODE_P_B_ownership, "ownership"},
+  {OPCODE_P_B_reset_mode, "reset_mode"},
+  {OPCODE_P_B_mtu, "mtu"},
+  {OPCODE_P_B_negative_ack, "negative_ack"},
+  {OPCODE_P_B_type, "type"},
+  {OPCODE_P_B_help_timeout, "help_timeout"},
+  {OPCODE_P_B_longpress, "longpress"},
+  {OPCODE_P_B_count, "count"},
+  {OPCODE_P_B_eventmode, "eventmode"},
+  {OPCODE_P_B_numpad_ownership, "numpad_ownership"},
+  {OPCODE_P_B_navigator_ownership, "navigator_ownership"},
+  {OPCODE_P_B_telephony_ownership, "telephony_ownership"},
+  {OPCODE_P_B_progkeys_ownership, "progkeys_ownership"},
+  {OPCODE_P_B_alphakeys_ownership, "alphakeys_ownership"},
+  {OPCODE_P_B_numpad_eventmode, "numpad_eventmode"},
+  {OPCODE_P_B_onoff, "onoff"},
+  {OPCODE_P_B_bpp, "bpp"},
+  {OPCODE_P_B_w, "w"},
+  {OPCODE_P_B_h, "h"},
+  {OPCODE_P_B_contrast, "contrast"},
+  {OPCODE_P_B_clearscreen, "clearscreen"},
+  {OPCODE_P_B_year, "year"},
+  {OPCODE_P_B_month, "month"},
+  {OPCODE_P_B_day, "day"},
+  {OPCODE_P_B_m, "m"},
+  {OPCODE_P_B_s, "s"},
+  {OPCODE_P_B_enable, "enable"},
+  {OPCODE_P_B_address, "address"},
+  {OPCODE_P_B_name, "name"},
+  {OPCODE_P_B_anchorid, "anchorid"},
+  {OPCODE_P_B_grid, "grid"},
+  {OPCODE_P_B_x, "x"},
+  {OPCODE_P_B_y, "y"},
+  {OPCODE_P_B_visible, "visible"},
+  {OPCODE_P_B_border, "border"},
+  {OPCODE_P_B_fontid, "fontid"},
+  {OPCODE_P_B_active, "active"},
+  {OPCODE_P_B_halign, "halign"},
+  {OPCODE_P_B_valign, "valign"},
+  {OPCODE_P_B_size, "size"},
+  {OPCODE_P_B_mode, "mode"},
+  {OPCODE_P_B_showevent, "showevent"},
+  {OPCODE_P_B_showactive, "showactive"},
+  {OPCODE_P_B_icon, "icon"},
+  {OPCODE_P_B_label, "label"},
+  {OPCODE_P_B_value, "value"},
+  {OPCODE_P_B_password, "password"},
+  {OPCODE_P_B_cursor, "cursor"},
+  {OPCODE_P_B_mask, "mask"},
+  {OPCODE_P_B_qos_ticket, "qos_ticket"},
+  {OPCODE_P_B_focus, "focus"},
+  {OPCODE_P_B_state, "state"},
+  {OPCODE_P_B_format, "format"},
+  {OPCODE_P_B_incdec, "incdec"},
+  {OPCODE_P_B_value_notify, "value_notify"},
+  {OPCODE_P_B_timeout, "timeout"},
+  {OPCODE_P_B_min, "min"},
+  {OPCODE_P_B_max, "max"},
+  {OPCODE_P_B_data, "data"},
+  {OPCODE_P_B_custversion, "custversion"},
+  {OPCODE_P_B_L10Nversion, "L10Nversion"},
+  {OPCODE_P_B_append, "append"},
+  {OPCODE_P_B_shortpress, "shortpress"},
+  {OPCODE_P_B_autorepeat, "autorepeat"},
+  {OPCODE_P_B_repetition, "repetition"},
+  {OPCODE_P_B_vsplit, "vsplit"},
+  {OPCODE_P_B_accesskey, "accesskey"},
+  {OPCODE_P_B_realcount, "realcount"},
+  {OPCODE_P_B_start, "start"},
+  {OPCODE_P_B_modal, "modal"},
+  {OPCODE_P_B_session_timeout, "session_timeout"},
+  {OPCODE_P_B_softkeys_ownership, "softkeys_ownership"},
+  {OPCODE_P_B_ringings_count, "ringings_count"},
+  {OPCODE_P_B_cod, "cod"},
+  {OPCODE_P_B_bonded, "bonded"},
+  {OPCODE_P_B_link_key, "link_key"},
+  {OPCODE_P_B_pin, "pin"},
+  {OPCODE_P_B_term_type, "term_type"},
+  {OPCODE_P_B_link_type, "link_type"},
+  {OPCODE_P_B_circular, "circular"},
+  {OPCODE_P_B_autospread, "autospread"},
+  {OPCODE_P_B_backlight_timeout, "backlight_timeout"},
+  {OPCODE_P_B_screensaver_timeout, "screensaver_timeout"},
+  {OPCODE_P_B_cycling, "cycling"},
+  {OPCODE_P_B_CS_idle_state, "CS_idle_state"},
+  {OPCODE_P_B_PS_idle_state, "PS_idle_state"},
+  {OPCODE_P_B_bonded_devices, "bonded_devices"},
+  {OPCODE_P_B_serialnum, "serialnum"},
+  {OPCODE_P_B_hardversion, "hardversion"},
+  {OPCODE_P_B_softversion, "softversion"},
+  {OPCODE_P_B_rom_size, "rom_size"},
+  {OPCODE_P_B_ram_size, "ram_size"},
+  {OPCODE_P_B_reset_cause, "reset_cause"},
+  {OPCODE_P_B_cycling_time, "cycling_time"},
+  {OPCODE_P_B_inputborder, "inputborder"},
+  {OPCODE_P_B_disablelongpress, "disablelongpress"},
+  {OPCODE_P_B_all_icons_off, "all_icons_off"},
+  {OPCODE_P_B_all_labels_off, "all_labels_off"},
+  {OPCODE_P_B_widgets_size, "widgets_size"},
+  {OPCODE_P_B_list_type, "list_type"},
+  {OPCODE_P_B_frame_type, "frame_type"},
+  {OPCODE_P_B_bth_ringing, "bth_ringing"},
+  {OPCODE_P_B_URI, "URI"},
+  {OPCODE_P_B_fetch_timeout, "fetch_timeout"},
+  {OPCODE_P_B_mask_subst, "mask_subst"},
+  {OPCODE_P_B_use_customisation, "use_customisation"},
+  {OPCODE_P_B_page_active, "page_active"},
+  {OPCODE_P_B_overwrite, "overwrite"},
+  {OPCODE_P_B_ime_lock, "ime_lock"},
+  {OPCODE_P_B_method, "method"},
+  {OPCODE_P_B_login, "login"},
+  {OPCODE_P_B_binary_suffix, "binary_suffix"},
+  {OPCODE_P_B_binary_count, "binary_count"},
+  {OPCODE_P_B_SIPCversion, "SIPCversion"},
+  {OPCODE_P_A_key_ownership, "key_ownership"},
+  {OPCODE_P_A_key_eventmode, "key_eventmode"},
+  {OPCODE_P_A_value, "value"},
+  {OPCODE_P_A_mode, "mode"},
+  {OPCODE_P_A_color, "color"},
+  {OPCODE_P_A_type, "type"},
+  {OPCODE_P_A_icon, "icon"},
+  {OPCODE_P_A_label, "label"},
+  {OPCODE_P_A_ownership, "ownership"},
+  {OPCODE_P_A_enable, "enable"},
+  {OPCODE_P_A_state, "state"},
+  {OPCODE_P_A_name, "name"},
+  {OPCODE_P_A_number, "number"},
+  {OPCODE_P_A_action_icon, "action_icon"},
+  {OPCODE_P_A_action_label, "action_label"},
+  {OPCODE_P_A_action_value, "action_value"},
+  {OPCODE_P_A_today, "today"},
+  {OPCODE_P_A_tomorrow, "tomorrow"},
+  {OPCODE_P_A_code, "code"},
+  {OPCODE_P_A_data, "data"},
+  {OPCODE_P_A_delay_max_handset, "delay_max_handset"},
+  {OPCODE_P_A_delay_max_handsfree, "delay_max_handsfree"},
+  {OPCODE_P_A_delay_tx, "delay_tx"},
+  {OPCODE_P_A_delay_rx, "delay_rx"},
+  {OPCODE_P_A_pem_data, "pem_data"},
+  {OPCODE_P_A_serial_number, "serial_number"},
+  {OPCODE_P_A_owner_name, "owner_name"},
+  {OPCODE_P_A_issuer_name, "issuer_name"},
+  {OPCODE_P_A_end_date, "end_date"}
+};
+
+#define OPCODE_EVT_CONTEXT_SWITCH 0
+#define OPCODE_EVT_RESET 1
+#define OPCODE_EVT_KEY_PRESS 2
+#define OPCODE_EVT_KEY_RELEASE 3
+#define OPCODE_EVT_KEY_SHORTPRESS 4
+#define OPCODE_EVT_KEY_LONGPRESS 5
+#define OPCODE_EVT_ONHOOK 6
+#define OPCODE_EVT_OFFHOOK 7
+#define OPCODE_EVT_HELP 8
+#define OPCODE_EVT_WIDGETS_GC 9
+#define OPCODE_EVT_ERROR_PROTOCOL 10
+#define OPCODE_EVT_ERROR_CREATE 11
+#define OPCODE_EVT_ERROR_DELETE 12
+#define OPCODE_EVT_ERROR_SET_PROPERTY 13
+#define OPCODE_EVT_ERROR_GET_PROPERTY 14
+#define OPCODE_EVT_SUCCESS_CREATE 15
+#define OPCODE_EVT_SUCCESS_DELETE 16
+#define OPCODE_EVT_SUCCESS_SET_PROPERTY 17
+#define OPCODE_EVT_ERROR_INSERT_ITEM 18
+#define OPCODE_EVT_ERROR_DELETE_ITEM 19
+#define OPCODE_EVT_SUCCESS_INSERT_ITEM 20
+#define OPCODE_EVT_DEVICE_PRESENCE 21
+#define OPCODE_EVT_KEY_LINE 22
+#define OPCODE_EVT_SUCCESS_DELETE_ITEM 23
+#define OPCODE_EVT_BT_BONDING_RESULT 24
+#define OPCODE_EVT_BT_KEY_SHORTPRESS 25
+#define OPCODE_EVT_BT_KEY_LONGPRESS 26
+#define OPCODE_EVT_BT_KEY_VERYLONGPRESS 27
+#define OPCODE_EVT_LOCAL_APPLICATION 28
+#define OPCODE_EVT_WARNING_CREATE 29
+#define OPCODE_EVT_WARNING_SET_PROPERTY 30
+#define OPCODE_EVT_ARP_SPOOFING 31
+#define OPCODE_EVT_CHAR_NOT_FOUND 32
+#define OPCODE_EVT_CHAR_BAD_LENGTH 33
+#define OPCODE_EVT_QOS_TICKET 34
+#define OPCODE_EVT_UA3_ERROR 35
+#define OPCODE_EVT_TABBOX 128
+#define OPCODE_EVT_LISTBOX 129
+#define OPCODE_EVT_LISTBOX_FIRST 130
+#define OPCODE_EVT_LISTBOX_LAST 131
+#define OPCODE_EVT_ACTIONLISTBOX 132
+#define OPCODE_EVT_ACTIONBOX 133
+#define OPCODE_EVT_INPUTBOX 134
+#define OPCODE_EVT_INPUTBOX_FOCUS_LOST 135
+#define OPCODE_EVT_CHECKBOX 136
+#define OPCODE_EVT_TIMERBOX 137
+#define OPCODE_EVT_POPUPBOX_TIMEOUT 138
+#define OPCODE_EVT_DIALOGBOX 139
+#define OPCODE_EVT_SLIDERBAR 140
+#define OPCODE_EVT_PROGRESSBAR 141
+#define OPCODE_EVT_AOMVBOX 142
+#define OPCODE_EVT_TELEPHONICBOX_FOCUS 143
+#define OPCODE_EVT_AOM_INSERTED 144
+#define OPCODE_EVT_AOM_REMOVED 145
+#define OPCODE_EVT_AOM_KEY_PRESS 146
+#define OPCODE_EVT_IDLETIMER 147
+#define OPCODE_EVT_GET_PROPERTY_RESULT 148
+#define OPCODE_EVT_AOM_KEY_RELEASE 149
+#define OPCODE_EVT_POPUPBOX_DISMISSED 150
+#define OPCODE_EVT_DIALOGBOX_TIMEOUT 151
+#define OPCODE_EVT_DIALOGBOX_DISMISSED 152
+#define OPCODE_EVT_BT_BONDED_DEVICE 153
+#define OPCODE_EVT_BT_INQUIRY_RESULT 154
+#define OPCODE_EVT_BT_NAME_DISCOVERY 155
+#define OPCODE_EVT_IME_REMOTEOPEN 156
+#define OPCODE_EVT_BT_BATTERY 158
+#define OPCODE_EVT_IME_LIST 159
+#define OPCODE_EVT_IME_CHANGE 160
+#define OPCODE_EVT_IME_OPEN 161
+#define OPCODE_EVT_TELEPHONICBOX_EVENT 162
+#define OPCODE_EVT_ACTLISTBOX_TIMEOUT 163
+#define OPCODE_EVT_ACTLISTBOX_DISMISSED 164
+#define OPCODE_EVT_ADTTS_RESPONSE 165
+#define OPCODE_EVT_AP_MAC 166
+
+static const value_string val_str_event[] = {
+  {OPCODE_EVT_CONTEXT_SWITCH, "EVT_CONTEXT_SWITCH"},
+  {OPCODE_EVT_RESET, "EVT_RESET"},
+  {OPCODE_EVT_KEY_PRESS, "EVT_KEY_PRESS"},
+  {OPCODE_EVT_KEY_RELEASE, "EVT_KEY_RELEASE"},
+  {OPCODE_EVT_KEY_SHORTPRESS, "EVT_KEY_SHORTPRESS"},
+  {OPCODE_EVT_KEY_LONGPRESS, "EVT_KEY_LONGPRESS"},
+  {OPCODE_EVT_ONHOOK, "EVT_ONHOOK"},
+  {OPCODE_EVT_OFFHOOK, "EVT_OFFHOOK"},
+  {OPCODE_EVT_HELP, "EVT_HELP"},
+  {OPCODE_EVT_WIDGETS_GC, "EVT_WIDGETS_GC"},
+  {OPCODE_EVT_ERROR_PROTOCOL, "EVT_ERROR_PROTOCOL"},
+  {OPCODE_EVT_ERROR_CREATE, "EVT_ERROR_CREATE"},
+  {OPCODE_EVT_ERROR_DELETE, "EVT_ERROR_DELETE"},
+  {OPCODE_EVT_ERROR_SET_PROPERTY, "EVT_ERROR_SET_PROPERTY"},
+  {OPCODE_EVT_ERROR_GET_PROPERTY, "EVT_ERROR_GET_PROPERTY"},
+  {OPCODE_EVT_SUCCESS_CREATE, "EVT_SUCCESS_CREATE"},
+  {OPCODE_EVT_SUCCESS_DELETE, "EVT_SUCCESS_DELETE"},
+  {OPCODE_EVT_SUCCESS_SET_PROPERTY, "EVT_SUCCESS_SET_PROPERTY"},
+  {OPCODE_EVT_ERROR_INSERT_ITEM, "EVT_ERROR_INSERT_ITEM"},
+  {OPCODE_EVT_ERROR_DELETE_ITEM, "EVT_ERROR_DELETE_ITEM"},
+  {OPCODE_EVT_SUCCESS_INSERT_ITEM, "EVT_SUCCESS_INSERT_ITEM"},
+  {OPCODE_EVT_DEVICE_PRESENCE, "EVT_DEVICE_PRESENCE"},
+  {OPCODE_EVT_KEY_LINE, "EVT_KEY_LINE"},
+  {OPCODE_EVT_SUCCESS_DELETE_ITEM, "EVT_SUCCESS_DELETE_ITEM"},
+  {OPCODE_EVT_BT_BONDING_RESULT, "EVT_BT_BONDING_RESULT"},
+  {OPCODE_EVT_BT_KEY_SHORTPRESS, "EVT_BT_KEY_SHORTPRESS"},
+  {OPCODE_EVT_BT_KEY_LONGPRESS, "EVT_BT_KEY_LONGPRESS"},
+  {OPCODE_EVT_BT_KEY_VERYLONGPRESS, "EVT_BT_KEY_VERYLONGPRESS"},
+  {OPCODE_EVT_LOCAL_APPLICATION, "EVT_LOCAL_APPLICATION"},
+  {OPCODE_EVT_WARNING_CREATE, "EVT_WARNING_CREATE"},
+  {OPCODE_EVT_WARNING_SET_PROPERTY, "EVT_WARNING_SET_PROPERTY"},
+  {OPCODE_EVT_ARP_SPOOFING, "EVT_ARP_SPOOFING"},
+  {OPCODE_EVT_CHAR_NOT_FOUND, "EVT_CHAR_NOT_FOUND"},
+  {OPCODE_EVT_QOS_TICKET, "EVT_QOS_TICKET"},
+  {OPCODE_EVT_UA3_ERROR, "EVT_UA3_ERROR"},
+  {OPCODE_EVT_TABBOX, "EVT_TABBOX"},
+  {OPCODE_EVT_LISTBOX, "EVT_LISTBOX"},
+  {OPCODE_EVT_LISTBOX_FIRST, "EVT_LISTBOX_FIRST"},
+  {OPCODE_EVT_LISTBOX_LAST, "EVT_LISTBOX_LAST"},
+  {OPCODE_EVT_ACTIONLISTBOX, "EVT_ACTIONLISTBOX"},
+  {OPCODE_EVT_ACTIONBOX, "EVT_ACTIONBOX"},
+  {OPCODE_EVT_INPUTBOX, "EVT_INPUTBOX"},
+  {OPCODE_EVT_INPUTBOX_FOCUS_LOST, "EVT_INPUTBOX_FOCUS_LOST"},
+  {OPCODE_EVT_CHECKBOX, "EVT_CHECKBOX"},
+  {OPCODE_EVT_TIMERBOX, "EVT_TIMERBOX"},
+  {OPCODE_EVT_POPUPBOX_TIMEOUT, "EVT_POPUPBOX_TIMEOUT"},
+  {OPCODE_EVT_DIALOGBOX, "EVT_DIALOGBOX"},
+  {OPCODE_EVT_SLIDERBAR, "EVT_SLIDERBAR"},
+  {OPCODE_EVT_PROGRESSBAR, "EVT_PROGRESSBAR"},
+  {OPCODE_EVT_AOMVBOX, "EVT_AOMVBOX"},
+  {OPCODE_EVT_TELEPHONICBOX_FOCUS, "EVT_TELEPHONICBOX_FOCUS"},
+  {OPCODE_EVT_AOM_INSERTED, "EVT_AOM_INSERTED"},
+  {OPCODE_EVT_AOM_REMOVED, "EVT_AOM_REMOVED"},
+  {OPCODE_EVT_AOM_KEY_PRESS, "EVT_AOM_KEY_PRESS"},
+  {OPCODE_EVT_IDLETIMER, "EVT_IDLETIMER"},
+  {OPCODE_EVT_GET_PROPERTY_RESULT, "EVT_GET_PROPERTY_RESULT"},
+  {OPCODE_EVT_AOM_KEY_RELEASE, "EVT_AOM_KEY_RELEASE"},
+  {OPCODE_EVT_POPUPBOX_DISMISSED, "EVT_POPUPBOX_DISMISSED"},
+  {OPCODE_EVT_DIALOGBOX_TIMEOUT, "EVT_DIALOGBOX_TIMEOUT"},
+  {OPCODE_EVT_DIALOGBOX_DISMISSED, "EVT_DIALOGBOX_DISMISSED"},
+  {OPCODE_EVT_BT_BONDED_DEVICE, "EVT_BT_BONDED_DEVICE"},
+  {OPCODE_EVT_BT_INQUIRY_RESULT, "EVT_BT_INQUIRY_RESULT"},
+  {OPCODE_EVT_BT_NAME_DISCOVERY, "EVT_BT_NAME_DISCOVERY"},
+  {OPCODE_EVT_IME_REMOTEOPEN, "EVT_IME_REMOTEOPEN"},
+  {OPCODE_EVT_BT_BATTERY, "EVT_BT_BATTERY"},
+  {OPCODE_EVT_IME_LIST, "EVT_IME_LIST"},
+  {OPCODE_EVT_IME_CHANGE, "EVT_IME_CHANGE"},
+  {OPCODE_EVT_IME_OPEN, "EVT_IME_OPEN"},
+  {OPCODE_EVT_TELEPHONICBOX_EVENT, "EVT_TELEPHONICBOX_EVENT"},
+  {OPCODE_EVT_ACTLISTBOX_TIMEOUT, "EVT_ACTLISTBOX_TIMEOUT"},
+  {OPCODE_EVT_ACTLISTBOX_DISMISSED, "EVT_ACTLISTBOX_DISMISSED"}
+};
+
+#define P_BASIC         0
+#define P_ARRAY         128
+#define P_INVALID       255
+#define P_INVALID_INDEX 255
+
+#define C_STATIC    0
+#define C_DYNAMIC   128
+#define C_INVALID   255
+
+#define E_INVALID   255
+
+
+/*-----------------------------------------------------------------------------
+  globals
+  ---------------------------------------------------------------------------*/
+static int  proto_noe                  = -1;
+static gint ett_noe                            = -1;
+static gint ett_body                   = -1;
+static gint ett_property               = -1;
+static gint ett_value                  = -1;
+static int  hf_noe_length              = -1;
+static int  hf_noe_server              = -1;
+static int  hf_noe_method_ack  = -1;
+static int  hf_noe_method              = -1;
+static int  hf_noe_class               = -1;
+static int  hf_noe_event               = -1;
+static int  hf_noe_objectid            = -1;
+static int  hf_noe_method_index        = -1;
+static int  hf_noe_pcode               = -1;
+static int  hf_noe_aindx               = -1;
+static int  hf_noe_psize               = -1;
+
+static const value_string servers_vals[] = {
+       {0x15,  "Call Server"                   },
+       {0x16,  "Presentation Server"   },
+       {0, NULL}
+};
+static const value_string servers_short_vals[] = {
+       {0x15,  "CS"},
+       {0x16,  "PS"},
+       {0, NULL}
+};
+enum
+{
+    METHOD_CREATE              = 0x00,
+    METHOD_DELETE              = 0x01,
+    METHOD_SET_PROPERTY        = 0x02,
+    METHOD_GET_PROPERTY        = 0x03,
+    METHOD_NOTIFY              = 0x04,
+    METHOD_DELETE_ITEM = 0x05,
+    METHOD_INSERT_ITEM = 0x06,
+    METHOD_INVALID
+};
+static const value_string methods_vals[] = {
+       {METHOD_CREATE,                 "Create"                },
+       {METHOD_DELETE,                 "Delete"                },
+       {METHOD_SET_PROPERTY,   "SetProperty"   },
+       {METHOD_GET_PROPERTY,   "GetProperty"   },
+       {METHOD_NOTIFY,                 "Notify"                },
+       {METHOD_DELETE_ITEM,    "DeleteItem"    },
+       {METHOD_INSERT_ITEM,    "InsertItem"    },
+       {0, NULL}
+};
+
+
+#define ERROR_INVALID_METHOD           0
+#define ERROR_UNKNOWN_CLASS                    1
+#define ERROR_STATIC_CLASS                     2
+#define ERROR_DUPLICATE_OBJECTID       3
+#define ERROR_UNKNOWN_PROPERTY_                4
+#define ERROR_BAD_INDEX                                5
+#define ERROR_BAD_LENGTH__                     6
+#define ERROR_REQUIRED_MISSING         7
+#define ERROR_BAD_VALUE                                8
+#define ERROR_READONLY_PROPERTY                9
+#define ERROR_UNKNOWN_OBJECTID         10
+#define ERROR_INVALID_CONTAINER                11
+#define ERROR_PROPERTY_VMIN                    12
+#define ERROR_PROPERTY_VMAX                    13
+#define ERROR_POSITIVE_ACK                     14
+#define ERROR_NOT_IMPLEMENTED          15
+#define ERROR_INVALID_CLASS                    16
+#define ERROR_INVALID_PROPERTY         17
+#define ERROR_BAD_UTF8                         18
+
+#define ERROR_MESSAGE_DROP                     128
+#define ERROR_MAX_SET_PROPERTY         129
+#define ERROR_INTERNAL                         130
+
+
+static const value_string errcode_vals[] = {
+       {ERROR_INVALID_METHOD           , "An invalid method opcode was received"                                                                                       },
+       {ERROR_UNKNOWN_CLASS            , "An invalid class opcode was received"                                                                                        },
+       {ERROR_STATIC_CLASS                     , "Trying to create or delete a static class"                                                                           },
+       {ERROR_DUPLICATE_OBJECTID       , "Trying to create an existing object"                                                                                         },
+       {ERROR_UNKNOWN_PROPERTY_        , "Property opcode doesn\92t exist in specified class"                                                            },
+       {ERROR_BAD_INDEX                        , "Bad property index (array overflow)"                                                                                         },
+       {ERROR_BAD_LENGTH__                     , "Short message or bad property length"                                                                                        },
+       {ERROR_REQUIRED_MISSING         , "A required property was not specified in create method"                                                      },
+       {ERROR_BAD_VALUE                        , "Bad property value"                                                                                                                          },
+       {ERROR_READONLY_PROPERTY        , "Trying to set a read-only property"                                                                                          },
+       {ERROR_UNKNOWN_OBJECTID         , "The specified object doesn\92t exist (delete, setProperty or getProperty methods)"     },
+       {ERROR_INVALID_CONTAINER        , "Invalid container"                                                                                                                           },
+       {ERROR_PROPERTY_VMIN            , "Property value < property minimum value"                                                                                     },
+       {ERROR_PROPERTY_VMAX            , "Property value > property maximum value"                                                                                     },
+       {ERROR_POSITIVE_ACK                     , "Positive ack requested with a getProperty method"                                                            },
+       {ERROR_NOT_IMPLEMENTED          , "The specified property is not implemented"                                                                           },
+       {ERROR_INVALID_CLASS            , "Invalid class specified with insertItem and deleteItem"                                                      },
+       {ERROR_INVALID_PROPERTY         , "Invalid property specified with insertItem and deleteItem"                                           },
+       {ERROR_BAD_UTF8                         , "Invalid UTF8 value in UA message"                                                                                            },
+       {ERROR_MESSAGE_DROP                     , "Decoder queue is full"                                                                                                                       },
+       {ERROR_MAX_SET_PROPERTY         , "A maximum of 256 properties can be received in a setProperty method"                         },
+       {ERROR_INTERNAL                         , "Internal error"                                                                                                                                      },
+       {0, NULL}
+};
+
+static const value_string str_key_name[] = {
+       {0x00   , "Null Char."                          },
+       {0x01   , "Start Of Header"                     },
+       {0x02   , "Start Of Text"                       },
+       {0x03   , "End Of Text"                         },
+       {0x04   , "End Of Transmission"         },
+       {0x05   , "Enquiry"                                     },
+       {0x06   , "Acknowledgment"                      },
+       {0x07   , "Bell"                                        },
+       {0x08   , "Backspace"                           },
+       {0x09   , "Horizontal Tab"                      },
+       {0x0A   , "Line Feed"                           },
+       {0x0B   , "Vertical Tab"                        },
+       {0x0C   , "Form Feed"                           },
+       {0x0D   , "Enter"                                       },
+       {0x0E   , "Shift Out"                           },
+       {0x0F   , "Shift In"                            },
+       {0x10   , "Data Link Escape"            },
+       {0x11   , "Device Control 1"            },
+       {0x12   , "Device Control 2"            },
+       {0x13   , "Device Control 3"            },
+       {0x14   , "Device Control 4"            },
+       {0x15   , "Negative Acknowledgment"     },
+       {0x16   , "Synchronous Idle"            },
+       {0x17   , "End Of Trans. Block"         },
+       {0x18   , "Cancel"                                      },
+       {0x19   , "End Of Medium"                       },
+       {0x1A   , "Substitute"                          },
+       {0x1B   , "Escape"                                      },
+       {0x1C   , "File Separator"                      },
+       {0x1D   , "Group Separator"                     },
+       {0x1E   , "Request To Send"                     },
+       {0x1F   , "Unit Separator"                      },
+       {0x20   , "Space"                                       },
+       {0x7F   , "Delete"                                      },
+       {0xE0   , "a`"                                          },
+       {0xE7   , "c,"                                          },
+       {0xE8   , "e`"                                          },
+       {0xE9   , "e'"                                          },
+       {0xF9   , "u`"                                          },
+       {0x20AC , "Euro Character"                      },
+       {0xE100 , "Release"                                     },
+       {0xE101 , "Bis"                                         },
+       {0xE102 , "Message"                                     },
+       {0xE103 , "Handsfree"                           },
+       {0xE104 , "Mute"                                        },
+       {0xE105 , "Volume Dec"                          },
+       {0xE106 , "Volume Inc"                          },
+       {0xE107 , "Hookswitch"                          },
+       {0xE110 , "Ok"                                          },
+       {0xE111 , "Left"                                        },
+       {0xE112 , "Right"                                       },
+       {0xE113 , "Down"                                        },
+       {0xE114 , "Up"                                          },
+       {0xE115 , "Home"                                        },
+       {0xE116 , "Help"                                        },
+       {0xE117 , "Directory"                           },
+       {0xE120 , "ProgKey 0"                           },
+       {0xE121 , "ProgKey 1"                           },
+       {0xE122 , "ProgKey 2"                           },
+       {0xE123 , "ProgKey 3"                           },
+       {0xE124 , "ProgKey 4"                           },
+       {0xE125 , "ProgKey 5"                           },
+       {0xE130 , "SoftKey 0"                           },
+       {0xE131 , "SoftKey 1"                           },
+       {0xE132 , "SoftKey 2"                           },
+       {0xE133 , "SoftKey 3"                           },
+       {0xE134 , "SoftKey 4"                           },
+       {0xE135 , "SoftKey 5"                           },
+       {0xE136 , "SoftKey 6"                           },
+       {0xE137 , "SoftKey 7"                           },
+       {0xE138 , "SoftKey 8"                           },
+       {0xE139 , "SoftKey 9"                           },
+       {0, NULL}
+};
+
+
+/*-----------------------------------------------------------------------------
+       DECODE UTF8 TO UNICODE
+       This function translates an UTF8 vale to an UNICODE one.
+       Need to have at least 48 bits value.
+       ---------------------------------------------------------------------------*/
+static guint64 decode_utf8(guint64 utf8)
+{
+       static guint64 unicode;
+
+       if(utf8 <= 0xFF)
+       {
+               unicode =
+                       utf8 & 0x7F;
+       }
+       else if(utf8 <= 0xFFFF)
+       {
+               unicode =
+                       ((utf8 & 0x1F00) >> 2) +
+                       (utf8 & 0x3F);
+       }
+       else if(utf8 <= 0xFFFFFF)
+       {
+               unicode =
+                       ((utf8 & 0x0F0000) >> 4) +
+                       ((utf8 & 0x3F00) >> 2) +
+                       (utf8 & 0x3F);
+       }
+       else if(utf8 <= 0xFFFFFFFF)
+       {
+               unicode =
+                       ((utf8 & 0x07000000) >> 6) +
+                       ((utf8 & 0x3F0000) >> 4) +
+                       ((utf8 & 0x3F00) >> 2) +
+                       (utf8 & 0x3F);
+       }
+       else if(utf8 <= 0xFFFFFFFFFF)
+       {
+               unicode =
+                       ((utf8 & 0x0300000000) >> 8) +
+                       ((utf8 & 0x3F000000) >> 6) +
+                       ((utf8 & 0x3F0000) >> 4) +
+                       ((utf8 & 0x3F00) >> 2) +
+                       (utf8 & 0x3F);
+       }
+       else if(utf8 <= 0xFFFFFFFFFFFF)
+       {
+               unicode =
+                       ((utf8 & 0x010000000000) >> 10) +
+                       ((utf8 & 0x3F00000000) >> 8) +
+                       ((utf8 & 0x3F000000) >> 6) +
+                       ((utf8 & 0x3F0000) >> 4) +
+                       ((utf8 & 0x3F00) >> 2) +
+                       (utf8 & 0x3F);
+       }
+       else
+       {
+               unicode = 0;
+       }
+       return unicode;
+} 
+
+
+/*-----------------------------------------------------------------------------
+       DECODE KEY NAME
+       This function translates an UNICODE to the name associated.
+       Need to have at least 48 bits value.
+       ---------------------------------------------------------------------------*/
+static char *decode_key_name(int unicode)
+{
+       static char key_name[10];
+
+       if((unicode <= 0x20)
+               || (unicode == 0x7F)
+               || (unicode == 0xE0)
+               || (unicode == 0xE7)
+               || (unicode == 0xE8)
+               || (unicode == 0xE9)
+               || (unicode == 0xF9))
+       {
+               g_snprintf(key_name, 10, "%s", val_to_str(unicode, str_key_name, "Unknown"));
+       }
+       else if(unicode <= 0xFF)
+       {
+               g_snprintf(key_name, 10, "%c", unicode);
+       }
+       else
+       {
+               g_snprintf(key_name, 10, "%s", val_to_str(unicode, str_key_name, "Unknown"));
+       }
+       return key_name;
+} 
+
+
+/*-----------------------------------------------------------------------------
+       DECODE EVT ERROR
+       ---------------------------------------------------------------------------*/
+static void
+decode_evt_error(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
+{
+       guint8  method, class, index, property;
+       guint16 objectid, errcode, Psize;
+       guint32 Pdata;
+
+       errcode = tvb_get_ntohs (tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               2,
+               "ErrCode : %s (%d)",
+               val_to_str(errcode, VALS(errcode_vals), "Unknown"),
+               errcode);
+       offset += 2;
+       length -= 2;
+
+       method = tvb_get_guint8(tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               1,
+               "Method  : %s (%d)",
+               val_to_str(method, VALS(methods_vals), "Unknown"),
+               method);
+       offset ++;
+       length --;
+
+       class = tvb_get_guint8(tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               1,
+               "Class   : %s (%d)",
+               val_to_str(class, val_str_class, "Unknown"),
+               class);
+       offset ++;
+       length --;
+
+       objectid = tvb_get_ntohs (tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               2,
+               "Objectid: %04xh (%d)",
+               objectid,
+               objectid);
+       offset += 2;
+       length -= 2;
+
+       property = tvb_get_guint8(tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               1,
+               "Property   : %s (%d)",
+               val_to_str(property, val_str_props, "Unknown"),
+               property);
+       offset ++;
+       length --;
+
+       index = tvb_get_guint8(tvb, offset);
+               proto_tree_add_text(tree,
+               tvb,
+               offset,
+               1,
+               "Index   : %d",
+               index);
+       offset ++;
+       length --;
+
+       Psize = tvb_get_ntohs (tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               2,
+               "Length   : %d",
+               Psize);
+       offset += 2;
+       length -= 2;
+
+       Pdata = tvb_get_ntohl (tvb, offset);
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               4,
+               "Value   : %x",
+               Pdata);
+       offset += 4;
+       length -= 4;
+
+       proto_tree_add_text(tree,
+               tvb,
+               offset,
+               length,
+               "Message : %s",
+               tvb_bytes_to_str(tvb, offset, length));
+}
+
+
+/*-----------------------------------------------------------------------------
+       MESSAGE BODY DECODER
+       This function decodes the message body of an 0x15 (and 0x16) UA3G message.
+       ---------------------------------------------------------------------------*/
+static void decode_tlv(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
+{
+       proto_item *property_item, *value_item;
+       proto_tree *property_tree, *value_tree;
+       guint8 property_type;
+       guint16 property_length, property_value_index;
+       guint64 property_index = 0;
+
+       /* add text to the frame tree */
+       property_item = proto_tree_add_text(tree,
+               tvb,
+               offset,
+               length,
+               "NOE Message Body");
+       property_tree = proto_item_add_subtree(property_item, ett_body);
+
+       while(length > 0)
+       {
+               property_type = tvb_get_guint8(tvb, offset);
+
+               proto_tree_add_text(property_item,
+                       tvb,
+                       offset,
+                       1,
+                       "Property Opcode: %s (0x%02x)",
+                       val_to_str(property_type, val_str_props, "Unknown"),
+                       property_type);
+               offset++;
+               length--;
+
+               if(property_type >= P_ARRAY)
+               {
+                       proto_tree_add_text(property_item,
+                               tvb,
+                               offset,
+                               1,
+                               "Index          : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+               }
+
+               property_length = tvb_get_guint8(tvb, offset);
+               if(property_length & 0x80)
+               {
+                       property_length = tvb_get_ntohs(tvb, offset);
+                       property_length &= 0x7fff;
+                       proto_tree_add_text(property_item,
+                               tvb,
+                               offset,
+                               2,
+                               "Length         : %d",
+                               tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1));
+                       offset += 2;
+                       length -= 2;
+               }
+               else
+               {
+                       proto_tree_add_text(property_item,
+                               tvb,
+                               offset,
+                               1,
+                               "Length         : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+               }
+               
+               switch(property_length)
+               {
+               case 0:
+                       {
+                               break;
+                       }
+               case 1:
+                       {
+                               proto_tree_add_text(property_item,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Value          : %d",
+                                       tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                               break;
+                       }
+               case 2:
+                       {
+                               guint16 property_value;
+                               property_value = tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1);
+                               proto_tree_add_text(property_item,
+                                       tvb,
+                                       offset,
+                                       2,
+                                       "Value          : %d",
+                                       property_value);
+                               offset += 2;
+                               length -= 2;
+                               break;
+                       }
+               case 3:
+                       {
+                               guint64 property_value;
+                               property_value = tvb_get_guint8(tvb, offset) * 65536 +
+                                       tvb_get_guint8(tvb, offset + 1) * 256 +
+                                       tvb_get_guint8(tvb, offset + 2);
+                               proto_tree_add_text(property_item,
+                                       tvb,
+                                       offset,
+                                       3,
+                                       "Value          : %llu",
+                                       property_value);
+                               offset += 3;
+                               length -= 3;
+                               break;
+                       }
+               case 4:
+                       {
+                               guint64 property_value;
+                               property_value = tvb_get_guint8(tvb, offset) * 16777216 +
+                                       tvb_get_guint8(tvb, offset + 1) * 65536 +
+                                       tvb_get_guint8(tvb, offset + 2) * 256 +
+                                       tvb_get_guint8(tvb, offset + 3);
+                               proto_tree_add_text(property_item,
+                                       tvb,
+                                       offset,
+                                       4,
+                                       "Value          : %llu",
+                                       property_value);
+                               offset += 4;
+                               length -= 4;
+                               break;
+                       }
+               default:
+                       {
+                               /* add text to the frame tree */
+                               value_item = proto_tree_add_text(property_tree,
+                                       tvb,
+                                       offset,
+                                       property_length,
+                                       "Value (> 4 bytes)");
+
+                               value_tree = proto_item_add_subtree(value_item, ett_value);
+
+                               property_value_index = 0;
+                               while(property_length > 0)
+                               {
+                                       property_value_index++;
+                                       proto_tree_add_text(value_item,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Value %5d: 0x%02x",
+                                               property_value_index, tvb_get_guint8(tvb, offset));
+                                       offset++;
+                                       length--;
+                                       property_length--;
+                               }
+                               break;
+                       }
+               }
+       }
+}
+
+
+
+/*-----------------------------------------------------------------------------
+       GETPROPERTY MESSAGE BODY DECODER
+       This function decodes the message body of an 0x15 (and 0x16) UA3G message.
+       ---------------------------------------------------------------------------*/
+static void decode_getproperty_tlv(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length)
+{
+       proto_item *body_item;
+       proto_tree *body_tree;
+       guint8 body_type;
+
+       /* add text to the frame tree */
+       body_item = proto_tree_add_text(tree,
+               tvb,
+               offset,
+               length,
+               "NOE Message Body");
+       body_tree = proto_item_add_subtree(body_item, ett_property);
+
+       while(length > 0)
+       {
+               body_type = tvb_get_guint8(tvb, offset);
+
+               proto_tree_add_text(body_item,
+                       tvb,
+                       offset,
+                       1,
+                       "Property Opcode: %s (0x%02x)",
+                       val_to_str(body_type, val_str_props, "Unknown"),
+                       body_type);
+               offset++;
+               length--;
+
+               if(body_type >= P_ARRAY)
+               {
+                       proto_tree_add_text(body_item,
+                               tvb,
+                               offset,
+                               1,
+                               "Index: %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+               }
+       }
+}
+
+
+
+/*-----------------------------------------------------------------------------
+       TERMINAL TO SERVER EVENT MESSAGE BODY DECODER
+       This function decodes the message body of an 0x15 (and 0x16) UA3G message.
+       ---------------------------------------------------------------------------*/
+static void decode_evt(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length)
+{
+       guint8 event = tvb_get_guint8(tvb, offset);
+
+       proto_tree_add_uint_format(tree,
+               hf_noe_event,
+               tvb,
+               offset,
+               1,
+               event,
+               "Event   : %s (%d)",
+               val_to_str(event, val_str_event, "Unknown"),
+               event);
+
+       /* add text to the frame "INFO" column */
+       if(check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
+               val_to_str(event, val_str_event, "Unknown"));
+       /* update text of the main proto item */
+       proto_item_append_text(tree, ", %s",
+               val_to_str(event, val_str_event, "Unknown"));
+
+       offset++;
+       length--;
+
+       switch(event)
+       {
+       case OPCODE_EVT_BT_KEY_SHORTPRESS:
+       case OPCODE_EVT_BT_KEY_LONGPRESS:
+       case OPCODE_EVT_BT_KEY_VERYLONGPRESS:
+       case OPCODE_EVT_KEY_LINE:
+       case OPCODE_EVT_ONHOOK:
+       case OPCODE_EVT_OFFHOOK:
+               {
+                       static const value_string str_struct[] = {
+                               {0x00, "RJ9 Plug"               },
+                               {0x01, "BT Handset Link"},
+                               {0, NULL}
+                               };
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               length,
+                               "Value   : %s (%d)",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_struct, "Unknown"), tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       case OPCODE_EVT_KEY_PRESS:
+       case OPCODE_EVT_KEY_RELEASE:
+       case OPCODE_EVT_KEY_SHORTPRESS:
+       case OPCODE_EVT_KEY_LONGPRESS:
+       case OPCODE_EVT_HELP:
+               {
+                       /* utf8_value is the utf8 value to translate into Unicode with the decode_uft8 function */
+                       guint64 utf8_value = 0;
+                       guint64 unicode_value;
+                       static char key_name[30];
+                       int pt_length = length;
+                       int pt_offset = offset;
+
+                       while(pt_length > 0)
+                       {
+                               utf8_value = (utf8_value << 8) + tvb_get_guint8(tvb, pt_offset);
+                               pt_offset ++;
+                               pt_length --;
+                       }
+                       unicode_value = decode_utf8(utf8_value);
+                       g_snprintf(key_name, 30, "\"%s\"", decode_key_name((int)unicode_value));
+
+                       /* add text to the frame "INFO" column */
+                       if(check_col(pinfo->cinfo, COL_INFO))
+                               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+                               key_name);
+                       /* update text of the main proto item */
+                       proto_item_append_text(tree, ", %s",
+                               key_name);
+
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               length,
+                               "Key Name: %s (UTF-8 Value: %s, Unicode Value: 0x%x)",
+                               key_name,
+                               tvb_bytes_to_str(tvb, offset, length),
+                               unicode_value);
+                       break;
+               }
+       case OPCODE_EVT_ERROR_PROTOCOL:
+       case OPCODE_EVT_ERROR_CREATE:
+       case OPCODE_EVT_ERROR_DELETE:
+       case OPCODE_EVT_ERROR_SET_PROPERTY:
+       case OPCODE_EVT_ERROR_GET_PROPERTY:
+               {
+                       decode_evt_error(tree, tvb, offset, length);
+                       break;
+               }
+       case OPCODE_EVT_CONTEXT_SWITCH:
+               {
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Context : %s",
+                               val_to_str(tvb_get_guint8(tvb, offset),
+                               VALS(servers_vals),
+                               "Unknown"));
+                       break;
+               }
+       case OPCODE_EVT_SUCCESS_CREATE:
+       case OPCODE_EVT_SUCCESS_DELETE:
+       case OPCODE_EVT_SUCCESS_SET_PROPERTY:
+       case OPCODE_EVT_SUCCESS_INSERT_ITEM:
+       case OPCODE_EVT_SUCCESS_DELETE_ITEM:
+               {
+                       proto_tree_add_uint(tree,
+                               hf_noe_objectid,
+                               tvb,
+                               offset,
+                               2,
+                               tvb_get_ntohs(tvb, offset));
+                       /* update text of the main proto item */
+                       proto_item_append_text(tree, ", Objectid: 0x%x",
+                               (guint) tvb_get_ntohs(tvb, offset));
+                       break;
+               }
+       case OPCODE_EVT_WIDGETS_GC:
+               {
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               4,
+                               "FreeMem : %d bytes",
+                               tvb_get_ntohl(tvb, offset));
+                       break;
+               }
+       case OPCODE_EVT_BT_BONDING_RESULT:
+               {
+                       proto_tree_add_uint(tree,
+                               hf_noe_objectid,
+                               tvb,
+                               offset,
+                               2,
+                               tvb_get_ntohs(tvb, offset));
+                       /* update text of the main proto item */
+                       proto_item_append_text(tree, ", Objectid: 0x%x",
+                               (guint) tvb_get_ntohs(tvb, offset));
+                       offset += 2;
+                       length -= 2;
+
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Bonded : %d",
+                               tvb_get_ntohs(tvb, offset));
+                       offset += 1;
+                       length -= 1;
+
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Value  : %d",
+                               tvb_get_ntohs(tvb, offset));
+                       break;
+               }
+       default:
+               {
+                       proto_tree_add_uint(tree,
+                               hf_noe_objectid,
+                               tvb,
+                               offset,
+                               2,
+                               tvb_get_ntohs(tvb, offset));
+                       /* update text of the main proto item */
+                       proto_item_append_text(tree, ", Objectid: 0x%x",
+                               (guint) tvb_get_ntohs(tvb, offset));
+                       offset += 2;
+                       length -= 2;
+
+                       if(length > 0)
+                               decode_tlv(tree, tvb, offset, length);
+                       break;
+               }
+       }
+}
+
+
+
+/*-----------------------------------------------------------------------------
+       METHOD DECODER
+       This function decodes the method of an 0x15 (and 0x16) UA3G message.
+       ---------------------------------------------------------------------------*/
+static void decode_mtd(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint8 method,
+                                          guint offset,
+                                          guint length)
+{
+       guint8 class = tvb_get_guint8(tvb, offset);
+
+       proto_tree_add_uint_format(tree,
+               hf_noe_class,
+               tvb,
+               offset,
+               1,
+               class,
+               "Class   : %s (%d)",
+               val_to_str(class, val_str_class, "Unknown"),
+               class);
+
+       /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
+               val_to_str(class, val_str_class, "Unknown"));
+       /* update text of the main proto item */
+       proto_item_append_text(tree, ", %s",
+               val_to_str(class, val_str_class, "Unknown"));
+
+       offset++;
+       length--;
+
+       if(class >= C_DYNAMIC)
+       {
+               proto_tree_add_uint(tree,
+                       hf_noe_objectid,
+                       tvb,
+                       offset,
+                       2,
+                       tvb_get_ntohs(tvb, offset));
+
+               /* update text of the main proto item */
+               proto_item_append_text(tree, ", Objectid: 0x%x",
+                       (guint) tvb_get_ntohs(tvb, offset));
+
+               offset += 2;
+               length -= 2;
+       }
+
+       switch(method)
+       {
+       case METHOD_INSERT_ITEM:
+               {
+                       proto_tree_add_uint(tree,
+                               hf_noe_method_index,
+                               tvb,
+                               offset,
+                               1,
+                               tvb_get_guint8(tvb, offset));
+                       offset += 1;
+                       length -= 1;
+                       if(length > 0)
+                               decode_tlv(tree, tvb, offset, length);
+                       break;
+               }
+       case METHOD_DELETE_ITEM:
+               {
+                       proto_tree_add_uint(tree,
+                               hf_noe_method_index,
+                               tvb,
+                               offset,
+                               1,
+                               tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       case METHOD_GET_PROPERTY:
+               {
+                       decode_getproperty_tlv(tree, tvb, offset, length);
+                       break;
+               }
+       default:
+               {
+                       if(length > 0)
+                               decode_tlv(tree, tvb, offset, length);
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+  NOE DISSECTOR
+  ---------------------------------------------------------------------------*/
+static void dissect_noe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       proto_item    *noe_item  = NULL;
+       proto_tree    *noe_tree  = NULL;
+       gint           length    = 0;
+       guint8         server    = 0;
+       gint           offset    = 0;
+       guint8         method    = 0xff;
+       guint8         methodack = 0;
+
+       (void)pinfo;
+
+       if(tree)
+       {
+               noe_item = proto_tree_add_item(tree, proto_noe, tvb, 0, -1, FALSE);
+               noe_tree = proto_item_add_subtree(noe_item, ett_noe);
+
+               length = tvb_get_letohs(tvb, offset);
+
+               proto_tree_add_uint(noe_tree,
+                       hf_noe_length,
+                       tvb,
+                       offset,
+                       2,
+                       length);
+               offset += 2;
+
+               server = tvb_get_guint8(tvb, offset);
+
+               /* add text to the frame "INFO" column */
+               if(check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, " - NOE Protocol (%s)",
+                       val_to_str(server, VALS(servers_short_vals), "Unknown"));
+               
+               proto_tree_add_uint(noe_tree,
+                       hf_noe_server,
+                       tvb,
+                       offset,
+                       1,
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               
+               /* update text of the main proto item */
+               proto_item_append_text(noe_item, ", %s",
+                       val_to_str(server, VALS(servers_short_vals), "Unknown"));
+
+               method    = tvb_get_guint8(tvb, offset);
+               methodack = (method & 0x80) ? 1 : 0;
+               method    = (method & 0x7f);
+
+               proto_tree_add_uint(noe_tree,
+                       hf_noe_method,
+                       tvb,
+                       offset,
+                       1,
+                       method);
+
+               if(method >= METHOD_INVALID)
+                       return;
+
+               /* add text to the frame "INFO" column */
+               if(check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+                       val_to_str(method, VALS(methods_vals), "Unknown"));
+
+               /* update text of the main proto item */
+               proto_item_append_text(noe_item, ", %s",
+                       val_to_str(method, VALS(methods_vals), "Unknown"));
+
+               if(method == METHOD_NOTIFY)
+               {
+                       offset++;
+                       length--;
+                       decode_evt(noe_tree, tvb, pinfo, offset, length);
+               }
+               else
+               /* Create, Delete, SetProperty, GetProperty, DeleteItem, InsertItem properties */
+               {
+                       proto_tree_add_boolean(noe_tree,
+                               hf_noe_method_ack,
+                               tvb,
+                               offset,
+                               1,
+                               methodack);
+                       offset++;
+                       length--;
+                       decode_mtd(noe_tree, tvb, pinfo, method, offset, length);
+               }
+       }
+}
+
+
+
+/*-----------------------------------------------------------------------------
+  DISSECTORS REGISTRATION FUNCTIONS
+  ---------------------------------------------------------------------------*/
+void proto_register_noe(void)
+{
+       static hf_register_info hf_noe[] =
+       {
+               { &hf_noe_length,
+               {
+                       "Length  ",
+                       "noe.length",
+                       FT_UINT16,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Method Length",
+                       HFILL
+               }
+               },  
+               { &hf_noe_server,
+               {
+                       "Server  ",
+                       "noe.server",
+                       FT_UINT8,
+                       BASE_HEX,
+                       VALS(servers_vals),
+                       0x0,
+                       "Method Opcode",
+                       HFILL
+               }
+               },  
+               { &hf_noe_method_ack,
+               {
+                       "Ack     ",
+                       "noe.method_ack",
+                       FT_BOOLEAN,
+                       BASE_NONE,
+                       NULL,
+                       0x0,
+                       "Method Acknowlege",
+                       HFILL
+               }
+               },
+               { &hf_noe_method,
+               {
+                       "Method  ",
+                       "noe.method",
+                       FT_UINT8,
+                       BASE_DEC,
+                       VALS(methods_vals),
+                       0x0,
+                       "Method Opcode",
+                       HFILL
+               }
+               },
+               { &hf_noe_class,
+               {
+                       "Class   ",
+                       "noe.class",
+                       FT_UINT8,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Class Opcode",
+                       HFILL
+               }
+               },
+               { &hf_noe_event,
+               {
+                       "Event   ",
+                       "noe.event",
+                       FT_UINT8,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Event Opcode",
+                       HFILL
+               }
+               },
+               { &hf_noe_objectid,
+               {
+                       "Objectid",
+                       "noe.objectid",
+                       FT_UINT16,
+                       BASE_HEX,
+                       NULL,
+                       0x0,
+                       "Object Identifier",
+                       HFILL
+               }
+               },
+               { &hf_noe_method_index,
+               {
+                       "ItemIndx",
+                       "noe.item_index",
+                       FT_UINT8,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Delete/Insert Index",
+                       HFILL
+               }
+               },
+               { &hf_noe_pcode,
+               {
+                       "Property",
+                       "noe.property",
+                       FT_UINT8,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Property Identifier",
+                       HFILL
+               }
+               },
+               { &hf_noe_aindx,
+               {
+                       "ArrIndex",
+                       "noe.array_index",
+                       FT_UINT8,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Array Index",
+                       HFILL
+               }
+               },
+               { &hf_noe_psize,
+               {
+                       "PropSize",
+                       "noe.property_size",
+                       FT_UINT16,
+                       BASE_DEC,
+                       NULL,
+                       0x0,
+                       "Property Size",
+                       HFILL
+               }
+               }
+       };
+
+       static gint *ett[] =
+       {
+               &ett_noe,
+               &ett_body,
+               &ett_property,
+               &ett_value,
+       };
+
+       /* NOE dissector registration */
+       proto_noe = proto_register_protocol("NOE Protocol", "NOE", "noe");
+
+       proto_register_field_array(proto_noe, hf_noe, array_length(hf_noe));
+
+       register_dissector("noe", dissect_noe, proto_noe);
+
+       /* Common subtree array registration */
+       proto_register_subtree_array(ett, array_length(ett));
+}
+
+
+
+void proto_reg_handoff_noe(void)
+{
+       dissector_handle_t handle_noe = find_dissector("noe");
+
+       /* hooking of UA on UAUDP */
+       register_dissector_table("ua.opcode",
+               "ua.opcode",
+               FT_UINT8,
+               BASE_HEX);
+
+       dissector_add("ua.opcode", 0x15, handle_noe);
+}
index e88cd8212d455a7117beea9381063f0f3ce97496..c05e58d8b52eae61d56dbf4fdc3223cc978190ea 100644 (file)
 /* packet-ua.c
-* Routines for UA (Universal Alcatel) packet dissection.
-* Copyright 2011, Marek Tews <marek@trx.com.pl>
-*
-* $Id$
-*
-* Wireshark - Network traffic analyzer
-* By Gerald Combs <gerald@wireshark.org>
-* Copyright 1998 Gerald Combs
-*
-* Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
-* is a dissector file; if you just copied this from README.developer,
-* don't bother with the "Copied from" - you don't even need to put
-* in a "Copied from" if you copied an existing dissector, especially
-* if the bulk of the code in the new dissector is your code)
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ * Routines for UA/UDP (Universal Alcatel over UDP) packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
+ *
+ * $Id: 
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-#include <epan/packet.h>
-
-static void DissectNOE(tvbuff_t *pTvb, proto_tree *pRootUA);
-static void DissectNOE_type(tvbuff_t *pTvb, proto_tree *pNoeItem);
-static void DissectNOE_voicemode(tvbuff_t *pTvb, proto_tree *pNoeItem);
-static void DissectNOE_callserver(tvbuff_t *pTvb, proto_tree *pNoeItem);
-static void DissectNOE_ip(tvbuff_t *pTvb, proto_tree *pNoeItem);
-static void DissectNOE_ip_startrtp(tvbuff_t *pTvb, proto_tree *pNoeItem);
-static void DissectNOE_ip_startrtp_properties(tvbuff_t *pTvb, proto_tree *pNoeItem);
-
-static void DissectTLV(tvbuff_t *pTvb, proto_tree *pNoeItem, gboolean bIsArrIndex);
-static void DissectTLV_data(tvbuff_t *pTvb, proto_tree *pTlv, guint8 u8Property);
-
-/*
-* Here are the global variables associated with
-* the various user definable characteristics of the dissection
-*/
-
-/* Define the UA proto */
-static int proto_ua = -1;
-
-/* Define many header fields for UA (Universal Alcatel Protocol) */
-static int hf_noe = -1;
-static int hf_noe_length = -1;
-static int hf_noe_type = -1;
-static int hf_noe_method = -1;
-static int hf_noe_class = -1;
-static int hf_noe_objid = -1;
-static int hf_noe_event = -1;
-static int hf_noe_keychar = -1;
-static int hf_noe_action = -1;
-static int hf_noe_reserved = -1;
-static int hf_noe_property = -1;
-static int hf_noe_id = -1;
-static int hf_noe_size = -1;
-static int hf_noe_local_port = -1;
-static int hf_noe_remote_ip = -1;
-static int hf_noe_remote_port = -1;
-static int hf_noe_data = -1;
-static int hf_noe_compressor = -1;
-static int hf_noe_typeofservice = -1;
-static int hf_noe_payloadconcat = -1;
-static int hf_noe_voicemode = -1;
-
-static int hf_tlv = -1;
-static int hf_tlv_property = -1;
-static int hf_tlv_arrindex = -1;
-static int hf_tlv_propsize = -1;
-static int hf_tlv_label = -1;
-static int hf_tlv_data = -1;
-static int hf_tlv_year = -1;
-static int hf_tlv_number = -1;
-
-/* Define the trees for UA (Universal Alcatel Protocol) */
-static int ett_ua = -1;
-
-static int ett_noe = -1;
-static int ett_noe_property = -1;
-
-static int ett_tlv = -1;
-static int ett_tlv_sub = -1;
-
-
-/************************************************************
-* Value Strings
-************************************************************/
-
-/**
-* NOE
-*/
-static const value_string szNoeType[] =
-{
-    { 0x00, "Unknown" },
-    { 0x01, "HandsetOffHook" },
-    { 0x02, "HandsetOnHook" },
-    { 0x03, "DigitDialed" },
-    { 0x13, "IP" },
-    { 0x15, "CallServer" },
-    { 0x20, "KeyPushed" },
-    { 0x21, "LedCmd" },
-    { 0x27, "WriteLine1" },
-    { 0x28, "WriteLine2" },
-    { 0x29, "VoiceMode" },
-    { 0x31, "SetClockComd" },
-    { 0x35, "CursorBlink" },
-    { 0x38, "ClockTimerPosition" },
-    { 0x3a, "Error_0x3a" },
-    { 0x3d, "SideTone" },
-    { 0x3f, "Mute" },
-    { 0x46, "AllIconsOff" },
-    { 0x47, "IconsCmd" },
-    { 0x48, "AmplifiedHandset" },
-    { 0x49, "DPIConfiguration" },
-    { 0x4a, "AudioPaddedPath" },
-    { 0x4f, "Error_0x4f" },
-    { 0, NULL }
-};
-
-static const value_string szCallServerMethod[] =
-{
-    { 0x00, "Create" },
-    { 0x01, "Delete" },
-    { 0x02, "SetProperty" },
-    { 0x04, "Notify" },
-    { 0, NULL }
-};
-
-static const value_string szCallServerClass[] =
-{
-    { 1,   "Terminal" },
-    { 5,   "Leds" },
-    { 6,   "Screen" },
-    { 7,   "Date" },
-    { 8,   "AOMV" },
-    { 12,  "CallState" },
-    { 128, "FrameBox" },
-    { 129, "TabBox" },
-    { 130, "ListBox" },
-    { 132, "TextBox" },
-    { 133, "ActionBox" },
-    { 136, "DataBox" },
-    { 137, "TimerBox" },
-    { 144, "AOMVBox" },
-    { 145, "TelephonicBox" },
-    { 146, "KeyboardContext" },
-    { 151, "TelephonicBoxItem" },
-    { 158, "HeaderBox" },
-    { 0, NULL }
-};
-
-static const value_string szCallServerEvent[] =
-{
-    { 2,   "KeyPress" },
-    { 4,   "KeyShortPress" },
-    { 6,   "OnHook" },
-    { 7,   "OffHook" },
-    { 128, "TabBox" },
-    { 133, "ActionBox" },
-    { 152, "DialogBoxDismissed" },
-    { 0, NULL }
-};
-
-static const value_string szStartRtpPropID[] =
-{
-    { 0x00, "LocalUDPPort" },
-    { 0x01, "RemoteIP" },
-    { 0x02, "RemoteUDPPort" },
-    { 0x03, "TypeOfService" },
-    { 0x04, "Payload" },
-    { 0x05, "PayloadConcatenation" }, /* in ms */
-    { 0x06, "EchoCancelationEnabler" },
-    { 0x07, "SilenceCompression" },
-    { 0x08, "_802_1QUserPriority" },
-    { 0x0A, "PostFiltering" },
-    { 0x0B, "HighPassFilter" },
-    { 0, NULL }
-};
-
-static const value_string szStartRtpPayload[] =
-{
-    { 0,    "G.711 A-law" },
-    { 1,    "G.711 mu-law" },
-    { 2,    "G.723.1 5.3 kbps" },
-    { 3,    "G.723.1 6.3 kbps" },
-    { 0x11, "G.729A 8kbps"},
-    { 0, NULL }
-};
-
-static const value_string szNoeAction[] =
-{
-    { 0x01, "Start RTP" },
-    { 0x02, "Stop RTP" },
-    { 0, NULL }
-};
-
-static const value_string szNoeVoiceMode[] =
-{
-    { 0x10, "Disable" },
-    { 0x11, "Handset" },
-    { 0x13, "Speaker" },
-    { 0, NULL }
-};
-
-/**
-* TLV PROPERTY
-*/
-static const value_string szTlvProperty[] =
-{
-    { 8,   "Count" },
-    { 11,  "NavigatorOwnerShip" },
-    { 15,  "NumpadEvent" },
-    { 16,  "Format_16" },
-    { 18,  "W" },
-    { 19,  "Hour" },
-    { 24,  "Year" },
-    { 25,  "Month" },
-    { 26,  "Day" },
-    { 27,  "Minutes" },
-    { 28,  "Seconds" },
-    { 36,  "AnchorID" },
-    { 39,  "Y" },
-    { 40,  "Visible" },
-    { 42,  "FontID" },
-    { 44,  "HAlign" },
-    { 54,  "Icon_54" },
-    { 55,  "Label" },
-    { 56,  "Value" },
-    { 61,  "Focus" },
-    { 62,  "State_62" },
-    { 63,  "Format_63" },
-    { 76,  "VSplit" },
-    { 78,  "RealCount" },
-    { 79,  "Start" },
-    { 95,  "_95" },
-    { 131, "Key Ownership" },
-    { 134, "Mode" },
-    { 135, "Color" },
-    { 137, "Icon_137" },
-    { 138, "Label_138" },
-    { 141, "State_141" },
-    { 142, "Name" },
-    { 143, "Number" },
-    { 147, "Today" },
-    { 148, "Tomorrow" },
-    { 0, NULL }
-};
-
-/************************************************************
-* Check whether it can be protocol data
-************************************************************/
-gboolean is_ua(tvbuff_t *tvb)
-{
-    gint nLen, iOffs;
-    gint nNoeLen;
+#include "epan/packet.h"
+#include "epan/prefs.h"
+#include "epan/tap.h"
+#include "epan/value_string.h"
+#include "epan/dissectors/packet-rtp.h"
+#include "epan/dissectors/packet-rtcp.h"
+#include <string.h>
 
-    nLen = tvb_length(tvb);
-    for(iOffs = 0; iOffs < nLen; )
-    {
-        nNoeLen = tvb_get_letohs(tvb, iOffs) +2;
-        if(nNoeLen > nLen -iOffs)
-            return FALSE;
-        iOffs += nNoeLen;
-    }
-    return TRUE;
-}
+#include "packet-uaudp.h"
 
-/************************************************************
-* Dissectors
-************************************************************/
 
-/*
-* DissectUA - The dissector for UA (Universal Alcatel Protocol)
-*/
-static int DissectUA(tvbuff_t *pTvb, packet_info *pInfo, proto_tree *pTree)
-{
-    gint        nLen, iOffs;
-    guint       nNoeLen;
-    proto_item *pRootUA;
-    proto_tree *pSubTreeUA;
-    tvbuff_t   *pTvbNoe;
 
-    /* Check whether it can be protocol data */
-    if(!is_ua(pTvb))
-        return 0;
+/*-----------------------------------------------------------------------------
+  GLOBALS
+  ---------------------------------------------------------------------------*/
+static int  proto_ua_msg               = -1;
+static gint ett_ua_msg                 = -1;
 
-    /* INFO column */
-    col_append_str(pInfo->cinfo, COL_INFO, " - UA");
+e_ua_direction message_direction; /* Uses to determine UA3G messages */
 
-    nLen = tvb_length(pTvb);
-    if(pTree)
-    {
-        /* root element "UA Protocol, ..." */
-        pRootUA = proto_tree_add_item(pTree, proto_ua, pTvb, 0, -1, ENC_NA);
-        pSubTreeUA = proto_item_add_subtree(pRootUA, ett_ua);
+static gboolean setup_conversations_enabled = TRUE;
 
-        /* NOE items */
-        for(iOffs = 0; iOffs < nLen; )
-        {
-            nNoeLen = tvb_get_letohs(pTvb, iOffs);
-            nNoeLen += 2;
+static dissector_handle_t rtp_handle = NULL;
+static dissector_handle_t rtcp_handle = NULL;
 
-            pTvbNoe = tvb_new_subset(pTvb, iOffs, nNoeLen, nNoeLen);
-            DissectNOE(pTvbNoe, pSubTreeUA);
+extern gint find_terminal_port(guint port);
 
-            iOffs += nNoeLen;
-        }
-    }
 
-    return nLen;
-}
+extern void dhs2ua(char *p, const char *ptr, int opcode, int length);
+extern void ua2dhs(char *p, const char *ptr, int opcode, int length);
 
 
-/**********************************************
-* NOE section
-***********************************************
-Noe
-NoeVoiceMode
-NoeMute
-NoeIP
-NoeIPStartRTP
-NoeCallServer
-NoeCallServerCreate
-NoeCallServerSetProperty
-NoeCallServerNotify
-NoeCallServerNotifyKeyPress
-NoeCallServerNotifyKeyShortPress
-***********************************************/
-static void DissectNOE(tvbuff_t *pTvb, proto_tree *pRootUA)
+static void uadecode(e_ua_direction direction,
+                                        proto_tree *tree,
+                                        packet_info *pinfo,
+                                        tvbuff_t *tvb,
+                                        gint offset,
+                                        gint opcode,
+                                        gint length)
 {
-    proto_item *pNoeItem = proto_tree_add_item(pRootUA, hf_noe, pTvb, 0, -1, ENC_NA);
-    if(pNoeItem)
-    {
-        proto_tree* pSubTreeNOE;
-
-        pSubTreeNOE = proto_item_add_subtree(pNoeItem, ett_noe);
-        proto_tree_add_item(pSubTreeNOE, hf_noe_length, pTvb, 0, 2, ENC_LITTLE_ENDIAN);
-        DissectNOE_type(tvb_new_subset_remaining(pTvb, 2), pSubTreeNOE);
-    }
+       message_direction = direction;
+
+       switch(opcode & 0x7f) /* suppression of the CP bit */
+       {
+       case 0x15:
+       case 0x16:
+               {
+                       call_dissector(find_dissector("noe"),
+                               tvb_new_subset(tvb, offset, length, length),
+                               pinfo,
+                               tree);
+                       break;
+               }
+       case 0x00:
+       case 0x01:
+       case 0x02:
+       case 0x03:
+       case 0x04:
+       case 0x05:
+       case 0x06:
+       case 0x07:      /* Only UA NOE */
+       case 0x08:      /* Only UA NOE */
+       case 0x09:
+       case 0x0A:
+       case 0x0B:
+       case 0x0C:
+       case 0x0D:
+       case 0x0E:
+       case 0x0F:
+       case 0x11:
+       case 0x12:
+       case 0x13:
+       case 0x14:
+       case 0x17:
+       case 0x18:
+       case 0x1F:      /* case 0x9F */
+       case 0x20:
+       case 0x21:
+       case 0x22:
+       case 0x23:
+       case 0x24:      /* Only IP NOE */
+       case 0x25:      /* Only IP NOE */
+       case 0x26:
+       case 0x27:
+       case 0x28:
+       case 0x29:
+       case 0x2A:
+       case 0x2B:      /* Only UA NOE */
+       case 0x2C:
+       case 0x2D:
+       case 0x2E:
+       case 0x30:
+       case 0x31:
+       case 0x32:      /* Only UA NOE */
+       case 0x33:
+       case 0x35:
+       case 0x36:      /* IP Phone */
+       case 0x38:
+       case 0x39:
+       case 0x3A:
+       case 0x3B:
+       case 0x3C:
+       case 0x3D:
+       case 0x3E:
+       case 0x3F:
+       case 0x40:
+       case 0x41:
+       case 0x42:
+       case 0x43:
+       case 0x44:
+       case 0x45:
+       case 0x46:
+       case 0x47:
+       case 0x48:
+       case 0x49:
+       case 0x4A:
+       case 0x4B:
+       case 0x4C:
+       case 0x4D:
+       case 0x4E:
+       case 0x4F:
+       case 0x50:      /* Only UA NOE */
+               {
+                       call_dissector(find_dissector("ua3g"),
+                       tvb_new_subset(tvb, offset, length, length),
+                       pinfo,
+                       tree);
+                       break;
+               }
+       default:
+               {
+                       /* add text to the frame "INFO" column */
+                       if (check_col(pinfo->cinfo, COL_INFO))
+                               col_append_fstr(pinfo->cinfo, COL_INFO, " - UA3G Message ERR: Opcode Unknown");
+
+                       proto_tree_add_text(tree,
+                               tvb,
+                               offset,
+                               length,
+                               "Opcode Unknown 0x%02x",
+                               tvb_get_guint8(tvb, (offset + 2)));
+                       break;
+               }
+       }
 }
 
-static void DissectNOE_type(tvbuff_t *pTvb, proto_tree *pNoeItem)
-{
-    proto_item_append_text(pNoeItem, ": %s", val_to_str_const(tvb_get_guint8(pTvb, 0), szNoeType, "Unknown"));
-    proto_tree_add_item(pNoeItem, hf_noe_type, pTvb, 0, 1, ENC_NA);
 
-    switch(tvb_get_guint8(pTvb, 0))
-    {
-    case 0x13: /*IP*/
-        {
-            DissectNOE_ip(tvb_new_subset_remaining(pTvb, 1), pNoeItem);
-            break;
-        }
-    case 0x15: /*CallServer*/
-        {
-            DissectNOE_callserver(tvb_new_subset_remaining(pTvb, 1), pNoeItem);
-            break;
-        }
-    case 0x29: /*VoiceMode*/
-        {
-            DissectNOE_voicemode(tvb_new_subset_remaining(pTvb, 1), pNoeItem);
-            break;
-        }
-    }
-}
 
-static void DissectNOE_voicemode(tvbuff_t *pTvb, proto_tree *pNoeItem)
+/*-----------------------------------------------------------------------------
+  UA DISSECTOR
+  ---------------------------------------------------------------------------*/
+static void _dissect_ua_msg(tvbuff_t *tvb,
+                                               packet_info *pinfo,
+                                               proto_tree *tree,
+                        e_ua_direction direction)
 {
-    proto_tree_add_item(pNoeItem, hf_noe_voicemode, pTvb, 0, 1, ENC_NA);
-    if(tvb_length(pTvb) > 1)
-        proto_tree_add_item(pNoeItem, hf_noe_data, pTvb, 1, -1, ENC_NA);
+       proto_item *ua_msg_item = NULL;
+       proto_tree *ua_msg_tree = NULL;
+       gint offset = 0;
+       gint length = 0;
+       gint opcode = 0;
+       gint suboffset  = 0;
+    address remote_rtp_addr;
+       guint32 remote_rtp_port = 0;
+
+       if(tree)
+       {
+               ua_msg_item = proto_tree_add_protocol_format(tree, proto_ua_msg, tvb, 0, -1,
+                       "Universal Alcatel Protocol, %s",
+                       ((direction == SYS_TO_TERM) ?
+                       "System -> Terminal" : "Terminal -> System"));
+
+               ua_msg_tree = proto_item_add_subtree(ua_msg_item, ett_ua_msg);
+
+               while (tvb_offset_exists(tvb, offset))
+               {
+                       length = (tvb_get_guint8(tvb, offset+0) +
+                               tvb_get_guint8(tvb, offset+1) * 256) + 2;
+
+                       opcode = tvb_get_guint8(tvb, offset+2);
+
+                       /* RTP/RTCP conversation setup */
+                       if(setup_conversations_enabled && opcode==0x13 && tvb_get_guint8(tvb, offset+3)==0x01)
+                       {
+                               /* StartRTP */
+                               suboffset = offset+5;
+                               remote_rtp_addr.data = NULL;
+
+                               while(suboffset < offset+length)
+                               {
+                                       switch(tvb_get_guint8(tvb, suboffset))
+                                       {
+                                       case 0x00: /* local port */
+                                               {
+                                               /*local_rtp_port = tvb_get_ntohs(tvb, suboffset+2);*/
+                                               break;
+                                               }
+                                       case 0x01: /* remote IP */
+                                               {
+                                               remote_rtp_addr.type=AT_IPv4;
+                                               remote_rtp_addr.len=4;
+                                               remote_rtp_addr.data=tvb_get_ptr(tvb, suboffset+2, 4);
+                                               break;
+                                               }
+                                       case 0x02: /* remote port */
+                                               {
+                                               remote_rtp_port = tvb_get_ntohs(tvb, suboffset+2);
+                                               break;
+                                               }
+                                       }
+
+                               suboffset += tvb_get_guint8(tvb, suboffset+1) + 2;
+                               }
+
+                               if(remote_rtp_addr.data!=NULL && remote_rtp_port!=0)
+                               {
+                                       if(rtp_handle)
+                                       {
+                                               rtp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port, 0,
+                                               "UA", pinfo->fd->num, 0, NULL);
+                                       }
+                                       if(rtcp_handle)
+                                       {
+                                               rtcp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port+1, 0,
+                                               "UA", pinfo->fd->num);
+                                       }
+                               }
+                       }
+
+                       uadecode(direction, ua_msg_tree, pinfo, tvb, offset, opcode, length);
+
+                       offset += length;
+               }
+       }
 }
 
-static void DissectNOE_callserver(tvbuff_t *pTvb, proto_tree *pNoeItem)
-{
-    tvbuff_t *pTvbTlv;
-
-    gint nLen;
-    guint8 u8Method;
-
-    nLen = tvb_length(pTvb);
-    u8Method = tvb_get_guint8(pTvb, 0);
 
-    proto_item_append_text(pNoeItem, ", %s", val_to_str(u8Method, szCallServerMethod, "Unknown"));
-    proto_tree_add_item(pNoeItem, hf_noe_method, pTvb, 0, 1, ENC_NA);
-
-    switch(u8Method)
-    {
-    case 0x00: /*Create*/
-    case 0x01: /*Delete*/
-    case 0x02: /*SetProperty*/
-        {
-            guint8 u8Class; gint iOffs;
-
-            u8Class = tvb_get_guint8(pTvb, 1);
-            proto_item_append_text(pNoeItem, ", %s", val_to_str(u8Class, szCallServerClass, "Unknown"));
-            proto_tree_add_item(pNoeItem, hf_noe_class, pTvb, 1, 1, ENC_NA);
-
-            iOffs = 2;
-            if(u8Class >= 100)
-            {
-                proto_item_append_text(pNoeItem, ", Id(0x%04x)", tvb_get_ntohs(pTvb, 2));
-                proto_tree_add_item(pNoeItem, hf_noe_objid, pTvb, 2, 2, ENC_LITTLE_ENDIAN);
-                iOffs += 2;
-            }
-
-            /* TLV items */
-            for(; iOffs < nLen; )
-            {
-                guint    nTlvLen;
-                guint8   nTlvProperty;
-                gboolean bIsArrIndex;
-
-                nTlvProperty = tvb_get_guint8(pTvb, iOffs);
-                /* for property of more than 100 and equal 104 or 120 before the field is still arrindex propsize */
-                if((nTlvProperty < 100) || (nTlvProperty == 104) || (nTlvProperty == 120))
-                {
-                    nTlvLen = tvb_get_guint8(pTvb, iOffs+1);
-                    nTlvLen += 2;
-                    bIsArrIndex = FALSE;
-                }
-                else
-                {
-                    nTlvLen = tvb_get_guint8(pTvb, iOffs+2);
-                    nTlvLen += 3;
-                    bIsArrIndex = TRUE;
-                }
-                pTvbTlv = tvb_new_subset(pTvb, iOffs, nTlvLen, nTlvLen);
-                DissectTLV(pTvbTlv, pNoeItem, bIsArrIndex);
-
-                iOffs += nTlvLen;
-            }
-            break;
-        }
-    case 0x04: /*Notify*/
-        {
-            guint8 u8Event;
-
-            u8Event = tvb_get_guint8(pTvb, 1);
-            proto_tree_add_item(pNoeItem, hf_noe_event, pTvb, 1, 1, ENC_NA);
-
-            switch(u8Event)
-            {
-            case 2: /*KeyPress*/
-                {
-                    proto_tree_add_item(pNoeItem, hf_noe_keychar, pTvb, 2, -1, ENC_NA);
-                    break;
-                }
-            case 4: /*KeyShortPress*/
-                {
-                    proto_tree_add_item(pNoeItem, hf_noe_keychar, pTvb, 2, 2, ENC_NA);
-                    break;
-                }
-            }
-            break;
-        }
-    }
-}
-
-static void DissectNOE_ip(tvbuff_t *pTvb, proto_tree *pNoeItem)
+static void dissect_ua_sys_to_term(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-    guint8 u8Action;
-
-    /* Action */
-    u8Action = tvb_get_guint8(pTvb, 0);
-    proto_item_append_text(pNoeItem, " %s", val_to_str(u8Action, szNoeAction, "Unknown"));
-    proto_tree_add_item(pNoeItem, hf_noe_action, pTvb, 0, 1, ENC_NA);
-
-    switch(u8Action)
-    {
-    case 0x01: /*Start RTP*/
-        {
-            DissectNOE_ip_startrtp(tvb_new_subset_remaining(pTvb, 1), pNoeItem);
-            break;
-        }
-    case 0x02: /*Stop RTP*/
-        {
-            break;
-        }
-    }
+       _dissect_ua_msg(tvb, pinfo, tree, SYS_TO_TERM);
 }
 
-static void DissectNOE_ip_startrtp(tvbuff_t *pTvb, proto_tree *pNoeItem)
+static void dissect_ua_term_to_sys(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-    gint nLen, iOffs;
-    nLen = tvb_length(pTvb);
-
-    /*Reserved*/
-    proto_tree_add_item(pNoeItem, hf_noe_reserved, pTvb, 0, 1, ENC_NA);
-
-    /*Properties*/
-    for(iOffs = 1; iOffs < nLen; )
-    {
-        guint     u8PropSize;
-        tvbuff_t *pTvbTlv;
+       _dissect_ua_msg(tvb, pinfo, tree, TERM_TO_SYS);
+}
 
-        u8PropSize = tvb_get_guint8(pTvb, iOffs+1) + 2;
-        pTvbTlv = tvb_new_subset(pTvb, iOffs, u8PropSize, u8PropSize);
 
-        DissectNOE_ip_startrtp_properties(pTvbTlv, pNoeItem);
-        iOffs += u8PropSize;
-    }
-}
+/*-----------------------------------------------------------------------------
+  DISSECTORS REGISTRATION FUNCTIONS
+  ---------------------------------------------------------------------------*/
+static guint prefs_initialized = FALSE;
 
-static void DissectNOE_ip_startrtp_properties(tvbuff_t *pTvb, proto_tree *pNoeItem)
+void proto_reg_handoff_ua_msg(void)
 {
-    proto_item *pProp;
+    static gboolean prefs_initialized = FALSE;
+       dissector_handle_t handle_ua_msg;
 
-    pProp = proto_tree_add_item(pNoeItem, hf_noe_property, pTvb, 0, -1, ENC_NA);
-    if(pProp)
+    if(!prefs_initialized)
     {
-        guint8 u8ID, u8Size;
-        proto_tree* pSubTreeProp;
-
-        pSubTreeProp = proto_item_add_subtree(pProp, ett_noe_property);
-        /*ID*/
-        u8ID = tvb_get_guint8(pTvb, 0);
-        proto_item_append_text(pProp, " - %25s", val_to_str(u8ID, szStartRtpPropID, "Unknown"));
-        proto_tree_add_item(pSubTreeProp, hf_noe_id, pTvb, 0, 1, ENC_NA);
-
-        /*SIZE*/
-        u8Size = tvb_get_guint8(pTvb, 1);
-        proto_tree_add_item(pSubTreeProp, hf_noe_size, pTvb, 1, 1, ENC_NA);
-
-        /*data*/
-        switch(u8ID)
-        {
-        default:
-            {
-                proto_item_append_text(pProp, ": %s", tvb_bytes_to_str(pTvb, 2, u8Size));
-                proto_tree_add_item(pSubTreeProp, hf_noe_data, pTvb, 2, -1, ENC_NA);
-                break;
-            }
-        case 0x00: /*LocalUDPPort*/
-            {
-                proto_item_append_text(pProp, ": %u", tvb_get_ntohs(pTvb, 2));
-                proto_tree_add_item(pSubTreeProp, hf_noe_local_port, pTvb, 2, 2, ENC_BIG_ENDIAN);
-                break;
-            }
-        case 0x01: /*RemoteIP*/
-            {
-                proto_item_append_text(pProp, ": %s", tvb_ip_to_str(pTvb, 2));
-                proto_tree_add_item(pSubTreeProp, hf_noe_remote_ip, pTvb, 2, 4, ENC_NA);
-                break;
-            }
-        case 0x02: /*RemoteUDPPort*/
-            {
-                proto_item_append_text(pProp, ": %u", tvb_get_ntohs(pTvb, 2));
-                proto_tree_add_item(pSubTreeProp, hf_noe_remote_port, pTvb, 2, 2, ENC_BIG_ENDIAN);
-                break;
-            }
-        case 0x03: /*TypeOfService*/
-            {
-                proto_item_append_text(pProp, ": %u", tvb_get_guint8(pTvb, 2));
-                proto_tree_add_item(pSubTreeProp, hf_noe_typeofservice, pTvb, 2, 1, ENC_NA);
-                break;
-            }
-        case 0x04: /*Payload*/
-            {
-                proto_item_append_text(pProp, ": %s", val_to_str_const(tvb_get_guint8(pTvb, 2), szStartRtpPayload, "Unknown"));
-                proto_tree_add_item(pSubTreeProp, hf_noe_compressor, pTvb, 2, 1, ENC_NA);
-                break;
-            }
-        case 0x05: /*PayloadConcatenation*/
-            {
-                proto_item_append_text(pProp, ": %u ms", tvb_get_guint8(pTvb, 2));
-                proto_tree_add_item(pSubTreeProp, hf_noe_payloadconcat, pTvb, 2, 1, ENC_NA);
-                break;
-            }
-        }
+               /* hooking of UA on UAUDP */
+               register_dissector_table("uaudp.opcode",
+                       "UAUDP opcode",
+                       FT_UINT8,
+                       BASE_DEC);
+
+               handle_ua_msg = find_dissector("ua_sys_to_term");
+               dissector_add("uaudp.opcode", UAUDP_DATA, handle_ua_msg);
+
+               handle_ua_msg = find_dissector("ua_term_to_sys");
+               dissector_add("uaudp.opcode", UAUDP_DATA, handle_ua_msg);
+        prefs_initialized = TRUE;
     }
 }
 
-/***********************************************
-* TLV section
-***********************************************/
-static void DissectTLV(tvbuff_t *pTvb, proto_tree *pNoeItem, gboolean bIsArrIndex)
-{
-    proto_item *pTlv;
-
-    pTlv = proto_tree_add_item(pNoeItem, hf_tlv, pTvb, 0, -1, ENC_NA);
-    if(pTlv)
-    {
-        gint iOffs;
-        guint8 u8Property, u8PropSize;
-        proto_tree* pSubTreeTLV;
-
-        iOffs = 0;
-        pSubTreeTLV = proto_item_add_subtree(pTlv, ett_tlv);
-        u8Property = tvb_get_guint8(pTvb, iOffs);
-        proto_item_append_text(pTlv, "%u %s ", u8Property, val_to_str(u8Property, szTlvProperty, "Unknown"));
-        proto_tree_add_item(pSubTreeTLV, hf_tlv_property, pTvb, iOffs++, 1, ENC_NA);
-
-        if(bIsArrIndex)
-            proto_tree_add_item(pTlv, hf_tlv_arrindex, pTvb, iOffs++, 1, ENC_NA);
 
-        u8PropSize = tvb_get_guint8(pTvb, iOffs);
-        proto_tree_add_item(pSubTreeTLV, hf_tlv_propsize, pTvb, iOffs++, 1, ENC_NA);
+void proto_register_ua_msg(void)
+{
+    module_t *ua_msg_module;
 
-        if(u8PropSize > 0)
-            DissectTLV_data(tvb_new_subset(pTvb, iOffs, u8PropSize, u8PropSize), pSubTreeTLV, u8Property);
-    }
-}
+       static gint *ett[] =
+       {
+               &ett_ua_msg,
+       };
 
-/* TLV DATA */
-static void DissectTLV_data(tvbuff_t *pTvb, proto_tree *pTlv, guint8 u8Property)
-{
-    proto_tree* pNoeItem;
-    switch(u8Property)
-    {
-    default:
-        {
-            proto_item_append_text(pTlv, "%s", tvb_bytes_to_str(pTvb, 0, tvb_length(pTvb)));
-            proto_tree_add_item(pTlv, hf_tlv_data, pTvb, 0, -1, ENC_NA);
-            break;
-        }
-
-    case 24: /*Year*/
-        {
-            proto_item_append_text(pTlv, "%u", tvb_get_ntohs(pTvb, 0));
-            proto_tree_add_item(pTlv, hf_tlv_year, pTvb, 0, 2, ENC_BIG_ENDIAN);
-            break;
-        }
-
-    case 55: /*Label*/
-    case 138: /*Label_138*/
-        {
-            proto_item_append_text(pTlv, "'%s'", tvb_get_ephemeral_string(pTvb, 0, tvb_length(pTvb)));
-            proto_tree_add_item(pTlv, hf_tlv_label, pTvb, 0, -1, ENC_ASCII|ENC_NA);
-
-            /* append text on NOE level */
-            pNoeItem = proto_item_get_parent(pTlv);
-            proto_item_append_text(pNoeItem, ", Label='%s'", tvb_get_ephemeral_string(pTvb, 0, tvb_length(pTvb)));
-            break;
-        }
-
-    case 143: /*Phone number*/
-        {
-            proto_item_append_text(pTlv, "%s", tvb_get_ephemeral_string(pTvb, 0, tvb_length(pTvb)));
-            proto_tree_add_item(pTlv, hf_tlv_number, pTvb, 0, -1, ENC_NA);
-            break;
-        }
-
-    case 147: /*Today*/
-    case 148: /*Tomorrow*/
-        {
-            proto_item_append_text(pTlv, "'%s'", tvb_get_ephemeral_string(pTvb, 0, tvb_length(pTvb)));
-            proto_tree_add_item(pTlv, hf_tlv_data, pTvb, 0, -1, ENC_NA);
-            break;
-        }
-    }
-}
+       /* used for StartRTP conversation setup */
+       rtp_handle = find_dissector("rtp");
+       rtcp_handle = find_dissector("rtcp");
 
+       /* UA dissector registration */
+       proto_ua_msg = proto_register_protocol("Universal Alcatel Protocol", "UA", "ua");
 
+       register_dissector("ua_sys_to_term", dissect_ua_sys_to_term, proto_ua_msg);
+       register_dissector("ua_term_to_sys", dissect_ua_term_to_sys, proto_ua_msg);
 
-/* Register all the bits needed by the filtering engine */
-void proto_register_ua(void)
-{
-    static hf_register_info hf[] =
-    {
-        { &hf_noe,
-          { "NOE", "ua.noe",
-            FT_NONE, BASE_NONE, NULL, 0x0,
-            NULL, HFILL }},
-        { &hf_noe_length,
-          { "Length", "ua.noe.length",
-            FT_UINT16, BASE_DEC, NULL, 0x0,
-            "NOE item length (without 2 bytes containing the length)", HFILL }},
-        { &hf_noe_type,
-          { "Type", "ua.noe.type",
-            FT_UINT8, BASE_DEC, VALS(szNoeType), 0x0,
-            "NOE item type", HFILL }},
-        { &hf_noe_method,
-          { "Method", "ua.noe.method",
-            FT_UINT8, BASE_DEC, VALS(szCallServerMethod), 0x0,
-            "Call Server method", HFILL }},
-        { &hf_noe_class,
-          { "Class", "ua.noe.class",
-            FT_UINT8, BASE_DEC,             VALS(szCallServerClass), 0x0,
-            "Call Server class", HFILL }},
-        { &hf_noe_objid,
-          { "ObjectID", "ua.noe.objid",
-            FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
-            "Call Server object id", HFILL }},
-        { &hf_noe_event,
-          { "Event", "ua.noe.event",
-            FT_UINT8, BASE_DEC, VALS(szCallServerEvent), 0x0,
-            "Call Server event", HFILL }},
-        { &hf_noe_keychar,
-          { "KeyChar", "ua.noe.event.keychar",
-            FT_BYTES, BASE_NONE, NULL, 0x0,
-            "Event key char", HFILL }},
-        { &hf_noe_voicemode,
-          { "VoiceMode", "ua.noe.voicemode",
-            FT_UINT8, BASE_DEC, VALS(szNoeVoiceMode), 0x0,
-            NULL, HFILL }},
-
-        { &hf_noe_action,
-          { "Action", "ua.noe.action",
-            FT_UINT8, BASE_DEC, VALS(szNoeAction), 0x0,
-            "IP action", HFILL }},
-        { &hf_noe_reserved,
-          { "Reserved", "ua.noe.action.startrtp.reserved",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "IP start rtp reserved", HFILL }},
-        { &hf_noe_property,
-          { "Property", "ua.noe.action.startrtp.property",
-            FT_NONE, BASE_NONE, NULL, 0x0,
-            "IP property", HFILL }},
-        { &hf_noe_id,
-          { "ID", "ua.noe.action.startrtp.property.id",
-            FT_UINT8, BASE_DEC, VALS(szStartRtpPropID), 0x0,
-            "IP property id", HFILL }},
-        { &hf_noe_size,
-          { "Size", "ua.noe.action.startrtp.property.size",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "IP property size", HFILL }},
-        { &hf_noe_data,
-          { "Data", "ua.noe.action.startrtp.data",
-            FT_BYTES, BASE_NONE, NULL, 0x0,
-            NULL, HFILL }},
-
-        { &hf_noe_local_port,
-          { "LocalPort", "ua.noe.action.startrtp.localport",
-            FT_UINT16, BASE_DEC, NULL, 0x0,
-            "IP start rtp property localport", HFILL }},
-        { &hf_noe_remote_ip,
-          { "RemoteIP", "ua.noe.action.startrtp.remoteip",
-            FT_IPv4, BASE_NONE, NULL, 0x0,
-            "IP start rtp property remote ipv4", HFILL }},
-        { &hf_noe_remote_port,
-          { "RemotePort", "ua.noe.action.startrtp.remoteport",
-            FT_UINT16, BASE_DEC, NULL, 0x0,
-            "IP start rtp property remoteport", HFILL }},
-        { &hf_noe_compressor,
-          { "Payload", "ua.noe.action.startrtp.payload",
-            FT_UINT8, BASE_DEC, VALS(szStartRtpPayload), 0x0,
-            "IP start rtp property payload", HFILL }},
-        { &hf_noe_typeofservice,
-          { "TypeOfService", "ua.noe.action.startrtp.typeofservice",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "IP start rtp property type of service", HFILL }},
-        { &hf_noe_payloadconcat,
-          { "Payld Concat", "ua.noe.action.startrtp.payldconcat",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "IP start rtp property payload concatenation (in ms)", HFILL }},
-
-        { &hf_tlv,
-          { "TLV", "ua.noe.tlv",
-            FT_NONE, BASE_NONE, NULL, 0x0,
-            NULL, HFILL }},
-        { &hf_tlv_property,
-          { "Property", "ua.noe.tlv.property",
-            FT_UINT8, BASE_DEC, VALS(szTlvProperty), 0x0,
-            "TLV property", HFILL }},
-        { &hf_tlv_arrindex,
-          { "ArrIndex", "ua.noe.tlv.arrindex",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "TLV array index", HFILL }},
-        { &hf_tlv_propsize,
-          { "PropSize", "ua.noe.tlv.propsize",
-            FT_UINT8, BASE_DEC, NULL, 0x0,
-            "TLV property size", HFILL }},
-        { &hf_tlv_data,
-          { "Data", "ua.noe.tlv.data",
-            FT_BYTES, BASE_NONE, NULL, 0x0,
-            "TLV data", HFILL }},
-        { &hf_tlv_label,
-          { "Label", "ua.noe.tlv.label",
-            FT_STRING, BASE_NONE, NULL, 0x0,
-            "TLV label", HFILL }},
-        { &hf_tlv_year,
-          { "Year", "ua.noe.tlv.year",
-            FT_UINT16, BASE_DEC, NULL, 0x0,
-            "TLV year", HFILL }},
-        { &hf_tlv_number,
-          { "Number", "ua.noe.tlv.number",
-            FT_STRING, BASE_NONE, NULL, 0x0,
-            "TLV remote phone number", HFILL }},
-    };
-    static gint *ett[] =
-    {
-        &ett_ua,
-        &ett_noe,
-        &ett_noe_property,
-        &ett_tlv,
-        &ett_tlv_sub,
-    };
-
-    proto_ua = proto_register_protocol("UA Protocol (Universal Alcatel Protocol)", "UA", "ua");
-    proto_register_field_array(proto_ua, hf, array_length(hf));
-    proto_register_subtree_array(ett, array_length(ett));
-}
+       /* Common subtree array registration */
+       proto_register_subtree_array(ett, array_length(ett));
 
+    /* Register preferences */
+    ua_msg_module = prefs_register_protocol(proto_ua_msg, proto_reg_handoff_ua_msg);
 
-/* The registration hand-off routine is called at startup */
-void proto_reg_handoff_ua(void)
-{
-    dissector_handle_t hDis = new_create_dissector_handle(DissectUA, proto_ua);
-    dissector_add_uint("uaudp.opcode", 7, hDis);
+       prefs_register_bool_preference(ua_msg_module, "setup_conversations",
+               "Setup RTP/RTCP conversations on Start RTP",
+               "Setup RTP/RTCP conversations when parsing Start RTP messages",
+               &setup_conversations_enabled);
 }
-/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c
new file mode 100644 (file)
index 0000000..030517f
--- /dev/null
@@ -0,0 +1,6379 @@
+/* packet-ua3g.c
+ * Routines for UA/UDP (Universal Alcatel over UDP) packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
+ *
+ * $Id: 
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib.h>
+#include "epan/packet.h"
+#include "epan/prefs.h"
+#include "epan/tap.h"
+#include "epan/value_string.h"
+#include "packet-uaudp.h"
+
+extern int isprint( int ch );
+
+/*-----------------------------------------------------------------------------
+       Globals
+       ---------------------------------------------------------------------------*/
+static int  proto_ua3g                 = -1;
+static gint ett_ua3g                   = -1;
+static gint ett_ua3g_body              = -1;
+static gint ett_ua3g_param             = -1;
+static gint ett_ua3g_option            = -1;
+static int  hf_ua3g_length             = -1;
+static int  hf_ua3g_opcode             = -1;
+static int     hf_ua3g_ip                      = -1;
+static int     hf_ua3g_command         = -1;
+
+extern e_ua_direction message_direction;
+
+/* Definition of opcodes */
+/* System To Terminal */
+#define NOP                                            0x00
+#define PRODUCTION_TEST                        0x01    /* IP Phone */
+#define SUBDEVICE_ESCAPE               0x02    /* IP Phone */
+#define SOFT_RESET                             0x03
+#define IP_PHONE_WARMSTART             0x04    /* IP Phone */
+#define HE_ROUTING                             0x05    /* IP Phone - NOT EXPECTED */
+#define SUBDEVICE_RESET                        0x06
+#define LOOPBACK_ON                            0x07    /* IP Phone & UA NOE */
+#define LOOPBACK_OFF                   0x08    /* IP Phone & UA NOE */
+#define VIDEO_ROUTING                  0x09    /* IP Phone - NOT EXPECTED */
+#define SUPER_MSG                              0x0B
+#define SEGMENT_MSG                            0x0C
+#define REMOTE_UA_ROUTING              0x0D    /* IP Phone - NOT EXPECTED */
+#define VERY_REMOTE_UA_ROUTING 0x0E    /* IP Phone - NOT EXPECTED */
+#define OSI_ROUTING                            0x0F    /* IP Phone - NOT EXPECTED */
+#define ABC_A_ROUTING                  0x11    /* IP Phone - NOT EXPECTED */
+#define IBS_ROUTING                            0x12    /* IP Phone - NOT EXPECTED */
+#define IP_DEVICE_ROUTING              0x13
+#define M_REFLEX_HUB_ROUTING   0x14    /* IP Phone - NOT EXPECTED */
+/*#define NOE_CS_ROUTING               0x15    // Decoded by packet-noe.c */
+/*#define NOE_PS_ROUTING               0x16    // Decoded by packet-noe.c */
+#define SUPER_MSG_2                            0x17
+#define DEBUG_IN_LINE                  0x18
+#define LED_COMMAND                            0x21    /* IP Phone */
+#define START_BUZZER                   0x22    /* VTA */
+#define STOP_BUZZER                            0x23    /* VTA */
+#define ENABLE_DTMF                            0x24    /* Only IP NOE */
+#define DISABLE_DTMF                   0x25    /* Only IP NOE */
+#define CLEAR_LCD_DISP                 0x26    /* IP Phone */
+#define LCD_LINE_1_CMD                 0x27    /* IP Phone */
+#define LCD_LINE_2_CMD                 0x28    /* IP Phone */
+#define MAIN_VOICE_MODE                        0x29
+#define VERSION_INQUIRY                        0x2A
+#define ARE_YOU_THERE                  0x2B    /* IP Phone & UA NOE */
+#define SUBDEVICE_METASTATE            0x2C
+#define VTA_STATUS_INQUIRY             0x2D    /* IP Phone */
+#define SUBDEVICE_STATE                        0x2E
+#define DWL_DTMF_CLCK_FORMAT   0x30    /* IP Phone */
+#define SET_CLCK                               0x31    /* IP Phone */
+#define VOICE_CHANNEL                  0x32    /* IP Phone & UA NOE */
+#define EXTERNAL_RINGING               0x33
+#define LCD_CURSOR                             0x35    /* IP Phone */
+#define DWL_SPECIAL_CHAR               0x36    /* IP Phone */
+#define SET_CLCK_TIMER_POS             0x38    /* IP Phone */
+#define SET_LCD_CONTRAST               0x39    /* IP Phone */
+#define AUDIO_IDLE                             0x3A
+#define SET_SPEAKER_VOL                        0x3B    /* IP Phone */
+#define BEEP                                   0x3C
+#define SIDETONE                               0x3D
+#define RINGING_CADENCE                        0x3E
+#define        MUTE                                    0x3F
+#define FEEDBACK                               0x40
+#define KEY_RELEASE                            0x41    /* IP Phone */
+#define TRACE_ON                               0x42    /* IP Phone - NOT EXPECTED */
+#define TRACE_OFF                              0x43    /* IP Phone - NOT EXPECTED */
+#define READ_PERIPHERAL                        0x44    /* IP Phone - NOT EXPECTED */
+#define WRITE_PERIPHERAL               0x45    /* IP Phone - NOT EXPECTED */
+#define ALL_ICONS_OFF                  0x46    /* IP Phone */
+#define ICON_CMD                               0x47    /* IP Phone */
+#define AMPLIFIED_HANDSET              0x48    /* IP Phone */
+#define AUDIO_CONFIG                   0x49
+#define AUDIO_PADDED_PATH              0x4A    /* IP Phone */
+#define RELEASE_RADIO_LINK             0x4B    /* IP Phone - NOT EXPECTED */
+#define DECT_HANDOVER                  0x4C    /* IP Phone - NOT EXPECTED */
+#define LOUDSPEAKER                            0x4D
+#define ANNOUNCE                               0x4E
+#define RING                                   0x4F
+#define UA_DWL_PROTOCOL                        0x50    /* Only UA NOE */
+/* Terminal To System */
+#define CS_NOP_ACK                             0x00
+#define CS_HANDSET_OFFHOOK             0x01    /* IP Phone */
+#define CS_HANDSET_ONHOOK              0x02    /* IP Phone */
+#define CS_DIGIT_DIALED                        0x03    /* IP Phone */
+#define CS_SUBDEVICE_MSG               0x04
+#define CS_HE_ROUTING                  0x05    /* IP Phone - NOT EXPECTED */
+#define CS_LOOPBACK_ON                 0x06    /* IP Phone & UA NOE */
+#define CS_LOOPBACK_OFF                        0x07    /* IP Phone & UA NOE */
+#define CS_VIDEO_ROUTING               0x09    /* IP Phone - NOT EXPECTED */
+#define CS_WARMSTART_ACK               0x0A    /* IP Phone */
+#define CS_SUPER_MSG                   0x0B    /* IP Phone - NOT EXPECTED */
+#define CS_SEGMENT_MSG                 0x0C
+#define CS_REMOTE_UA_ROUTING   0x0D    /* IP Phone - NOT EXPECTED */
+#define CS_VERY_REMOTE_UA_R            0x0E    /* IP Phone - NOT EXPECTED */
+#define CS_OSI_ROUTING                 0x0F    /* IP Phone - NOT EXPECTED */
+#define CS_ABC_A_ROUTING               0x11    /* IP Phone - NOT EXPECTED */
+#define CS_IBS_ROUTING                 0x12    /* IP Phone - NOT EXPECTED */
+#define CS_IP_DEVICE_ROUTING   0x13
+/*#define CS_NOE_CS_ROUTING            0x15    // Decoded by packet-noe.c */
+/*#define CS_NOE_PS_ROUTING            0x16    // Decoded by packet-noe.c */
+#define CS_SUPER_MSG_2                 0x17
+#define CS_DEBUG_IN_LINE               0x18
+#define CS_UNSOLICITED_MSG             0x9F
+#define CS_NON_DIGIT_KEY_PUSHED        0x20    /* IP Phone */
+#define CS_VERSION_RESPONSE            0x21
+#define CS_I_M_HERE                            0x22
+#define CS_RSP_STATUS_INQUIRY  0x23    /* IP Phone */
+#define CS_SUBDEVICE_STATE             0x24
+#define CS_DIGIT_KEY_RELEASED  0x26    /* IP Phone */
+#define CS_TRACE_ON_ACK                        0x27    /* IP Phone */
+#define CS_TRACE_OFF_ACK               0x28    /* IP Phone */
+#define CS_SPECIAL_KEY_STATUS  0x29    /* IP Phone */
+#define CS_KEY_RELEASED                        0x2A    /* IP Phone */
+#define CS_PERIPHERAL_CONTENT  0x2B    /* IP Phone */
+#define CS_TM_KEY_PUSHED               0x2D    /* IP Phone */
+#define CS_UA_DWL_PROTOCOL             0x50    /* Only UA NOE */
+
+
+static const value_string *opcodes_vals;
+
+/* System To Terminal Opcodes */
+static const value_string opcodes_vals_sys[] =
+{
+       {NOP                                    , "NOP"                                                                 },
+       {PRODUCTION_TEST                , "Production Test"                                             },      /* IP Phone */
+       {SUBDEVICE_ESCAPE               , "Subdevice Escape To Subdevice"               },      /* IP Phone */
+       {SOFT_RESET                             , "Software Reset"                                              },
+       {IP_PHONE_WARMSTART             , "IP-Phone Warmstart"                                  },      /* IP Phone */
+       {HE_ROUTING                             , "HE Routing Code"                                             },      /* IP Phone - NOT EXPECTED */
+       {SUBDEVICE_RESET                , "Subdevice Reset"                                             },
+       {LOOPBACK_ON                    , "Loopback On"                                                 },
+       {LOOPBACK_OFF                   , "Loopback Off"                                                },
+       {VIDEO_ROUTING                  , "Video Routing Code"                                  },      /* IP Phone - NOT EXPECTED */
+       {SUPER_MSG                              , "Super Message"                                               },
+       {SEGMENT_MSG                    , "Segment Message"                                             },
+       {REMOTE_UA_ROUTING              , "Remote UA Routing Code"                              },      /* IP Phone - NOT EXPECTED */
+       {VERY_REMOTE_UA_ROUTING , "Very Remote UA Routing Code"                 },      /* IP Phone - NOT EXPECTED */
+       {OSI_ROUTING                    , "OSI Routing Code"                                    },      /* IP Phone - NOT EXPECTED */
+       {ABC_A_ROUTING                  , "ABC-A Routing Code"                                  },      /* IP Phone - NOT EXPECTED */
+       {IBS_ROUTING                    , "IBS Routing Code"                                    },      /* IP Phone - NOT EXPECTED */
+       {IP_DEVICE_ROUTING              , "IP Device Routing"                                   },
+       {M_REFLEX_HUB_ROUTING   , "Mutli-Reflex Hub Routing Code"               },      /* IP Phone - NOT EXPECTED */
+       {SUPER_MSG_2                    , "Super Message 2"                                             },
+       {DEBUG_IN_LINE                  , "Debug In Line"                                               },
+       {LED_COMMAND                    , "Led Command"                                                 },      /* IP Phone */
+       {START_BUZZER                   , "Start Buzzer"                                                },      /* VTA */
+       {STOP_BUZZER                    , "Stop Buzzer"                                                 },      /* VTA */
+       {ENABLE_DTMF                    , "Enable DTMF"                                                 },
+       {DISABLE_DTMF                   , "Disable DTMF"                                                },
+       {CLEAR_LCD_DISP                 , "Clear LCD Display"                                   },      /* IP Phone */
+       {LCD_LINE_1_CMD                 , "LCD Line 1 Commands"                                 },      /* IP Phone */
+       {LCD_LINE_2_CMD                 , "LCD Line 2 Commands"                                 },      /* IP Phone */
+       {MAIN_VOICE_MODE                , "Main Voice Mode"                                             },
+       {VERSION_INQUIRY                , "Version Inquiry"                                             },
+       {ARE_YOU_THERE                  , "Are You There?"                                              },
+       {SUBDEVICE_METASTATE    , "Subdevice Metastate"                                 },
+       {VTA_STATUS_INQUIRY             , "VTA Status Inquiry"                                  },      /* IP Phone */
+       {SUBDEVICE_STATE                , "Subdevice State?"                                    },
+       {DWL_DTMF_CLCK_FORMAT   , "Download DTMF & Clock Format"                },      /* IP Phone */
+       {SET_CLCK                               , "Set Clock"                                                   },      /* IP Phone */
+       {VOICE_CHANNEL                  , "Voice Channel"                                               },      /* IP Phone & UA NOE */
+       {EXTERNAL_RINGING               , "External Ringing"                                    },
+       {LCD_CURSOR                             , "LCD Cursor"                                                  },      /* IP Phone */
+       {DWL_SPECIAL_CHAR               , "Download Special Character"                  },      /* IP Phone */
+       {SET_CLCK_TIMER_POS             , "Set Clock/Timer Position"                    },      /* IP Phone */
+       {SET_LCD_CONTRAST               , "Set LCD Contrast"                                    },      /* IP Phone */
+       {AUDIO_IDLE                             , "Audio Idle"                                                  },
+       {SET_SPEAKER_VOL                , "Set Speaker Volume"                                  },      /* IP Phone */
+       {BEEP                                   , "Beep"                                                                },
+       {SIDETONE                               , "Sidetone"                                                    },
+       {RINGING_CADENCE                , "Set Programmable Ringing Cadence"    },
+       {MUTE                                   , "Mute"                                                                },
+       {FEEDBACK                               , "Feedback"                                                    },
+       {KEY_RELEASE                    , "Key Release"                                                 },      /* IP Phone */
+       {TRACE_ON                               , "Trace On"                                                    },      /* IP Phone - NOT EXPECTED */
+       {TRACE_OFF                              , "Trace Off"                                                   },      /* IP Phone - NOT EXPECTED */
+       {READ_PERIPHERAL                , "Read Peripheral"                                             },      /* IP Phone - NOT EXPECTED */
+       {WRITE_PERIPHERAL               , "Write Peripheral"                                    },      /* IP Phone - NOT EXPECTED */
+       {ALL_ICONS_OFF                  , "All Icons Off"                                               },      /* IP Phone */
+       {ICON_CMD                               , "Icon Command"                                                },      /* IP Phone */
+       {AMPLIFIED_HANDSET              , "Amplified Handset (Boost)"                   },      /* IP Phone */
+       {AUDIO_CONFIG                   , "Audio Config"                                                },
+       {AUDIO_PADDED_PATH              , "Audio Padded Path"                                   },      /* IP Phone */
+       {RELEASE_RADIO_LINK             , "Release Radio Link"                                  },      /* IP Phone - NOT EXPECTED */
+       {DECT_HANDOVER                  , "DECT External Handover Routing Code" },      /* IP Phone - NOT EXPECTED */
+       {LOUDSPEAKER                    , "Loudspeaker"                                                 },
+       {ANNOUNCE                               , "Announce"                                                    },
+       {RING                                   , "Ring"                                                                },
+       {UA_DWL_PROTOCOL                , "UA Download Protocol"                                },
+};
+
+/* Terminal To System Opcodes */
+static const value_string opcodes_vals_term[] =
+{
+       {CS_NOP_ACK                             , "NOP Acknowledge"                                             },
+       {CS_HANDSET_OFFHOOK             , "Handset Offhook"                                             },      /* IP Phone */
+       {CS_HANDSET_ONHOOK              , "Hansdet Onhook"                                              },      /* IP Phone */
+       {CS_DIGIT_DIALED                , "Digital Dialed"                                              },      /* IP Phone */
+       {CS_SUBDEVICE_MSG               , "Subdevice Message"                                   },
+       {CS_HE_ROUTING                  , "HE Routing Response Code"                    },      /* IP Phone - NOT EXPECTED */
+       {CS_LOOPBACK_ON                 , "Loopback On Acknowledge"                             },      /* Same as CS To Terminal */
+       {CS_LOOPBACK_OFF                , "Loopback Off Acknowledge"                    },      /* Same as CS To Terminal */
+       {CS_VIDEO_ROUTING               , "Video Routing Response Code"                 },      /* IP Phone - NOT EXPECTED */
+       {CS_WARMSTART_ACK               , "Warmstart Acknowledge"                               },      /* IP Phone */
+       {CS_SUPER_MSG                   , "Super Message"                                               },      /* IP Phone - NOT EXPECTED */
+       {CS_SEGMENT_MSG                 , "Segment Message"                                             },      /* Same as CS To Terminal */
+       {CS_REMOTE_UA_ROUTING   , "Remote UA Routing Response Code"             },      /* IP Phone - NOT EXPECTED */
+       {CS_VERY_REMOTE_UA_R    , "Very Remote UA Routing Response Code"},      /* IP Phone - NOT EXPECTED */
+       {CS_OSI_ROUTING                 , "OSI Response Code"                                   },      /* IP Phone - NOT EXPECTED */
+       {CS_ABC_A_ROUTING               , "ABC-A Routing Response Code"                 },      /* IP Phone - NOT EXPECTED */
+       {CS_IBS_ROUTING                 , "IBS Routing Response Code"                   },      /* IP Phone - NOT EXPECTED */
+       {CS_IP_DEVICE_ROUTING   , "IP Device Routing"                                   },
+       {CS_SUPER_MSG_2                 , "Super Message 2"                                             },      /* Same as CS To Terminal */
+       {CS_DEBUG_IN_LINE               , "Debug Message"                                               },
+       {CS_UNSOLICITED_MSG             , "Unsolicited Message"                                 },
+       {CS_NON_DIGIT_KEY_PUSHED, "Non-Digit Key Pushed"                                },      /* IP Phone */
+       {CS_VERSION_RESPONSE    , "Version Information"                                 },
+       {CS_I_M_HERE                    , "I'm Here Response"                                   },
+       {CS_RSP_STATUS_INQUIRY  , "Response To Status Inquiry"                  },      /* IP Phone */
+       {CS_SUBDEVICE_STATE             , "Subdevice State Response"                    },
+       {CS_DIGIT_KEY_RELEASED  , "Digit Key Released"                                  },      /* IP Phone */
+       {CS_TRACE_ON_ACK                , "Trace On Acknowledge"                                },      /* IP Phone - NOT EXPECTED */
+       {CS_TRACE_OFF_ACK               , "Trace Off Acknowledge"                               },      /* IP Phone - NOT EXPECTED */
+       {CS_SPECIAL_KEY_STATUS  , "Special Key Status"                                  },      /* IP Phone */
+       {CS_KEY_RELEASED                , "Key Released"                                                },      /* IP Phone */
+       {CS_PERIPHERAL_CONTENT  , "Peripheral Content"                                  },      /* IP Phone - NOT EXPECTED */
+       {CS_TM_KEY_PUSHED               , "TM Key Pushed"                                               },      /* IP Phone - NOT EXPECTED */
+       {CS_UA_DWL_PROTOCOL             , "Download Protocol"                                   },
+       {0, NULL}
+};
+
+static const value_string str_on_off[] = {
+       {0x00, "Off"},
+       {0x01, "On"},
+       {0, NULL}
+};
+static const value_string str_yes_no[] = {
+       {0x00, "No"},
+       {0x01, "Yes"},
+       {0, NULL}
+};
+static const value_string str_device_type[] = {
+       {0x00, "Voice Terminal Adaptor"},
+       {0, NULL}
+};
+
+
+/*-----------------------------------------------------------------------------
+       VERSION NUMBER COMPUTER - This function computes a version number (S.SZ.AB) from a 16 bits number
+       ---------------------------------------------------------------------------*/
+static char *version_number_computer(int hexa_version)
+{
+       static char version[10];
+       int release, vers, fix;
+
+       release = (int)(hexa_version / 10000);
+       vers = (int)((hexa_version % 10000) / 100);
+       fix = (hexa_version % 10000) % 100;
+       g_snprintf(version, 10, "%d.%02d.%02d", release, vers, fix);
+       return version;
+}
+
+
+/*-----------------------------------------------------------------------------
+       Function for UA3G message with opcode and one parameter
+
+       PRODUCTION TEST - 01h (MESSAGE FROM THE SYSTEM)
+       SUBDEVICE RESET - 06h (MESSAGE FROM THE SYSTEM)
+       ARE YOU THERE - 2Bh - IPhone & UA NOE (MESSAGE FROM THE SYSTEM)
+       SET SPEAKER VOLUME - 3Bh (MESSAGE FROM THE SYSTEM)
+       TRACE ON - 42h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_with_one_parameter(proto_tree *tree,
+                                                 tvbuff_t *tvb,
+                                                 packet_info *pinfo,
+                                                 guint offset,
+                                                 guint length,
+                                                 guint8 opcode,
+                                                 proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_first_parameter[] = {
+               {0x01, "Production Test Command"        },
+               {0x06, "Reserved For Compatibility"     },
+               {0x2B, "Temporization"                          },
+               {0x3B, "Volmue"                                         },
+               {0x42, "Subdevice Address"                      },
+               {0, NULL}
+       };
+
+       if(length > 0)
+       {
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+               proto_tree_add_text(ua3g_body_item,
+                       tvb,
+                       offset,
+                       length,
+                       "%s: %d",
+                       val_to_str(opcode, str_first_parameter, "Unknown"), tvb_get_guint8(tvb, offset));
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SUBDEVICE ESCAPE TO SUBDEVICE - 02h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_subdevice_escape(proto_tree *tree,
+                                               tvbuff_t *tvb,
+                                               packet_info *pinfo,
+                                               guint offset,
+                                               guint length,
+                                               guint8 opcode,
+                                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int j = 0;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subdevice Address: %d",
+               (tvb_get_guint8(tvb, offset) & 0x0F));
+       offset++;
+       length--;
+
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subdevice Opcode : 0x%02x",
+               (tvb_get_guint8(tvb, offset) & 0x7F));
+       offset++;
+       length--;
+
+       while(length > 0)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Parameter Byte %2d: %d",
+                       j++, tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SOFTWARE RESET - 03h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_software_reset(proto_tree *tree,
+                                         tvbuff_t *tvb,
+                                         packet_info *pinfo,
+                                         guint offset,
+                                         guint length,
+                                         guint8 opcode,
+                                         proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_verswitch[] = {
+               {0x00, "Reset Without Version Switch"   },
+               {0x01, "Reset With Version Switch"              },
+               {0, NULL}
+       };
+
+       if(length > 0)
+       {
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "%s",
+                       val_to_str(tvb_get_guint8(tvb, offset), str_verswitch, "Unknown"));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       IP-PHONE WARMSTART - 04h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_ip_phone_warmstart(proto_tree *tree,
+                                                 tvbuff_t *tvb,
+                                                 packet_info *pinfo,
+                                                 guint offset,
+                                                 guint length,
+                                                 guint8 opcode,
+                                                 proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int j = 0;
+       static const value_string str_command[] = {
+               {0x00, "Run In UA2G Emulation Mode"     },
+               {0x01, "Run In Full UA3G Mode"          },
+               {0, NULL}
+       };
+
+       if(length > 0)
+       {
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Command: %s",
+                       val_to_str(tvb_get_guint8(tvb, offset), str_command, "Unknown"));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SUPER MESSAGE - 0Bh (MESSAGE FROM THE SYSTEM)
+       SUPER MESSAGE 2 - 17h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_super_msg(proto_tree *tree,
+                                tvbuff_t *tvb,
+                                packet_info *pinfo,
+                                guint offset,
+                                guint length,
+                                guint8 opcode,
+                                proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i, parameter_length;
+       int j = 0;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       while(length > 0)
+       {
+               if(opcode == 0x17)
+               {
+                       parameter_length = tvb_get_ntohs(tvb, offset);
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               2,
+                               "Length %d  : %d",
+                               j++, parameter_length);
+                       offset += 2;
+                       length -= 2;
+               }
+               else
+               {
+                       parameter_length = tvb_get_guint8(tvb, offset);
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Length %d  : %d",
+                               j++, parameter_length);
+                       offset++;
+                       length--;
+               }
+
+               for(i = 1; i <= parameter_length; i++)
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "L%d Byte %2d: %d",
+                               j, i, tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SEGMENT MESSAGE - 0Ch (MESSAGE FROM THE TERMINAL AND FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_segment_msg(proto_tree *tree,
+                                  tvbuff_t *tvb,
+                                  packet_info *pinfo,
+                                  guint offset,
+                                  guint length,
+                                  guint8 opcode,
+                                  proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int first_sub_segment;
+       int j = 0;
+       static const value_string str_first_sub_segment[] = {
+               {0x00, "Subsequent Segment"     },
+               {0x80, "Fisrt Segment"          },
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       first_sub_segment = (tvb_get_guint8(tvb, offset) & 0x80);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "F/S                         : %s (%d)",
+               val_to_str(first_sub_segment, str_first_sub_segment, "Unknown"),
+               first_sub_segment);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Number Of Remaining Segments: %d",
+               (tvb_get_guint8(tvb, offset) & 0x7F));
+       offset++;
+       length--;
+
+       if(first_sub_segment == 0x80)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       2,
+                       "Length                      : %d",
+                       tvb_get_ntohs(tvb, offset));
+               offset += 2;
+               length -= 2;
+       }
+
+       while(length > 0)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Segment Message byte %d      : %d",
+                       j++, tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       IP DEVICE ROUTING - 13h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_ip_device_routing(proto_tree *tree,
+                                                tvbuff_t *tvb,
+                                                packet_info *pinfo,
+                                                guint offset,
+                                                guint length,
+                                                guint8 opcode,
+                                                proto_item *ua3g_item,
+                                                proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+    proto_item *ua3g_param_item;
+    proto_tree *ua3g_param_tree;
+       static char parameter_value[160];
+       static const value_string str_command[] = {
+               {0x00, "Reset"                                  },
+               {0x01, "Start RTP"                              },
+               {0x02, "Stop RTP"                               },
+               {0x03, "Redirect"                               },
+               {0x04, "Tone Definition"                },
+               {0x05, "Start Tone"                             },
+               {0x06, "Stop Tone"                              },
+               {0x07, "Start Listen RTP"               },
+               {0x08, "Stop Listen RTP"                },
+               {0x09, "Get Parameters Value"   },
+               {0x0A, "Set Parameters Value"   },
+               {0x0B, "Send Digit"                             },
+               {0x0C, "Pause RTP"                              },
+               {0x0D, "Restart RTP"                    },
+               {0x0E, "Start Record RTP"               },
+               {0x0F, "Stop Record RTP"                },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_ip,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_command, "Unknown"));
+       offset++;
+       length--;
+
+       switch(command)
+       {
+       case 0x00: /* RESET */
+               {
+                       int i, parameter_id, parameter_length;
+                       static const value_string str_parameter_id[] = {
+                               {0x00, "Update Mode"            },
+                               {0x01, "Bad Sec Mode"           },
+                               {0x02, "Customization Name"     },
+                               {0x03, "Localization Name"      },
+                               {0, NULL}
+                       };
+
+                       if(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x00: /* Update Mode */
+                                               {
+                                                       int i;
+                                                       static const value_string str_update_mode[] = {
+                                                               {0x00, "NOE Update Mode"        },
+                                                               {0x01, "Bootloader"                     },
+                                                               {0x02, "Data"                           },
+                                                               {0x04, "Customization"          },
+                                                               {0x08, "Localization"           },
+                                                               {0x10, "Code"                           },
+                                                               {0x20, "SIP"                            },
+                                                               {0, NULL}
+                                                       };
+                                                       static const value_string str_disable_enable[] = {
+                                                               {0, "Disable"   },
+                                                               {1, "Enable"    },
+                                                               {0, NULL}
+                                                       };
+
+                                                       if((tvb_get_guint8(tvb, offset + 2) & 0x80) == 0x00)
+                                                       {
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "%s: ",
+                                                                       val_to_str(tvb_get_guint8(tvb, offset + 2) & 0x80, str_update_mode, "Unknown"));
+
+                                                               for(i = 0; i < 6; i++)
+                                                               {
+                                                                       char param_value[30];
+                                                                       g_snprintf(param_value, 30,
+                                                                               "%s: %s, ",
+                                                                               val_to_str(0x01 << i, str_update_mode, "Unknown"),
+                                                                               val_to_str((tvb_get_guint8(tvb, offset + 2) >> i) & 0x01, str_disable_enable, ""));
+                                                                       strcat(parameter_value, param_value);
+                                                               }
+                                                       }
+
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "%s",
+                                                                       val_to_str(tvb_get_guint8(tvb, offset + 2) & 0x80, str_update_mode, "Unknown"));
+
+                                                       break;
+                                               }
+                                       case 0x01: /* Bad_Sec_Mode */
+                                               {
+                                                       static const value_string str_bad_sec_mode[] = {
+                                                               {0x01, "Binary is full, CS is secured, but terminal running in clear mode"},
+                                                               {0, NULL}
+                                                       };
+
+                                                       g_snprintf(parameter_value, 160,
+                                                               val_to_str(tvb_get_guint8(tvb, offset + 2), str_bad_sec_mode, "Unknown"));
+                                                       break;
+                                               }
+                                       case 0x02: /* Cust_Name */
+                                               {
+                                                       g_snprintf(parameter_value, 160, "\"");
+                                                       for(i = 1; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[5];
+                                                               if(isprint(tvb_get_guint8(tvb, offset + 1 + i)))
+                                                                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               else
+                                                                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+
+                                                       strcat(parameter_value, "\"");
+                                                       break;
+                                               }
+                                       case 0x03: /* L10N_Name */
+                                               {
+                                                       g_snprintf(parameter_value, 160, "\"");
+                                                       for(i = 1; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[5];
+                                                               if(isprint(tvb_get_guint8(tvb, offset + 1 + i)))
+                                                                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               else
+                                                                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+
+                                                       strcat(parameter_value, "\"");
+                                                       break;
+                                               }
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"));
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x01: /* START RTP */
+               {
+                       int i, parameter_length, parameter_id;
+                       static const value_string str_direction[] = {
+                               {0x00, "Terminal Input"                                                         },
+                               {0x01, "Terminal Output"                                                        },
+                               {0x02, "Terminal Input / Output (Both Direction)"       },
+                               {0, NULL}
+                       };
+                       static const value_string str_parameter_id[] = {
+                               {0x00, "Local UDP Port"                                                                         },
+                               {0x01, "Remote IP Address"                                                                      },
+                               {0x02, "Remote UDP Port"                                                                        },
+                               {0x03, "Type Of Service"                                                                        },
+                               {0x04, "Compressor"                                                                                     },
+                               {0x05, "Payload Concatenation (ms)"                                                     },
+                               {0x06, "Echo Cancelation Enabler"                                                       },
+                               {0x07, "Silence Suppression Enabler"                                            },
+                               {0x08, "802.1 Q User Priority"                                                          },
+                               {0x09, "Reserved"                                                                                       },
+                               {0x0a, "Post Filtering Enabler"                                                         },
+                               {0x0b, "High Pass Filtering Enabler"                                            },
+                               {0x0c, "Remote SSRC"                                                                            },
+                               {0x0d, "Must Send QOS Tickets"                                                          },
+                               {0x0e, "Local Identifier"                                                                       },
+                               {0x0f, "Distant Identifier"                                                                     },
+                               {0x10, "Destination For RTCP Sender Reports - Port Number"      },
+                               {0x11, "Destination For RTCP Sender Reports - IP Address"       },
+                               {0x12, "Destination For RTCP Receiver Reports - Port Number"},
+                               {0x13, "Destination For RTCP Receiver Reports - IP Address"     },
+                               {0x14, "Channel Number"                                                                         },
+                               {0x15, "DTMF Sending"                                                                           },
+                               {0x16, "Payload Type Of Redundancy"                                                     },
+                               {0x17, "Payload Type Of DTMF Events"                                            },
+                               {0x18, "Enable / Disable RFC 2198"                                                      },
+                               {0x31, "SRTP Encryption Enable For This Communication"          },
+                               {0x32, "Master Key For SRTP Session"                                            },
+                               {0x33, "Master Salt Key For SRTP Session"                                       },
+                               {0x34, "Master key for output stream of SRTP session"           },
+                               {0x35, "Master salt key for output stream of SRTP session"      },
+                               {0x36, "Integrity checking enabled for this communication"      },
+                               {0x37, "MKI value for SRTP packets in input stream"                     },
+                               {0x38, "MKI value for SRTP packets in output stream"            },
+                               {0x50, "MD5 Authentication"                                                                     },
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Direction: %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_direction, "Unknown"));
+                       offset++;
+                       length--;
+
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x01: /* Remote IP Address */
+                                       case 0x11: /* Destination For RTCP Sender Reports - IP Address */
+                                       case 0x13: /* Destination For RTCP Receiver Reports - IP Address */
+                                               {
+                                                       if(parameter_length > 0)
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                       for(i = 2; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[50];
+                                                               strcat(parameter_value, ".");
+                                                               g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       break;
+                                               }
+                                       case 0x04: /* Compressor */
+                                               {
+                                                       static const value_string str_compressor[] = {
+                                                               {0x00, "G.711 A-law"            },
+                                                               {0x01, "G.711 mu-law"           },
+                                                               {0x0F, "G.723.1 5.3kbps"        },
+                                                               {0x10, "G.723.1 6.3kbps"        },
+                                                               {0x11, "G.729A 8 kbps"  },
+                                                               {0, NULL}
+                                                       };
+
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_compressor, "Default Codec"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x06: /* Echo Cancelation Enabler */
+                                       case 0x07: /* Silence Suppression Enabler */
+                                       case 0x0A: /* Post Filtering Enabler */
+                                       case 0x0B: /* High Pass Filtering Enabler */
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_on_off, "On"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x0D: /* Must Send QOS Tickets */
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_yes_no, "No"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x0E: /* Local Identifier */
+                                       case 0x0F: /* Distant Identifier */
+                                               {
+                                                       g_snprintf(parameter_value, 160, "\"");
+                                                       for(i = 1; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[5];
+                                                               if(isprint(tvb_get_guint8(tvb, offset + 1 + i)))
+                                                                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               else
+                                                                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       strcat(parameter_value, "\"");
+                                                       break;
+                                               }
+                                       case 0x15: /* DTMF Sending */
+                                               {
+                                                       static const value_string str_dtmf_sending[] = {
+                                                               {0x00, "Don't Send DTMF"        },
+                                                               {0, NULL}
+                                                       };
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_dtmf_sending, "Send DTMF"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x18: /* Enable / Disable RFC 2198 */
+                                               {
+                                                       static const value_string str_enable_00[] = {
+                                                               {0x00, "Enable" },
+                                                               {0, NULL}
+                                                       };
+
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_enable_00, "Disable"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x31: /* SRTP Encryption Enable For This Communication */
+                                               {
+                                                       static const value_string str_enable_10[] = {
+                                                               {0x10, "Enable" },
+                                                               {0, NULL}
+                                                       };
+
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_enable_10, "Disable"));
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       case 0x00: /* Local UDP Port */
+                                       case 0x02: /* Remote UDP Port */
+                                       case 0x03: /* Type Of Service */
+                                       case 0x05: /* Payload Concatenation */
+                                       case 0x08: /* 802.1 Q User Priority */
+                                       case 0x09: /* Reserved */
+                                       case 0x0C: /* Remote SSRC */
+                                       case 0x10: /* Destination For RTCP Sender Reports - Port Number */
+                                       case 0x12: /* Destination For RTCP Receiver Reports - Port Number */
+                                       case 0x14: /* Channel Number */
+                                       case 0x16: /* Payload Type For Redundancy */
+                                       case 0x17: /* Payload Type For DTMF Events */
+                                       case 0x32: /* Master Key For SRTP Session */
+                                       case 0x33: /* Master Salt Key For SRTP Session */
+                                       case 0x34: /* Master key for output stream of SRTP session */
+                                       case 0x35: /* Master salt key for output stream of SRTP session */
+                                       case 0x36: /* Integrity checking enabled for this communication */
+                                       case 0x37: /* MKI value for SRTP packets in input stream */
+                                       case 0x38: /* MKI value for SRTP packets in output stream */
+                                       case 0x50: /* MD5 Authentication */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x02: /* STOP_RTP */
+               {
+                       int i, parameter_id, parameter_length;
+                       static const value_string str_parameter_id[] = {
+                               {0x0E, "Local Identifier"       },
+                               {0x0F, "Distant Identifier"     },
+                               {0x14, "Canal Identifier"       },
+                               {0, NULL}
+                       };
+
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x0E: /* Local Identifer */
+                                       case 0x0F: /* Distant Identifier */
+                                               {
+                                                       g_snprintf(parameter_value, 160, "\"");
+                                                       for(i = 1; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[5];
+                                                               if(isprint(tvb_get_guint8(tvb, offset + 1 + i)))
+                                                                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               else
+                                                                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       strcat(parameter_value, "\"");
+                                                       break;
+                                               }
+                                       case 0x14: /* Canal Identifier */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       break;
+                                               }
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x03: /* REDIRECT */
+               {
+                       int i, parameter_length, parameter_id;
+                       static const value_string str_parameter_id[] = {
+                               {0x00, "Remote MainCPU Server IP Adress"},
+                               {0x01, "Remote MainCPU Server Port"             },
+                               {0, NULL}
+                       };
+
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x00: /* Remote MainCPU Server IP Adress */
+                                               {
+                                                       if(parameter_length > 0)
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                       for(i = 2; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[50];
+                                                               strcat(parameter_value, ".");
+                                                               g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       break;
+                                               }
+                                       case 0x01: /* Remote MainCPU Server Port */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                               }
+                                               break;
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x04: /* DEF_TONES */
+               {
+                       int i, tone_nb_entries;
+                       guint16 frequency_1, frequency_2;
+                       signed char level_1, level_2;
+
+                       tone_nb_entries = tvb_get_guint8(tvb, offset);
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Nomber Of Entries: %d",
+                               tone_nb_entries);
+                       offset++;
+                       length--;
+
+                       while(length > 0)
+                       {
+                               for(i = 1; i <= tone_nb_entries; i++)
+                               {
+                                       frequency_1 = tvb_get_ntohs(tvb, offset);
+                                       level_1 = (signed char)(tvb_get_guint8(tvb, offset + 2)) / 2;
+                                       frequency_2 = tvb_get_ntohs(tvb, offset + 3);
+                                       level_2 = (signed char)(tvb_get_guint8(tvb, offset + 5)) / 2;
+                               
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               6,
+                                               "Tone Pair %d: %d Hz at %d dB / %d Hz at %d dB",
+                                               i, frequency_1, level_1, frequency_2, level_2);
+                                       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               2,
+                                               "Frequency 1: %d Hz",
+                                               frequency_1);
+                                       offset += 2;
+                                       length -= 2;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Level      : %d dB",
+                                               level_1);
+                                       offset++;
+                                       length--;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               2,
+                                               "Frequency 2: %d Hz",
+                                               frequency_2);
+                                       offset += 2;
+                                       length -= 2;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Level      : %d dB",
+                                               level_2);
+                                       offset++;
+                                       length--;
+                               }
+                       }
+                       break;
+               }
+       case 0x05: /* START TONE */
+               {
+                       guint8 i, tone_nb_entries, tone_direction, tone_id;
+/*                     guint8 i, tone_nb_entries, tone_direction, tone_id, tone_duration tone_silence; */
+                       int tone_duration;
+                       static const value_string str_tone_direction[] = {
+                               {0x00, "On The Phone"                                   },
+                               {0x40, "To The Network"                                 },
+                               {0x80, "On The Phone and To The Network"},
+                               {0, NULL}
+                       };
+
+                       tone_direction = tvb_get_guint8(tvb, offset) & 0xC0;
+                       tone_nb_entries = tvb_get_guint8(tvb, offset);
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Direction: %s - Nomber Of Entries: %d",
+                               val_to_str(tone_direction, str_tone_direction, "Unknown"), tone_nb_entries);
+                       offset++;
+                       length--;
+
+                       while(length > 0)
+                       {
+                               for(i = 1; i <= tone_nb_entries; i++)
+                               {
+                                       tone_id = tvb_get_guint8(tvb, offset);
+                                       tone_duration = tvb_get_ntohs(tvb, offset + 1);
+                                       /*tone_duration = tvb_get_guint8(tvb, offset + 1);
+                                       tone_silence = tvb_get_guint8(tvb, offset + 2);*/
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               6,
+                                               "Tone Pair %d: Id: %d, Duration: %d ms",
+/*                                             "Tone Pair %d: Id: %d, Duration: %d ms, Silence: %d ms", */
+                                               i, tone_id, tone_duration);
+/*                                             i, tone_id, tone_duration, tone_silence); */
+                                       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Identification: %d",
+                                               tone_id);
+                                       offset++;
+                                       length--;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               2,
+                                               "Duration      : %d ms",
+                                               tone_duration);
+                                       offset += 2;
+                                       length -= 2;
+
+                                       /*proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Duration      : %d ms",
+                                               tone_duration);
+                                       offset++;
+                                       length--;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Silence       : %d ms",
+                                               tone_silence);
+                                       offset++;
+                                       length--;*/
+                               }
+                       }
+                       break;
+               }
+       case 0x07: /* START LISTEN RTP */
+       case 0x08: /* STOP LISTEN RTP */
+               {
+                       int i, parameter_length, parameter_id;
+                       static const value_string str_parameter_id[] = {
+                               {0x00, "Remote IP Adress     "  },
+                               {0x01, "Remote UDP Port In   "  },
+                               {0x02, "Remote UDP Port Out  "  },
+                               {0x03, "Remote IP Address Out"  },
+                               {0x04, "Canal Number"                   },
+                               {0, NULL}
+                       };
+                       
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x00: /* Remote IP Adress - Not for start listening rtp */
+                                       case 0x03: /* Remote IP Adress Out - Not for start listening rtp */
+                                               {
+                                                       if(parameter_length > 0)
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                       for(i = 2; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[50];
+                                                               strcat(parameter_value, ".");
+                                                               g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       break;
+                                               }
+                                       case 0x01: /* Remote UDP Port In - Not for start listening rtp */
+                                       case 0x02: /* Remote UDP Port Out - Not for start listening rtp */
+                                       case 0x04: /* Canal Number */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                               }
+                                               break;
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x09: /* GET_PARAM_REQ */
+               {
+                       guint8 parameter;
+                       static const value_string str_parameter[] = {
+                               {0x00   , "Firmware Version"            },
+                               {0x01   , "Firmware Version"            },
+                               {0x02   , "DHCP IP Address"                     },
+                               {0x03   , "Local IP Address"            },
+                               {0x04   , "Subnetwork Mask"                     },
+                               {0x05   , "Router IP Address"           },
+                               {0x06   , "TFTP IP Address"                     },
+                               {0x07   , "MainCPU IP Address"          },
+                               {0x08   , "Default Codec"                       },
+                               {0x09   , "Ethernet Drivers Config"     },
+                               {0x0A   , "MAC Address"                         },
+                               {0, NULL}
+                       };
+
+                       while(length > 0)
+                       {
+                               parameter = tvb_get_guint8(tvb, offset);
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%s",
+                                       val_to_str(parameter, str_parameter, "Unknown"));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x0A: /* SET_PARAM_REQ */
+               {
+                       int i, parameter_id, parameter_length;
+                       static const value_string str_parameter_id[] = {
+                               {0x00   , "QOS IP TOS"                                                  },
+                               {0x01   , "QOS 8021 VLID"                                               },
+                               {0x02   , "QOS 8021 PRI"                                                },
+                               {0x03   , "SNMP MIB2 SysContact"                                },
+                               {0x04   , "SNMP MIB2 SysName"                                   },
+                               {0x05   , "SNMP MIB2 SysLocation"                               },
+                               {0x06   , "Default Compressor"                                  },
+                               {0x07   , "Error String Net Down"                               },
+                               {0x08   , "Error String Cable PB"                               },
+                               {0x09   , "Error String Try Connect"                    },
+                               {0x0A   , "Error String Connected"                              },
+                               {0x0B   , "Error String Reset"                                  },
+                               {0x0C   , "Error String Duplicate IP Address"   },
+                               {0x0D   , "SNMP MIB Community"                                  },
+                               {0x0E   , "TFTP Backup Sec Mode"                                },
+                               {0x0F   , "TFTP Backup IP Address"                              },
+                               {0x10   , "Set MMI Password"                                    },
+                               {0x11   , "Set PC Port Status"                                  },
+                               {0x12   , "Record RTP Authorization"                    },
+                               {0x13   , "Security Flags"                                              },
+                               {0x14   , "ARP Spoofing"                                                },
+                               {0x15   , "Session Param"                                               },
+                               {0x30   , "MD5 Authentication"                                  },
+                               {0, NULL}
+                       };
+
+                       while(length > 0)
+                       {
+                               guint64 param_value = 0;
+
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x06: /* Compressor */
+                                               {
+                                                       static const value_string str_compressor[] = {
+                                                               {0x00, "G.711 A-law"            },
+                                                               {0x01, "G.711 mu-law"           },
+                                                               {0x0F, "G.723.1 5.3kbps"        },
+                                                               {0x10, "G.723.1 6.3kbps"        },
+                                                               {0x11, "G.729A 8 kbps"  },
+                                                               {0, NULL}
+                                                       };
+
+                                                       g_snprintf(parameter_value, 160, val_to_str(tvb_get_guint8(tvb, offset + 2),
+                                                               str_compressor,
+                                                               "Default Codec"));
+                                                       break;
+                                               }
+                                       case 0x07: /* ERR STRING NET DOWN */
+                                       case 0x08: /* ERR STRING CABLE PB */
+                                       case 0x09: /* ERR STRING TRY CONNECT */
+                                       case 0x0A: /* ERR STRING CONNECTED */
+                                       case 0x0B: /* ERR STRING RESET */
+                                       case 0x0C: /* ERR STRING DUPLICATE IP ADDRESS */
+                                               {
+                                                       g_snprintf(parameter_value, 160, "\"");
+                                                       for(i = 1; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[5];
+                                                               if(isprint(tvb_get_guint8(tvb, offset + 1 + i)))
+                                                                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               else
+                                                                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       strcat(parameter_value, "\"");
+                                                       break;
+                                               }
+                                       case 0x0F: /* TFTP BACKUP IP ADDR */
+                                               {
+                                                       if(parameter_length > 0)
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                       for(i = 2; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[50];
+                                                               strcat(parameter_value, ".");
+                                                               g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       break;
+                                               }
+                                       case 0x11: /* Set PC Port status */
+                                               {
+                                                       static const value_string str_set_pc_port_status[] = {
+                                                               {0x00, "No PC Port Security"},
+                                                               {0x01, "Block PC Port"          },
+                                                               {0x02, "Filter VLAN"            },
+                                                               {0, NULL}
+                                                       };
+                                                       g_snprintf(parameter_value, 160, val_to_str(tvb_get_guint8(tvb, offset + 2),
+                                                               str_set_pc_port_status,
+                                                               "Unknown"));
+                                                       break;
+                                               }
+                                       case 0x12: /* Record RTP Authorization */
+                                               {
+                                                       static const value_string str_enable_feature[] = {
+                                                               {0x00, "Disable Feature"},
+                                                               {0x01, "Enable Feature" },
+                                                               {0, NULL}
+                                                       };
+
+                                                       g_snprintf(parameter_value, 160, val_to_str(tvb_get_guint8(tvb, offset + 2),
+                                                               str_enable_feature,
+                                                               "Unknown"));
+                                                       break;
+                                               }
+                                       case 0x13: /* Security Flags */
+                                               {
+                                                       static const value_string str_set_pc_port_status[] = {
+                                                               {0x00, "Filtering Not Active"   },
+                                                               {0x01, "Filtering Activated"    },
+                                                               {0, NULL}
+                                                       };
+                                                       g_snprintf(parameter_value, 160, val_to_str((tvb_get_guint8(tvb, offset + 2) & 0x01),
+                                                               str_set_pc_port_status,
+                                                               "Unknown"));
+                                                       break;
+                                               }
+                                       case 0x00: /* QOS IP TOS */
+                                       case 0x01: /* QOS 8021 VLID */
+                                       case 0x02: /* QOS 8021 PRI */
+                                       case 0x03: /* SNMP MIB2 SYSCONTACT */
+                                       case 0x04: /* SNMP MIB2 SYSNAME */
+                                       case 0x05: /* SNMP MIB2 SYSLOCATION */
+                                       case 0x0D: /* SNMP MIB COMMUNITY */
+                                       case 0x0E: /* TFTP BACKUP SEC MODE */
+                                       case 0x10: /* SET MMI PASSWORD */
+                                       case 0x14: /* ARP Spoofing */
+                                       case 0x15: /* Session Param */
+                                       case 0x30: /* MD5 Authentication */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else if(parameter_length > 8)
+                                                       {
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       }
+                                                       break;
+                                               }
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x0B: /* SEND_DIGIT */
+               {
+                       static const value_string str_digit[] = {
+                               {0, "0"         },
+                               {1, "1"         },
+                               {2, "2"         },
+                               {3, "3"         },
+                               {4, "4"         },
+                               {5, "5"         },
+                               {6, "6"         },
+                               {7, "7"         },
+                               {8, "8"         },
+                               {9, "9"         },
+                               {10, "*"        },
+                               {11, "#"        },
+                               {12, "A"        },
+                               {13, "B"        },
+                               {14, "C"        },
+                               {15, "D"        },
+                               {16, "Flash"},
+                               {0, NULL}
+                       };
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Digit Value: %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_digit, "Unknown"));
+               break;
+               }
+       case 0x0C: /* PAUSE_RTP */
+       case 0x0D: /* RESTART_RTP */
+               {
+                       int i, parameter_length, parameter_id;
+                       static const value_string str_parameter_id[] = {
+                               {0x14, "Canal Identifier"},
+                               {0, NULL}
+                       };
+                       
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                       {
+                                               guint64 param_value = 0;
+
+                                               for(i = parameter_length; i > 0; i--)
+                                               {
+                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                               }
+                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                       }
+                                       else
+                                               g_snprintf(parameter_value, 160,
+                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                       tvb_get_guint8(tvb, offset + 2),
+                                                       tvb_get_guint8(tvb, offset + 3),
+                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x0E: /* START_RECORD_RTP */
+       case 0x0F: /* STOP RECORD RTP */
+               {
+                       int i, parameter_length, parameter_id;
+                       static const value_string str_parameter_id[] = {
+                               {0x00   , "Recorder Index"                                      },
+                               {0x01   , "Remote IP Address"                           },
+                               {0x02   , "Remote UDP Port In"                          },
+                               {0x03   , "Remote UDP Port Out"                         },
+                               {0x04   , "Remote IP Address Out"                       },
+                               {0x05   , "Local UDP Port In"                           },
+                               {0x06   , "Local UDP Port Out"                          },
+                               {0x07   , "Type Of Service"                                     },
+                               {0x08   , "Master Key For SRTP Session"         },
+                               {0x09   , "Master Salt Key For SRTP Session"},
+                               {0x30   , "MD5 Authentication"                          },
+                               {0, NULL}
+                       };
+                       
+                       while(length > 0)
+                       {
+                               parameter_id = tvb_get_guint8(tvb, offset);
+                               parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                               if(parameter_length > 0)
+                               {
+                                       switch(parameter_id)
+                                       {
+                                       case 0x01: /* Remote IP Address */
+                                       case 0x04: /* Remote IP Address Out */
+                                               {
+                                                       if(parameter_length > 0)
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                       for(i = 2; i <= parameter_length; i++)
+                                                       {
+                                                               char param_value[50];
+                                                               strcat(parameter_value, ".");
+                                                               g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                               strcat(parameter_value, param_value);
+                                                       }
+                                                       break;
+                                               }
+                                       case 0x00: /* Recorder Index */
+                                       case 0x02: /* Remote UDP Port In */
+                                       case 0x03: /* Remote UDP Port Out */
+                                       case 0x05: /* Local UDP Port In */
+                                       case 0x06: /* Local UDP Port Out */
+                                       case 0x07: /* Type Of Service */
+                                       case 0x08: /* Master Key For SRTP Session */
+                                       case 0x09: /* Master Salt Key For SRTP Session */
+                                       case 0x30: /* MD5 Authentication */
+                                       default:
+                                               {
+                                                       if((parameter_length > 0) && (parameter_length <= 8))
+                                                       {
+                                                               guint64 param_value = 0;
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                       }
+                                                       else
+                                                               g_snprintf(parameter_value, 160,
+                                                                       "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                       tvb_get_guint8(tvb, offset + 2),
+                                                                       tvb_get_guint8(tvb, offset + 3),
+                                                                       tvb_get_guint8(tvb, offset + parameter_length),
+                                                                       tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                               }
+                                               break;
+                                       }
+
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s: %s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                               }
+                               else
+                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length + 2,
+                                               "%s",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Parameter: %s (0x%02x)",
+                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Length   : %d",
+                                       parameter_length);
+                               offset++;
+                               length--;
+
+                               if(parameter_length > 0)
+                               {
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               parameter_length,
+                                               "Value    : %s",
+                                               parameter_value);
+                                       offset += parameter_length;
+                                       length -= parameter_length;
+                               }
+                       }
+                       break;
+               }
+       case 0x06: /* STOP TONE */
+       default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       DEBUG IN LINE - 18h (MESSAGE FROM THE TERMINAL AND FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_debug_in_line(proto_tree *tree,
+                       tvbuff_t *tvb,
+                       packet_info *pinfo,
+                       guint offset,
+                       guint length,
+                       guint8 opcode,
+                       proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i, parameter_length;
+       char parameter_value[100];
+
+       parameter_length = length;
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       g_snprintf(parameter_value, 160, "\"");
+       for(i = 0; i < parameter_length; i++)
+       {
+               char param_value[5];
+               if(isprint(tvb_get_guint8(tvb, offset + i)))
+                       g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + i));
+               else
+                       g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + i));
+               strcat(parameter_value, param_value);
+       }
+       strcat(parameter_value, "\"");
+
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               length,
+               "Text String With Debug: %s",
+               parameter_value);
+}
+
+
+/*-----------------------------------------------------------------------------
+       LED COMMAND - 21h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_led_command(proto_tree *tree,
+                                  tvbuff_t *tvb,
+                                  packet_info *pinfo,
+                                  guint offset,
+                                  guint length,
+                                  guint8 opcode,
+                                  proto_item *ua3g_item,
+                                  proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int command = tvb_get_guint8(tvb, offset);
+       static const value_string str_command[] = {
+               {0x00, "Led Off"                                },
+               {0x01, "Led On"                                 },
+               {0x02, "Red Led Fast Flash"             },
+               {0x03, "Red Led Slow Flash"             },
+               {0x04, "Green Led On"                   },
+               {0x05, "Green Led Fast Flash"   },
+               {0x06, "Green Led Slow Flash"   },
+               {0x07, "All Led Off"                    },
+               {0, NULL}
+       };
+       
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               "s - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command   : %s",
+               val_to_str(command, str_command, "Unknown"));
+       offset++;
+       length--;
+
+       if(command != 0x07)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Led Number: %d",
+                       tvb_get_guint8(tvb, offset));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       LCD LINE 1 COMMANDS - 27h (MESSAGE FROM THE SYSTEM)
+       LCD LINE 2 COMMANDS - 28h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_lcd_line_cmd(proto_tree *tree,
+                                       tvbuff_t *tvb,
+                                       packet_info *pinfo,
+                                       guint offset,
+                                       guint length,
+                                       guint8 opcode,
+                                       proto_item *ua3g_item,
+                                       proto_item *ua3g_body_item)
+{
+       guint8 i, lcd_options, command, column_n;
+    proto_tree *ua3g_body_tree;
+    proto_item *ua3g_param_item;
+    proto_tree *ua3g_param_tree;
+    proto_item *ua3g_option_item;
+    proto_tree *ua3g_option_tree;
+       static char str_ascii[40];
+       static char lcd_options_tab[6];
+       static const value_string str_command[] = {
+               {0, "Clear Line & Write From Column"},
+               {1, "Write From Column"                         },
+               {2, "Append To Current Line"            },
+               {0, NULL}
+       };
+       static const value_string str_enable_disable[] = {
+               {0, "Disable"   },
+               {0, NULL}
+       };
+       static const value_string str_lcd_option[] = {
+               {7, "Suspend Display Refresh"   },
+               {6, "Time Of Day Display    "   },
+               {5, "Call Timer Display     "   },
+               {4, "Call Timer Control     "   },
+               {2, "Blink                  "   },
+               {0, NULL}
+       };
+       static const value_string str_call_timer_ctrl[] = {
+               {0x00, "Call Timer Status Not Changed"                  },
+               {0x08, "Stop Call Timer"                                                },
+               {0x10, "Start Call Timer From Current Value"    },
+               {0x18, "Initialize And Call Timer"                              },
+               {0, NULL}
+       };
+
+       lcd_options = tvb_get_guint8(tvb, offset) & 0xFC;
+       command = tvb_get_guint8(tvb, offset) & 0x03;
+       column_n = tvb_get_guint8(tvb, offset + 1);
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s %d",
+               val_to_str(command, str_command, "Unknown"),
+               column_n);
+       proto_item_append_text(ua3g_body_item,
+               " %s %d",
+               val_to_str(command, str_command, "Unknown"),
+               column_n);
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s %d",
+               val_to_str(command, str_command, "Unknown"),
+               column_n);
+       
+       g_snprintf(str_ascii, 40, "\"");
+       for(i = 0; i < length - 2; i++)
+       {
+               char ascii_value[5];
+               if(isprint(tvb_get_guint8(tvb, offset + 2 + i)))
+                       g_snprintf(str_ascii, 40, "%c", tvb_get_guint8(tvb, offset + 2 + i));
+               else
+                       g_snprintf(str_ascii, 40, "'0x%02x'", tvb_get_guint8(tvb, offset + 2 + i));
+               strcat(str_ascii, ascii_value);
+       }
+       strcat(str_ascii, "\"");
+
+       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               length,
+               "%s %d: %s",
+               val_to_str(command, str_command, "Unknown"), column_n, str_ascii);
+       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command        : %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_option_item = proto_tree_add_text(ua3g_param_tree,
+               tvb,
+               offset,
+               1,
+               "LCD Options    : 0x%x",
+               lcd_options);
+       ua3g_option_tree = proto_item_add_subtree(ua3g_option_item, ett_ua3g_option);
+
+       for(i = 2; i <= 7; i++)
+       {
+               int shift_value = 1 << i;
+               if(i != 3)
+               {
+                       proto_tree_add_text(ua3g_option_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "%s: %s",
+                               val_to_str(i, str_lcd_option, "Unknown"),
+                               val_to_str((tvb_get_guint8(tvb, offset) & shift_value), str_enable_disable, "Enable"));
+               }
+               else
+               {
+                       i++;
+                       proto_tree_add_text(ua3g_option_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "%s: %s",
+                               val_to_str(i, str_lcd_option, "Unknown"),
+                               val_to_str((tvb_get_guint8(tvb, offset) & 0x18), str_call_timer_ctrl, "Unknown"));
+               }
+       }
+       offset++;
+       length--;
+
+       if(command != 3)
+               proto_tree_add_text(ua3g_param_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Starting Column: %d",
+                       column_n);
+       else
+               proto_tree_add_text(ua3g_param_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Unused");
+
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_param_tree,
+               tvb,
+               offset,
+               length,
+               "ASCII Char     : %s",
+               str_ascii);
+}
+
+
+/*-----------------------------------------------------------------------------
+       MAIN VOICE MODE - 29h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_main_voice_mode(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length,
+                                          guint8 opcode,
+                                          proto_item *ua3g_item,
+                                          proto_item *ua3g_body_item)
+{
+       guint8 mode = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_voice_mode[] = {
+               {0x00, "Idle"                                   },
+               {0x01, "Handset"                                },
+               {0x02, "Group Listening"                },
+               {0x03, "On Hook Dial"                   },
+               {0x04, "Handsfree"                              },
+               {0x05, "Announce Loudspeaker"   },
+               {0x06, "Ringing"                                },
+               {0x10, "Idle"                                   },
+               {0x11, "Handset"                                },
+               {0x12, "Headset"                                },
+               {0x13, "Handsfree"                              },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(mode, str_voice_mode, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(mode, str_voice_mode, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(mode, str_voice_mode, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               mode,
+               "Voice Mode       : %s",
+               val_to_str(mode, str_voice_mode, "Unknown"));
+       offset++;
+       length--;
+
+       switch(mode)
+       {
+       case 0x06: /* Ringing */
+               {
+                       static const value_string str_cadence[] = {
+                               {0x00, "Standard Ringing"                       },
+                               {0x01, "Double Burst"                           },
+                               {0x02, "Triple Burst"                           },
+                               {0x03, "Continuous Ringing"                     },
+                               {0x04, "Priority Attendant Ringing"     },
+                               {0x05, "Regular Attendant Ringing"      },
+                               {0x06, "Programmable Cadence"           },
+                               {0x07, "Programmable Cadence"           },
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Tune             : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Cadence          : %s (%d)",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_cadence, "Unknown"),
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+               }
+       case 0x02: /* Group Listening */
+       case 0x03: /* On Hook Dial */
+       case 0x04: /* Handsfree */
+       case 0x05: /* Announce Loudspeaker */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Speaker Volume   : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+
+                       if(length > 0)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Microphone Volume: %d",
+                                       tvb_get_guint8(tvb, offset));
+                       }
+                       break;
+               }
+       case 0x11: /* Handset */
+       case 0x12: /* Headset */
+       case 0x13: /* Handsfree */
+               {
+                       signed char level;
+                       static const value_string str_receiving_level[] = {
+                               {0x11, "Receiving Level "},
+                               {0x12, "Receiving Level "},
+                               {0x13, "Speaker Level   "},
+                               {0, NULL}
+                       };
+
+                       level = (signed char)(tvb_get_guint8(tvb, offset)) / 2;
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "%s : %d dB",
+                               val_to_str(mode, str_receiving_level, "Unknown"), level);
+                       offset++;
+                       length--;
+
+                       level = (signed char)(tvb_get_guint8(tvb, offset)) / 2;
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Sending Level   : %d dB",
+                               level);
+                       break;
+               }
+       case 0x00: /* Idle */
+       case 0x01: /* Handset */
+       case 0x10: /* Idle */
+       default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SUBDEVICE METASTATE - 2Ch (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_subdevice_metastate(proto_tree *tree,
+                                                  tvbuff_t *tvb,
+                                                  packet_info *pinfo,
+                                                  guint offset,
+                                                  guint length,
+                                                  guint8 opcode,
+                                                  proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_new_metastate[] = {
+               {0x00, "Disable"},
+               {0x01, "Active" },
+               {0x02, "Wake Up"},
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subchannel Address: %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "New Metastate     : %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_new_metastate, "Unknown"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       Download DTMF & CLOCK FORMAT - 30h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_dwl_dtmf_clck_format(proto_tree *tree,
+                                                       tvbuff_t *tvb,
+                                                       packet_info *pinfo,
+                                                       guint offset,
+                                                       guint length,
+                                                       guint8 opcode,
+                                                       proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_clock_format[] = {
+               {0, "Europe"},
+               {1, "US"        },
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Minimum 'ON' Time      : %d ms",
+               (tvb_get_guint8(tvb, offset) * 10));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Inter-Digit Pause Time : %d ms",
+               (tvb_get_guint8(tvb, offset) * 10));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Clock Time Format      : %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_clock_format, "Unknown"));
+       offset++;
+       length--;
+
+       if(length > 0)
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "DTMF Country Adaptation: %d",
+                       tvb_get_guint8(tvb, offset));
+}
+
+
+/*-----------------------------------------------------------------------------
+       SET CLOCK - 31h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_set_clck(proto_tree *tree,
+                               tvbuff_t *tvb,
+                               packet_info *pinfo,
+                               guint offset,
+                               guint length,
+                               guint8 opcode,
+                               proto_item *ua3g_item,
+                               proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+    proto_item *ua3g_param_item;
+    proto_tree *ua3g_param_tree;
+       int hour, minute, second, call_timer;
+       static const value_string str_command[] = {
+               {0x00, "Set Current Time/Call Timer"    },
+               {0x01, "Set Current Time"                               },
+               {0x02, "Set Call Timer"                                 },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_command, "Unknown"));
+       offset++;
+       length--;
+       call_timer = 0;
+
+       switch(command)
+       {
+       case 0x02: /* Timer Form */
+               {
+                       call_timer = 1;
+               }
+       case 0x00: /* Set Current Time/Call Timer */
+       case 0x01: /* Set Current Time */
+               {
+                       static const value_string str_call_timer[] = {
+                               {1, "Call Timer "},
+                               {0, NULL}
+                       };
+
+                       while(length > 0)
+                       {
+                               hour = tvb_get_guint8(tvb, offset);
+                               minute = tvb_get_guint8(tvb, offset + 1);
+                               second = tvb_get_guint8(tvb, offset + 2);
+
+                               ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       3,
+                                       "%s: %d:%d:%d",
+                                       val_to_str(call_timer, str_call_timer, "Current Time"), hour, minute, second);
+                               ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%sHour  : %d",
+                                       val_to_str(call_timer, str_call_timer, ""), hour);
+                               offset++;
+                               length--;
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%sMinute: %d",
+                                       val_to_str(call_timer, str_call_timer, ""), minute);
+                               offset++;
+                               length--;
+                               proto_tree_add_text(ua3g_param_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%sSecond: %d",
+                                       val_to_str(call_timer, str_call_timer, ""), second);
+                               offset++;
+                               length--;
+
+                               call_timer = 1;
+                       }
+               }
+       default:
+               {
+                       break;
+               }
+       }
+
+}
+
+
+/*-----------------------------------------------------------------------------
+       VOICE CHANNEL - 32h - (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_voice_channel(proto_tree *tree,
+                                        tvbuff_t *tvb,
+                                        packet_info *pinfo,
+                                        guint offset,
+                                        guint length,
+                                        guint8 opcode,
+                                        proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_v[] = {
+               {0x00, "Normal Voice Channel Mode"      },
+               {0x01, "Write 00 to Voice Channel"      },
+               {0, NULL}
+       };
+       static const value_string str_c[] = {
+               {0x00, "Normal Codec Operation" },
+               {0x02, "Write Quiet To Codec"   },
+               {0, NULL}
+       };
+       static const value_string str_b[] = {
+               {0x00, "Use B1 As Voice Channel"},
+               {0x04, "Use B3 As Voice Channel"},
+               {0, NULL}
+       };
+       static const value_string str_voice_channel[] = {
+               {0x00, "No"},
+               {0x01, "B1"},
+               {0x02, "B2"},
+               {0x03, "B3"},
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       if(length == 1)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "%s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_v, "Unknown"));
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "%s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_c, "Unknown"));
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "%s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x04), str_b, "Unknown"));
+               offset++;
+               length--;
+       }
+
+       else if(length == 2)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Main Voice: %s",
+                       val_to_str(tvb_get_guint8(tvb, offset), str_voice_channel, "Unknown"));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Announce  : %s",
+                       val_to_str(tvb_get_guint8(tvb, offset), str_voice_channel, "Unknown"));
+               offset++;
+               length--;
+       }
+
+       else if(length == 4)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "B General     : %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "B Loud Speaker: %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "B Ear Piece   : %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "B Microphones : %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       EXTERNAL RINGING - 33h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_external_ringing(proto_tree *tree,
+                                               tvbuff_t *tvb,
+                                               packet_info *pinfo,
+                                               guint offset,
+                                               guint length,
+                                               guint8 opcode,
+                                               proto_item *ua3g_item,
+                                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_ext_ring_cmd[] = {
+               {0x00, "Turn Off"                                       },
+               {0x01, "Turn On"                                        },
+               {0x02, "Follow The Normal Ringing"      },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_ext_ring_cmd, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_ext_ring_cmd, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_ext_ring_cmd, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               tvb_get_guint8(tvb, offset),
+               "External Ringing Command: %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_ext_ring_cmd, "Unknown"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       LCD CURSOR - 35h - (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_lcd_cursor(proto_tree *tree,
+                                 tvbuff_t *tvb,
+                                 packet_info *pinfo,
+                                 guint offset,
+                                 guint length,
+                                 guint8 opcode,
+                                 proto_item *ua3g_item,
+                                 proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str((tvb_get_guint8(tvb, offset + 1) & 0x02), str_on_off, "On"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str((tvb_get_guint8(tvb, offset + 1) & 0x02), str_on_off, "On"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str((tvb_get_guint8(tvb, offset + 1) & 0x02), str_on_off, "On"));
+
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Line Number: %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               tvb_get_guint8(tvb, offset),
+               "Cursor %s",
+               val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_on_off, "On"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       DOWNLOAD SPECIAL CHARACTER - 36h - (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_dwl_special_char(proto_tree *tree,
+                                               tvbuff_t *tvb,
+                                               packet_info *pinfo,
+                                               guint offset,
+                                               guint length,
+                                               guint8 opcode,
+                                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i, j;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       while(length > 0)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Character Number: %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               for(i = 1; i <= 8; i++)
+               {
+                       int byte = tvb_get_guint8(tvb, offset);
+                       char byte_char[20] = "  ";
+
+                       /* The following loop will draw a picture of the character with "spaces" and "o" */
+                       for(j = 7; j >= 0; j--)
+                       {
+                               if(((byte >> j) & 0x01) == 0)
+                                       strcat(byte_char, "  ");
+                               else
+                                       strcat(byte_char, "o ");
+                       }
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Byte %d: 0x%02x   %s",
+                               i, byte, byte_char);
+                       offset++;
+                       length--;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SET CLOCK/TIMER POSITION - 38h - (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_set_clck_timer_pos(proto_tree *tree,
+                                                 tvbuff_t *tvb,
+                                                 packet_info *pinfo,
+                                                 guint offset,
+                                                 guint length,
+                                                 guint8 opcode,
+                                                 proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Clock Line Number       : %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Clock Column Number     : %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Call Timer Line Number  : %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Call Timer Column Number: %d",
+               tvb_get_guint8(tvb, offset));
+}
+
+
+/*-----------------------------------------------------------------------------
+       SET LCD CONTRAST - 39h - (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_set_lcd_contrast(proto_tree *tree,
+                                               tvbuff_t *tvb,
+                                               packet_info *pinfo,
+                                               guint offset,
+                                               guint length,
+                                               guint8 opcode,
+                                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_driver_number[] = {
+               {0x00, "Display"},
+               {0x01, "Icon"   },
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Driver Number : %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_driver_number, "Unknown"));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Contrast Value: %d",
+               tvb_get_guint8(tvb, offset));
+}
+
+
+/*-----------------------------------------------------------------------------
+       BEEP - 3Ch (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_beep(proto_tree *tree,
+                       tvbuff_t *tvb,
+                       packet_info *pinfo,
+                       guint offset,
+                       guint length,
+                       guint8 opcode,
+                       proto_item *ua3g_item,
+                       proto_item *ua3g_body_item)
+{
+       if(length > 0) /* All cases except classical beep */
+       {
+               guint8 command = tvb_get_guint8(tvb, offset);
+               proto_tree *ua3g_body_tree;
+               static const value_string str_command[] = {
+                       {0x01, "Beep Once"      },
+                       {0x02, "Beep Start"     },
+                       {0x03, "Stop Beep"      },
+                       {0x04, "Start Beep"     },
+                       {0x05, "Define Beep"},
+                       {0, NULL}
+               };
+
+               /* add text to the frame tree */
+               proto_item_append_text(ua3g_item,
+                       ", %s",
+                       val_to_str(command, str_command, "Unknown"));
+               proto_item_append_text(ua3g_body_item,
+                       " - %s",
+                       val_to_str(command, str_command, "Unknown"));
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+               /* add text to the frame "INFO" column */
+               if (check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+                       val_to_str(command, str_command, "Unknown"));
+
+               proto_tree_add_uint_format(ua3g_body_tree,
+                       hf_ua3g_command,
+                       tvb,
+                       offset,
+                       1,
+                       command,
+                       "Beep           : %s",
+                       val_to_str(command, str_command, "Unknown"));
+               offset++;
+               length--;
+
+               switch(command)
+               {
+               case 0x01: /* Beep Once */
+               case 0x02: /* Beep Start */
+                       {
+                               int i =  0;
+                               static const value_string str_destination[] = {
+                                       {0x01, "Ear-Piece"                                      },
+                                       {0x02, "Loudspeaker"                            },
+                                       {0x02, "Ear-Piece and Loudspeaker"      },
+                                       {0, NULL}
+                               };
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Destination    : %s",
+                                       val_to_str(tvb_get_guint8(tvb, offset), str_destination, "Unknown"));
+                               offset++;
+                               length--;
+
+                               while(length > 0)
+                               {
+                                       i++;
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "On / Off       : %s",
+                                               val_to_str((tvb_get_guint8(tvb, offset) & 0x80), str_on_off, "On"));
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Cadence T%d     : %d ms",
+                                               i, ((tvb_get_guint8(tvb, offset) & 0x7F) * 10));
+                                       offset++;
+                                       length--;
+                               }
+                               break;
+                       }
+               case 0x04: /* Start Beep */
+                       {
+                               int i;
+                               char char_destination[50];
+                               static const value_string str_destination[] = {
+                                       {0x01, "Handset"                                },
+                                       {0x02, "Headset"                                },
+                                       {0x04, "Loudspeaker"                    },
+                                       {0x08, "Announce Loudspeaker"   },
+                                       {0x10, "Handsfree"                              },
+                                       {0, NULL}
+                               };
+
+                               g_snprintf(char_destination, 50,
+                                       "%s",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_destination, ""));
+                               for(i = 1; i < 5; i++)
+                               {
+                                       strcat(char_destination,
+                                               val_to_str((tvb_get_guint8(tvb, offset) & (0x01 << i)), str_destination, ""));
+                               }
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Destination    : %s",
+                                       char_destination);
+                               offset++;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Beep Number    : %x",
+                                       tvb_get_guint8(tvb, offset));
+                               break;
+                       }
+               case 0x05:
+                       {
+                               int i, nb_of_notes, beep_number;
+                               static const value_string str_freq_sample_nb[] = {
+                                       {0x00, "Frequency"                      },
+                                       {0xFF, "Audio Sample Number"},
+                                       {0, NULL}
+                               };
+                               static const value_string str_duration[] = {
+                                       {0x00, "Duration "                      },
+                                       {0xFF, "Duration (Ignored)"     },
+                                       {0, NULL}
+                               };
+                               static const value_string str_terminator[] = {
+                                       {0xFD, "Stop"           },
+                                       {0xFE, "Loop"           },
+                                       {0xFF, "Infinite"       },
+                                       {0, NULL}
+                               };
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Beep Number    : %x",
+                                       beep_number = tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+
+                               if(beep_number <= 0x44)
+                                       beep_number = 0x00;
+                               else beep_number = 0xFF;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Number Of Notes: %x",
+                                       nb_of_notes = tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+
+                               while(length > 0)
+                               {
+                                       for(i = 1; i <= nb_of_notes; i++)
+                                       {
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "%s %d    : %d",
+                                                       val_to_str(beep_number, str_freq_sample_nb, "Unknown"),
+                                                       i, tvb_get_guint8(tvb, offset));
+                                               offset++;
+                                               length--;
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Level %d        : %d",
+                                                       i, tvb_get_guint8(tvb, offset));
+                                               offset++;
+                                               length--;
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "%s %d    : %x",
+                                                       val_to_str(beep_number, str_duration, "Unknown"),
+                                                       i, tvb_get_guint8(tvb, offset));
+                                               offset++;
+                                               length--;
+                                       }
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Terminator     : %d (%s)",
+                                               tvb_get_guint8(tvb, offset),
+                                               val_to_str(tvb_get_guint8(tvb, offset), str_terminator, "Unknown"));
+                                       offset++;
+                                       length--;
+                               }
+                               break;
+                       }
+               case 0x03: /* Stop Beep */
+               default:
+                       {
+                               break;
+                       }
+               }
+       }
+       else /* Classical Beep */
+       {
+               /* add text to the frame tree */
+               proto_item_append_text(ua3g_item,
+                       ", Classical Beep");
+               proto_item_append_text(ua3g_body_item,
+                       " - Classical Beep",
+                       val_to_str(opcode, opcodes_vals, "Unknown"));
+
+               /* add text to the frame "INFO" column */
+               if (check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, ": Classical Beep");
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SIDETONE ON / OFF - 3Dh (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_sidetone(proto_tree *tree,
+                               tvbuff_t *tvb,
+                               packet_info *pinfo,
+                               guint offset,
+                               guint length,
+                               guint8 opcode,
+                               proto_item *ua3g_item,
+                               proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_on_off, "On"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_on_off, "On"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_on_off, "On"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_on_off, "On"));
+       offset++;
+
+       if(command == 0x01)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Level  : %d dB",
+                       (signed char)(tvb_get_guint8(tvb, offset) / 2));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SET PROGRAMMABLE RINGING CADENCE - 3Eh (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_ringing_cadence(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length,
+                                          guint8 opcode,
+                                          proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i = 0;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Cadence: %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+
+       while(length > 0)
+       {
+               i++;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "On / Off       : %s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x80), str_on_off, "On"));
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Length %d      : %d ms",
+                       i, ((tvb_get_guint8(tvb, offset) & 0x7F) * 10));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       MUTE ON / OFF - 3Fh (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_mute(proto_tree *tree,
+                       tvbuff_t *tvb,
+                       packet_info *pinfo,
+                       guint offset,
+                       guint length,
+                       guint8 opcode,
+                       proto_item *ua3g_item,
+                       proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_mute[] = {
+               {0x00, "Microphone Disable"     },
+               {0x01, "Microphone Enable"      },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_mute, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_mute, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_mute, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "%s",
+               val_to_str(command, str_mute, "Unknown"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       FEEDBACK ON / OFF - 40h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_feedback(proto_tree *tree,
+                               tvbuff_t *tvb,
+                               packet_info *pinfo,
+                               guint offset,
+                               guint length,
+                               guint8 opcode,
+                               proto_item *ua3g_item,
+                               proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_on_off, "On"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_on_off, "On"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_on_off, "On"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command : %s",
+               val_to_str(command, str_on_off, "On"));
+       offset++;
+       length--;
+
+       if(command == 0x01)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Level   : %d dB",
+                       (signed char)(tvb_get_guint8(tvb, offset) / 2));
+               offset++;
+               length--;
+
+               if(length > 0)
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Duration: %d ms",
+                               (tvb_get_guint8(tvb, offset) * 10));
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       READ PERIPHERAL - 44h (MESSAGE FROM THE SYSTEM)
+       WRITE PERIPHERAL - 45h (MESSAGE FROM THE SYSTEM)
+       PERIPHERAL CONTENT - 2Bh (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_r_w_peripheral(proto_tree *tree,
+                                         tvbuff_t *tvb,
+                                         packet_info *pinfo,
+                                         guint offset,
+                                         guint length,
+                                         guint8 opcode,
+                                         proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               2,
+               "Address : %d",
+               tvb_get_ntohs(tvb, offset));
+       offset += 2;
+       length -= 2;
+
+       if(length > 0)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Content: %d",
+                       tvb_get_guint8(tvb, offset));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       ICON COMMAND - 47h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_icon_cmd(proto_tree *tree,
+                               tvbuff_t *tvb,
+                               packet_info *pinfo,
+                               guint offset,
+                               guint length,
+                               guint8 opcode,
+                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i;
+       static const value_string str_state[] = {
+               {0x00, "Off"            },
+               {0x01, "Slow Flash"     },
+               {0x02, "Not Used"       },
+               {0x03, "Steady On"      },
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Icon Number: %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+
+       for(i = 0; i < 8; i++)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       2,
+                       "Segment %d: %s (%d)",
+                       i,
+                       val_to_str((((tvb_get_guint8(tvb, offset) << 1) >> i) & 0x02) + ((tvb_get_guint8(tvb, offset + 1) >> i) & 0x01),str_state, "Unknwon"),
+                       (((tvb_get_guint8(tvb, offset) << 1) >> i) & 0x02) + ((tvb_get_guint8(tvb, offset + 1) >> i) & 0x01));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       AUDIO CONFIGURATION - 49h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_audio_config(proto_tree *tree,
+                                       tvbuff_t *tvb,
+                                       packet_info *pinfo,
+                                       guint offset,
+                                       guint length,
+                                       guint8 opcode,
+                                       proto_item *ua3g_item,
+                                       proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_command[] = {
+               {0x00, "Audio Coding"                                   },
+               {0x01, "DPI Channel Allocations"                },
+               {0x02, "Loudspeaker Volume Adjust"              },
+               {0x03, "Audio Circuit Configuration"    },
+               {0x04, "Handsfree Parameters"                   },
+               {0x05, "Loudspeaker Acoustic Parameters"},
+               {0x06, "Device Congiguration"                   },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command        : %s (%d)",
+               val_to_str(command, str_command, "Unknown"), command);
+       offset++;
+       length--;
+
+       switch(command)
+       {
+       case 0x00: /* Audio Coding */
+               {
+                       static const value_string str_law[] = {
+                               {0x00, "A Law"  },
+                               {0x01, "m Law"  },
+                               {0, NULL}
+                       };
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Ignored        : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Law    : %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_law, "Unknown"));
+                       break;
+               }
+       case 0x01: /* DPI Channel Allocations */
+               {
+                       int i;
+                       static const value_string str_body[] = {
+                               {0, "UA Channel UA-TX1   "},
+                               {1, "UA Channel UA-TX2   "},
+                               {2, "GCI Channel GCI-TX1 "},
+                               {3, "GCI Channel GCI-TX2 "},
+                               {4, "Codec Channel COD-TX"},
+                               {0, NULL}
+                       };
+                       for(i = 0; i < 5; i++)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%s: %d",
+                                       val_to_str(i, str_body, "Unknown"), tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x02: /* Loudspeaker Volume Adjust */
+               {
+                       int i;
+                       for(i = 1; i < 8; i++)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Volume Level %d: %d",
+                                       i, tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x03: /* Audio Circuit Configuration */
+               {
+                       int i;
+                       static const value_string str_body[] = {
+                               {0, "Anti-Distortion Coeff 1(DTH)"},
+                               {1, "Anti-Distortion Coeff 2(DTR)"},
+                               {2, "Anti-Distortion Coeff 3(DTF)"},
+                               {3, "Sidetone Attenuation (STR)  "},
+                               {4, "Anti-Larsen Coeff 1 (AHP1)  "},
+                               {5, "Anti-Larsen Coeff 2 (AHP2)  "},
+                               {6, "Anti-Larsen Coeff 3 (ATH)   "},
+                               {7, "Anti-Larsen Coeff 4 (ATR)   "},
+                               {8, "Anti-Larsen Coeff 5 (ATF)   "},
+                               {9, "Anti-Larsen Coeff 6 (ALM)   "},
+                               {0, NULL}
+                       };
+
+                       for(i = 0; i < 10; i++)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%s: %d",
+                                       val_to_str(i, str_body, "Unknown"), tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x04: /* Handsfree Parameters */
+               {
+                       static const value_string str_return_loss[] = {
+                               {0x00, "Return Loss Normal"},
+                               {0x01, "Return Loss Active"},
+                       };
+                       static const value_string str_full_duplex[] = {
+                               {0x00, "Handsfree Normal"},
+                               {0x02, "More Full Duplex"},
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "%s",
+                               val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_return_loss, "Unknown"));
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "%s",
+                               val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_full_duplex, "Unknown"));
+                       break;
+               }
+       case 0x05: /* Loudspeaker Acoustic Parameters */
+               {
+                       int i;
+                       static const value_string str_body[] = {
+                               {0, "Group Listening Attenuation Constant                                      "},
+                               {1, "Handsfree Attenuation Constant                                            "},
+                               {2, "Handsfree Number Of ms To Stay In Send State Before Going To Another State"},
+                               {3, "Handsfree Number Of Positions To Shift Right MTx                          "},
+                               {4, "Handsfree Number Of Positions To Shift Right MRc                          "},
+                               {5, "Handsfree Idle Transmission Threshold                                     "},
+                               {6, "Handsfree Low Transmission Threshold                                      "},
+                               {7, "Handsfree Idle Reception Threshold                                        "},
+                               {8, "Handsfree Low Reception Threshold                                         "},
+                               {9, "Handsfree Medium Reception Threshold                                      "},
+                               {10, "Handsfree High Reception Threshold                                        "},
+                               {0, NULL}
+                       };
+
+                       for(i = 0; i < 11; i++)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%s: %d",
+                                       val_to_str(i, str_body, "Unknown"), tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x06: /* Device Configuration */
+               {
+                       static const value_string str_device[] = {
+                               {0, "Handset Device             "},
+                               {1, "Headset Device             "},
+                               {2, "Loudspeaker Device         "},
+                               {3, "Announce Loudspeaker Device"},
+                               {4, "Handsfree Device           "},
+                               {0, NULL}
+                       };
+                       static const value_string str_device_values[] = {
+                               {0x01, " Internal"              },
+                               {0x02, " Rj9 Plug"              },
+                               {0x04, " Jack Plug"             },
+                               {0x08, " Bluetooth Link"},
+                               {0x10, " USB Link"              },
+                               {0, NULL}
+                       };
+                       static char parameter_value[100];
+                       int j;
+                       int i = 0;
+
+                       while(length > 0)
+                       {
+                               g_snprintf(parameter_value, 160,
+                                       "%s",
+                                       val_to_str(tvb_get_guint8(tvb, offset) & 0x01, str_device_values, ""));
+
+                               for(j = 1; j < 4; j++)
+                               {
+                                       char param_value[20];
+                                       g_snprintf(param_value, 20,
+                                               "%s",
+                                               val_to_str((tvb_get_guint8(tvb, offset) & (0x01 << j)), str_device_values, ""));
+                                       strcat(parameter_value, param_value);
+                               }
+                               if(strcmp(parameter_value, "") <= 0)
+                                       g_snprintf(parameter_value, 160, " None");
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "%s:%s",
+                                       val_to_str(i, str_device, "Unknown"), parameter_value);
+                               offset++;
+                               length--;
+                               i++;
+                       }
+                       break;
+               }
+       default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       AUDIO PADDED PATH - 4Ah (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_audio_padded_path(proto_tree *tree,
+                                                tvbuff_t *tvb,
+                                                packet_info *pinfo,
+                                                guint offset,
+                                                guint length,
+                                                guint8 opcode,
+                                                proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Emission Padded Level : %d",
+               tvb_get_guint8(tvb, offset));
+       offset++;
+       length--;
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Reception Padded Level: %d",
+               tvb_get_guint8(tvb, offset));
+}
+
+
+/*-----------------------------------------------------------------------------
+       KEY RELEASE ON / OFF - 41h (MESSAGE FROM THE SYSTEM)
+       AMPLIFIED HANDSET (BOOST) - 48h (MESSAGE FROM THE SYSTEM)
+       LOUDSPEAKER ON / OFF - 4Dh (MESSAGE FROM THE SYSTEM)
+       ANNOUNCE ON / OFF - 4Eh (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_on_off_level(proto_tree *tree,
+                                       tvbuff_t *tvb,
+                                       packet_info *pinfo,
+                                       guint offset,
+                                       guint length,
+                                       guint8 opcode,
+                                       proto_item *ua3g_item,
+                                       proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_on_off, "On"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_on_off, "On"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_on_off, "On"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_on_off, "On"));
+       offset++;
+       length--;
+
+       if(length > 0)
+       {
+               if(command == 0x01)
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Level on Loudspeaker: %d dB",
+                               (signed char)(tvb_get_guint8(tvb, offset)));
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       RING ON / OFF - 4Fh (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_ring(proto_tree *tree,
+                       tvbuff_t *tvb,
+                       packet_info *pinfo,
+                       guint offset,
+                       guint length,
+                       guint8 opcode,
+                       proto_item *ua3g_item,
+                       proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_cadence[] = {
+               {0x00, "Standard Ringing"                       },
+               {0x01, "Double Burst"                           },
+               {0x02, "Triple Burst"                           },
+               {0x03, "Continuous"                                     },
+               {0x04, "Priority Attendant Ringing"     },
+               {0x05, "Regular Attendant Ringing"      },
+               {0x06, "Programmable Cadence"           },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_on_off, "On"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_on_off, "On"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_on_off, "On"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_on_off, "On"));
+       offset++;
+       length--;
+
+       if(command == 0x01)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Melody       : %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Cadence      : %s",
+                       val_to_str(tvb_get_guint8(tvb, offset), str_cadence, "Unknown"));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Speaker level: %d dB",
+                       (signed char)(tvb_get_guint8(tvb, offset)));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Beep number  : %d",
+                       tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Silent       : %s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x80), str_on_off, "On"));
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Progressive  : %d",
+                       (tvb_get_guint8(tvb, offset) & 0x03));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       UA DOWNLOAD PROTOCOL - 50h - Only for UA NOE (MESSAGE FROM THE TERMINAL AND FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_ua_dwl_protocol(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length,
+                                          guint8 opcode,
+                                          proto_item *ua3g_item,
+                                          proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_command[] = {
+               {0x00, "Downloading Suggest"                                    },
+               {0x01, "Downloading Request"                                    },
+               {0x02, "Downloading Acknowledge"                                },
+               {0x03, "Downloading Data"                                               },
+               {0x04, "Downloading End"                                                },
+               {0x05, "Downloading End Acknowledge"                    },
+               {0x06, "Downloading ISO Checksum"                               },
+               {0x07, "Downloading ISO Checksum Acknowledge"   },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_command,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command        : %s",
+               val_to_str(command, str_command, "Unknown"));
+       offset++;
+       length--;
+
+       switch(command)
+       {
+       case 0x00:      /* Downloading Suggest (MESSAGE FROM THE TERMINAL) */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Item Identifier: %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Item Version   : %s",
+                               version_number_computer(tvb_get_letohs(tvb, offset)));
+                       offset += 2;
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Cause          : %d",
+                               tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       case 0x01:      /* Downloading Request (MESSAGE FROM THE SYSTEM) */
+               {
+                       static const value_string str_force_mode[] = {
+                               {0x00, "System Accept All Refusals"     },
+                               {0x01, "Force Software Lock"            },
+                               {0, NULL}
+                       };
+                       static const value_string str_item_id[] = {
+                               {0x00, "Patches File"           },
+                               {0x01, "Application Binary"     },
+                               {0x02, "Datas Binary"           },
+                               {0, NULL}
+                       };
+                       static const value_string str_mode_selection_country[] = {
+                               {0x00, "No Check"                                                       },
+                               {0x01, "For All Countries Except Chinese"       },
+                               {0x02, "For Chinese"                                            },
+                               {0, NULL}
+                       };
+                       static const value_string str_mem_size[] = {
+                               {0x00, "No Check"       },
+                               {0x01, "128 Kbytes"     },
+                               {0x02, "256 Kbytes"     },
+                               {0x03, "512 Kbytes"     },
+                               {0x04, "1 Mbytes"       },
+                               {0x05, "2 Mbytes"       },
+                               {0x06, "4 Mbytes"       },
+                               {0x07, "8 Mbytes"       },
+                               {0, NULL}
+                       };
+                       static const value_string str_bin_info[] = {
+                               {0x00, "Uncompressed Binary"    },
+                               {0x01, "LZO Compressed Binary"  },
+                               {0, NULL}
+                       };
+
+                       if(length > 7) /* Not R1 */
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Force Mode           : %s",
+                                       val_to_str(tvb_get_guint8(tvb, offset), str_force_mode, "Unknown"));
+                               offset++;
+                               length--;
+                       }
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Item Identifier      : %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_item_id, "Unknown"));
+                       offset++;
+                       length--;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               2,
+                               "Item Version         : %d",
+                               tvb_get_ntohs(tvb, offset));
+                       offset += 2;
+                       length -= 2;
+
+                       if(length > 2) /* Not R1 */
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Files Included       : %s Boot Binary Included, %s Loader Binary Included, %s Appli Binary Included, %s Datas Binary Included",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_yes_no, ""),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_yes_no, ""),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x04), str_yes_no, ""),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x08), str_yes_no, ""));
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Model Selection      : For A Model: %s, For B Model: %s, For C Model %s, Country Version: %s",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_yes_no, "Yes"),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_yes_no, "Yes"),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x04), str_yes_no, "Yes"),
+                                       val_to_str(((tvb_get_guint8(tvb, offset) & 0xE0) >> 5), str_mode_selection_country, "Unknown"));
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Hardware Selection   : For Ivanoe 1: %s, For Ivanoe 2: %s",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_yes_no, "Yes"),
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_yes_no, "Yes"));
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Memory Sizes Required: Flash Min Size: %s, External Ram Min Size: %s",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x07), str_mem_size, "Unknown"),
+                                       val_to_str(((tvb_get_guint8(tvb, offset) & 0x38) >> 3), str_mem_size, "Unknown"));
+                               offset++;
+                               length--;
+                       }
+                       else /* R1 */
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Binary Information   : %s, Country/Operator/CLient Identifier ?",
+                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_bin_info, ""));
+                               offset++;
+                               length--;
+                       }
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               3,
+                               "Binary Length        : %d",
+                               tvb_get_ntoh24(tvb, offset));
+                       break;
+               }
+       case 0x02:      /* Downloading Acknowledge (MESSAGE FROM THE TERMINAL) */
+               {
+                       static const value_string str_status[] = {
+                               {0x00, "Ok (Binary Item Downloading In \"Normal\" Progress)"                                                    },
+                               {0x01, "Hardware Failure: Flash Failure"                                                                                                },
+                               {0x02, "Not Enough Place To Store The Downloaded Binary"                                                                },
+                               {0x03, "Wrong Seq Number On Latest Received Download_Data Message"                                              },
+                               {0x04, "Wrong Packet Number On Latest Received Download_Data Message"                                   },
+                               {0x05, "Download Refusal Terminal (Validation Purpose)"                                                                 },
+                               {0x06, "Download Refusal Terminal (Development Purpose)"                                                                },
+                               {0x10, "Download Refusal: Hardware Cause (Unknown Flash Device, Incompatible Hardware)" },
+                               {0x11, "Download Refusal: No Loader Available Into The Terminal"                                                },
+                               {0x12, "Download Refusal: Software Lock"                                                                                                },
+                               {0x13, "Download Refusal: Wrong Parameter Into Download Request"                                                },
+                               {0x20, "Wrong Packet Number On Latest Received Downloading_Data Message"                                },
+                               {0x21, "Compress Header Invalid"                                                                                                                },
+                               {0x22, "Decompress Error"                                                                                                                               },
+                               {0x23, "Binary Header Invalid"                                                                                                                  },
+                               {0x24, "Binary Check Error: Flash Write Error Or Binary Is Invalid"                                             },
+                               {0x25, "Error Already Signaled - No More Data Accepted"                                                                 },
+                               {0x26, "No Downloading In Progress"                                                                                                             },
+                               {0x27, "Too Many Bytes Received (More Than Size Given Into The Download_Req Message)"   },
+                               {0xFF, "Undefined Error"                                                                                                                                },
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               2,
+                               "Packet Number: %d",
+                               tvb_get_ntohs(tvb, offset));
+                       offset += 2;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Status       : %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_status, "Unknown"));
+                       break;
+               }
+       case 0x03:      /* Downloading Data (MESSAGE FROM THE SYSTEM) */
+               {
+                       int i = 1;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               2,
+                               "Packet Number    : %d",
+                               tvb_get_ntohs(tvb, offset));
+                       offset += 2;
+                       length -= 2;
+
+                       while(length > 0)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Packet Number %3d: %d",
+                                       i, tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                               i++;
+                       }
+                       break;
+               }
+       case 0x05:      /* Downloading End Acknowledge (MESSAGE FROM THE TERMINAL) */
+               {
+                       static const value_string str_ok[] = {
+                               {0x00, "Ok"                                                                                             },
+                               {0x01, "Hardware Failure: Flash Problems"                               },
+                               {0x02, "Not Enough Place To Store The Downloaded Binary"},
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Status: %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_ok, "Not Ok"));
+                       break;
+               }
+       case 0x06:      /* Downloading Iso Checksum (MESSAGE FROM THE SYSTEM) */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               4,
+                               "Checksum: %d",
+                               tvb_get_ntohl(tvb, offset));
+                       offset += 4;
+                       length -= 4;
+                       break;
+               }
+       case 0x07:      /* Downloading ISO Checksum Acknowledge (MESSAGE FROM THE TERMINAL) */
+               {
+                       static const value_string str_ack_status[] = {
+                               {0x00, "The Checksum Matches"                           },
+                               {0x25, "Error Detected And Already Signaled"},
+                               {0x30, "Checksum Error (All Bytes Received)"},
+                               {0x31, "Checksum Error (Bytes Missing)"         },
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Acknowledge: %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_ack_status, "Unknown"));
+                       break;
+               }
+       case 0x04:      /* Downloading End (MESSAGE FROM THE SYSTEM) */
+       default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       DIGIT DIALED - 03h (MESSAGE FROM THE SYSTEM)
+       ---------------------------------------------------------------------------*/
+static void
+decode_digit_dialed(proto_tree *tree,
+                                       tvbuff_t *tvb,
+                                       packet_info *pinfo,
+                                       guint offset,
+                                       guint length,
+                                       guint8 opcode,
+                                       proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_digit[] = {
+               {0, "0"         },
+               {1, "1"         },
+               {2, "2"         },
+               {3, "3"         },
+               {4, "4"         },
+               {5, "5"         },
+               {6, "6"         },
+               {7, "7"         },
+               {8, "8"         },
+               {9, "9"         },
+               {10, "*"        },
+               {11, "#"        },
+               {12, "A"        },
+               {13, "B"        },
+               {14, "C"        },
+               {15, "D"        },
+               {16, "Flash"},
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Digit Value: %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_digit, "Unknown"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       SUBDEVICE_MSG - 04h (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_subdevice_msg(proto_tree *tree,
+                                        tvbuff_t *tvb,
+                                        packet_info *pinfo,
+                                        guint offset,
+                                        guint length,
+                                        guint8 opcode,
+                                        proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i = 0;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subdev Type      : %d",
+               (tvb_get_guint8(tvb, offset) & 0xF0));
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subdev Address   : %d",
+               (tvb_get_guint8(tvb, offset) & 0x0F));
+       offset++;
+       length--;
+
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Subdevice Opcode : %d",
+               (tvb_get_guint8(tvb, offset) & 0x7F));
+       offset++;
+       length--;
+
+       while(length > 0)
+       {
+               i++;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Parameter Byte %2d: %d",
+                       i, tvb_get_guint8(tvb, offset));
+               offset++;
+               length--;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       IP DEVICE ROUTING - 13h (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_cs_ip_device_routing(proto_tree *tree,
+                                                       tvbuff_t *tvb,
+                                                       packet_info *pinfo,
+                                                       guint offset,
+                                                       guint length,
+                                                       guint8 opcode,
+                                                       proto_item *ua3g_item,
+                                                       proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+    proto_item *ua3g_param_item;
+    proto_tree *ua3g_param_tree;
+       static char parameter_value[100];
+       static const value_string str_command[] = {
+               {0x00, "Init"                                                   },
+               {0x01, "Incident"                                               },
+               {0x02, "Get Parameters Value Response"  },
+               {0x03, "QOS Ticket RSP"                                 },
+               {0, NULL}
+       };
+
+       /* add text to the frame tree */
+       proto_item_append_text(ua3g_item,
+               ", %s",
+               val_to_str(command, str_command, "Unknown"));
+       proto_item_append_text(ua3g_body_item,
+               " - %s",
+               val_to_str(command, str_command, "Unknown"));
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+    /* add text to the frame "INFO" column */
+       if (check_col(pinfo->cinfo, COL_INFO))
+               col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+               val_to_str(command, str_command, "Unknown"));
+       
+       proto_tree_add_uint_format(ua3g_body_tree,
+               hf_ua3g_ip,
+               tvb,
+               offset,
+               1,
+               command,
+               "Command: %s",
+               val_to_str(command, str_command, "Unknown"));
+       offset++;
+       length--;
+
+       switch(command)
+       {
+               case 0x00:
+                       {
+                               static const value_string str_vta_type[] = {
+                                       {0x20, "NOE A"},
+                                       {0x21, "NOE B"},
+                                       {0x22, "NOE C"},
+                                       {0x23, "NOE D"},
+                                       {0, NULL}
+                               };
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "VTA Type             : %s",
+                                       val_to_str(tvb_get_guint8(tvb, offset), str_vta_type, "Unknown"));
+                               offset++;
+                               length--;
+
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Characteristic Number: %d",
+                                       tvb_get_guint8(tvb, offset));
+                               break;
+                       }
+               case 0x01:
+                       {
+                               int i=0;
+                               if(length == 1)
+                               {
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Incident 0: %d",
+                                               tvb_get_guint8(tvb, offset));
+                               }
+                               else
+                               {
+                                       while(length >0)
+                                       {
+                                               i++;
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Parameter %d Identifier: %d",
+                                                       i, tvb_get_guint8(tvb, offset));
+                                               offset++;
+                                               length--;
+                                       }
+                               }
+                               break;
+                       }
+               case 0x02:
+                       {
+                               int i, parameter_id, parameter_length;
+                               static const value_string str_parameter_id[] = {
+                                       {0x00, "Firmware Version"               },
+                                       {0x01, "Firmware Version"               },
+                                       {0x02, "DHCP IP Address"                },
+                                       {0x03, "Local IP Address"               },
+                                       {0x04, "Subnetwork Mask"                },
+                                       {0x05, "Router IP Address"              },
+                                       {0x06, "TFTP IP Address"                },
+                                       {0x07, "Main CPU Address"               },
+                                       {0x08, "Default Codec"                  },
+                                       {0x09, "Ethernet Drivers Config"},
+                                       {0x0A, "MAC Address"                    },
+                                       {0, NULL}
+                               };
+
+                               while(length > 0)
+                               {
+                                       parameter_id = tvb_get_guint8(tvb, offset);
+                                       parameter_length = tvb_get_guint8(tvb, offset + 1);
+
+                                       if(parameter_length > 0)
+                                       {
+                                               switch(parameter_id)
+                                               {
+                                               case 0x00: /* Firmware Version */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%s", version_number_computer(tvb_get_ntohs(tvb, offset + 2)));
+                                                               break;
+                                                       }
+                                               case 0x01: /* Firmware Version */
+                                               case 0x02: /* DHCP IP Address */
+                                               case 0x03: /* Local IP Address */
+                                               case 0x04: /* Subnetwork Mask */
+                                               case 0x05: /* Router IP Address */
+                                               case 0x06: /* TFTP IP Address */
+                                               case 0x07: /* Main CPU Address */
+                                                       {
+                                                               if(parameter_length > 0)
+                                                                       g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 2));
+
+                                                               for(i = 2; i <= parameter_length; i++)
+                                                               {
+                                                                       char param_value[50];
+                                                                       strcat(parameter_value, ".");
+                                                                       g_snprintf(param_value, 50, "%d", tvb_get_guint8(tvb, offset + 1 + i));
+                                                                       strcat(parameter_value, param_value);
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x08: /* Default Codec */
+                                                       {
+                                                               static const value_string str_compressor[] = {
+                                                                       {0x00, "G.711 A-law"            },
+                                                                       {0x01, "G.711 mu-law"           },
+                                                                       {0x0F, "G.723.1 5.3kbps"        },
+                                                                       {0x10, "G.723.1 6.3kbps"        },
+                                                                       {0x11, "G.729A 8 kbps"  },
+                                                                       {0, NULL}
+                                                               };
+
+                                                               if((parameter_length > 0) && (parameter_length <= 8))
+                                                               {
+                                                                       guint64 param_value = 0;
+                                                                       for(i = parameter_length; i > 0; i--)
+                                                                       {
+                                                                               param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                                       }
+                                                                       g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_compressor, "Default Codec"));
+                                                               }
+                                                               else
+                                                                       g_snprintf(parameter_value, 160,
+                                                                               "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                               tvb_get_guint8(tvb, offset + 2),
+                                                                               tvb_get_guint8(tvb, offset + 3),
+                                                                               tvb_get_guint8(tvb, offset + parameter_length),
+                                                                               tvb_get_guint8(tvb, offset + 1 + parameter_length));
+
+                                                               break;
+                                                       }
+                                               case 0x09: /* Ethernet Drivers Config */
+                                                       {
+                                                               if(parameter_length == 2)
+                                                               {
+                                                                       g_snprintf(parameter_value, 160,
+                                                                               "Port Lan Speed: %d - Port Lan Duplex: %s", 
+                                                                               tvb_get_guint8(tvb, offset + 2), 
+                                                                               tvb_get_guint8(tvb, offset + 3));
+                                                               }
+                                                               else if(parameter_length == 4)
+                                                               {
+                                                                       g_snprintf(parameter_value, 160,
+                                                                               "Port Lan Speed: %d - Port Lan Duplex: %d - Port PC Speed: %d - Port PC Duplex: %d", 
+                                                                               tvb_get_guint8(tvb, offset + 2), 
+                                                                               tvb_get_guint8(tvb, offset + 3), 
+                                                                               tvb_get_guint8(tvb, offset + 4), 
+                                                                               tvb_get_guint8(tvb, offset + 5));
+                                                               }
+                                                               else
+                                                                       g_snprintf(parameter_value, 160,
+                                                                               "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                               tvb_get_guint8(tvb, offset + 2),
+                                                                               tvb_get_guint8(tvb, offset + 3),
+                                                                               tvb_get_guint8(tvb, offset + parameter_length),
+                                                                               tvb_get_guint8(tvb, offset + 1 + parameter_length));
+
+                                                               break;
+                                                       }
+                                               case 0x0A: /* MAC Address */
+                                                       {
+                                                               if(parameter_length > 0)
+                                                                       g_snprintf(parameter_value, 160, "%02x", tvb_get_guint8(tvb, offset + 2));
+
+                                                               for(i = 2; i <= parameter_length; i++)
+                                                               {
+                                                                       char param_value[50];
+                                                                       strcat(parameter_value, ":");
+                                                                       g_snprintf(param_value, 50, "%02x", tvb_get_guint8(tvb, offset + 1 + i));
+                                                                       strcat(parameter_value, param_value);
+                                                               }
+                                                               break;
+                                                       }
+                                               default:
+                                                       {
+                                                               if((parameter_length > 0) && (parameter_length <= 8))
+                                                               {
+                                                                       guint64 param_value = 0;
+
+                                                                       for(i = parameter_length; i > 0; i--)
+                                                                       {
+                                                                               param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i)));
+                                                                       }
+                                                                       g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                               }
+                                                               else
+                                                                       g_snprintf(parameter_value, 160,
+                                                                               "0x%02x 0x%02x ... 0x%02x 0x%02x",
+                                                                               tvb_get_guint8(tvb, offset + 2),
+                                                                               tvb_get_guint8(tvb, offset + 3),
+                                                                               tvb_get_guint8(tvb, offset + parameter_length),
+                                                                               tvb_get_guint8(tvb, offset + 1 + parameter_length));
+                                                       }
+                                                       break;
+                                               }
+
+                                               ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       parameter_length + 2,
+                                                       "%s: %s",
+                                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                                       }
+                                       else
+                                               ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       parameter_length + 2,
+                                                       "%s",
+                                                       val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                                       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Parameter: %s (0x%02x)",
+                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                                       offset++;
+                                       length--;
+
+                                       proto_tree_add_text(ua3g_param_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Length   : %d",
+                                               parameter_length);
+                                       offset++;
+                                       length--;
+
+                                       if(parameter_length > 0)
+                                       {
+                                               proto_tree_add_text(ua3g_param_tree,
+                                                       tvb,
+                                                       offset,
+                                                       parameter_length,
+                                                       "Value    : %s",
+                                                       parameter_value);
+                                               offset += parameter_length;
+                                               length -= parameter_length;
+                                       }
+                               }
+                               break;
+                       }
+               case 0x03:
+                       {
+                               int i, parameter_id, parameter_length, element_length;
+                               int framing_rtp = 0;
+                               char parameter_value_tab[15][50];
+                               static const value_string str_parameter_id[] = {
+                                       {0x01, "Date Of End Of Communication"   },
+                                       {0x02, "Node Number"                                    },
+                                       {0x03, "Ticket Protocol Version"                },
+                                       {0x06, "Equiment Type"                                  },
+                                       {0x08, "Local IP Address"                               },
+                                       {0x09, "Distant IP Address"                             },
+                                       {0x0A, "Local ID"                                               },
+                                       {0x0B, "Distant ID"                                             },
+                                       {0x0C, "Call Duration (second)"                 },
+                                       {0x0D, "Local SSRC"                                             },
+                                       {0x0E, "Distant SSRC"                                   },
+                                       {0x0F, "Codec"                                                  },
+                                       {0x10, "VAD"                                                    },
+                                       {0x11, "ECE"                                                    },
+                                       {0x12, "Voice Mode"                                             },
+                                       {0x13, "Transmitted Framing (ms)"               },
+                                       {0x14, "Received Framing (ms)"                  },
+                                       {0x15, "Framing Changes"                                },
+                                       {0x16, "Number Of RTP Packets Received" },
+                                       {0x17, "Number Of RTP Packets Sent"             },
+                                       {0x18, "Number Of RTP Packets Lost"             },
+                                       {0x19, "Total Silence Detected (second)"},
+                                       {0x1A, "Number Of SID Received"                 },
+                                       {0x1B, "Delay Distribution"                             },
+                                       {0x1C, "Maximum Delay (ms)"                             },
+                                       {0x1D, "Number Of DTMF Received"                },
+                                       {0x1E, "Consecutive BFI"                                },
+                                       {0x1F, "BFI Distribution"                               },
+                                       {0x20, "Jitter Depth Distribution"              },
+                                       {0x21, "Number Of ICMP Host Unreachable"},
+                                       {0x26, "Firmware Version"                               },
+                                       {0x29, "DSP Framing (ms)"                               },
+                                       {0x2A, "Transmitter SID"                                },
+                                       {0x2D, "Minimum Delay (ms)"                             },
+                                       {0x2E, "802.1 Q Used"                                   },
+                                       {0x2F, "802.1p Priority"                                },
+                                       {0x30, "VLAN Id"                                                },
+                                       {0x31, "DiffServ"                                               },
+                                       {0x3D, "200 ms BFI Distribution"                },
+                                       {0x3E, "Consecutive RTP Lost"                   },
+                                       {0, NULL}
+                               };
+                               static const value_string str_parameter_id_tab[] = {
+                                       {0x1B, "Range    : Value"       },
+                                       {0x1F, "Range  : Value" },
+                                       {0x20, "Jitter    : Value"      },
+                                       {0x3D, "Contents: Value"},
+                                       {0x3E, "Contents  : Value"},
+                                       {0, NULL}
+                               };
+
+                               while(length > 0)
+                               {
+                                       parameter_id = tvb_get_guint8(tvb, offset);
+                                       parameter_length = tvb_get_ntohs(tvb, offset + 1);
+
+                                       if(parameter_length > 0)
+                                       {
+                                               switch(parameter_id)
+                                               {
+                                               case 0x06: /* Type Of Equipment */
+                                                       {
+                                                               static const value_string str_first_byte[] = {
+                                                                       {0x01, "IP-Phone"                                       },
+                                                                       {0x02, "Appli-PC"                                       },
+                                                                       {0x03, "Coupler OmniPCX Enterprise"     },
+                                                                       {0x04, "Coupler OmniPCX Office"         },
+                                                                       {0, NULL}
+                                                               };
+                                                               static const value_string str_second_byte[] = {
+                                                                       {0x0101, "IP-Phone V2"                          },
+                                                                       {0x0102, "NOE-IP"                                       },
+                                                                       {0x0200, "4980 Softphone (PCMM2)"       },
+                                                                       {0x0201, "WebSoftphoneIP"                       },
+                                                                       {0x0300, "INTIP"                                        },
+                                                                       {0x0301, "GD"                                           },
+                                                                       {0x0302, "eVA"                                          },
+                                                                       {0, NULL}
+                                                               };
+                                                               g_snprintf(parameter_value, 160, "%s, %s",
+                                                                       val_to_str(tvb_get_guint8(tvb, offset + 3), str_first_byte, "Unknown"),
+                                                                       val_to_str(tvb_get_ntohs(tvb, offset + 3), str_second_byte, "Unknown"));
+                                                               break;
+                                                       }
+                                               case 0x08: /* Local IP Address */
+                                               case 0x09: /* Distant IP Address */
+                                               case 0x26: /* Firmware Version */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%d", tvb_get_guint8(tvb, offset + 3));
+                                                               for(i = 2; i <= parameter_length; i++)
+                                                               {
+                                                                       char param_value[5];
+                                                                       strcat(parameter_value, ".");
+                                                                       g_snprintf(param_value, 5, "%d", tvb_get_guint8(tvb, offset + 2 + i));
+                                                                       strcat(parameter_value, param_value);
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x0A:
+                                               case 0x0B:
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "\"");
+                                                               for(i = 1; i <= parameter_length; i++)
+                                                               {
+                                                                       char param_value[5];
+                                                                       if(isprint(tvb_get_guint8(tvb, offset + 2 + i)))
+                                                                               g_snprintf(param_value, 5, "%c", tvb_get_guint8(tvb, offset + 2 + i));
+                                                                       else
+                                                                               g_snprintf(param_value, 5, "'0x%02x'", tvb_get_guint8(tvb, offset + 2 + i));
+                                                                       strcat(parameter_value, param_value);
+                                                               }
+                                                               strcat(parameter_value, "\"");
+                                                               break;
+                                                       }
+                                               case 0x0F: /* Default Codec */
+                                                       {
+                                                               static const value_string str_compressor[] = {
+                                                                       {0x00, "G.711 A-law"            },
+                                                                       {0x01, "G.711 mu-law"           },
+                                                                       {0x02, "G.723.1 6.3kbps"        },
+                                                                       {0x03, "G.729"                  },
+                                                                       {0x04, "G.723.1 5.3kbps"        },
+                                                                       {0, NULL}
+                                                               };
+
+                                                               if((parameter_length > 0) && (parameter_length <= 8))
+                                                               {
+                                                                       guint64 param_value = 0;
+                                                                       for(i = parameter_length; i > 0; i--)
+                                                                       {
+                                                                               param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i)));
+                                                                       }
+                                                                       g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_compressor, "Default Codec"));
+                                                               }
+                                                               else
+                                                                       g_snprintf(parameter_value, 160, "Parameter Value Too Long (more than 64 bits)");
+
+                                                               break;
+                                                       }
+                                               case 0x10: /* VAD */
+                                               case 0x11: /* ECE */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%s", val_to_str(tvb_get_guint8(tvb, offset + 3), str_on_off, "On"));
+                                                               break;
+                                                       }
+                                               case 0x12: /* Voice Mode */
+                                                       {
+                                                               static const value_string str_voice_mode[] = {
+                                                                       {0x50, "Idle"                   },
+                                                                       {0x51, "Handset"                },
+                                                                       {0x52, "Group Listening"},
+                                                                       {0x53, "On Hook Dial"   },
+                                                                       {0x54, "Handsfree"              },
+                                                                       {0x55, "Headset"                },
+                                                                       {0, NULL}
+                                                               };
+
+                                                               if((parameter_length > 0) && (parameter_length <= 8))
+                                                               {
+                                                                       guint64 param_value = 0;
+                                                                       for(i = parameter_length; i > 0; i--)
+                                                                       {
+                                                                               param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i)));
+                                                                       }
+                                                                       g_snprintf(parameter_value, 160, val_to_str((guint8)(param_value), str_voice_mode, "Unknown"));
+                                                               }
+                                                               else
+                                                                       g_snprintf(parameter_value, 160, "Parameter Value Too Long (more than 64 bits)");
+
+                                                               break;
+                                                       }
+                                               case 0x1B: /* Delay Distribution */
+                                                       {
+                                                               static const value_string str_range[] = {
+                                                                       {0, "0-40     " },
+                                                                       {1, "40-80    " },
+                                                                       {2, "80-150   " },
+                                                                       {3, "150-250  " },
+                                                                       {4, "250 and +" },
+                                                                       {0, NULL}
+                                                               };
+                                                               element_length = 2;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "%s: %d",
+                                                                               val_to_str(i, str_range, "Unknown"),
+                                                                               tvb_get_ntohs(tvb, offset + 3 + element_length * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x1E: /* Consecutive BFI */
+                                                       {
+                                                               static const value_string str_range[] = {
+                                                                       {0, "0" },
+                                                                       {1, "1" },
+                                                                       {2, "2" },
+                                                                       {3, "3" },
+                                                                       {4, "4" },
+                                                                       {5, "5" },
+                                                                       {6, "5" },
+                                                                       {7, "7" },
+                                                                       {8, "8" },
+                                                                       {9, "9" },
+                                                                       {0, NULL}
+                                                               };
+                                                               element_length = 2;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "%s: %d",
+                                                                               val_to_str(i, str_range, "Unknown"),
+                                                                               tvb_get_ntohs(tvb, offset + 3 + element_length * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x1F: /* BFI Distribution */
+                                                       {
+                                                               static const value_string str_range[] = {
+                                                                       {0, "0      "   },
+                                                                       {1, "0-1    "   },
+                                                                       {2, "1-2    "   },
+                                                                       {3, "2-3    "   },
+                                                                       {4, "3 and +"   },
+                                                                       {0, NULL}
+                                                               };
+                                                               element_length = 2;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "%s: %d",
+                                                                               val_to_str(i, str_range, "Unknown"),
+                                                                               tvb_get_ntohs(tvb, offset + 3 + element_length * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x20: /* Jitter Depth Distribution */
+                                                       {
+                                                               element_length = 4;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "+/- %3d ms: %ld",
+                                                                               ((2 * i) + 1) * framing_rtp / 2,
+                                                                               tvb_get_ntohl(tvb, offset + 3 + 4 * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x2E: /* 802.1 Q Used */
+                                                       {
+                                                               static const value_string str_bool[] = {
+                                                                       {0x00, "False"  },
+                                                                       {0, NULL}
+                                                               };
+                                                               g_snprintf(parameter_value, 160, "%s", val_to_str(tvb_get_guint8(tvb, offset + 3), str_bool, "True"));
+                                                               break;
+                                                       }
+                                               case 0x2F: /* 802.1p Priority */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%d", (tvb_get_guint8(tvb, offset + 3) & 0x07));
+                                                               break;
+                                                       }
+                                               case 0x30: /* VLAN Id */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%d", (tvb_get_ntohs(tvb, offset + 3) & 0x0FFF));
+                                                               break;
+                                                       }
+                                               case 0x31: /* DiffServ */
+                                                       {
+                                                               g_snprintf(parameter_value, 160, "%d (%d)", tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 3)>>2);
+                                                               break;
+                                                       }
+                                               case 0x3D: /* 200 ms BFI Distribution */
+                                                       {
+                                                               static const value_string str_range[] = {
+                                                                       {0, "< 10 %  "  },
+                                                                       {1, "< 20 %  "  },
+                                                                       {2, "< 40 %  "  },
+                                                                       {3, "< 60 %  "  },
+                                                                       {4, ">= 60 % "  },
+                                                                       {0, NULL}
+                                                               };
+                                                               element_length = 2;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "%s: %d",
+                                                                               val_to_str(i, str_range, "Unknown"),
+                                                                               tvb_get_ntohs(tvb, offset + 3 + element_length * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x3E: /* Consecutive RTP Lost */
+                                                       {
+                                                               static const value_string str_range[] = {
+                                                                       {0, "1         "},
+                                                                       {1, "2         "},
+                                                                       {2, "3         "},
+                                                                       {3, "4         "},
+                                                                       {4, "5 and more"},
+                                                                       {0, NULL}
+                                                               };
+                                                               element_length = 2;
+                                                               for(i = 0; i < (parameter_length / element_length); i++)
+                                                               {
+                                                                       g_snprintf(parameter_value_tab[i], 50, "%s: %d",
+                                                                               val_to_str(i, str_range, "Unknown"),
+                                                                               tvb_get_ntohs(tvb, offset + 3 + element_length * i));
+                                                               }
+                                                               break;
+                                                       }
+                                               case 0x14: /* Received Framing (ms) */
+                                                       {
+                                                               framing_rtp = tvb_get_guint8(tvb, offset + 3);
+                                                       }
+                                               case 0x01: /* Date Of End Of Communication */
+                                               case 0x02: /* Node Number */
+                                               case 0x03: /* Ticket Protocol Version */
+                                               case 0x0C: /* Call Duration (second) */
+                                               case 0x0D: /* Local SSRC */
+                                               case 0x0E: /* Distant SSRC */
+                                               case 0x13: /* Transmitted Framing (ms) */
+                                               case 0x15: /* Framing Changes */
+                                               case 0x16: /* Number Of RTP Packets Received */
+                                               case 0x17: /* Number Of RTP Packets Sent */
+                                               case 0x18: /* Number Of RTP Packets Lost */
+                                               case 0x19: /* Total Silence Detected (second) */
+                                               case 0x1A: /* Number Of SID Received */
+                                               case 0x1C: /* Maximum Delay (ms) */
+                                               case 0x1D: /* Number Of DTMF Received */
+                                               case 0x21: /* Number Of ICMP Host Unreachable */
+                                               case 0x29: /* DSP Framing (ms) */
+                                               case 0x2A: /* Transmitter SID */
+                                               case 0x2D: /* Minimum Delay (ms) */
+                                               default:
+                                                       {
+                                                               guint64 param_value = 0;
+
+                                                               for(i = parameter_length; i > 0; i--)
+                                                               {
+                                                                       param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i)));
+                                                               }
+                                                               g_snprintf(parameter_value, 160, "%llu", param_value);
+                                                               break;
+                                                       }
+                                               }
+                                       }
+
+                                       switch(parameter_id)
+                                       {
+                                       /* Case of values in table */
+                                       case 0x1B:
+                                       case 0x1E:
+                                       case 0x1F:
+                                       case 0x20:
+                                       case 0x3D:
+                                       case 0x3E:
+                                               {
+                                                       ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                                               tvb,
+                                                               offset,
+                                                               parameter_length + 3,
+                                                               "%s:",
+                                                               val_to_str(parameter_id, str_parameter_id, "Unknown"));
+                                                       proto_tree_add_text(ua3g_body_tree,
+                                                               tvb,
+                                                               offset + 3,
+                                                               parameter_length,
+                                                               "          %s",
+                                                               val_to_str(parameter_id, str_parameter_id_tab, "Unknown"));
+                                                       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+                                                       proto_tree_add_text(ua3g_param_tree,
+                                                               tvb,
+                                                               offset,
+                                                               1,
+                                                               "Parameter: %s (0x%02x)",
+                                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                                                       offset++;
+                                                       length--;
+
+                                                       proto_tree_add_text(ua3g_param_tree,
+                                                               tvb,
+                                                               offset,
+                                                               2,
+                                                               "Length   : %d",
+                                                               parameter_length);
+                                                       offset += 2;
+                                                       length -= 2;
+
+                                                       for(i = 0; i < (parameter_length / element_length); i++)
+                                                       {
+                                                               proto_tree_add_text(ua3g_body_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       element_length,
+                                                                       "          %s",
+                                                                       parameter_value_tab[i]);
+                                                               offset += element_length;
+                                                               length -= element_length;
+                                                       }
+                                                       break;
+                                               }
+                                       default:
+                                               {
+                                                       if(parameter_length > 0)
+                                                               ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       parameter_length + 3,
+                                                                       "%s: %s",
+                                                                       val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_value);
+                                                       else
+                                                               ua3g_param_item = proto_tree_add_text(ua3g_body_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       parameter_length + 3,
+                                                                       "%s",
+                                                                       val_to_str(parameter_id, str_parameter_id, "Unknown"));
+
+                                                       ua3g_param_tree = proto_item_add_subtree(ua3g_param_item, ett_ua3g_param);
+
+                                                       proto_tree_add_text(ua3g_param_tree,
+                                                               tvb,
+                                                               offset,
+                                                               1,
+                                                               "Parameter: %s (0x%02x)",
+                                                               val_to_str(parameter_id, str_parameter_id, "Unknown"), parameter_id);
+                                                       offset++;
+                                                       length--;
+
+                                                       proto_tree_add_text(ua3g_param_tree,
+                                                               tvb,
+                                                               offset,
+                                                               2,
+                                                               "Length   : %d",
+                                                               parameter_length);
+                                                       offset += 2;
+                                                       length -= 2;
+
+                                                       if(parameter_length > 0)
+                                                       {
+                                                               proto_tree_add_text(ua3g_param_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       parameter_length,
+                                                                       "Value    : %s",
+                                                                       parameter_value);
+                                                               offset += parameter_length;
+                                                               length -= parameter_length;
+                                                       }
+                                                       break;
+                                               }
+                                       }
+                                                       
+                               }
+                               break;
+                       }
+               default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       UNSOLICITED MESSAGE - 9Fh/1Fh (MESSAGE FROM THE TERMINAL)
+       VERSION RESPONSE - 21h (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_unsolicited_msg(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length,
+                                          guint8 opcode,
+                                          proto_item *ua3g_item,
+                                          proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       static const value_string str_command[] = {
+               {0x00, "Hardware Reset Acknowledge"     },
+               {0x01, "Software Reset Acknowledge"     },
+               {0x02, "Illegal Command Received"       },
+               {0x05, "Subdevice Down"                         },
+               {0x06, "Segment Failure"                        },
+               {0x07, "UA Device Event"                        },
+               {0, NULL}
+       };
+
+       if(opcode != 0x21)
+       {
+               /* add text to the frame tree */
+               proto_item_append_text(ua3g_item,
+                       ", %s",
+                       val_to_str(command, str_command, "Unknown"));
+               proto_item_append_text(ua3g_body_item,
+                       " - %s",
+                       val_to_str(command, str_command, "Unknown"));
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+               /* add text to the frame "INFO" column */
+               if (check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+                       val_to_str(command, str_command, "Unknown"));
+
+               proto_tree_add_uint_format(ua3g_body_tree,
+                       hf_ua3g_command,
+                       tvb,
+                       offset,
+                       1,
+                       command,
+                       "Command: %s",
+                       val_to_str(command, str_command, "Unknown"));
+               offset++;
+               length--;
+       }
+       else
+       {
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+               command = 0xFF; /* Opcode = 0x21 */
+       }
+
+       switch(command)
+       {
+       case 0x00: /* Hardware Reset Acknowledge */
+       case 0x01: /* Software Reset Acknowledge */
+       case 0xFF: /* Opcode = 0x21 : Version Response */
+               {
+                       int link, vta_type;
+                       static const value_string str_vta_type[] = {
+                               {0x03, "4035"   },
+                               {0x04, "4020"   },
+                               {0x05, "4010"   },
+                               {0x20, "NOE A"  },
+                               {0x21, "NOE B"  },
+                               {0x22, "NOE C"  },
+                               {0x23, "NOE D"  },
+                               {0, NULL}
+                       };
+                       static const value_string str_other_info_1[] = {
+                               {0x00, "Link Is TDM"},
+                               {0x01, "Link Is IP"     },
+                               {0, NULL}
+                       };
+                       static const value_string str_other_info_2[] = {
+                               {0x00, "Download Allowed"},
+                               {0x01, "Download Refused"},
+                               {0, NULL}
+                       };
+                       static const value_string str_hard_config_ip[] = {
+                               {0x00, "Export Binary (No Thales)"      },
+                               {0x01, "Full Binary (Thales)"           },
+                               {0, NULL}
+                       };
+                       static const value_string str_hard_config_chip[] = {
+                               {0x00, "Chip Id: Unknown"       },
+                               {0x01, "Chip Id: Ivanoe 1"      },
+                               {0x02, "Chip Id: Ivanoe 2"      },
+                               {0x03, "Chip Id: Reserved"      },
+                               {0, NULL}
+                       };
+                       static const value_string str_hard_config_flash[] = {
+                               {0x00, "Flash Size: No Flash"   },
+                               {0x01, "Flash Size: 128 Kbytes" },
+                               {0x02, "Flash Size: 256 Kbytes" },
+                               {0x03, "Flash Size: 512 Kbytes" },
+                               {0x04, "Flash Size: 1 Mbytes"   },
+                               {0x05, "Flash Size: 2 Mbytes"   },
+                               {0x06, "Flash Size: 4 Mbytes"   },
+                               {0x07, "Flash Size: 8 Mbytes"   },
+                               {0, NULL}
+                       };
+                       static const value_string str_hard_config_ram[] = {
+                               {0x00, "External RAM Size: No External RAM"     },
+                               {0x01, "External RAM Size: 128 Kbytes"  },
+                               {0x02, "External RAM Size: 256 Kbytes"  },
+                               {0x03, "External RAM Size: 512 Kbytes"  },
+                               {0x04, "External RAM Size: 1 Mbytes"    },
+                               {0x05, "External RAM Size: 2 Mbytes"    },
+                               {0x06, "External RAM Size: 4 Mbytes"    },
+                               {0x07, "External RAM Size: 8 Mbytes"    },
+                               {0, NULL}
+                       };
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Device Type                  : %s",
+                               val_to_str(tvb_get_guint8(tvb, offset), str_device_type, "Unknown"));
+                       offset++;
+                       length--;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               2,
+                               "Firmware Version             : %s",
+                               version_number_computer(tvb_get_ntohs(tvb, offset)));
+                       offset += 2;
+                       length -= 2;
+
+                       if(opcode != 0x21)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Self-Test Result             : %d",
+                                       tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+
+                       vta_type = tvb_get_guint8(tvb, offset);
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "VTA Type                     : %s",
+                               val_to_str(vta_type, str_vta_type, "Unknown"));
+                       offset++;
+                       length--;
+
+                       switch(vta_type)
+                       {
+                       case 0x03:
+                       case 0x04:
+                       case 0x05:
+                               {
+                                       static const value_string str_subtype[] = {
+                                               {0x03, "2x40"},
+                                               {0x04, "1x20"},
+                                               {0x05, "1x20"},
+                                               {0, NULL}
+                                       };
+                                       static const value_string str_generation[] = {
+                                               {0x02, "3"},
+                                               {0, NULL}
+                                       };
+                                       static const value_string str_design[] = {
+                                               {0x00, "Alpha"},
+                                               {0, NULL}
+                                       };
+                                       static const value_string str_hard_vta_type[] = {
+                                               {0x03, "MR2 (4035)"     },
+                                               {0x05, "VLE (4010)"     },
+                                               {0x07, "LE (4020)"      },
+                                               {0, NULL}
+                                       };
+                                       static const value_string str_hard_design[] = {
+                                               {0x06, "Alpha"},
+                                               {0, NULL}
+                                       };
+                                       static const value_string str_hard_subtype[] = {
+                                               {0x06, "2x40"},
+                                               {0x07, "1x20"},
+                                               {0x08, "1x20"},
+                                               {0, NULL}
+                                       };
+
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Characteristic Number        : VTA SubType: %s, Generation: %s, Design: %s",
+                                               val_to_str((((tvb_get_guint8(tvb, offset) & 0xC0) >> 6) + vta_type), str_subtype, "Unknown"),
+                                               val_to_str(((tvb_get_guint8(tvb, offset) & 0x38) >> 3), str_generation, "Unknown"),
+                                               val_to_str((tvb_get_guint8(tvb, offset) & 0x07), str_design, "Unknown"));
+                                       offset++;
+                                       length--;
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Other Information            : %s",
+                                               val_to_str(tvb_get_guint8(tvb, offset), str_other_info_2, "Unknown"));
+                                       offset++;
+                                       length--;
+
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Hardware Configuration       : VTA Type: %s, Design: %s, VTA SubType: %s",
+                                               val_to_str((((tvb_get_guint8(tvb, offset) & 0xE0) >> 5) + vta_type), str_hard_vta_type, "Unknown"),
+                                               val_to_str(((tvb_get_guint8(tvb, offset) & 0x1C) >> 2), str_hard_design, "Unknown"),
+                                               val_to_str((tvb_get_guint8(tvb, offset) & 0x03), str_hard_subtype, "Unknown"));
+                                       offset++;
+                                       length--;
+
+                                       if(opcode != 0x21)
+                                       {
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Hook Status/BCM Version      : %s Hook",
+                                                       val_to_str(tvb_get_guint8(tvb, offset), str_on_off, "On"));
+                                               offset++;
+                                               length--;
+
+                                       }
+                                       break;
+                               }
+                       case 0x20:
+                       case 0x21:
+                       case 0x22:
+                       case 0x23:
+                       default:
+                               {
+                                       link = tvb_get_guint8(tvb, offset);
+                                       proto_tree_add_text(ua3g_body_tree,
+                                               tvb,
+                                               offset,
+                                               1,
+                                               "Other Information 1          : %s",
+                                               val_to_str(link, str_other_info_1, "Unknown"));
+                                       offset++;
+                                       length--;
+
+                                       if(link == 0x00)
+                                       {
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Hardware Version             : %d",
+                                                       tvb_get_guint8(tvb, offset));
+                                               offset++;
+                                               length--;
+
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Hardware Configuration       : %s, %s, %s",
+                                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x03), str_hard_config_chip, "Unknown"),
+                                                       val_to_str(((tvb_get_guint8(tvb, offset) & 0x1C) >> 2), str_hard_config_flash, "Unknown"),
+                                                       val_to_str(((tvb_get_guint8(tvb, offset) & 0xE0) >> 5), str_hard_config_ram, "Unknown"));
+                                               offset++;
+                                               length--;
+                                       }
+                                       else
+                                       {
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Other Information 2          : %s",
+                                                       val_to_str(tvb_get_guint8(tvb, offset), str_other_info_2, "Unknown"));
+                                               offset++;
+                                               length--;
+
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Hardware Configuration       : %s",
+                                                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_hard_config_ip, "Unknown"));
+                                               offset++;
+                                               length--;
+                                       }
+
+                                       if(opcode != 0x21)
+                                       {
+                                               proto_tree_add_text(ua3g_body_tree,
+                                                       tvb,
+                                                       offset,
+                                                       1,
+                                                       "Hook Status                  : %s Hook",
+                                                       val_to_str(tvb_get_guint8(tvb, offset), str_on_off, "On"));
+                                               offset++;
+                                               length--;
+
+                                               if(length > 0)
+                                               {
+                                                       if(link == 0x00)
+                                                       {
+                                                               proto_tree_add_text(ua3g_body_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       2,
+                                                                       "Firmware Datas Patch Version : %s",
+                                                                       version_number_computer(tvb_get_ntohs(tvb, offset)));
+                                                               offset += 2;
+                                                               length -= 2;
+
+                                                               if(length >0)
+                                                               {
+                                                                       proto_tree_add_text(ua3g_body_tree,
+                                                                               tvb,
+                                                                               offset,
+                                                                               2,
+                                                                               "Firmware Version (Loader)    : %s",
+                                                                               version_number_computer(tvb_get_ntohs(tvb, offset)));
+                                                               }
+                                                       }
+
+                                                       else
+                                                       {
+                                                               proto_tree_add_text(ua3g_body_tree,
+                                                                       tvb,
+                                                                       offset,
+                                                                       2,
+                                                                       "Datas Version                : %s",
+                                                                       version_number_computer(tvb_get_ntohs(tvb, offset)));
+                                                               offset += 2;
+                                                               length -= 2;
+
+                                                               if(length >0)
+                                                               {
+                                                                       proto_tree_add_text(ua3g_body_tree,
+                                                                               tvb,
+                                                                               offset,
+                                                                               2,
+                                                                               "Firmware Version (Bootloader): %s",
+                                                                               version_number_computer(tvb_get_ntohs(tvb, offset)));
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       break;
+                               }
+                       }
+                       break;
+               }
+       case 0x02: /* Illegal Command Received */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Opcode Of Bad  Command  : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+                       length--;
+
+                       while(length >0)
+                       {
+                               proto_tree_add_text(ua3g_body_tree,
+                                       tvb,
+                                       offset,
+                                       1,
+                                       "Next Byte Of Bad Command: %d",
+                                       tvb_get_guint8(tvb, offset));
+                               offset++;
+                               length--;
+                       }
+                       break;
+               }
+       case 0x05: /* Subdevice Down */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Subdevice Address: %d",
+                               tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       case 0x06: /* Segment Failure */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "T                       : %d",
+                               (tvb_get_guint8(tvb, offset) & 0x01));
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Num                     : %d",
+                               (tvb_get_guint8(tvb, offset) & 0x02));
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "/S                      : %d",
+                               (tvb_get_guint8(tvb, offset) & 0x04));
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "L                       : %d",
+                               (tvb_get_guint8(tvb, offset) & 0x08));
+                       offset++;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Opcode Bad Segment      : %d",
+                               tvb_get_guint8(tvb, offset));
+                       offset++;
+
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Next Byte Of Bad Segment: %d",
+                               tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       case 0x07: /* UA Device Event */
+               {
+                       proto_tree_add_text(ua3g_body_tree,
+                               tvb,
+                               offset,
+                               1,
+                               "Device Event: %d",
+                               tvb_get_guint8(tvb, offset));
+                       break;
+               }
+       default:
+               {
+                       break;
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       NON-DIGIT KEY PUSHED - 20h (MESSAGE FROM THE TERMINAL)
+       DIGIT KEY RELEASED - 26h (MESSAGE FROM THE TERMINAL)
+       KEY RELEASED - 2Ah (MESSAGE FROM THE TERMINAL)
+       TM KEY PUSHED - 2Dh (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_key_number(proto_tree *tree,
+                                 tvbuff_t *tvb,
+                                 packet_info *pinfo,
+                                 guint offset,
+                                 guint length,
+                                 guint8 opcode,
+                                 proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       static const value_string str_first_parameter[] = {
+               {0x01, "Production Test Command"        },
+               {0x06, "Reserved For Compatibility"     },
+               {0x3B, "Volmue"                                         },
+               {0x42, "Subdevice Address"                      },
+               {0, NULL}
+       };
+
+       if(length > 0)
+       {
+               ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+               proto_tree_add_text(ua3g_body_item,
+                       tvb,
+                       offset,
+                       length,
+                       "Key Number: Row %d, Column %d",
+                       (tvb_get_guint8(tvb, offset) & 0xF0), (tvb_get_guint8(tvb, offset) & 0x0F));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       I'M HERE - 22h - Only for UA NOE (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_i_m_here(proto_tree *tree,
+                               tvbuff_t *tvb,
+                               packet_info *pinfo,
+                               guint offset,
+                               guint length,
+                               guint8 opcode,
+                               proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       proto_tree_add_text(ua3g_body_tree,
+               tvb,
+               offset,
+               1,
+               "Id Code: %s",
+               val_to_str(tvb_get_guint8(tvb, offset), str_device_type, "Unknown"));
+}
+
+
+/*-----------------------------------------------------------------------------
+       RESPONSE STATUS INQUIRY - 23h (MESSAGE FROM THE TERMINAL)
+       SPECIAL KEY STATUS - 29h (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_special_key(proto_tree *tree,
+                                  tvbuff_t *tvb,
+                                  packet_info *pinfo,
+                                  guint offset,
+                                  guint length,
+                                  guint8 opcode,
+                                  proto_item *ua3g_body_item)
+{
+       guint8 command = tvb_get_guint8(tvb, offset);
+    proto_tree *ua3g_body_tree;
+       int i;
+       static const value_string str_parameters[] = {
+               {0x00, "Not Received Default In Effect" },
+               {0x02, "Downloaded Values In Effect"    },
+               {0, NULL}
+       };
+       static const value_string str_special_key_status[] = {
+               {0x00, "Released"},
+               {0, NULL}
+       };
+       static const value_string str_special_key[] = {
+               {0, "Shift "},
+               {1, "Ctrl  "},
+               {2, "Alt   "},
+               {3, "Cmd   "},
+               {4, "Shift'"},
+               {5, "Ctrl' "},
+               {6, "Alt'  "},
+               {7, "Cmd'  "},
+               {0, NULL}
+       };
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+       if(opcode == 0x23)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Parameters Received for DTMF: %s",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x02), str_parameters, "Unknown"));
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Hookswitch Status           : %shook",
+                       val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_on_off, "On"));
+               offset++;
+               length--;
+       }
+
+       for(i = 0; i < 8; i++)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "%s                      : %s",
+                       val_to_str(i, str_special_key, "Unknown"),
+                       val_to_str((tvb_get_guint8(tvb, offset) & (0x01 << i)),
+                       str_special_key_status, "Pressed"));
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       SUBDEVICE STATE ENQUIRY - 24h (MESSAGE FROM THE TERMINAL)
+       ---------------------------------------------------------------------------*/
+static void
+decode_subdevice_state(proto_tree *tree,
+                                          tvbuff_t *tvb,
+                                          packet_info *pinfo,
+                                          guint offset,
+                                          guint length,
+                                          guint8 opcode,
+                                          proto_item *ua3g_body_item)
+{
+    proto_tree *ua3g_body_tree;
+       int i;
+
+       ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body);
+
+       for(i = 0; i <= 7; i++)
+       {
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Subdevice %d State: %d",
+                       i, (tvb_get_guint8(tvb, offset) & 0x0F));
+               i++;
+               proto_tree_add_text(ua3g_body_tree,
+                       tvb,
+                       offset,
+                       1,
+                       "Subdevice %d State: %d",
+                       i, ((tvb_get_guint8(tvb, offset) & 0xF0) >> 4));
+               offset++;
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       UA3G DISSECTOR
+       ---------------------------------------------------------------------------*/
+static void dissect_ua3g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    proto_item *ua3g_item = NULL;
+    proto_tree *ua3g_tree = NULL;
+    proto_item *ua3g_body_item = NULL;
+    gint length = 0;
+    gint offset = 0;
+    guint8 opcode = 0x00;
+
+    (void)pinfo;
+
+    if(tree)
+    {
+               ua3g_item = proto_tree_add_item(tree, proto_ua3g, tvb, 0, -1, FALSE);
+               ua3g_tree = proto_item_add_subtree(ua3g_item, ett_ua3g);
+               
+               if(message_direction == SYS_TO_TERM)
+               {
+                       opcodes_vals = opcodes_vals_sys;
+               }
+               else
+                       opcodes_vals = opcodes_vals_term;
+
+               /* Length of the UA Message */
+               length = tvb_get_letohs(tvb, offset);
+
+               /* add text to the frame "INFO" column */
+               if (check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, " - UA3G Message:");
+
+               proto_tree_add_uint(ua3g_tree,
+                       hf_ua3g_length,
+                       tvb,
+                       offset,
+                       2,
+                       length);
+               offset += 2;
+
+               /* Opcode of the UA Message */
+               opcode = tvb_get_guint8(tvb, offset);
+               if(opcode != 0x9f)
+                       opcode = (opcode & 0x7f);
+
+               /* Usefull for a research in wireshark */
+               proto_tree_add_uint_format(ua3g_tree,
+                       hf_ua3g_opcode,
+                       tvb,
+                       offset,
+                       1,
+                       opcode,
+                       "Opcode: %s (0x%02x)",
+                       val_to_str(opcode, opcodes_vals, "Unknown"), opcode);
+           offset++;
+               length--;
+
+               /* add text to the frame "INFO" column */
+               if (check_col(pinfo->cinfo, COL_INFO))
+                       col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
+                       val_to_str(opcode, opcodes_vals, "Unknown"));
+
+               proto_item_append_text(ua3g_item, ", %s", val_to_str(opcode, opcodes_vals, "Unknown"));
+
+               if(length > 0)
+               ua3g_body_item = proto_tree_add_text(ua3g_tree,
+                       tvb,
+                       offset,
+                       length,
+                       "UA3G Body - %s",
+                       val_to_str(opcode, opcodes_vals, "Unknown"));
+
+               if(message_direction == SYS_TO_TERM)
+               {
+                       switch(opcode)
+                       {
+                       case PRODUCTION_TEST: /* 0x01 */
+                       case SUBDEVICE_RESET: /* 0x06 */
+                       case ARE_YOU_THERE: /* 0x2B */
+                       case SET_SPEAKER_VOL: /* 0x3B */
+                       case TRACE_ON: /* 0x42 */
+                               {
+                                       decode_with_one_parameter(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SUBDEVICE_ESCAPE: /* 0x02 */
+                               {
+                                       decode_subdevice_escape(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SOFT_RESET: /* 0x03 */
+                               {
+                                       decode_software_reset(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case IP_PHONE_WARMSTART: /* 0x04 */
+                               {
+                                       decode_ip_phone_warmstart(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SUPER_MSG: /* 0x0B */
+                       case SUPER_MSG_2: /* 0x17 */
+                               {
+                                       decode_super_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SEGMENT_MSG: /* 0x0C */
+                               {
+                                       decode_segment_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case IP_DEVICE_ROUTING: /* 0x13 */
+                               {
+                                       decode_ip_device_routing(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case DEBUG_IN_LINE: /* 0x18 */
+                               {
+                                       decode_debug_in_line(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case LED_COMMAND: /* 0x21 */
+                               {
+                                       decode_led_command(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case LCD_LINE_1_CMD: /* 0x27 */
+                       case LCD_LINE_2_CMD: /* 0x28 */
+                               {
+                                       decode_lcd_line_cmd(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case MAIN_VOICE_MODE: /* 0x29 */
+                               {
+                                       decode_main_voice_mode(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case SUBDEVICE_METASTATE: /* 0x2C */
+                               {
+                                       decode_subdevice_metastate(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case DWL_DTMF_CLCK_FORMAT: /* 0x30 */
+                               {
+                                       decode_dwl_dtmf_clck_format(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SET_CLCK: /* 0x31 */
+                               {
+                                       decode_set_clck(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case VOICE_CHANNEL: /* 0x32 */
+                               {
+                                       decode_voice_channel(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case EXTERNAL_RINGING: /* 0x33 */
+                               {
+                                       decode_external_ringing(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case LCD_CURSOR: /* 0x35 */
+                               {
+                                       decode_lcd_cursor(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case DWL_SPECIAL_CHAR: /* 0x36 */
+                               {
+                                       decode_dwl_special_char(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SET_CLCK_TIMER_POS: /* 0x38 */
+                               {
+                                       decode_set_clck_timer_pos(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case SET_LCD_CONTRAST: /* 0x39 */
+                               {
+                                       decode_set_lcd_contrast(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case BEEP: /* 0x3C */
+                               {
+                                       decode_beep(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case SIDETONE: /* 0x3D */
+                               {
+                                       decode_sidetone(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case RINGING_CADENCE: /* 0x3E */
+                               {
+                                       decode_ringing_cadence(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case MUTE: /* 0x3F */
+                               {
+                                       decode_mute(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case FEEDBACK: /* 0x40 */
+                               {
+                                       decode_feedback(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case READ_PERIPHERAL: /* 0x44 */
+                       case WRITE_PERIPHERAL: /* 0x45 */
+                               {
+                                       decode_r_w_peripheral(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case ICON_CMD: /* 0x47 */
+                               {
+                                       decode_icon_cmd(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case AUDIO_CONFIG: /* 0x49 */
+                               {
+                                       decode_audio_config(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case AUDIO_PADDED_PATH: /* 0x4A */
+                               {
+                                       decode_audio_padded_path(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case KEY_RELEASE: /* 0x41 */
+                       case AMPLIFIED_HANDSET: /* 0x48 */
+                       case LOUDSPEAKER: /* 0x4D */
+                       case ANNOUNCE: /* 0x4E */
+                               {
+                                       decode_on_off_level(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case RING: /* 0x4F */
+                               {
+                                       decode_ring(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case UA_DWL_PROTOCOL: /* 0x50 */
+                               {
+                                       decode_ua_dwl_protocol(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       /* Case for UA3G message with only opcode (No body) */
+                       case NOP: /* 0x00 */
+                       case HE_ROUTING:        /* 0x05 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case LOOPBACK_ON: /* 0x07 */
+                       case LOOPBACK_OFF: /* 0x08 */
+                       case VIDEO_ROUTING:     /* 0x09 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case REMOTE_UA_ROUTING: /* 0x0D NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case VERY_REMOTE_UA_ROUTING:    /* 0x0E NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case OSI_ROUTING:       /* 0x0F NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case ABC_A_ROUTING:     /* 0x11 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case IBS_ROUTING:       /* 0x12 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case M_REFLEX_HUB_ROUTING:      /* 0x14 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case START_BUZZER: /* 0x22 */
+                       case STOP_BUZZER: /* 0x23 */
+                       case ENABLE_DTMF: /* 0x24 */
+                       case DISABLE_DTMF: /* 0x25 */
+                       case CLEAR_LCD_DISP: /* 0x26 */
+                       case VERSION_INQUIRY: /* 0x2A */
+                       case VTA_STATUS_INQUIRY: /* 0x2D */
+                       case SUBDEVICE_STATE: /* 0x2E */
+                       case AUDIO_IDLE: /* 0x3A */
+                       case TRACE_OFF: /* 0x43 */
+                       case ALL_ICONS_OFF: /* 0x46 */
+                       case RELEASE_RADIO_LINK: /* 0x4B */
+                       case DECT_HANDOVER:     /* 0x4C NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       default:
+                               {
+                                       break;
+                               }
+                       }
+               }
+               if(message_direction == TERM_TO_SYS)
+               {
+                       switch(opcode)
+                       {
+                       case CS_DIGIT_DIALED: /* 0x03 */
+                               {
+                                       decode_digit_dialed(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_SUBDEVICE_MSG: /* 0x04 */
+                               {
+                                       decode_subdevice_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_SUPER_MSG: /* 0x0B */
+                       case CS_SUPER_MSG_2: /* 0x17 */
+                               {
+                                       decode_super_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_SEGMENT_MSG: /* 0x0C */
+                               {
+                                       decode_segment_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_IP_DEVICE_ROUTING: /* 0x13 */
+                               {
+                                       decode_cs_ip_device_routing(ua3g_tree, tvb, pinfo, offset, length, opcode,ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_DEBUG_IN_LINE: /* 0x18 */
+                               {
+                                       decode_debug_in_line(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_NON_DIGIT_KEY_PUSHED:   /* 0x20 Key translation not sure */
+                       case CS_DIGIT_KEY_RELEASED:     /* 0x26 Key translation not sure */
+                       case CS_KEY_RELEASED: /* 0x2A */
+                       case CS_TM_KEY_PUSHED:  /* 0x2D Key translation not sure */
+                               {
+                                       decode_key_number(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_UNSOLICITED_MSG: /* 0x9F (0x1F) */
+                       case CS_VERSION_RESPONSE: /* 0x21 */
+                               {
+                                       decode_unsolicited_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_I_M_HERE: /* 0x22 */
+                               {
+                                       decode_i_m_here(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_RSP_STATUS_INQUIRY: /* 0x23 */
+                       case CS_SPECIAL_KEY_STATUS: /* 0x29 */
+                               {
+                                       decode_special_key(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_SUBDEVICE_STATE: /* 0x24 */
+                               {
+                                       decode_subdevice_state(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_PERIPHERAL_CONTENT: /* 0x2B */
+                               {
+                                       decode_r_w_peripheral(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item);
+                                       break;
+                               }
+                       case CS_UA_DWL_PROTOCOL: /* 0x50 */
+                               {
+                                       decode_ua_dwl_protocol(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item);
+                                       break;
+                               }
+                       /* Case for UA3G message with only opcode (No body) */
+                       case CS_NOP_ACK: /* 0x00 */
+                       case CS_HANDSET_OFFHOOK: /* 0x01 */
+                       case CS_HANDSET_ONHOOK: /* 0x02 */
+                       case CS_HE_ROUTING:     /* 0x05 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_LOOPBACK_ON: /* 0x06 */
+                       case CS_LOOPBACK_OFF: /* 0x07 */
+                       case CS_VIDEO_ROUTING:  /* 0x09 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_WARMSTART_ACK: /* 0x0A */
+                       case CS_REMOTE_UA_ROUTING:      /* 0x0D NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_VERY_REMOTE_UA_R:       /* 0x0E NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_OSI_ROUTING:    /* 0x0F NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_ABC_A_ROUTING:  /* 0x11 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_IBS_ROUTING:    /* 0x12 NOT DECODED - No description in 3AK 29000 0556 DSZZA */
+                       case CS_TRACE_ON_ACK: /* 0x27 */
+                       case CS_TRACE_OFF_ACK: /* 0x28 */
+                       default:
+                               {
+                                       break;
+                               }
+                       }
+               }
+       }
+}
+
+
+/*-----------------------------------------------------------------------------
+       DISSECTORS REGISTRATION FUNCTIONS
+       ---------------------------------------------------------------------------*/
+void proto_register_ua3g(void)
+{
+       static hf_register_info hf_ua3g[] =
+               {
+                       { &hf_ua3g_length,
+                               {
+                               "Length",
+                               "ua3g.length",
+                               FT_UINT16,
+                               BASE_DEC,
+                               NULL,
+                               0x00,
+                               "Decimal Value",
+                               HFILL
+                               }
+                       },
+                       { &hf_ua3g_opcode,
+                               {
+                               "Opcode",
+                               "ua3g.opcode",
+                               FT_UINT8,
+                               BASE_HEX,
+                               NULL,
+                               0x00,
+                               "Hexa Value",
+                               HFILL
+                               }
+                       },
+                       { &hf_ua3g_ip,
+                               {
+                               "IP Device Routing",
+                               "ua3g.ip",
+                               FT_UINT8,
+                               BASE_HEX,
+                               NULL,
+                               0x00,
+                               "Hexa Value - 2nd Command For IP Device Routing Opcode",
+                               HFILL
+                               }
+                       },
+                       { &hf_ua3g_command,
+                               {
+                               "Command",
+                               "ua3g.command",
+                               FT_UINT8,
+                               BASE_HEX,
+                               NULL,
+                               0x00,
+                               "Hexa Value - 2nd Command (Excepted IP Device Routing Opcode)",
+                               HFILL
+                               }
+                       },
+               };
+       
+       static gint *ett[] =
+    {
+    &ett_ua3g,
+    &ett_ua3g_body,
+       &ett_ua3g_param,
+       &ett_ua3g_option,
+    };
+
+    /* UA3G dissector registration */
+    proto_ua3g = proto_register_protocol("UA3G Message",
+               "UA3G",
+               "ua3g");
+       
+    proto_register_field_array(proto_ua3g, hf_ua3g, array_length(hf_ua3g));
+
+    register_dissector("ua3g", dissect_ua3g, proto_ua3g);
+
+    /* Common subtree array registration */
+    proto_register_subtree_array(ett, array_length(ett));
+}
+
+
+void proto_reg_handoff_ua3g(void)
+{
+    dissector_handle_t handle_ua3g = find_dissector("ua3g");
+
+    /* hooking of UA3G on UDP */
+    register_dissector_table("ua3g.opcode",
+               "ua3g.opcode",
+               FT_UINT8,
+               BASE_HEX);
+    
+    dissector_add("ua3g.opcode", 0x15, handle_ua3g);
+}
diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c
new file mode 100644 (file)
index 0000000..a6b2095
--- /dev/null
@@ -0,0 +1,573 @@
+/* packet-uasip.c
+ * Routines for UA/UDP (Universal Alcatel over UDP) and NOE/SIP packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
+ *
+ * $Id: 
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#include "packet-uaudp.h"
+
+#include <string.h>
+#include <glib.h>
+
+#include "epan/packet.h"
+#include "epan/prefs.h"
+#include "epan/tap.h"
+#include "epan/value_string.h"
+
+void proto_reg_handoff_uasip(void);
+gboolean str_to_ipaddr(const gchar *addr, guint8 *ad);
+
+static tap_struct_uaudp ua_tap_info;
+static int uasip_tap                           = -1;
+static int proto_uasip                         = -1;
+static int hf_uasip_opcode                     = -1;
+static int hf_uasip_version                    = -1;
+static int hf_uasip_window_size                = -1;
+static int hf_uasip_mtu                                = -1;
+static int hf_uasip_udp_lost           = -1;
+static int hf_uasip_udp_lost_reinit    = -1;
+static int hf_uasip_keepalive          = -1;
+static int hf_uasip_qos_ip_tos         = -1;
+static int hf_uasip_qos_8021_vlid      = -1;
+static int hf_uasip_qos_8021_pri       = -1;
+static int hf_uasip_expseq                     = -1;
+static int hf_uasip_sntseq                     = -1;
+static gint ett_uasip                          = -1;
+
+static guint8 proxy_ipaddr[4];
+static const char* pref_proxy_ipaddr_s = NULL;
+static gboolean use_proxy_ipaddr = FALSE;
+static gboolean noesip_enabled = FALSE;
+
+#define UAUDP_CONNECT_VERSION           0x00
+#define UAUDP_CONNECT_WINDOW_SIZE       0x01
+#define UAUDP_CONNECT_MTU               0x02
+#define UAUDP_CONNECT_UDP_LOST          0x03
+#define UAUDP_CONNECT_UDP_LOST_REINIT   0x04
+#define UAUDP_CONNECT_KEEPALIVE         0x05
+#define UAUDP_CONNECT_QOS_IP_TOS        0x06
+#define UAUDP_CONNECT_QOS_8021_VLID     0x07
+#define UAUDP_CONNECT_QOS_8021_PRI      0x08
+
+static const value_string uasip_opcode_str[] =
+{
+       { UAUDP_CONNECT,                "Connect" },
+       { UAUDP_CONNECT_ACK,    "Connect ACK" },
+       { UAUDP_RELEASE,                "Release" },
+       { UAUDP_RELEASE_ACK,    "Release ACK" },
+       { UAUDP_KEEPALIVE,              "Keepalive" },
+       { UAUDP_KEEPALIVE_ACK,  "Keepalive ACK" },
+       { UAUDP_NACK,                   "NACK" },
+       { UAUDP_DATA,                   "DATA" },
+       { 0,                                    NULL }
+};
+
+static const value_string uasip_connect_vals[] =
+{
+       { UAUDP_CONNECT_VERSION,                        "Version" },
+       { UAUDP_CONNECT_WINDOW_SIZE,            "Window Size" },
+       { UAUDP_CONNECT_MTU,                            "MTU" },
+       { UAUDP_CONNECT_UDP_LOST,                       "UDP lost" },
+       { UAUDP_CONNECT_UDP_LOST_REINIT,        "UDP lost reinit" },
+       { UAUDP_CONNECT_KEEPALIVE,                      "Keepalive" },
+       { UAUDP_CONNECT_QOS_IP_TOS,                     "QoS IP TOS" },
+       { UAUDP_CONNECT_QOS_8021_VLID,          "QoS 802.1 VLID" },
+       { UAUDP_CONNECT_QOS_8021_PRI,           "QoS 802.1 PRI"},
+       { 0,                                                            NULL }
+};
+
+static dissector_handle_t ua_sys_to_term_handle;
+static dissector_handle_t ua_term_to_sys_handle;
+
+gboolean str_to_ipaddr(const gchar *addr, guint8 *ad)
+{
+       int i = 0;
+       const gchar *p = addr;
+       guint32 value;
+
+       if (addr == NULL)
+       {
+               return FALSE;
+       }
+       
+       for (i = 0; i < 4; i++)
+       {
+               value = 0;
+               while (*p != '.' && *p != '\0')
+               {
+                       value = value * 10 + (*p - '0');
+                       p++;
+               }
+               if(value > 255)
+               {
+            return FALSE;
+               }
+               ad[i] = value;
+               p++;
+       }
+
+       return TRUE;
+}
+
+static void rTLV(proto_tree *tree, int *V, tvbuff_t *tvb, gint offset, gint8 L)
+{
+       switch(L)
+       {
+               case 1:
+                       proto_tree_add_uint(tree, *V, tvb, offset, L+2, tvb_get_guint8(tvb, offset+2));
+               break;
+               
+               case 2:
+                       proto_tree_add_uint(tree, *V, tvb, offset, L+2, tvb_get_ntohs(tvb, offset+2));
+               break;
+               
+               case 3:
+                       proto_tree_add_uint(tree, *V, tvb, offset, L+2, tvb_get_ntoh24(tvb, offset+2));
+               break;
+               
+               case 4:
+                       proto_tree_add_uint(tree, *V, tvb, offset, L+2, tvb_get_ntohl(tvb, offset+2));
+               break;
+               
+               default:
+               break;
+    }
+}
+
+
+static void _dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, e_ua_direction direction)
+{
+       proto_item *uasip_item = NULL;
+       proto_tree *uasip_tree = NULL;
+       gint offset = 0;
+       guint8 opcode = 0;
+
+       if (noesip_enabled)
+       {
+               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               {
+                       col_append_str(pinfo->cinfo, COL_PROTOCOL, "/NOE");
+               }
+       }
+       else
+       {
+               if (check_col(pinfo->cinfo, COL_PROTOCOL))
+               {
+                       col_append_str(pinfo->cinfo, COL_PROTOCOL, "/DL");
+               }
+       }
+
+       opcode = tvb_get_guint8(tvb, offset);
+       offset++;
+
+       ua_tap_info.opcode = opcode;
+       ua_tap_info.expseq = 0;
+       ua_tap_info.sntseq = 0;
+
+       if (check_col(pinfo->cinfo, COL_INFO))
+       {
+               col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(opcode, uasip_opcode_str, "unknown (0x%02x)"));
+       }
+
+    uasip_item = proto_tree_add_protocol_format(tree, proto_uasip, tvb, 0, 5, "SIP/NOE Protocol, %s", val_to_str(opcode, uasip_opcode_str, "unknown (0x%02x)"));
+       uasip_tree = proto_item_add_subtree(uasip_item, ett_uasip);
+       proto_tree_add_uint(uasip_tree, hf_uasip_opcode, tvb, 0, 1, opcode);
+
+       switch(opcode)
+       {
+               case UAUDP_CONNECT:
+               {
+                       while(tvb_offset_exists(tvb, offset))
+                       {
+                               guint8 T = tvb_get_guint8(tvb, offset+0);
+                               guint8 L = tvb_get_guint8(tvb, offset+1);
+
+                               switch(T)
+                {
+                                       case UAUDP_CONNECT_VERSION:
+                                               rTLV(uasip_tree, &hf_uasip_version, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_WINDOW_SIZE:
+                                               rTLV(uasip_tree, &hf_uasip_window_size, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_MTU:
+                                               rTLV(uasip_tree, &hf_uasip_mtu, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_UDP_LOST:
+                                               rTLV(uasip_tree, &hf_uasip_udp_lost, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_UDP_LOST_REINIT:
+                                               rTLV(uasip_tree, &hf_uasip_udp_lost_reinit, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_KEEPALIVE:
+                                               rTLV(uasip_tree, &hf_uasip_keepalive, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_QOS_IP_TOS:
+                                               rTLV(uasip_tree, &hf_uasip_qos_ip_tos, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_QOS_8021_VLID:
+                                               rTLV(uasip_tree, &hf_uasip_qos_8021_vlid, tvb, offset, L);
+                                       break;
+                                       
+                                       case UAUDP_CONNECT_QOS_8021_PRI:
+                                               rTLV(uasip_tree, &hf_uasip_qos_8021_pri, tvb, offset, L);
+                                       break;
+                                       
+                                       default:
+                                       break;
+                               }
+                               offset += (2 + L);
+                       }
+               }
+               break;
+
+               case UAUDP_NACK:
+               {
+                       proto_tree_add_uint(uasip_tree, hf_uasip_expseq, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
+                       ua_tap_info.expseq = tvb_get_ntohs(tvb, offset+0);
+                       offset += 2;
+                       
+                       if (noesip_enabled)
+                       {
+                               if (check_col(pinfo->cinfo, COL_INFO)) 
+                               {
+                                       col_add_fstr(pinfo->cinfo, COL_INFO, "NACK");
+                               }
+                       }
+                       else
+                       {
+                               if (check_col(pinfo->cinfo, COL_INFO)) 
+                               {
+                                       col_add_fstr(pinfo->cinfo, COL_INFO, "NACK exp:%d", ua_tap_info.expseq);
+                               }
+                       }
+               }
+               break;
+
+        case UAUDP_DATA:
+        {
+                       int datalen;
+
+                       proto_tree_add_uint(uasip_tree, hf_uasip_expseq, tvb, offset+0, 2, tvb_get_ntohs(tvb, offset+0));
+            proto_tree_add_uint(uasip_tree, hf_uasip_sntseq, tvb, offset+2, 2, tvb_get_ntohs(tvb, offset+2));
+                       ua_tap_info.expseq = tvb_get_ntohs(tvb, offset+0);
+                       ua_tap_info.sntseq = tvb_get_ntohs(tvb, offset+2);
+                       offset += 4;
+                       datalen  = (tvb_length(tvb) - offset);
+
+                       if (noesip_enabled)
+                       {
+                               if (datalen > 0)
+                               {
+                                       if (direction == SYS_TO_TERM)
+                                       {
+                                               call_dissector(ua_sys_to_term_handle, tvb_new_subset(tvb, offset, datalen, datalen), pinfo, tree);
+                                       }
+                                       else if (direction == TERM_TO_SYS)
+                                       {
+                                               call_dissector(ua_term_to_sys_handle, tvb_new_subset(tvb, offset, datalen, datalen), pinfo, tree);
+                                       }
+                       else
+                       {
+                                               if (check_col(pinfo->cinfo, COL_INFO))
+                                               {
+                                                       col_add_str(pinfo->cinfo, COL_INFO, "DATA - Couldn't resolve direction.");
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       if (check_col(pinfo->cinfo, COL_INFO))
+                                       {
+                                               col_add_str(pinfo->cinfo, COL_INFO, "ACK");
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               if (datalen > 0)
+                               {
+                                       if (check_col(pinfo->cinfo, COL_INFO))
+                                       {
+                                               col_add_fstr(pinfo->cinfo, COL_INFO, "DATA exp:%d", ua_tap_info.expseq);
+                                               col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq);
+                                       }
+                               }
+                               else
+                               {
+                                       if (check_col(pinfo->cinfo, COL_INFO))
+                                       {
+                                               col_add_fstr(pinfo->cinfo, COL_INFO, "ACK  exp:%d", ua_tap_info.expseq);
+                                               col_append_fstr(pinfo->cinfo, COL_INFO, " snt:%d", ua_tap_info.sntseq);
+                                       }
+                               }
+                       }
+               }
+               break;
+               
+               default:
+               break;
+       }
+    tap_queue_packet(uasip_tap, pinfo, &ua_tap_info);
+}
+
+static void dissect_uasip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+       if (use_proxy_ipaddr)
+       {
+               if (memcmp((pinfo->src).data, proxy_ipaddr, 4*sizeof(guint8)) == 0)
+               {
+                       _dissect_uasip(tvb, pinfo, tree, SYS_TO_TERM);
+                       return;
+               }
+               else if (memcmp((pinfo->dst).data, proxy_ipaddr, 4*sizeof(guint8)) == 0)
+               {
+                       _dissect_uasip(tvb, pinfo, tree, TERM_TO_SYS);
+                       return;
+               }
+       }
+       _dissect_uasip(tvb, pinfo, tree, DIR_UNKNOWN);
+}
+
+void proto_register_uasip()
+{
+       module_t *uasip_module;
+
+       static hf_register_info hf_uasip[] =
+       {
+               { 
+                       &hf_uasip_opcode,
+                       {
+                               "Opcode",
+                               "uasip.opcode",
+                               FT_UINT8,
+                               BASE_DEC,
+                               VALS(uasip_opcode_str),
+                               0x0,
+                               "UA/SIP Opcode",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_version,
+                       {
+                               "Version",
+                               "uasip.version",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Version",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_window_size,
+                       {
+                               "Window Size",
+                               "uasip.window_size", 
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Window Size",
+                               HFILL
+                       }
+               },
+               {
+                       &hf_uasip_mtu,
+                       {
+                               "MTU", 
+                               "uasip.mtu",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP MTU",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_udp_lost,
+                       {
+                               "UDP Lost",
+                               "uasip.udp_lost",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Lost",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_udp_lost_reinit,
+                       { 
+                               "UDP lost reinit",
+                               "uasip.udp_lost_reinit",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Lost Re-Init",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_keepalive,
+                       { 
+                               "Keepalive",
+                               "uasip.keepalive",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Keepalive",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_qos_ip_tos,
+                       {
+                               "QoS IP TOS",
+                               "uasip.qos_ip_tos",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP QoS IP TOS",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_qos_8021_vlid,
+                       { 
+                               "QoS 802.1 VLID",
+                               "uasip.qos_8021_vlid",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP QoS 802.1 VLID",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_qos_8021_pri,
+                       { 
+                               "QoS 802.1 PRI",
+                               "uasip.qos_8021_pri",
+                               FT_UINT8,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP QoS 802.1 PRI",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_expseq,
+                       {
+                               "Sequence Number (expected)",
+                               "uasip.expseq",
+                               FT_UINT16,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Expected Sequence Number",
+                               HFILL
+                       }
+               },
+               { 
+                       &hf_uasip_sntseq,
+                       { 
+                               "Sequence Number (sent)    ", 
+                               "uasip.sntseq",
+                               FT_UINT16,
+                               BASE_DEC,
+                               NULL,
+                               0x0,
+                               "UA/SIP Sent Sequence Number",
+                               HFILL
+                       }
+               },
+    };
+
+       static gint *ett[] =
+       {
+               &ett_uasip,
+       };
+
+       proto_uasip = proto_register_protocol("UA/SIP Protocol", "UASIP", "uasip"); 
+       register_dissector("uasip", dissect_uasip, proto_uasip);
+
+       proto_register_field_array(proto_uasip, hf_uasip, array_length(hf_uasip));
+       proto_register_subtree_array(ett, array_length(ett));
+
+       uasip_module = prefs_register_protocol(proto_uasip, proto_reg_handoff_uasip);
+       prefs_register_bool_preference(uasip_module, "noesip", "Try to decode SIP NOE", "NOE SIP Protocol", &noesip_enabled);
+       prefs_register_string_preference(uasip_module, "proxy_ipaddr", "Proxy IP Address", "IPv4 address of the proxy", &pref_proxy_ipaddr_s);
+/*     uasip_tap = register_tap("uasip");*/
+}
+
+void proto_reg_handoff_uasip(void)
+{
+       static gboolean prefs_initialized = FALSE;
+       static dissector_handle_t uasip_handle;
+
+       if(!prefs_initialized)
+       {
+               uasip_handle = create_dissector_handle(dissect_uasip, proto_uasip);
+               ua_sys_to_term_handle = find_dissector("ua_sys_to_term");
+               ua_term_to_sys_handle = find_dissector("ua_term_to_sys");
+               prefs_initialized = TRUE;
+       }
+    else 
+    {
+               if (str_to_ipaddr(pref_proxy_ipaddr_s, proxy_ipaddr))
+               {
+                       use_proxy_ipaddr = TRUE;
+               }
+               else
+               {
+                       use_proxy_ipaddr = FALSE;
+                       pref_proxy_ipaddr_s = g_strdup("");
+               }
+       }
+       dissector_add_string("media_type", "application/octet-stream", uasip_handle);
+}
+
index ebe5b6eb5e55d36f8734a72c123462972ea4f7cc..b2c519f1cf42a9adaf25fb5bd8700c8bc82ba6f9 100644 (file)
@@ -1,8 +1,8 @@
 /* packet-uaudp.c
- * Routines for UA/UDP (Universal Alcatel UDP) packet dissection.
- * Copyright 2011, Marek Tews <marek@trx.com.pl>
+ * Routines for UA/UDP (Universal Alcatel over UDP) packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
  *
- * $Id$
+ * $Id
  *
  * Wireshark - Network traffic analyzer
  * By Gerald Combs <gerald@wireshark.org>
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 
-#include <epan/packet.h>
-#include <epan/prefs.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 
-#include "packet-ua.h"
+#include "packet-uaudp.h"
 
-static gboolean use_heuristic_dissector = TRUE;
-static range_t *global_uaudp_port_range = NULL;
+#include <string.h>
+#include <glib.h>
 
-/* Define the UAUDP proto */
-static int proto_uaudp = -1;
-static dissector_handle_t uaudp_handle;
-static dissector_table_t uaudp_dissector_table;
+#include "epan/packet.h"
+#include "epan/prefs.h"
+#include "epan/tap.h"
+#include "epan/value_string.h"
 
-/* Define many header fields for UAUDP */
-static int hf_uaudp_opcode = -1;
-static int hf_uaudp_expected = -1;
-static int hf_uaudp_send = -1;
 
-/*
-* Define the trees for UAUDP
-*/
-static int ett_uaudp_header = -1;
+/* GLOBALS */
 
-/**
-* Opcode
-*/
-static const value_string szUaOpcode[] =
+static int uaudp_tap                = -1;
+
+static tap_struct_uaudp ua_tap_info;
+
+static int proto_uaudp              = -1;
+
+static int hf_uaudp_opcode          = -1;
+static int hf_uaudp_version         = -1;
+static int hf_uaudp_window_size     = -1;
+static int hf_uaudp_mtu             = -1;
+static int hf_uaudp_udp_lost        = -1;
+static int hf_uaudp_udp_lost_reinit = -1;
+static int hf_uaudp_keepalive       = -1;
+static int hf_uaudp_qos_ip_tos      = -1;
+static int hf_uaudp_qos_8021_vlid   = -1;
+static int hf_uaudp_qos_8021_pri    = -1;
+static int hf_uaudp_expseq          = -1;
+static int hf_uaudp_sntseq          = -1;
+
+static gint ett_uaudp               = -1;
+
+/* pref */
+static guint8 sys_ip[4];
+static const char* pref_sys_ip_s = "";
+
+static gboolean use_sys_ip = FALSE;
+static gboolean decode_ua = TRUE;
+
+#define UAUDP_CONNECT_VERSION           0x00
+#define UAUDP_CONNECT_WINDOW_SIZE       0x01
+#define UAUDP_CONNECT_MTU               0x02
+#define UAUDP_CONNECT_UDP_LOST          0x03
+#define UAUDP_CONNECT_UDP_LOST_REINIT   0x04
+#define UAUDP_CONNECT_KEEPALIVE         0x05
+#define UAUDP_CONNECT_QOS_IP_TOS        0x06
+#define UAUDP_CONNECT_QOS_8021_VLID     0x07
+#define UAUDP_CONNECT_QOS_8021_PRI      0x08
+
+
+static const value_string uaudp_opcode_str[] =
+{
+    { UAUDP_CONNECT,        "Connect" },
+    { UAUDP_CONNECT_ACK,    "Connect ACK" },
+    { UAUDP_RELEASE,        "Release" },
+    { UAUDP_RELEASE_ACK,    "Release ACK" },
+    { UAUDP_KEEPALIVE,      "Keepalive" },
+    { UAUDP_KEEPALIVE_ACK,  "Keepalive ACK" },
+    { UAUDP_NACK,           "NACK" },
+    { UAUDP_DATA,           "Data" },
+    { 0, NULL }
+};
+
+
+static const value_string uaudp_connect_vals[] =
 {
-    { 0, "Connect" },
-    { 1, "Connect ACK" },
-    { 2, "Release" },
-    { 3, "Release ACK" },
-    { 4, "Keepalive" },
-    { 5, "Keepalive ACK" },
-    { 6, "NACK" },
-    { 7, "Data" },
+    { UAUDP_CONNECT_VERSION,        "Version" },
+    { UAUDP_CONNECT_WINDOW_SIZE,    "Window Size" },
+    { UAUDP_CONNECT_MTU,            "MTU" },
+    { UAUDP_CONNECT_UDP_LOST,       "UDP lost" },
+    { UAUDP_CONNECT_UDP_LOST_REINIT,"UDP lost reinit" },
+    { UAUDP_CONNECT_KEEPALIVE,      "Keepalive" },
+    { UAUDP_CONNECT_QOS_IP_TOS,     "QoS IP TOS" },
+    { UAUDP_CONNECT_QOS_8021_VLID,  "QoS 802.1 VLID" },
+    { UAUDP_CONNECT_QOS_8021_PRI,   "QoS 802.1 PRI"},
     { 0, NULL }
 };
 
+
+static dissector_handle_t ua_sys_to_term_handle;
+static dissector_handle_t ua_term_to_sys_handle;
+
+
+typedef struct
+{
+    char   *name;
+    char   *text;
+    guint   port;
+    guint   last_port;
+} prefs_uaudp_t;
+
+#define MAX_TERMINAL_PORTS 4
+
+static prefs_uaudp_t ports[MAX_TERMINAL_PORTS] =
+{
+    {"port1", "Terminal UDP port (setting 1)", 32000,  32000},
+    {"port2", "Terminal UDP port (setting 2)", 32512,  32512},
+    {"port3", "Terminal UDP port (setting 3)", 0,      0},
+    {"port4", "Terminal UDP port (setting 4)", 0,      0},
+};
 /*
-* dissect_uaudp - The dissector for the UA/UDP protocol
+    {"port5", "Terminal UDP port (setting 5)", 0,      0},
+    {"port6", "Terminal UDP port (setting 6)", 0,      0},
+    {"port7", "Terminal UDP port (setting 7)", 0,      0},
+    {"port8", "Terminal UDP port (setting 8)", 0,      0}
+};
 */
-static int
-dissect_uaudp(tvbuff_t *pTvb, packet_info *pInfo, proto_tree *pTree)
+
+guint find_terminal_port(guint port)
 {
-    gint   nLen;
-    guint8 u8Opcode;
-    proto_item *pUAUDP, *pHeaderSubTree;
+    int i;
+    for (i=0; i<MAX_TERMINAL_PORTS; i++)
+        if (ports[i].port == port)
+            return 1;
+    return 0;
+}
 
-    /* PROTOCOL column */
-    col_set_str(pInfo->cinfo, COL_PROTOCOL, "UAUDP");
 
-    nLen = tvb_reported_length(pTvb);
-    u8Opcode = tvb_get_guint8(pTvb, 0);
+static void rV(proto_tree *tree, int *V, tvbuff_t *tvb, gint offset, gint8 L)
+{
+    switch(L)
+    {
+    case 1:
+    proto_tree_add_uint(tree,
+                *V,
+                tvb,
+                offset,
+                L+2,
+                tvb_get_guint8(tvb, offset+2));
+    break;
+    case 2:
+    proto_tree_add_uint(tree,
+                *V,
+                tvb,
+                offset,
+                L+2,
+                tvb_get_ntohs(tvb, offset+2));
+    break;
+    case 3:
+    proto_tree_add_uint(tree,
+                *V,
+                tvb,
+                offset,
+                L+2,
+                tvb_get_ntoh24(tvb, offset+2));
+    break;
+    case 4:
+    proto_tree_add_uint(tree,
+                *V,
+                tvb,
+                offset,
+                L+2,
+                tvb_get_ntohl(tvb, offset+2));
+    break;
+    }
+}
 
-    /* INFO column */
-    col_set_str(pInfo->cinfo, COL_INFO, val_to_str_const(u8Opcode, szUaOpcode, "Unknown"));
 
-    /* opcode "UA/UDP Protocol, ..." */
-    pUAUDP = proto_tree_add_item(pTree, proto_uaudp, pTvb, 0, -1, ENC_NA);
-    proto_item_append_text(pUAUDP, ", %s (%d)", val_to_str_const(u8Opcode, szUaOpcode, "Unknown"), u8Opcode);
+/* UA/UDP DISSECTOR */
+static void _dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+                           e_ua_direction direction)
+{
+    proto_item *uaudp_item = NULL;
+    proto_tree *uaudp_tree = NULL;
+    gint offset = 0;
+    guint8 opcode = 0;
+
+    /* print the name of the protocol in the "PROTOCOL" column */
+    if (check_col(pinfo->cinfo, COL_PROTOCOL))
+        col_set_str(pinfo->cinfo, COL_PROTOCOL, "UAUDP");
 
-    pHeaderSubTree = proto_item_add_subtree(pUAUDP, ett_uaudp_header);
-    proto_tree_add_item(pHeaderSubTree, hf_uaudp_opcode, pTvb, 0, 1, ENC_BIG_ENDIAN);
+    /* get the identifer, it means operation code */
+    opcode = tvb_get_guint8(tvb, offset);
+    offset++;
 
-    switch(u8Opcode)
+    ua_tap_info.opcode = opcode;
+    ua_tap_info.expseq = 0;
+    ua_tap_info.sntseq = 0;
+
+    /* print in "INFO" column the type of UAUDP message */
+
+    if (check_col(pinfo->cinfo, COL_INFO))
+        col_add_fstr(pinfo->cinfo,
+             COL_INFO,
+             "%s",
+             val_to_str(opcode, uaudp_opcode_str, "unknown (0x%02x)"));
+
+    if (tree)
     {
-    case 6:
+               uaudp_item = proto_tree_add_protocol_format(tree, proto_uaudp, tvb, 0, 5,
+                       "Universal Alcatel/UDP Encapsulation Protocol, %s",
+                       val_to_str(opcode, uaudp_opcode_str, "unknown (0x%02x)"));
+
+        uaudp_tree = proto_item_add_subtree(uaudp_item, ett_uaudp);
+
+        /* print the identifier */
+        proto_tree_add_uint(uaudp_tree, hf_uaudp_opcode, tvb, 0, 1, opcode);
+
+        switch(opcode)
+        {
+        case UAUDP_CONNECT:
         {
-            /* Sequence Number (expected) */
-            proto_tree_add_item(pHeaderSubTree, hf_uaudp_expected, pTvb, 1, 2, ENC_BIG_ENDIAN);
+            while(tvb_offset_exists(tvb, offset))
+            {
+                guint8 T = tvb_get_guint8(tvb, offset+0);
+                guint8 L = tvb_get_guint8(tvb, offset+1);
+
+                switch(T)
+                {
+                case UAUDP_CONNECT_VERSION:
+                    rV(uaudp_tree, &hf_uaudp_version        , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_WINDOW_SIZE:
+                    rV(uaudp_tree, &hf_uaudp_window_size    , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_MTU:
+                    rV(uaudp_tree, &hf_uaudp_mtu            , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_UDP_LOST:
+                    rV(uaudp_tree, &hf_uaudp_udp_lost       , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_UDP_LOST_REINIT:
+                    rV(uaudp_tree, &hf_uaudp_udp_lost_reinit, tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_KEEPALIVE:
+                    rV(uaudp_tree, &hf_uaudp_keepalive      , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_QOS_IP_TOS:
+                    rV(uaudp_tree, &hf_uaudp_qos_ip_tos     , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_QOS_8021_VLID:
+                    rV(uaudp_tree, &hf_uaudp_qos_8021_vlid  , tvb, offset, L);
+                    break;
+                case UAUDP_CONNECT_QOS_8021_PRI:
+                    rV(uaudp_tree, &hf_uaudp_qos_8021_pri   , tvb, offset, L);
+                    break;
+                }
+                offset += (2 + L);
+            }
             break;
         }
-    case 7:
-        {
-            int iOffs = 1;
-
-            /* Sequence Number (expected) */
-            proto_tree_add_item(pHeaderSubTree, hf_uaudp_expected, pTvb, iOffs, 2, ENC_BIG_ENDIAN);
-            iOffs += 2;
 
-            /* Sequence Number (sent) */
-            proto_tree_add_item(pHeaderSubTree, hf_uaudp_send, pTvb, iOffs, 2, ENC_BIG_ENDIAN);
-            iOffs += 2;
+        case UAUDP_NACK:
+        {
+            proto_tree_add_uint(uaudp_tree,
+                                hf_uaudp_expseq,
+                                tvb,
+                                offset,
+                                2,
+                                tvb_get_ntohs(tvb, offset));
+            offset += 2;
+            break;
+        }
 
-            /* Create the tvbuffer for the next dissector */
-            if(nLen > iOffs)
+        case UAUDP_DATA:
+        {
+            int datalen;
+
+            proto_tree_add_uint(uaudp_tree,
+                                hf_uaudp_expseq,
+                                tvb,
+                                offset+0,
+                                2,
+                                tvb_get_ntohs(tvb, offset+0));
+
+            proto_tree_add_uint(uaudp_tree,
+                                hf_uaudp_sntseq,
+                                tvb,
+                                offset+2,
+                                2,
+                                tvb_get_ntohs(tvb, offset+2));
+
+            ua_tap_info.expseq = hf_uaudp_expseq;
+            ua_tap_info.sntseq = hf_uaudp_sntseq;
+            offset  += 4;
+            datalen  = (tvb_length(tvb) - offset);
+
+            /* if it remains some data, call of UA dissector */
+            if (datalen > 0)
             {
-                if(dissector_try_uint(uaudp_dissector_table, 7, tvb_new_subset_remaining(pTvb, iOffs), pInfo, pTree))
-                    iOffs = nLen;
-                return iOffs;
+                if (direction==SYS_TO_TERM)
+                    call_dissector(ua_sys_to_term_handle,
+                                   tvb_new_subset(tvb, offset, datalen, datalen),
+                                   pinfo,
+                                   tree);
+                else if (direction==TERM_TO_SYS)
+                    call_dissector(ua_term_to_sys_handle,
+                                   tvb_new_subset(tvb, offset, datalen, datalen),
+                                   pinfo,
+                                   tree);
+                else {
+                    if (check_col(pinfo->cinfo, COL_INFO))
+                        col_add_str(pinfo->cinfo,
+                             COL_INFO,
+                             "Data - Couldn't resolve direction. Check UAUDP Preferences.");
+                }
+                ua_tap_info.expseq = hf_uaudp_expseq;
             }
-            else
-            {
-                col_append_str(pInfo->cinfo, COL_INFO, " ACK");
+            else {
+                /* print in "INFO" column */
+                if (check_col(pinfo->cinfo, COL_INFO))
+                    col_add_str(pinfo->cinfo,
+                                COL_INFO,
+                                "Data ACK");
             }
             break;
         }
+        default:
+            break;
+        }
     }
-    return nLen;
+    tap_queue_packet(uaudp_tap, pinfo, &ua_tap_info);
 }
 
-/*
- * UAUDP-over-UDP
- */
-static gboolean
-dissect_uaudp_heur(tvbuff_t *pTvb, packet_info *pInfo, proto_tree *pTree)
+static void dissect_uaudp_dir_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
-    guint8 u8Opcode;
+    _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN);
+}
 
-    if(!use_heuristic_dissector)
-        return FALSE;
+static void dissect_uaudp_term_to_serv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS);
+}
 
-    /* The opcode must be in range */
-    u8Opcode = tvb_get_guint8(pTvb, 0);
-    if(u8Opcode > 7)
-        return FALSE;
+static void dissect_uaudp_serv_to_term(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM);
+}
 
-    /* The minimum length of a UAUDP message */
-    switch(u8Opcode)
-    {
-    case 4:
-    case 5:
-        {
-            if(tvb_reported_length(pTvb) != 1)
-                return FALSE;
-            break;
+/*
+ * UA/UDP DISSECTOR
+ * Ethereal packet dissector entry point
+ */
+static void dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+    /* server addres has precedence on ports if present */
+    if (use_sys_ip) {
+        /* use server address to find direction*/
+        if (memcmp((pinfo->src).data, sys_ip, 4*sizeof(guint8)) == 0)
+               {
+            _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM);
+            return;
         }
-    case 6:
-        {
-            if(tvb_reported_length(pTvb) != 3)
-                return FALSE;
-            break;
+        else if (memcmp((pinfo->dst).data, sys_ip, 4*sizeof(guint8)) == 0)
+               {
+            _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS);
+            return;
         }
-    case 7:
-        {
-            guint nLen = tvb_reported_length(pTvb);
-            if(nLen < 5)
-                return FALSE;
+    }
 
-            if(nLen > 5 && !is_ua(tvb_new_subset_remaining(pTvb, 5)))
-                return FALSE;
+    /* use ports to find direction */
+    if (find_terminal_port(pinfo->srcport))
+       {
+        _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS);
+        return;
+    }
+    else if (find_terminal_port(pinfo->destport))
+       {
+        _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM);
+        return;
+    }
 
-            break;
+    _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN);
+}
+
+
+gboolean str_to_addr_ip(const gchar *addr, guint8 *ad)
+{
+    int i = 0;
+    const gchar *p = addr;
+    guint32 value;
+
+       if (addr==NULL) return FALSE;
+
+    for (i=0; i<4; i++)
+    {
+        value = 0;
+        while (*p != '.' && *p != '\0')
+        {
+            value = value * 10 + (*p - '0');
+            p++;
         }
-    /*
-     * There I met with other opcodes
-     * and do not know how much data is transmitted.
-     */
-    default: return FALSE;
+               if(value > 255)
+               {
+            return FALSE;
+               }
+               ad[i] = value;
+               p++;
     }
 
-    dissect_uaudp(pTvb, pInfo, pTree);
     return TRUE;
 }
 
-/* Register all the bits needed by the filtering engine */
+
+/* Register the protocol with Ethereal */
 void proto_reg_handoff_uaudp(void);
 
-void
-proto_register_uaudp(void)
+void proto_register_uaudp()
 {
-    static hf_register_info hf[] =
+    module_t *uaudp_module;
+    int i;
+
+    /* Setup list of header fields. See Section 1.6.1 for details */
+    static hf_register_info hf_uaudp[] =
     {
-        { &hf_uaudp_opcode,
-            { "Opcode", "uaudp.opcode",
-                FT_UINT8, BASE_DEC, VALS(szUaOpcode), 0x0,
-                "UA/UDP Opcode", HFILL }
+        { 
+            &hf_uaudp_opcode,
+            {
+                "Opcode",
+                 "uaudp.opcode",
+                 FT_UINT8,
+                 BASE_DEC,
+                 VALS(uaudp_opcode_str),
+                 0x0,
+                 "UA/UDP Opcode",
+                 HFILL
+            }
         },
-        { &hf_uaudp_expected,
-            { "Sequence Number (expected)", "uaudp.expected",
-                FT_UINT16, BASE_DEC, NULL, 0x0,
-                NULL, HFILL }
+        { 
+            &hf_uaudp_version,
+            {
+                "Version",
+                "uaudp.version",
+                FT_UINT8,
+                BASE_DEC,
+                NULL, 0x0,
+                "UA/UDP Version",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_window_size,
+            {
+                "Window Size",
+                "uaudp.window_size", 
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP Window Size",
+                HFILL
+            }
+        },
+        {
+            &hf_uaudp_mtu,
+            {
+                "MTU", 
+                "uaudp.mtu",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP MTU",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_udp_lost,
+            {
+                "UDP Lost",
+                "uaudp.udp_lost",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP Lost",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_udp_lost_reinit,
+            { 
+                "UDP lost reinit",
+                "uaudp.udp_lost_reinit",
+                FT_UINT8,
+                BASE_DEC,
+                NULL, 0x0,
+                "UA/UDP Lost Re-Init",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_keepalive,
+            { 
+                "Keepalive",
+                "uaudp.keepalive",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP Keepalive",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_qos_ip_tos,
+            {
+                "QoS IP TOS",
+                "uaudp.qos_ip_tos",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP QoS IP TOS",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_qos_8021_vlid,
+            { 
+                "QoS 802.1 VLID",
+                "uaudp.qos_8021_vlid",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP QoS 802.1 VLID",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_qos_8021_pri,
+            { 
+                "QoS 802.1 PRI",
+                "uaudp.qos_8021_pri",
+                FT_UINT8,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP QoS 802.1 PRI",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_expseq,
+            {
+                "Sequence Number (expected)",
+                "uaudp.expseq",
+                FT_UINT16,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP Expected Sequence Number",
+                HFILL
+            }
+        },
+        { 
+            &hf_uaudp_sntseq,
+            { 
+                "Sequence Number (sent)    ", 
+                "uaudp.sntseq",
+                FT_UINT16,
+                BASE_DEC,
+                NULL,
+                0x0,
+                "UA/UDP Sent Sequence Number",
+                HFILL
+            }
         },
-        { &hf_uaudp_send,
-            { "Sequence Number (sent)", "uaudp.sent",
-                FT_UINT16, BASE_DEC, NULL, 0x0,
-                NULL, HFILL }
-        }
     };
+
+    /* Setup protocol subtree array */
     static gint *ett[] =
     {
-        &ett_uaudp_header,
+        &ett_uaudp,
     };
 
-    module_t* uaudp_module;
+    /* Register the protocol name and description */
+    proto_uaudp = proto_register_protocol("UA/UDP Encapsulation Protocol", 
+                                          "UAUDP",
+                                          "uaudp");
 
-    proto_uaudp = proto_register_protocol("Universal Alcatel UDP Protocol", "UAUDP", "uaudp");
+    register_dissector("uaudp", dissect_uaudp, proto_uaudp);
+    register_dissector("uaudp_dir_unknown", dissect_uaudp_dir_unknown, proto_uaudp);
+    register_dissector("uaudp_term_to_serv", dissect_uaudp_term_to_serv, proto_uaudp);
+    register_dissector("uaudp_serv_to_term", dissect_uaudp_serv_to_term, proto_uaudp);
 
-    proto_register_field_array(proto_uaudp, hf, array_length(hf));
+    /* Required function calls to register the header fields and subtrees used */
+    proto_register_field_array(proto_uaudp, hf_uaudp, array_length(hf_uaudp));
     proto_register_subtree_array(ett, array_length(ett));
 
-    new_register_dissector("uaudp", dissect_uaudp, proto_uaudp);
-
-    /* Register our configuration options */
+    /* Register preferences */
     uaudp_module = prefs_register_protocol(proto_uaudp, proto_reg_handoff_uaudp);
-    prefs_register_bool_preference(uaudp_module, "use_heuristic_dissector",
-        "Use heuristic dissector",
-        "Use to decode a packet a heuristic dissector. "
-        "Otherwise, they are decoded only those packets that will come from the specified ports.",
-        &use_heuristic_dissector);
-    prefs_register_range_preference(uaudp_module, "udp_ports",
-        "UAUDP port numbers",
-        "Port numbers used for UAUDP traffic (examples: 5001, 32512)",
-        &global_uaudp_port_range, MAX_UDP_PORT);
-
-    uaudp_dissector_table = register_dissector_table("uaudp.opcode", "UA/UDP Opcode", FT_UINT8, BASE_DEC);
-}
 
-/* The registration hand-off routine is called at startup */
-static void
-range_delete_callback(guint32 port)
-{
-    dissector_delete_uint("udp.port", port, uaudp_handle);
-}
+/*
+    prefs_register_bool_preference(uaudp_module, "enable",
+                                   "Enable UA/UDP decoding based on preferences",
+                                   "Enable UA/UDP decoding based on preferences",
+                                   &decode_ua);
+*/
+    for (i=0; i<MAX_TERMINAL_PORTS; i++) {
+        prefs_register_uint_preference(uaudp_module,
+                                       ports[i].name,
+                                       ports[i].text,
+                                       ports[i].text,
+                                       10,
+                                       &ports[i].port);
+    }
+    prefs_register_string_preference(uaudp_module, "system_ip",
+                                     "System IP Address (optional)",
+                                     "IPv4 address of the DHS3 system. (Used only in case of identical source and destination ports)",
+                                     &pref_sys_ip_s);
 
-static void
-range_add_callback (guint32 port)
-{
-    dissector_add_uint("udp.port", port, uaudp_handle);
+    /* Register tap listener */
+/*    uaudp_tap = register_tap("uaudp");*/
 }
 
+
+/* If this dissector uses sub-dissector registration add a registration routine.
+   This format is required because a script is used to find these routines and
+   create the code that calls these routines.
+*/
 void
 proto_reg_handoff_uaudp(void)
 {
-    static range_t *uaudp_port_range  = NULL;
-    static gboolean uaudp_initialized = FALSE;
+    static gboolean prefs_initialized = FALSE;
+    static dissector_handle_t uaudp_handle;
+    int i;
 
-    if (!uaudp_initialized)
+    if(!prefs_initialized)
     {
-        /*
-         * For UAUDP-over-UDP.
-         */
-        heur_dissector_add("udp", dissect_uaudp_heur, proto_uaudp);
-
-        uaudp_handle = find_dissector("uaudp");
-        uaudp_initialized = TRUE;
+        uaudp_handle = create_dissector_handle(dissect_uaudp, proto_uaudp);
+        ua_sys_to_term_handle = find_dissector("ua_sys_to_term");
+        ua_term_to_sys_handle = find_dissector("ua_term_to_sys");
+        prefs_initialized = TRUE;
     }
     else
     {
-        range_foreach(uaudp_port_range, range_delete_callback);
-        g_free(uaudp_port_range);
+        for(i=0; i<MAX_TERMINAL_PORTS; i++)
+        {
+            dissector_delete("udp.port", ports[i].last_port, uaudp_handle);
+        }
+               if(str_to_addr_ip(pref_sys_ip_s, sys_ip))
+        {
+            use_sys_ip = TRUE;
+        }
+        else 
+        {
+            use_sys_ip = FALSE;
+                       pref_sys_ip_s = g_strdup("");
+        }
     }
 
-    uaudp_port_range = range_copy(global_uaudp_port_range);
-    range_foreach(uaudp_port_range, range_add_callback);
+    if(decode_ua)
+    {
+        for(i=0; i < MAX_TERMINAL_PORTS; i++)
+        {
+            dissector_add("udp.port", ports[i].port, uaudp_handle);
+            ports[i].last_port = ports[i].port;
+        }
+    }
 }
 
-/*
-* Editor modelines - http://www.wireshark.org/tools/modelines.html
-*
-* Local variables:
-* c-basic-offset: 4
-* tab-width: 8
-* indent-tabs-mode: nil
-* End:
-*
-* ex: set shiftwidth=4 tabstop=8 expandtab:
-* :indentSize=4:tabSize=8:noTabs=true:
-*/
diff --git a/epan/dissectors/packet-uaudp.h b/epan/dissectors/packet-uaudp.h
new file mode 100644 (file)
index 0000000..0051623
--- /dev/null
@@ -0,0 +1,53 @@
+/* packet-uaudp.h
+ * Routines for UA/UDP (Universal Alcatel over UDP) packet dissection.
+ * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
+ *
+ * $Id: 
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _PACKET_UAUDP_H_
+#define _PACKET_UAUDP_H_
+
+#include <gmodule.h>
+
+#define UAUDP_CONNECT           0
+#define UAUDP_CONNECT_ACK       1
+#define UAUDP_RELEASE           2
+#define UAUDP_RELEASE_ACK       3
+#define UAUDP_KEEPALIVE         4
+#define UAUDP_KEEPALIVE_ACK     5
+#define UAUDP_NACK              6
+#define UAUDP_DATA              7
+
+typedef enum _e_ua_direction {
+    SYS_TO_TERM,  /* system -> terminal */
+    TERM_TO_SYS,  /* terminal -> system */
+    DIR_UNKNOWN   /* unknown direction */
+} e_ua_direction;
+
+/* struct for tap ethereal */
+typedef struct _tap_struct_uaudp {
+    guint opcode;
+    guint expseq; /* expected sequence number */
+    guint sntseq; /* sent sequence number */
+} tap_struct_uaudp;
+
+#endif /* _PACKET_UAUDP_H_ */