diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-06-06 04:54:47 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-06-06 04:54:47 +0000 |
commit | 57c6467b81520805fc6b06ed9aa1363c163b41b6 (patch) | |
tree | 1e64c224ed2b0945e658b71676772987e67cdbc9 | |
parent | e63f70cfc22a5d58413b7b16e8acd2f78ffaaf9e (diff) |
Fix some bugs & do extensive cleanup;
Bugs fixed:
- Calling col_...() fcns or dissectors under 'if (tree)'
- Potential buffer overflows (if bad data)
- Misc incorrect data display issues
Cleanup including;
- Remove unneeded #includes
- Fix excessive use of value_strings
- Use extended value_strings & val_to_str_(ext_)const as appropriate
- Optimize repeated fetches of the same data from a tvb
- Do general code simplification
- Remove or #if 0 unused code;
- Add XXX comments for code which may be incorrect
- Remove unneeded prefs callback to proto_reg_handoff...()
- Remove unneeded use of check_col()
- Define several functions as static
- Move proto_reg_handoff...() to the end of the file
- Fix whitespace (including "4 space tabs")
- ...
svn path=/trunk/; revision=43129
-rw-r--r-- | epan/dissectors/packet-noe.c | 3053 | ||||
-rw-r--r-- | epan/dissectors/packet-ua.c | 495 | ||||
-rw-r--r-- | epan/dissectors/packet-ua3g.c | 9243 | ||||
-rw-r--r-- | epan/dissectors/packet-uasip.c | 956 | ||||
-rw-r--r-- | epan/dissectors/packet-uaudp.c | 1111 | ||||
-rw-r--r-- | epan/dissectors/packet-uaudp.h | 17 |
6 files changed, 7493 insertions, 7382 deletions
diff --git a/epan/dissectors/packet-noe.c b/epan/dissectors/packet-noe.c index dc9aa4b31d..5ab27306ef 100644 --- a/epan/dissectors/packet-noe.c +++ b/epan/dissectors/packet-noe.c @@ -28,1440 +28,1454 @@ #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_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 +#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"}, - {0, NULL} + {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"}, + {0, NULL} }; - -#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 +static value_string_ext val_str_class_ext = VALUE_STRING_EXT_INIT(val_str_class); + +#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 +#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"}, - {0, NULL} + {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"}, + {0, NULL} }; - -#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 +static value_string_ext val_str_props_ext = VALUE_STRING_EXT_INIT(val_str_props); + +#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 +#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"}, - {0, NULL} + {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"}, + {0, NULL} }; +static value_string_ext val_str_event_ext = VALUE_STRING_EXT_INIT(val_str_event); -#define P_BASIC 0 +#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 C_STATIC 0 +#define C_DYNAMIC 128 +#define C_INVALID 255 -#define E_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_psize = -1; -static int hf_noe_aindx = -1; -static int hf_noe_errcode = -1; +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_psize = -1; +static int hf_noe_aindx = -1; +static int hf_noe_errcode = -1; static const value_string servers_vals[] = { - {0x15, "Call Server"}, - {0x16, "Presentation Server"}, - {0, NULL} + {0x15, "Call Server"}, + {0x16, "Presentation Server"}, + {0, NULL} }; static const value_string servers_short_vals[] = { - {0x15, "CS"}, - {0x16, "PS"}, - {0, NULL} + {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 + 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} + {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 +#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't 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't 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} + {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't 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't 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 value_string_ext errcode_vals_ext = VALUE_STRING_EXT_INIT(errcode_vals); 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} + {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} }; - +static value_string_ext str_key_name_ext = VALUE_STRING_EXT_INIT(str_key_name); /*----------------------------------------------------------------------------- - DECODE UTF8 TO UNICODE - This function translates an UTF8 vale to an UNICODE one. - Need to have at least 48 bits value. - ---------------------------------------------------------------------------*/ + 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 <= G_GUINT64_CONSTANT(0xFF)) - { - unicode = - utf8 & G_GUINT64_CONSTANT(0x7F); - } - else if(utf8 <= G_GUINT64_CONSTANT(0xFFFF)) - { - unicode = - ((utf8 & G_GUINT64_CONSTANT(0x1F00) >> 2) + - (utf8 & G_GUINT64_CONSTANT(0x3F))); - } - else if(utf8 <= G_GUINT64_CONSTANT(0xFFFFFF)) - { - unicode = - ((utf8 & G_GUINT64_CONSTANT(0x0F0000)) >> 4) + - ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + - (utf8 & G_GUINT64_CONSTANT(0x3F)); - } - else if(utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFF)) - { - unicode = - ((utf8 & G_GUINT64_CONSTANT(0x07000000)) >> 6) + - ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + - ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + - (utf8 & G_GUINT64_CONSTANT(0x3F)); - } - else if(utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFF)) - { - unicode = - ((utf8 & G_GUINT64_CONSTANT(0x0300000000)) >> 8) + - ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) + - ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + - ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + - (utf8 & G_GUINT64_CONSTANT(0x3F)); - } - else if(utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFFFF)) - { - unicode = - ((utf8 & G_GUINT64_CONSTANT(0x010000000000)) >> 10) + - ((utf8 & G_GUINT64_CONSTANT(0x3F00000000)) >> 8) + - ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) + - ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + - ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + - (utf8 & G_GUINT64_CONSTANT(0x3F)); - } - else - { - unicode = G_GUINT64_CONSTANT(0); - } - return unicode; -} + static guint64 unicode; + + if (utf8 <= G_GUINT64_CONSTANT(0xFF)) + { + unicode = + utf8 & G_GUINT64_CONSTANT(0x7F); + } + else if (utf8 <= G_GUINT64_CONSTANT(0xFFFF)) + { + unicode = + ((utf8 & G_GUINT64_CONSTANT(0x1F00) >> 2) + + (utf8 & G_GUINT64_CONSTANT(0x3F))); + } + else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFF)) + { + unicode = + ((utf8 & G_GUINT64_CONSTANT(0x0F0000)) >> 4) + + ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + + (utf8 & G_GUINT64_CONSTANT(0x3F)); + } + else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFF)) + { + unicode = + ((utf8 & G_GUINT64_CONSTANT(0x07000000)) >> 6) + + ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + + ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + + (utf8 & G_GUINT64_CONSTANT(0x3F)); + } + else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFF)) + { + unicode = + ((utf8 & G_GUINT64_CONSTANT(0x0300000000)) >> 8) + + ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) + + ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + + ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + + (utf8 & G_GUINT64_CONSTANT(0x3F)); + } + else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFFFF)) + { + unicode = + ((utf8 & G_GUINT64_CONSTANT(0x010000000000)) >> 10) + + ((utf8 & G_GUINT64_CONSTANT(0x3F00000000)) >> 8) + + ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) + + ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) + + ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) + + (utf8 & G_GUINT64_CONSTANT(0x3F)); + } + else + { + unicode = G_GUINT64_CONSTANT(0); + } + return unicode; +} /*----------------------------------------------------------------------------- - DECODE KEY NAME - This function translates an UNICODE to the name associated. - Need to have at least 48 bits value. - ---------------------------------------------------------------------------*/ + 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; -} + char *key_name; + + key_name = ep_alloc(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_ext_const(unicode, &str_key_name_ext, "Unknown")); + } + else if (unicode <= 0xFF) + { + g_snprintf(key_name, 10, "%c", unicode); + } + else + { + g_snprintf(key_name, 10, "%s", val_to_str_ext_const(unicode, &str_key_name_ext, "Unknown")); + } + return key_name; +} /*----------------------------------------------------------------------------- - DECODE EVT ERROR - ---------------------------------------------------------------------------*/ -static void -decode_evt_error(proto_tree *tree, tvbuff_t *tvb, guint offset, guint length) + DECODE EVT ERROR + ---------------------------------------------------------------------------*/ +static void decode_evt_error(proto_tree *tree, + tvbuff_t *tvb, + guint offset, + guint length) { - guint8 method, class, property; - guint16 errcode; - guint32 Pdata; - - errcode = tvb_get_ntohs (tvb, offset); - proto_tree_add_uint_format_value(tree, hf_noe_errcode, 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_uint_format_value(tree, hf_noe_method, 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_int_format_value(tree, hf_noe_class, tvb, offset, 1, - class, "%s (%d)", val_to_str(class, val_str_class, "Unknown"), class); - offset ++; - length --; - - proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); - offset += 2; - length -= 2; - - property = tvb_get_guint8(tvb, offset); - proto_tree_add_int_format_value(tree, hf_noe_pcode, tvb, offset, 1, - property, "%s (0x%02x)", val_to_str(property, val_str_props, "Unknown"), property); - offset ++; - length --; - - proto_tree_add_item(tree, hf_noe_aindx, tvb, offset, 1, ENC_NA); - offset ++; - length --; - - proto_tree_add_uint(tree, hf_noe_length, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); - 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)); + guint8 method, class, property; + guint16 errcode; + guint32 Pdata; + + if (!tree) + return; + + errcode = tvb_get_ntohs (tvb, offset); + proto_tree_add_uint_format_value(tree, hf_noe_errcode, tvb, offset, 2, + errcode, "%s (%d)", val_to_str_ext_const(errcode, &errcode_vals_ext, "Unknown"), errcode); + offset += 2; + length -= 2; + + method = tvb_get_guint8(tvb, offset); + proto_tree_add_uint_format_value(tree, hf_noe_method, tvb, offset, 1, + method, "%s (%d)", val_to_str_const(method, methods_vals, "Unknown"), method); + offset += 1; + length -= 1; + + class = tvb_get_guint8(tvb, offset); + proto_tree_add_int_format_value(tree, hf_noe_class, tvb, offset, 1, + class, "%s (%d)", val_to_str_ext_const(class, &val_str_class_ext, "Unknown"), class); + offset += 1; + length -= 1; + + proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + offset += 2; + length -= 2; + + property = tvb_get_guint8(tvb, offset); + proto_tree_add_int_format_value(tree, hf_noe_pcode, tvb, offset, 1, + property, "%s (0x%02x)", val_to_str_ext_const(property, &val_str_props_ext, "Unknown"), property); + offset += 1; + length -= 1; + + proto_tree_add_item(tree, hf_noe_aindx, tvb, offset, 1, ENC_NA); + offset += 1; + length -= 1; + + proto_tree_add_uint(tree, hf_noe_length, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + 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) + 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_int_format_value(property_tree, hf_noe_pcode, tvb, offset, 1, - property_type, "%s (0x%02x)", val_to_str(property_type, val_str_props, "Unknown"), property_type); - offset++; - length--; - - if(property_type >= P_ARRAY) - { - proto_tree_add_item(property_item, hf_noe_aindx, tvb, offset, 1, ENC_NA); - 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_uint(property_tree, hf_noe_psize, tvb, offset, 2, - tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1)); - offset += 2; - length -= 2; - } - else - { - proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 1, - 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_ntohs(tvb, offset); - proto_tree_add_text(property_item, - tvb, - offset, - 2, - "Value: %d", - property_value); - offset += 2; - length -= 2; - break; - } - case 3: - { - guint32 property_value; - property_value = tvb_get_ntoh24(tvb, offset); - proto_tree_add_text(property_item, - tvb, - offset, - 3, - "Value: %u", - property_value); - offset += 3; - length -= 3; - break; - } - case 4: - { - guint32 property_value; - property_value = tvb_get_ntohl(tvb, offset); - proto_tree_add_text(property_item, - tvb, - offset, - 4, - "Value: %u", - property_value); - offset += 4; - length -= 4; - break; - } - default: - { - /* add text to the frame tree */ - value_item = proto_tree_add_text(property_item, - 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_tree, - tvb, - offset, - 1, - "Value %5d: 0x%02x", - property_value_index, tvb_get_guint8(tvb, offset)); - offset++; - length--; - property_length--; - } - break; - } - } - } + proto_item *property_item, *value_item; + proto_tree *property_tree, *value_tree; + guint8 property_type; + guint16 property_length, property_value_index; +/* guint64 property_index;*/ + + /* 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_int_format_value(property_tree, hf_noe_pcode, tvb, offset, 1, + property_type, "%s (0x%02x)", val_to_str_ext_const(property_type, &val_str_props_ext, "Unknown"), property_type); + offset += 1; + length -= 1; + + if (property_type >= P_ARRAY) + { + proto_tree_add_item(property_item, hf_noe_aindx, tvb, offset, 1, ENC_NA); + offset += 1; + length -= 1; + } + + property_length = tvb_get_guint8(tvb, offset); + if (property_length & 0x80) + { + property_length = tvb_get_ntohs(tvb, offset); + property_length &= 0x7fff; + proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 2, + tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1)); + offset += 2; + length -= 2; + } + else + { + proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 1, + tvb_get_guint8(tvb, offset)); + offset += 1; + length -= 1; + } + + 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 += 1; + length -= 1; + break; + } + case 2: + { + guint16 property_value; + property_value = tvb_get_ntohs(tvb, offset); + proto_tree_add_text(property_item, + tvb, + offset, + 2, + "Value: %d", + property_value); + offset += 2; + length -= 2; + break; + } + case 3: + { + guint32 property_value; + property_value = tvb_get_ntoh24(tvb, offset); + proto_tree_add_text(property_item, + tvb, + offset, + 3, + "Value: %u", + property_value); + offset += 3; + length -= 3; + break; + } + case 4: + { + guint32 property_value; + property_value = tvb_get_ntohl(tvb, offset); + proto_tree_add_text(property_item, + tvb, + offset, + 4, + "Value: %u", + property_value); + offset += 4; + length -= 4; + break; + } + default: + { + /* add text to the frame tree */ + value_item = proto_tree_add_text(property_item, + 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 += 1; + proto_tree_add_text(value_tree, + tvb, + offset, + 1, + "Value %5d: 0x%02x", + property_value_index, tvb_get_guint8(tvb, offset)); + offset += 1; + length -= 1; + property_length -= 1; + } + 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) + 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_int_format_value(body_tree, hf_noe_pcode, tvb, offset, 1, - body_type, "%s (0x%02x)", val_to_str(body_type, val_str_props, "Unknown"), body_type); - - offset++; - length--; - - if(body_type >= P_ARRAY) - { - proto_tree_add_item(body_item, hf_noe_aindx, tvb, offset, 1, ENC_NA); - offset++; - 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_int_format_value(body_tree, hf_noe_pcode, tvb, offset, 1, + body_type, "%s (0x%02x)", val_to_str_ext_const(body_type, &val_str_props_ext, "Unknown"), body_type); + + offset += 1; + length -= 1; + + if (body_type >= P_ARRAY) + { + proto_tree_add_item(body_item, hf_noe_aindx, tvb, offset, 1, ENC_NA); + offset += 1; + length -= 1; + } + } } /*----------------------------------------------------------------------------- - 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) + 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_value(tree, - hf_noe_event, - tvb, - offset, - 1, - 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%" G_GINT64_MODIFIER "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)); - 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)); - offset += 2; - /*Fix Clang Warning*/ - /*length -= 2;*/ - - proto_tree_add_text(tree, - tvb, - offset, - 1, - "Bonded: %d", - tvb_get_ntohs(tvb, offset)); - offset += 1; - /*Fix Clang Warning*/ - /*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)); - offset += 2; - length -= 2; - - if(length > 0) - decode_tlv(tree, tvb, offset, length); - break; - } - } + guint8 event = tvb_get_guint8(tvb, offset); + + proto_tree_add_uint_format_value(tree, + hf_noe_event, + tvb, + offset, + 1, + event, + "%s (%d)", + val_to_str_ext_const(event, &val_str_event_ext, "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_ext_const(event, &val_str_event_ext, "Unknown")); + /* update text of the main proto item */ + /* XXX: Just dups the above proto_tree_add_uint_format_value() ?? */ + proto_item_append_text(tree, ", %s", + val_to_str_ext_const(event, &val_str_event_ext, "Unknown")); + + offset += 1; + length -= 1; + + 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_const(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; + char *key_name; + 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 += 1; + pt_length -= 1; + } + unicode_value = decode_utf8(utf8_value); + key_name = ep_alloc(30); + 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%" G_GINT64_MODIFIER "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_const(tvb_get_guint8(tvb, offset), + 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)); + 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)); + 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)); + 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) + 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_int_format_value(tree, - hf_noe_class, - tvb, - offset, - 1, - 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)); - 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; - } - } + guint8 class = tvb_get_guint8(tvb, offset); + + proto_tree_add_int_format_value(tree, + hf_noe_class, + tvb, + offset, + 1, + class, + "%s (%d)", + val_to_str_ext_const(class, &val_str_class_ext, "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_ext_const(class, &val_str_class_ext, "Unknown")); + /* update text of the main proto item */ + /* XXX: Just dups the above proto_tree_add_int_format_value() ?? */ + proto_item_append_text(tree, ", %s", + val_to_str_ext_const(class, &val_str_class_ext, "Unknown")); + + offset += 1; + length -= 1; + + if (class >= C_DYNAMIC) + { + proto_tree_add_uint(tree, hf_noe_objectid, tvb, offset, 2, 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) +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, ENC_NA); - 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_format_value(noe_tree, - hf_noe_method, - tvb, - offset, - 1, - method, - "%s (%d)", - val_to_str(method, VALS(methods_vals), "Unknown"), - 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); - } - } + proto_item *noe_item; + proto_tree *noe_tree; + gint length; + guint8 server; + guint8 method; + gboolean methodack; + gint offset = 0; + + noe_item = proto_tree_add_item(tree, proto_noe, tvb, 0, -1, ENC_NA); + 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_const(server, servers_short_vals, "Unknown")); + + proto_tree_add_uint(noe_tree, + hf_noe_server, + tvb, + offset, + 1, + server); + offset += 1; + length -= 1;; + + /* update text of the main proto item */ + proto_item_append_text(noe_item, ", %s", + val_to_str_const(server, servers_short_vals, "Unknown")); + + method = tvb_get_guint8(tvb, offset); + methodack = (method & 0x80) != 0; + method = (method & 0x7f); + + proto_tree_add_uint_format_value(noe_tree, + hf_noe_method, + tvb, + offset, + 1, + method, + "%s (%d)", + val_to_str_const(method, methods_vals, "Unknown"), + 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_const(method, methods_vals, "Unknown")); + + /* update text of the main proto item */ + proto_item_append_text(noe_item, ", %s", + val_to_str_const(method, methods_vals, "Unknown")); + + if (method == METHOD_NOTIFY) + { + offset += 1; + length -= 1; + 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 += 1; + length -= 1; + decode_mtd(noe_tree, tvb, pinfo, method, offset, length); + } } @@ -1471,184 +1485,181 @@ static void dissect_noe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ---------------------------------------------------------------------------*/ 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 Acknowledge", - 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_INT8, - 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_INT8, - BASE_DEC, - NULL, - 0x0, - "Property Identifier", - HFILL - } - }, - { &hf_noe_psize, - { - "PropLength", - "noe.prop_len", - FT_UINT16, - BASE_DEC, - NULL, - 0x0, - "Property Length", - HFILL - } - }, - { &hf_noe_errcode, - { - "ErrCode", - "noe.errcode", - FT_UINT16, - BASE_DEC, - NULL, - 0x0, - "Error Code", - HFILL - } - }, - { &hf_noe_aindx, - { - "ArrIndex", - "noe.array_index", - FT_UINT8, - BASE_DEC, - NULL, - 0x0, - "Array Index", - 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)); + 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 Acknowledge", + 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_INT8, + 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_INT8, + BASE_DEC, + NULL, + 0x0, + "Property Identifier", + HFILL + } + }, + { &hf_noe_psize, + { + "PropLength", + "noe.prop_len", + FT_UINT16, + BASE_DEC, + NULL, + 0x0, + "Property Length", + HFILL + } + }, + { &hf_noe_errcode, + { + "ErrCode", + "noe.errcode", + FT_UINT16, + BASE_DEC, + NULL, + 0x0, + "Error Code", + HFILL + } + }, + { &hf_noe_aindx, + { + "ArrIndex", + "noe.array_index", + FT_UINT8, + BASE_DEC, + NULL, + 0x0, + "Array Index", + 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"); +#if 0 /* Future */ + 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_uint("ua.opcode", 0x15, handle_noe); + /* hooking of NOE on UA */ + dissector_add_uint("ua.opcode", 0x15, handle_noe); +#endif } diff --git a/epan/dissectors/packet-ua.c b/epan/dissectors/packet-ua.c index cae38d6eb8..516b02c3a4 100644 --- a/epan/dissectors/packet-ua.c +++ b/epan/dissectors/packet-ua.c @@ -27,150 +27,146 @@ #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 "epan/dissectors/packet-rtp.h" #include "epan/dissectors/packet-rtcp.h" -#include <string.h> #include "packet-uaudp.h" - - /*----------------------------------------------------------------------------- GLOBALS ---------------------------------------------------------------------------*/ -static int proto_ua_msg = -1; -static gint ett_ua_msg = -1; - -e_ua_direction message_direction; /* Uses to determine UA3G messages */ -static gboolean setup_conversations_enabled = TRUE; - -static dissector_handle_t rtp_handle = NULL; -static dissector_handle_t rtcp_handle = NULL; +#if 0 +static dissector_table_t ua_opcode_dissector_table; +#endif -extern gint find_terminal_port(guint port); +static int proto_ua_msg = -1; +static gint ett_ua_msg = -1; +e_ua_direction message_direction; /* Uses to determine UA3G messages */ -extern void dhs2ua(char *p, const char *ptr, int opcode, int length); -extern void ua2dhs(char *p, const char *ptr, int opcode, int length); +static gboolean setup_conversations_enabled = TRUE; +static dissector_handle_t noe_handle; +static dissector_handle_t ua3g_handle; -static void uadecode(e_ua_direction direction, - proto_tree *tree, - packet_info *pinfo, - tvbuff_t *tvb, - gint offset, - gint opcode, - gint length) +static void uadecode(e_ua_direction direction, + proto_tree *tree, + packet_info *pinfo, + tvbuff_t *tvb, + gint offset, + gint opcode, + gint length) { - 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; - } - } + message_direction = direction; + + switch (opcode & 0x7f) /* suppression of the CP bit */ + { + case 0x15: + case 0x16: + { + call_dissector(noe_handle, + 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(ua3g_handle, + 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; + } + } } @@ -178,100 +174,93 @@ static void uadecode(e_ua_direction direction, /*----------------------------------------------------------------------------- UA DISSECTOR ---------------------------------------------------------------------------*/ -static void _dissect_ua_msg(tvbuff_t *tvb, - packet_info *pinfo, - proto_tree *tree, - e_ua_direction direction) +static void _dissect_ua_msg(tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + e_ua_direction direction) { - 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; - } - } + gint offset = 0; + proto_item *ua_msg_item; + proto_tree *ua_msg_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)) + { + gint length; + gint opcode; + + length = tvb_get_letohs(tvb, offset) + 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)) + { + address remote_rtp_addr; + guint32 remote_rtp_port; + gint suboffset; + + remote_rtp_addr.data = NULL; + remote_rtp_port = 0; + + /* StartRTP */ + suboffset = offset + 5; + + 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)) + { + rtp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port, 0, + "UA", pinfo->fd->num, 0, NULL); + 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 dissect_ua_sys_to_term(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - _dissect_ua_msg(tvb, pinfo, tree, SYS_TO_TERM); + _dissect_ua_msg(tvb, pinfo, tree, SYS_TO_TERM); } static void dissect_ua_term_to_sys(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - _dissect_ua_msg(tvb, pinfo, tree, TERM_TO_SYS); + _dissect_ua_msg(tvb, pinfo, tree, TERM_TO_SYS); } @@ -279,56 +268,56 @@ static void dissect_ua_term_to_sys(tvbuff_t *tvb, packet_info *pinfo, proto_tree DISSECTORS REGISTRATION FUNCTIONS ---------------------------------------------------------------------------*/ -void proto_reg_handoff_ua_msg(void) +void proto_register_ua_msg(void) { - static gboolean prefs_initialized = FALSE; - dissector_handle_t handle_ua_msg; - - if(!prefs_initialized) - { - /* 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_uint("uaudp.opcode", UAUDP_DATA, handle_ua_msg); - - handle_ua_msg = find_dissector("ua_term_to_sys"); - dissector_add_uint("uaudp.opcode", UAUDP_DATA, handle_ua_msg); - prefs_initialized = TRUE; - } -} + module_t *ua_msg_module; + static gint *ett[] = + { + &ett_ua_msg, + }; -void proto_register_ua_msg(void) -{ - module_t *ua_msg_module; + /* 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); + + /* Common subtree array registration */ + proto_register_subtree_array(ett, array_length(ett)); - static gint *ett[] = - { - &ett_ua_msg, - }; + /* Register preferences */ + ua_msg_module = prefs_register_protocol(proto_ua_msg, NULL); - /* used for StartRTP conversation setup */ - rtp_handle = find_dissector("rtp"); - rtcp_handle = find_dissector("rtcp"); + 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); +} + +void proto_reg_handoff_ua_msg(void) +{ +#if 0 /* Future */ + dissector_handle_t handle_ua_msg; + + /* hooking of UA on UAUDP */ + /* XXX: The following is NG since the same 'pattern' is added twice */ + handle_ua_msg = find_dissector("ua_sys_to_term"); + dissector_add_uint("uaudp.opcode", UAUDP_DATA, handle_ua_msg); - /* UA dissector registration */ - proto_ua_msg = proto_register_protocol("Universal Alcatel Protocol", "UA", "ua"); + handle_ua_msg = find_dissector("ua_term_to_sys"); + dissector_add_uint("uaudp.opcode", UAUDP_DATA, handle_ua_msg); - 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); + /* For hooking dissectors to UA */ + ua_opcode_dissector_table = + register_dissector_table("ua.opcode", + "ua.opcode", + FT_UINT8, + BASE_HEX); - /* 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); +#endif + noe_handle = find_dissector("noe"); + ua3g_handle = find_dissector("ua3g"); - 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); } diff --git a/epan/dissectors/packet-ua3g.c b/epan/dissectors/packet-ua3g.c index 82dc0de5e2..328e577b2d 100644 --- a/epan/dissectors/packet-ua3g.c +++ b/epan/dissectors/packet-ua3g.c @@ -27,267 +27,292 @@ #include "config.h" #endif +#include <ctype.h> + #include <glib.h> + #include "epan/packet.h" -#include "epan/prefs.h" -#include "epan/tap.h" -#include "epan/value_string.h" #include "epan/emem.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; + +#if 0 +static dissector_table_t ua3g_opcode_dissector_table; +#endif + + +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 */ +#define SC_NOP 0x00 +#define SC_PRODUCTION_TEST 0x01 /* IP Phone */ +#define SC_SUBDEVICE_ESCAPE 0x02 /* IP Phone */ +#define SC_SOFT_RESET 0x03 +#define SC_IP_PHONE_WARMSTART 0x04 /* IP Phone */ +#define SC_HE_ROUTING 0x05 /* IP Phone - NOT EXPECTED */ +#define SC_SUBDEVICE_RESET 0x06 +#define SC_LOOPBACK_ON 0x07 /* IP Phone & UA NOE */ +#define SC_LOOPBACK_OFF 0x08 /* IP Phone & UA NOE */ +#define SC_VIDEO_ROUTING 0x09 /* IP Phone - NOT EXPECTED */ +#define SC_SUPER_MSG 0x0B +#define SC_SEGMENT_MSG 0x0C +#define SC_REMOTE_UA_ROUTING 0x0D /* IP Phone - NOT EXPECTED */ +#define SC_VERY_REMOTE_UA_ROUTING 0x0E /* IP Phone - NOT EXPECTED */ +#define SC_OSI_ROUTING 0x0F /* IP Phone - NOT EXPECTED */ +#define SC_ABC_A_ROUTING 0x11 /* IP Phone - NOT EXPECTED */ +#define SC_IBS_ROUTING 0x12 /* IP Phone - NOT EXPECTED */ +#define SC_IP_DEVICE_ROUTING 0x13 +#define SC_M_REFLEX_HUB_ROUTING 0x14 /* IP Phone - NOT EXPECTED */ +#if 0 +#define SC_NOE_CS_ROUTING 0x15 /* Decoded by packet-noe.c */ +#define SC_NOE_PS_ROUTING 0x16 /* Decoded by packet-noe.c */ +#endif +#define SC_SUPER_MSG_2 0x17 +#define SC_DEBUG_IN_LINE 0x18 +#define SC_LED_COMMAND 0x21 /* IP Phone */ +#define SC_START_BUZZER 0x22 /* VTA */ +#define SC_STOP_BUZZER 0x23 /* VTA */ +#define SC_ENABLE_DTMF 0x24 /* Only IP NOE */ +#define SC_DISABLE_DTMF 0x25 /* Only IP NOE */ +#define SC_CLEAR_LCD_DISP 0x26 /* IP Phone */ +#define SC_LCD_LINE_1_CMD 0x27 /* IP Phone */ +#define SC_LCD_LINE_2_CMD 0x28 /* IP Phone */ +#define SC_MAIN_VOICE_MODE 0x29 +#define SC_VERSION_INQUIRY 0x2A +#define SC_ARE_YOU_THERE 0x2B /* IP Phone & UA NOE */ +#define SC_SUBDEVICE_METASTATE 0x2C +#define SC_VTA_STATUS_INQUIRY 0x2D /* IP Phone */ +#define SC_SUBDEVICE_STATE 0x2E +#define SC_DWL_DTMF_CLCK_FORMAT 0x30 /* IP Phone */ +#define SC_SET_CLCK 0x31 /* IP Phone */ +#define SC_VOICE_CHANNEL 0x32 /* IP Phone & UA NOE */ +#define SC_EXTERNAL_RINGING 0x33 +#define SC_LCD_CURSOR 0x35 /* IP Phone */ +#define SC_DWL_SPECIAL_CHAR 0x36 /* IP Phone */ +#define SC_SET_CLCK_TIMER_POS 0x38 /* IP Phone */ +#define SC_SET_LCD_CONTRAST 0x39 /* IP Phone */ +#define SC_AUDIO_IDLE 0x3A +#define SC_SET_SPEAKER_VOL 0x3B /* IP Phone */ +#define SC_BEEP 0x3C +#define SC_SIDETONE 0x3D +#define SC_RINGING_CADENCE 0x3E +#define SC_MUTE 0x3F +#define SC_FEEDBACK 0x40 +#define SC_KEY_RELEASE 0x41 /* IP Phone */ +#define SC_TRACE_ON 0x42 /* IP Phone - NOT EXPECTED */ +#define SC_TRACE_OFF 0x43 /* IP Phone - NOT EXPECTED */ +#define SC_READ_PERIPHERAL 0x44 /* IP Phone - NOT EXPECTED */ +#define SC_WRITE_PERIPHERAL 0x45 /* IP Phone - NOT EXPECTED */ +#define SC_ALL_ICONS_OFF 0x46 /* IP Phone */ +#define SC_ICON_CMD 0x47 /* IP Phone */ +#define SC_AMPLIFIED_HANDSET 0x48 /* IP Phone */ +#define SC_AUDIO_CONFIG 0x49 +#define SC_AUDIO_PADDED_PATH 0x4A /* IP Phone */ +#define SC_RELEASE_RADIO_LINK 0x4B /* IP Phone - NOT EXPECTED */ +#define SC_DECT_HANDOVER 0x4C /* IP Phone - NOT EXPECTED */ +#define SC_LOUDSPEAKER 0x4D +#define SC_ANNOUNCE 0x4E +#define SC_RING 0x4F +#define SC_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; +#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 +#if 0 +#define CS_NOE_CS_ROUTING 0x15 /* Decoded by packet-noe.c */ +#define CS_NOE_PS_ROUTING 0x16 /* Decoded by packet-noe.c */ +#endif +#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 */ /* 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"}, - {0, NULL} + {SC_NOP , "NOP"}, + {SC_PRODUCTION_TEST , "Production Test"}, /* IP Phone */ + {SC_SUBDEVICE_ESCAPE , "Subdevice Escape To Subdevice"}, /* IP Phone */ + {SC_SOFT_RESET , "Software Reset"}, + {SC_IP_PHONE_WARMSTART , "IP-Phone Warmstart"}, /* IP Phone */ + {SC_HE_ROUTING , "HE Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_SUBDEVICE_RESET , "Subdevice Reset"}, + {SC_LOOPBACK_ON , "Loopback On"}, + {SC_LOOPBACK_OFF , "Loopback Off"}, + {SC_VIDEO_ROUTING , "Video Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_SUPER_MSG , "Super Message"}, + {SC_SEGMENT_MSG , "Segment Message"}, + {SC_REMOTE_UA_ROUTING , "Remote UA Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_VERY_REMOTE_UA_ROUTING , "Very Remote UA Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_OSI_ROUTING , "OSI Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_ABC_A_ROUTING , "ABC-A Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_IBS_ROUTING , "IBS Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_IP_DEVICE_ROUTING , "IP Device Routing"}, + {SC_M_REFLEX_HUB_ROUTING , "Mutli-Reflex Hub Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_SUPER_MSG_2 , "Super Message 2"}, + {SC_DEBUG_IN_LINE , "Debug In Line"}, + {SC_LED_COMMAND , "Led Command"}, /* IP Phone */ + {SC_START_BUZZER , "Start Buzzer"}, /* VTA */ + {SC_STOP_BUZZER , "Stop Buzzer"}, /* VTA */ + {SC_ENABLE_DTMF , "Enable DTMF"}, + {SC_DISABLE_DTMF , "Disable DTMF"}, + {SC_CLEAR_LCD_DISP , "Clear LCD Display"}, /* IP Phone */ + {SC_LCD_LINE_1_CMD , "LCD Line 1 Commands"}, /* IP Phone */ + {SC_LCD_LINE_2_CMD , "LCD Line 2 Commands"}, /* IP Phone */ + {SC_MAIN_VOICE_MODE , "Main Voice Mode"}, + {SC_VERSION_INQUIRY , "Version Inquiry"}, + {SC_ARE_YOU_THERE , "Are You There?"}, + {SC_SUBDEVICE_METASTATE , "Subdevice Metastate"}, + {SC_VTA_STATUS_INQUIRY , "VTA Status Inquiry"}, /* IP Phone */ + {SC_SUBDEVICE_STATE , "Subdevice State?"}, + {SC_DWL_DTMF_CLCK_FORMAT , "Download DTMF & Clock Format"}, /* IP Phone */ + {SC_SET_CLCK , "Set Clock"}, /* IP Phone */ + {SC_VOICE_CHANNEL , "Voice Channel"}, /* IP Phone & UA NOE */ + {SC_EXTERNAL_RINGING , "External Ringing"}, + {SC_LCD_CURSOR , "LCD Cursor"}, /* IP Phone */ + {SC_DWL_SPECIAL_CHAR , "Download Special Character"}, /* IP Phone */ + {SC_SET_CLCK_TIMER_POS , "Set Clock/Timer Position"}, /* IP Phone */ + {SC_SET_LCD_CONTRAST , "Set LCD Contrast"}, /* IP Phone */ + {SC_AUDIO_IDLE , "Audio Idle"}, + {SC_SET_SPEAKER_VOL , "Set Speaker Volume"}, /* IP Phone */ + {SC_BEEP , "Beep"}, + {SC_SIDETONE , "Sidetone"}, + {SC_RINGING_CADENCE , "Set Programmable Ringing Cadence"}, + {SC_MUTE , "Mute"}, + {SC_FEEDBACK , "Feedback"}, + {SC_KEY_RELEASE , "Key Release"}, /* IP Phone */ + {SC_TRACE_ON , "Trace On"}, /* IP Phone - NOT EXPECTED */ + {SC_TRACE_OFF , "Trace Off"}, /* IP Phone - NOT EXPECTED */ + {SC_READ_PERIPHERAL , "Read Peripheral"}, /* IP Phone - NOT EXPECTED */ + {SC_WRITE_PERIPHERAL , "Write Peripheral"}, /* IP Phone - NOT EXPECTED */ + {SC_ALL_ICONS_OFF , "All Icons Off"}, /* IP Phone */ + {SC_ICON_CMD , "Icon Command"}, /* IP Phone */ + {SC_AMPLIFIED_HANDSET , "Amplified Handset (Boost)"}, /* IP Phone */ + {SC_AUDIO_CONFIG , "Audio Config"}, + {SC_AUDIO_PADDED_PATH , "Audio Padded Path"}, /* IP Phone */ + {SC_RELEASE_RADIO_LINK , "Release Radio Link"}, /* IP Phone - NOT EXPECTED */ + {SC_DECT_HANDOVER , "DECT External Handover Routing Code"}, /* IP Phone - NOT EXPECTED */ + {SC_LOUDSPEAKER , "Loudspeaker"}, + {SC_ANNOUNCE , "Announce"}, + {SC_RING , "Ring"}, + {SC_UA_DWL_PROTOCOL , "UA Download Protocol"}, + {0, NULL} }; +static value_string_ext opcodes_vals_sys_ext = VALUE_STRING_EXT_INIT(opcodes_vals_sys); /* 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} + {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_yes_no[] = { - {0x00, "No"}, - {0x01, "Yes"}, - {0, NULL} +static value_string_ext opcodes_vals_term_ext = VALUE_STRING_EXT_INIT(opcodes_vals_term); + +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} }; +static value_string_ext str_digit_ext = VALUE_STRING_EXT_INIT(str_digit); + +#define STR_ON_OFF(arg) ((arg) ? "On" : "Off") +#define STR_YES_NO(arg) ((arg) ? "Yes" : "No") + + static const value_string str_device_type[] = { - {0x00, "Voice Terminal Adaptor"}, - {0, NULL} + {0x00, "Voice Terminal Adaptor"}, + {0, NULL} }; @@ -297,47 +322,45 @@ static const value_string str_device_type[] = { 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; + int release, vers, fix; + + release = (int)(hexa_version / 10000); + vers = (int)((hexa_version % 10000) / 100); + fix = (hexa_version % 10000) % 100; + return ep_strdup_printf("%d.%02d.%02d", release, vers, fix); } /*----------------------------------------------------------------------------- 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) + 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) + TRACE ON - 42h (MESSAGE FROM THE SYSTEM) ---------------------------------------------------------------------------*/ static void decode_with_one_parameter(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode, proto_item *ua3g_body_item) + packet_info *pinfo _U_, 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_tree, tvb, offset, length, "%s: %d", - val_to_str(opcode, str_first_parameter, "Unknown"), tvb_get_guint8(tvb, offset)); - length--; - } + proto_tree *ua3g_body_tree; + static const value_string str_first_parameter[] = { + {0x01, "Production Test Command"}, + {0x06, "Reserved For Compatibility"}, + {0x2B, "Temporization"}, + {0x3B, "Volume"}, + {0x42, "Subdevice Address"}, + {0, NULL} + }; + + if (!ua3g_body_item || (length == 0)) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + proto_tree_add_text(ua3g_body_tree, tvb, offset, length, "%s: %d", + val_to_str_const(opcode, str_first_parameter, "Unknown"), tvb_get_guint8(tvb, offset)); } @@ -346,30 +369,34 @@ decode_with_one_parameter(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_subdevice_escape(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } + proto_tree *ua3g_body_tree; + int j; + + if (!ua3g_body_item) + return; + + 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--; + + j = 0; + 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--; + } } @@ -378,23 +405,24 @@ decode_subdevice_escape(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo ---------------------------------------------------------------------------*/ static void decode_software_reset(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } + proto_tree *ua3g_body_tree; + static const value_string str_verswitch[] = { + {0x00, "Reset Without Version Switch"}, + {0x01, "Reset With Version Switch"}, + {0, NULL} + }; + + if (!ua3g_body_item || (length == 0)) + return; + + 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_const(tvb_get_guint8(tvb, offset), str_verswitch, "Unknown")); + /* offset++; */ + /* length--; */ } @@ -403,27 +431,28 @@ decode_software_reset(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U ---------------------------------------------------------------------------*/ static void decode_ip_phone_warmstart(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_body_item) { - proto_tree *ua3g_body_tree; - 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--; - } + proto_tree *ua3g_body_tree; + static const value_string str_command[] = { + {0x00, "Run In UA2G Emulation Mode"}, + {0x01, "Run In Full UA3G Mode"}, + {0, NULL} + }; + + if (!ua3g_body_item || (length == 0)) + return; + + 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_const(tvb_get_guint8(tvb, offset), str_command, "Unknown")); + /* offset++; */ + /* length--; */ } @@ -433,38 +462,42 @@ decode_ip_phone_warmstart(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinf ---------------------------------------------------------------------------*/ static void decode_super_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode, - proto_item *ua3g_body_item) + 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--; - } - } + proto_tree *ua3g_body_tree; + int i, parameter_length; + int j; + + if (!ua3g_body_item || (length == 0)) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + j = 0; + 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--; + } + } } @@ -473,43 +506,43 @@ decode_super_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_segment_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } + proto_tree *ua3g_body_tree; + guint8 val; + int j; + + if (!ua3g_body_item) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "F/S: %s (%d)", + (val & 0x80) ? "First Segment" : "Subsequent Segment", + val & 0x80); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Number Of Remaining Segments: %d", + (val & 0x7F)); + offset++; + length--; + + if (val & 0x80) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 2, "Length: %d", + tvb_get_ntohs(tvb, offset)); + offset += 2; + length -= 2; + } + + j = 0; + 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--; + } } @@ -518,1215 +551,1181 @@ decode_segment_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_item, proto_item *ua3g_body_item) { - guint8 command = tvb_get_guint8(tvb, offset); - gint *lengthp = 0; - proto_tree *ua3g_body_tree; - proto_item *ua3g_param_item; - proto_tree *ua3g_param_tree; - 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} - }; - - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - - /* 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 */ - { - 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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%s: ", - val_to_str(tvb_get_guint8(tvb, offset + 2) & 0x80, str_update_mode, "Unknown")); - - for(i = 0; i < 6; i++) { - ep_strbuf_append_printf(strbuf, "%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, "")); - } - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%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} - }; - - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, - val_to_str(tvb_get_guint8(tvb, offset + 2), str_bad_sec_mode, "Unknown")); - break; - } - case 0x02: /* Cust_Name */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 1; i <= parameter_length; i++) { - if(isprint(tvb_get_guint8(tvb, offset + 1 + i))) - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - else - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - } - - ep_strbuf_append(strbuf, "\""); - break; - } - case 0x03: /* L10N_Name */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 1; i <= parameter_length; i++) { - if(isprint(tvb_get_guint8(tvb, offset + 1 + i))) - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - else - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - } - - ep_strbuf_append(strbuf, "\""); - 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"), strbuf->str); - } 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", strbuf->str); - /*Fix Clang Warning*/ - /*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 Directions)"}, - {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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_compressor, "Default Codec")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_on_off, "On")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_yes_no, "No")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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 */ - { - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_dtmf_sending, "Send DTMF")); - } - else - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_enable_00, "Disable")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, val_to_str((guint8)(param_value), str_enable_10, "Disable")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - 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 Identifier */ - case 0x0F: /* Distant Identifier */ - { - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - 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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - 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, "Number Of Entries: %d", tone_nb_entries); - offset++; - length--; - - while(length > 0 && tone_nb_entries) { - 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 - Number Of Entries: %d", - val_to_str(tone_direction, str_tone_direction, "Unknown"), tone_nb_entries); - offset++; - length--; - - while(length > 0 && tone_nb_entries) { - 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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } - 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", strbuf->str); - 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} - }; - - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, 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 */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 1; i <= parameter_length; i++) { - if(isprint(tvb_get_guint8(tvb, offset + 1 + i))) - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - else - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - } - ep_strbuf_append(strbuf, "\""); - break; - } - case 0x0F: /* TFTP BACKUP IP ADDR */ - { - if(parameter_length > 0) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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} - }; - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, 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} - }; - - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, 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} - }; - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else if(parameter_length > 8) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } - 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", strbuf->str); - 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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - offset += parameter_length; - length -= parameter_length; - } - } - break; - } - case 0x06: /* STOP TONE */ - default: - { - break; - } - } + guint8 command; + proto_tree *ua3g_body_tree; + proto_item *ua3g_param_item; + proto_tree *ua3g_param_tree; + + 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} + }; + static value_string_ext str_command_ext = VALUE_STRING_EXT_INIT(str_command); + + command = 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, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_ip, tvb, offset, 1, + command, "Command: %s", + val_to_str_ext_const(command, &str_command_ext, "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) { + emem_strbuf_t *strbuf; + strbuf = ep_strbuf_new_label(NULL); + + parameter_id = tvb_get_guint8(tvb, offset); + parameter_length = tvb_get_guint8(tvb, offset + 1); + + if (parameter_length > 0) { + guint8 param; + switch (parameter_id) { + case 0x00: /* Update Mode */ + { + static const char *str_update_mode[] = { + "Bootloader", + "Data", + "Customization", + "Localization", + "Code", + "SIP" + }; + param = tvb_get_guint8(tvb, offset + 2); + if ((param & 0x80) == 0x00) { + ep_strbuf_append(strbuf, "NOE Update Mode: "); + + for (i = 0; i < 6; i++) { + ep_strbuf_append_printf(strbuf, "%s: %s, ", + str_update_mode[i], + ((param >> i) & 0x01) ? "Enable" : "Disable"); + } + } else { + ep_strbuf_append(strbuf, "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} + }; + + ep_strbuf_append(strbuf, + val_to_str_const(tvb_get_guint8(tvb, offset + 2), str_bad_sec_mode, "Unknown")); + break; + } + case 0x02: /* Cust_Name */ + { + ep_strbuf_append(strbuf, "\""); + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + /* XXX: ! isprint() action same as for isprint() ?? */ + for (i = 1; i <= parameter_length; i++) { + if (isprint(tvb_get_guint8(tvb, offset + 1 + i))) + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + else + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + } + + ep_strbuf_append(strbuf, "\""); + break; + } + case 0x03: /* L10N_Name */ + { + ep_strbuf_append(strbuf, "\""); + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + /* XXX: ! isprint() action same as for isprint() ?? */ + for (i = 1; i <= parameter_length; i++) { + if (isprint(tvb_get_guint8(tvb, offset + 1 + i))) + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + else + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + } + + ep_strbuf_append(strbuf, "\""); + break; + } + } + + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s: %s", + val_to_str_const(parameter_id, str_parameter_id, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_const(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_const(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", strbuf->str); + /*offset += parameter_length;*/ + /*length -= parameter_length;*/ + } + } + break; + } + case 0x01: /* START RTP */ + { + emem_strbuf_t *strbuf; + int i, parameter_length, parameter_id; + + static const value_string str_direction[] = { + {0x00, "Terminal Input"}, + {0x01, "Terminal Output"}, + {0x02, "Terminal Input/Output (Both Directions)"}, + {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} + }; + static value_string_ext str_parameter_id_ext = VALUE_STRING_EXT_INIT(str_parameter_id); + + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Direction: %s", + val_to_str_const(tvb_get_guint8(tvb, offset), str_direction, "Unknown")); + offset++; + length--; + + strbuf = ep_strbuf_new_label(NULL); + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 1; i < parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+2+i)); + } + 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 <= 8) { + guint64 param_value = 0; + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); + } else { + ep_strbuf_append_printf(strbuf, "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 <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, STR_ON_OFF((guint8)(param_value))); + } else { + ep_strbuf_append_printf(strbuf, "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 <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + /* XXX: Only 0x01 ==> "Yes" ?? */ + ep_strbuf_append(strbuf, ((guint8)param_value == 0x01) ? "Yes": "No"); + } else { + ep_strbuf_append_printf(strbuf, "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 */ + { + break; + } + case 0x15: /* DTMF Sending */ + { + if (parameter_length <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, ((guint8)param_value) ? "Send DTMF" : "Don't Send DTMF"); + } else { + ep_strbuf_append_printf(strbuf, "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 */ + { + if (parameter_length <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, (((guint8)param_value) == 0x00) ? "Enable" : "Disable"); /* XXX: OK ? */ + } else { + ep_strbuf_append_printf(strbuf, "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 */ + { + if (parameter_length <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, (((guint8)param_value) == 0x10) ? "Enable" : "Disable"); + } else { + ep_strbuf_append_printf(strbuf, "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 <= 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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown"), strbuf->str); + } else { + /* (parameter_length == 0) */ + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_ext_const(parameter_id, &str_parameter_id_ext, "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_ext_const(parameter_id, &str_parameter_id_ext, "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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x02: /* STOP_RTP */ + { + emem_strbuf_t *strbuf; + int i, parameter_id, parameter_length; + + static const value_string str_parameter_id[] = { + {0x0E, "Local Identifier"}, + {0x0F, "Distant Identifier"}, + {0x14, "Canal Identifier"}, + {0, NULL} + }; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 Identifier */ + case 0x0F: /* Distant Identifier */ + { + break; + } + case 0x14: /* Canal Identifier */ + default: + { + if (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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_const(parameter_id, str_parameter_id, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_const(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_const(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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x03: /* REDIRECT */ + { + emem_strbuf_t *strbuf; + 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} + }; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); + } + break; + } + case 0x01: /* Remote MainCPU Server Port */ + default: + { + if (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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_const(parameter_id, str_parameter_id, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, parameter_length + 2, + "%s", val_to_str_const(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_const(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", strbuf->str); + 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, "Number Of Entries: %d", tone_nb_entries); + offset++; + length--; + + while (length > 0 && tone_nb_entries) { + 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 - Number Of Entries: %d", + val_to_str_const(tone_direction, str_tone_direction, "Unknown"), tone_nb_entries); + offset++; + length--; + + while (length > 0 && tone_nb_entries) { + for (i = 1; i <= tone_nb_entries; i++) { + tone_id = tvb_get_guint8(tvb, offset); + tone_duration = tvb_get_ntohs(tvb, offset + 1); +#if 0 + tone_duration = tvb_get_guint8(tvb, offset + 1); + tone_silence = tvb_get_guint8(tvb, offset + 2); +#endif + + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, 6, +#if 0 + "Tone Pair %d: Id: %d, Duration: %d ms, Silence: %d ms", + i, tone_id, tone_duration, tone_silence); +#endif + "Tone Pair %d: Id: %d, Duration: %d ms", + i, tone_id, tone_duration); + 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; + +#if 0 + 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--; +#endif + } + } + break; + } + case 0x07: /* START LISTEN RTP */ + case 0x08: /* STOP LISTEN RTP */ + { + emem_strbuf_t *strbuf; + 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} + }; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); + } + 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 <= 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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_const(parameter_id, str_parameter_id, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_const(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_const(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", strbuf->str); + 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} + }; + static value_string_ext str_parameter_ext = VALUE_STRING_EXT_INIT(str_parameter); + + while (length > 0) { + parameter = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + val_to_str_ext_const(parameter, &str_parameter_ext, "Unknown")); + offset++; + length--; + } + break; + } + case 0x0A: /* SET_PARAM_REQ */ + { + emem_strbuf_t *strbuf; + 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} + }; + static value_string_ext str_parameter_id_ext = VALUE_STRING_EXT_INIT(str_parameter_id); + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + guint64 param_value = 0; + + ep_strbuf_truncate(strbuf, 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} + }; + + ep_strbuf_append(strbuf, val_to_str_const(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 */ + { + ep_strbuf_append(strbuf, "\""); + for (i = 1; i <= parameter_length; i++) { + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + /* XXX: ! isprint() action same as for isprint() ?? */ + if (isprint(tvb_get_guint8(tvb, offset + 1 + i))) + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + else + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + } + ep_strbuf_append(strbuf, "\""); + break; + } + case 0x0F: /* TFTP BACKUP IP ADDR */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); + } + 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} + }; + ep_strbuf_append(strbuf, val_to_str_const(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} + }; + + ep_strbuf_append(strbuf, val_to_str_const(tvb_get_guint8(tvb, offset + 2), + str_enable_feature, "Unknown")); + break; + } + case 0x13: /* Security Flags */ + { + ep_strbuf_append(strbuf, + (tvb_get_guint8(tvb, offset + 2) & 0x01) ? + "Filtering Activated" : "Filtering Not Active"); + 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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else if (parameter_length > 8) { + ep_strbuf_append_printf(strbuf, "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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_ext_const(parameter_id, &str_parameter_id_ext, "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_ext_const(parameter_id, &str_parameter_id_ext, "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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x0B: /* SEND_DIGIT */ + { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Digit Value: %s", + val_to_str_ext_const(tvb_get_guint8(tvb, offset), &str_digit_ext, "Unknown")); + break; + } + case 0x0C: /* PAUSE_RTP */ + case 0x0D: /* RESTART_RTP */ + { + emem_strbuf_t *strbuf; + int i, parameter_length, parameter_id; + + static const value_string str_parameter_id[] = { + {0x14, "Canal Identifier"}, + {0, NULL} + }; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 0); + + parameter_id = tvb_get_guint8(tvb, offset); + parameter_length = tvb_get_guint8(tvb, offset + 1); + + if (parameter_length > 0) { + if (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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_const(parameter_id, str_parameter_id, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_const(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_const(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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x0E: /* START_RECORD_RTP */ + case 0x0F: /* STOP RECORD RTP */ + { + emem_strbuf_t *strbuf; + 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} + }; + static value_string_ext str_parameter_id_ext = VALUE_STRING_EXT_INIT(str_parameter_id); + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); + } + 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 <= 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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_ext_const(parameter_id, &str_parameter_id_ext, "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_ext_const(parameter_id, &str_parameter_id_ext, "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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x06: /* STOP TONE */ + default: + { + break; + } + } } @@ -1735,29 +1734,34 @@ decode_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo ---------------------------------------------------------------------------*/ static void decode_debug_in_line(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_body_item) { - gint *lengthp = 0; - proto_tree *ua3g_body_tree; - int i, parameter_length; - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - - parameter_length = length; - ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); - - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 0; i < parameter_length; i++) { - if(isprint(tvb_get_guint8(tvb, offset + i))) - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+i, lengthp)); - else - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+i, lengthp)); - } - ep_strbuf_append(strbuf, "\""); - - proto_tree_add_text(ua3g_body_tree, tvb, offset, length, - "Text String With Debug: %s", strbuf->str); + proto_tree *ua3g_body_tree; + int i, parameter_length; + emem_strbuf_t *strbuf; + + if (!ua3g_body_item) + return; + + parameter_length = length; + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + strbuf = ep_strbuf_new_label(NULL); + + ep_strbuf_append(strbuf, "\""); + for (i = 0; i < parameter_length; i++) { + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + /* XXX: ! isprint() action same as for isprint() ?? */ + if (isprint(tvb_get_guint8(tvb, offset + i))) + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+i, NULL)); + else + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+i, NULL)); + } + ep_strbuf_append(strbuf, "\""); + + proto_tree_add_text(ua3g_body_tree, tvb, offset, length, + "Text String With Debug: %s", strbuf->str); } @@ -1766,45 +1770,52 @@ decode_debug_in_line(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_ ---------------------------------------------------------------------------*/ static void decode_led_command(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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)); - } + proto_tree *ua3g_body_tree; + int command; + + 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} + }; + static value_string_ext str_command_ext = VALUE_STRING_EXT_INIT(str_command); + + command = 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, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, "s - %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + offset++; + length--; + + if ((command >= 0) && (command < 7)) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Led Number: %d", tvb_get_guint8(tvb, offset)); + } } @@ -1814,110 +1825,110 @@ decode_led_command(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_lcd_line_cmd(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_item, proto_item *ua3g_body_item) { - guint8 lcd_options, command, column_n; - guint i; - 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} - }; - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - - 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); - - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 0; i < length - 2; i++) { - if(isprint(tvb_get_guint8(tvb, offset + 2 + i))) - ep_strbuf_append_printf(strbuf, "%c", tvb_get_guint8(tvb, offset + 2 + i)); - else - ep_strbuf_append_printf(strbuf, "'0x%02x'", tvb_get_guint8(tvb, offset + 2 + i)); - } - ep_strbuf_append(strbuf, "\""); - - 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); + guint8 lcd_options, command, column_n; + guint i; + 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; + emem_strbuf_t *strbuf; +/* static char str_ascii[40]; */ /* XXX: value never created ? */ +/* 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_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"}, + {0x01, "Stop Call Timer"}, + {0x02, "Start Call Timer From Current Value"}, + {0x03, "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 "INFO" column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s %d", + val_to_str_const(command, str_command, "Unknown"), + column_n); + + if (!ua3g_body_item) + return; + + strbuf = ep_strbuf_new_label(NULL); + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s %d", + val_to_str_const(command, str_command, "Unknown"), + column_n); + proto_item_append_text(ua3g_body_item, " %s %d", + val_to_str_const(command, str_command, "Unknown"), + column_n); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + ep_strbuf_append(strbuf, "\""); + for (i = 0; i < length - 2; i++) { + if (isprint(tvb_get_guint8(tvb, offset + 2 + i))) + ep_strbuf_append_printf(strbuf, "%c", tvb_get_guint8(tvb, offset + 2 + i)); + else + ep_strbuf_append_printf(strbuf, "'0x%02x'", tvb_get_guint8(tvb, offset + 2 + i)); + } + ep_strbuf_append(strbuf, "\""); + + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + length, "%s %d: %s", + val_to_str_const(command, str_command, "Unknown"), column_n, /*str_ascii*/ strbuf->str); + 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_const(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++) { + if (i != 3) { + proto_tree_add_text(ua3g_option_tree, tvb, offset, 1, "%s: %s", + val_to_str_const(i, str_lcd_option, "Unknown"), + (lcd_options & (1 << i)) ? "Enable" : "Disable"); + } else { + i++; + proto_tree_add_text(ua3g_option_tree, tvb, offset, 1, "%s: %s", + val_to_str_const(i, str_lcd_option, "Unknown"), + val_to_str_const((lcd_options >> 3) & 0x03, 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*/ strbuf->str); } @@ -1926,122 +1937,130 @@ decode_lcd_line_cmd(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_main_voice_mode(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } - /* FALLTHROUGH */ - 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; - } - } + guint8 mode; + 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} + }; + static value_string_ext str_voice_mode_ext = VALUE_STRING_EXT_INIT(str_voice_mode); + + mode = 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, ": %s", + val_to_str_ext_const(mode, &str_voice_mode_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(mode, &str_voice_mode_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_ext_const(mode, &str_voice_mode_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, mode, "Voice Mode: %s", + val_to_str_ext_const(mode, &str_voice_mode_ext, "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} + }; + static value_string_ext str_cadence_ext = VALUE_STRING_EXT_INIT(str_cadence); + + 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_ext_const(tvb_get_guint8(tvb, offset), &str_cadence_ext, "Unknown"), + tvb_get_guint8(tvb, offset)); + offset++; + length--; + } + /* FALLTHROUGH */ + 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_const(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; + } + } } @@ -2050,24 +2069,27 @@ decode_main_voice_mode(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_subdevice_metastate(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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")); + proto_tree *ua3g_body_tree; + static const value_string str_new_metastate[] = { + {0x00, "Disable"}, + {0x01, "Active"}, + {0x02, "Wake Up"}, + {0, NULL} + }; + + if (!ua3g_body_item) + return; + + 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_const(tvb_get_guint8(tvb, offset), str_new_metastate, "Unknown")); } @@ -2076,35 +2098,39 @@ decode_subdevice_metastate(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_dwl_dtmf_clck_format(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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)); + proto_tree *ua3g_body_tree; + + static const value_string str_clock_format[] = { + {0, "Europe"}, + {1, "US"}, + {0, NULL} + }; + + if (!ua3g_body_item) + return; + + 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_const(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)); } @@ -2113,84 +2139,90 @@ decode_dwl_dtmf_clck_format(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_set_clck(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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; - } - /* FALLTHROUGH */ - 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; - } - } + guint8 command; + 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} + }; + + command = 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, ": %s", + val_to_str_const(command, str_command, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_const(command, str_command, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_const(command, str_command, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + val_to_str_const(command, str_command, "Unknown")); + offset++; + length--; + call_timer = 0; + + switch (command) { + case 0x02: /* Timer Form */ + { + call_timer = 1; + } + /* FALLTHROUGH */ + 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_const(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_const(call_timer, str_call_timer, ""), hour); + offset++; + length--; + proto_tree_add_text(ua3g_param_tree, tvb, offset, 1, "%sMinute: %d", + val_to_str_const(call_timer, str_call_timer, ""), minute); + offset++; + length--; + proto_tree_add_text(ua3g_param_tree, tvb, offset, 1, "%sSecond: %d", + val_to_str_const(call_timer, str_call_timer, ""), second); + offset++; + length--; + + call_timer = 1; + } + } + default: + { + break; + } + } } @@ -2200,71 +2232,61 @@ decode_set_clck(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_voice_channel(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } + proto_tree *ua3g_body_tree; + + static const value_string str_voice_channel[] = { + {0x00, "No"}, + {0x01, "B1"}, + {0x02, "B2"}, + {0x03, "B3"}, + {0, NULL} + }; + + if (!ua3g_body_item) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + if (length == 1) { + guint8 val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + (val & 0x01) ? "Write 00 to Voice Channel" : "Normal Voice Channel Mode"); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + (val & 0x02) ? "Write Quiet To Codec" : "Normal Codec Operation"); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + (val & 0x04) ? "Use B3 As Voice Channel" : "Use B1 As Voice Channel"); + offset++; + length--; + } else if (length == 2) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Main Voice: %s", + val_to_str_const(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_const(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--; + } } @@ -2273,32 +2295,39 @@ decode_voice_channel(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_ ---------------------------------------------------------------------------*/ static void decode_external_ringing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length _U_, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length _U_, guint8 opcode _U_, + 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")); + proto_tree *ua3g_body_tree; + guint8 command; + + static const value_string str_ext_ring_cmd[] = { + {0x00, "Turn Off"}, + {0x01, "Turn On"}, + {0x02, "Follow The Normal Ringing"}, + {0, NULL} + }; + + command = 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, ": %s", + val_to_str_const(command, str_ext_ring_cmd, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_const(command, str_ext_ring_cmd, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_const(command, str_ext_ring_cmd, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + 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_const(command, str_ext_ring_cmd, "Unknown")); } @@ -2307,31 +2336,37 @@ decode_external_ringing(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_lcd_cursor(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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")); + proto_tree *ua3g_body_tree; + guint8 str_on_off_val; + + str_on_off_val = tvb_get_guint8(tvb, offset + 1) & 0x02; + + /* add text to the frame "INFO" column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", + STR_ON_OFF(str_on_off_val)); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + STR_ON_OFF(str_on_off_val)); + proto_item_append_text(ua3g_body_item, " - %s", + STR_ON_OFF(str_on_off_val)); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + 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", + STR_ON_OFF(tvb_get_guint8(tvb, offset) & 0x02)); } @@ -2340,38 +2375,43 @@ decode_lcd_cursor(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_dwl_special_char(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, proto_item *ua3g_body_item) { - proto_tree *ua3g_body_tree; - int i, j; - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - - 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) - ep_strbuf_append_printf(strbuf, " "); - else - ep_strbuf_append_printf(strbuf, "o "); - } - - proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, - "Byte %d: 0x%02x %s", i, byte, byte_char); - offset++; - length--; - } - } + proto_tree *ua3g_body_tree; + int i, j; + emem_strbuf_t *strbuf; + + if (!ua3g_body_item) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + strbuf = ep_strbuf_new_label(NULL); + + 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); + + /* The following loop will draw a picture of the character with "spaces" and "o" */ + ep_strbuf_truncate(strbuf, 0); + for (j = 7; j >= 0; j--) { + if (((byte >> j) & 0x01) == 0) + ep_strbuf_append_printf(strbuf, " "); + else + ep_strbuf_append_printf(strbuf, "o "); + } + + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Byte %d: 0x%02x %s", i, byte, strbuf->str); + offset++; + length--; + } + } } @@ -2380,26 +2420,29 @@ decode_dwl_special_char(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_set_clck_timer_pos(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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)); + proto_tree *ua3g_body_tree; + + if (!ua3g_body_item) + return; + + 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)); } @@ -2408,24 +2451,27 @@ decode_set_clck_timer_pos(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_set_lcd_contrast(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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)); + proto_tree *ua3g_body_tree; + static const value_string str_driver_number[] = { + {0x00, "Display"}, + {0x01, "Icon"}, + {0, NULL} + }; + + if (!ua3g_body_item) + return; + + 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_const(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)); } @@ -2434,169 +2480,188 @@ decode_set_lcd_contrast(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_beep(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_item, proto_item *ua3g_body_item) { - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - 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; - static const value_string str_destination[] = { - {0x01, "Handset"}, - {0x02, "Headset"}, - {0x04, "Loudspeaker"}, - {0x08, "Announce Loudspeaker"}, - {0x10, "Handsfree"}, - {0, NULL} - }; - - ep_strbuf_append_printf(strbuf, "%s", - val_to_str((tvb_get_guint8(tvb, offset) & 0x01), str_destination, "")); - for(i = 1; i < 5; i++) { - ep_strbuf_append(strbuf, - val_to_str((tvb_get_guint8(tvb, offset) & (0x01 << i)), str_destination, "")); - } - - proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, - "Destination: %s", strbuf->str); - 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"); - - /* add text to the frame "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ": Classical Beep"); - } + if (length > 0) { /* All cases except classical beep */ + guint8 command; + 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} + }; + + command = 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, ": %s", + val_to_str_const(command, str_command, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_const(command, str_command, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_const(command, str_command, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, + offset, 1, command, "Beep: %s", + val_to_str_const(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"}, + {0x03, "Ear-Piece and Loudspeaker"}, + {0, NULL} + }; + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Destination: %s", + val_to_str_const(tvb_get_guint8(tvb, offset), str_destination, "Unknown")); + offset++; + length--; + + while (length > 0) { + guint8 val; + + i++; + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "On / Off: %s", + STR_ON_OFF(val & 0x80)); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Cadence T%d: %d ms", + i, ((val & 0x7F) * 10)); + offset++; + length--; + } + break; + } + case 0x04: /* Start Beep */ + { + guint8 beep_dest; + emem_strbuf_t *strbuf; + int i; + + static const value_string str_destination[] = { + {0x01, "Handset"}, + {0x02, "Headset"}, + {0x04, "Loudspeaker"}, + {0x08, "Announce Loudspeaker"}, + {0x10, "Handsfree"}, + {0, NULL} + }; + + beep_dest = tvb_get_guint8(tvb, offset); + + strbuf = ep_strbuf_new_label(NULL); + + for (i = 0; i < 5; i++) { + ep_strbuf_append(strbuf, + val_to_str_const(beep_dest & (0x01 << i), str_destination, "")); + } + + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Destination: %s", strbuf->str); + 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_const(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_const(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 "INFO" column */ + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, ": Classical Beep"); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", Classical Beep"); + proto_item_append_text(ua3g_body_item, " - Classical Beep"); + + } } @@ -2605,34 +2670,39 @@ decode_beep(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_sidetone(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length _U_, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length _U_, guint8 opcode _U_, + 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)); - } + guint8 command; + proto_tree *ua3g_body_tree; + + command = 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, ": %s", + STR_ON_OFF(command)); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + STR_ON_OFF(command)); + proto_item_append_text(ua3g_body_item, " - %s", + STR_ON_OFF(command)); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + STR_ON_OFF(command)); + 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)); + } } @@ -2641,27 +2711,30 @@ decode_sidetone(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_ringing_cadence(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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--; - } + proto_tree *ua3g_body_tree; + int i = 0; + + if (!ua3g_body_item) + return; + + 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", + STR_ON_OFF(tvb_get_guint8(tvb, offset) & 0x80)); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Length %d : %d ms", + i, ((tvb_get_guint8(tvb, offset) & 0x7F) * 10)); + offset++; + length--; + } } @@ -2670,77 +2743,88 @@ decode_ringing_cadence(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_mute(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length _U_, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length _U_, guint8 opcode _U_, + 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")); + guint8 command; + proto_tree *ua3g_body_tree; + + static const value_string str_mute[] = { + {0x00, "Microphone Disable"}, + {0x01, "Microphone Enable"}, + {0, NULL} + }; + + command = 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, ": %s", + val_to_str_const(command, str_mute, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_const(command, str_mute, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_const(command, str_mute, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "%s", + val_to_str_const(command, str_mute, "Unknown")); } /*----------------------------------------------------------------------------- - FEEDBACK ON / OFF - 40h (MESSAGE FROM THE SYSTEM) - ---------------------------------------------------------------------------*/ + FEEDBACK ON / OFF - 40h (MESSAGE FROM THE SYSTEM) + ---------------------------------------------------------------------------*/ static void decode_feedback(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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)); - } - } + guint8 command; + proto_tree *ua3g_body_tree; + + command = 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, ": %s", + STR_ON_OFF(command)); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + STR_ON_OFF(command)); + proto_item_append_text(ua3g_body_item, " - %s", + STR_ON_OFF(command)); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + STR_ON_OFF(command)); + 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)); + } + } } @@ -2751,21 +2835,24 @@ decode_feedback(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_r_w_peripheral(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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)); - } + proto_tree *ua3g_body_tree; + + if (!ua3g_body_item) + return; + + 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)); + } } @@ -2774,31 +2861,43 @@ decode_r_w_peripheral(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_icon_cmd(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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, "Unknown"), - (((tvb_get_guint8(tvb, offset) << 1) >> i) & 0x02) + ((tvb_get_guint8(tvb, offset + 1) >> i) & 0x01)); - } + proto_tree *ua3g_body_tree; + guint8 byte0, byte1, bytex; + int i; + + static const value_string str_state[] = { + {0x00, "Off"}, + {0x01, "Slow Flash"}, + {0x02, "Not Used"}, + {0x03, "Steady On"}, + {0, NULL} + }; + + if (!ua3g_body_item) + return; + + 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--; + + byte0 = tvb_get_guint8(tvb, offset); + byte1 = tvb_get_guint8(tvb, offset+1); + + for (i = 0; i < 8; i++) { + bytex = + ((byte0 >> i) & 0x01) * 2 + + ((byte1 >> i) & 0x01); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 2, + "Segment %d: %s (%d)", i, + val_to_str_const(bytex, str_state, "Unknown"), + bytex + ); + } } @@ -2807,211 +2906,210 @@ decode_icon_cmd(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_audio_config(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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"}, - {0, NULL} - }; - static const value_string str_full_duplex[] = { - {0x00, "Handsfree Normal"}, - {0x02, "More Full Duplex"}, - {0, NULL} - }; - - 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} - }; - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - int j; - int i = 0; - - while(length > 0) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%s", - val_to_str(tvb_get_guint8(tvb, offset) & 0x01, str_device_values, "")); - - for(j = 1; j < 4; j++) { - ep_strbuf_append_printf(strbuf, "%s", - val_to_str((tvb_get_guint8(tvb, offset) & (0x01 << j)), str_device_values, "")); - } - if(strcmp(strbuf->str, "") <= 0) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, " None"); - } - - proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s:%s", - val_to_str(i, str_device, "Unknown"), strbuf->str); - offset++; - length--; - i++; - } - break; - } - default: - { - break; - } - } + guint8 command; + 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 Configuration"}, + {0, NULL} + }; + static value_string_ext str_command_ext = VALUE_STRING_EXT_INIT(str_command); + + command = 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, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, + offset, 1, command, "Command: %s (%d)", + val_to_str_ext_const(command, &str_command_ext, "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_const(tvb_get_guint8(tvb, offset), str_law, "Unknown")); + break; + } + case 0x01: /* DPI Channel Allocations */ + { + int i; + static const gchar *str_body[] = { + "UA Channel UA-TX1 ", + "UA Channel UA-TX2 ", + "GCI Channel GCI-TX1 ", + "GCI Channel GCI-TX2 ", + "Codec Channel COD-TX" + }; + for (i = 0; i < 5; i++) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, + 1, "%s: %d", + str_body[i], 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 gchar *str_body[] = { + "Anti-Distortion Coeff 1(DTH)", + "Anti-Distortion Coeff 2(DTR)", + "Anti-Distortion Coeff 3(DTF)", + "Sidetone Attenuation (STR) ", + "Anti-Larsen Coeff 1 (AHP1) ", + "Anti-Larsen Coeff 2 (AHP2) ", + "Anti-Larsen Coeff 3 (ATH) ", + "Anti-Larsen Coeff 4 (ATR) ", + "Anti-Larsen Coeff 5 (ATF) ", + "Anti-Larsen Coeff 6 (ALM) " + }; + + for (i = 0; i < 10; i++) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, + 1, "%s: %d", + str_body[i], tvb_get_guint8(tvb, offset)); + offset++; + length--; + } + break; + } + case 0x04: /* Handsfree Parameters */ + { + guint8 val; + + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + (val & 0x01) ? "Return Loss Active" : "Return Loss Normal"); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s", + (val & 0x02) ? "More Full Duplex" : "Handsfree Normal"); + break; + } + case 0x05: /* Loudspeaker Acoustic Parameters */ + { + int i; + static const gchar *str_body[] = { + "Group Listening Attenuation Constant ", + "Handsfree Attenuation Constant ", + "Handsfree Number Of ms To Stay In Send State Before Going To Another State", + "Handsfree Number Of Positions To Shift Right MTx ", + "Handsfree Number Of Positions To Shift Right MRc ", + "Handsfree Idle Transmission Threshold ", + "Handsfree Low Transmission Threshold ", + "Handsfree Idle Reception Threshold ", + "Handsfree Low Reception Threshold ", + "Handsfree Medium Reception Threshold ", + "Handsfree High Reception Threshold " + }; + + for (i = 0; i < 11; i++) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s: %d", + str_body[i], tvb_get_guint8(tvb, offset)); + offset++; + length--; + } + break; + } + case 0x06: /* Device Configuration */ + { + static const gchar *str_device[] = { + "Handset Device ", + "Headset Device ", + "Loudspeaker Device ", + "Announce Loudspeaker Device", + "Handsfree Device " + }; + static const gchar *str_device_values[] = { + " Internal", + " Rj9 Plug", + " Jack Plug", + " Bluetooth Link", + " USB Link" + }; + emem_strbuf_t *strbuf; + guint8 device_values; + int j; + int device_index = 0; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + + device_values = tvb_get_guint8(tvb, offset); + + ep_strbuf_truncate(strbuf, 0); + + if (device_values != 0) { + for (j = 0; j < 5; j++) { + if (device_values & (0x01 << j)) { + ep_strbuf_append(strbuf, str_device_values[j]); + } + } + } else { + ep_strbuf_append(strbuf, " None"); + } + + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s:%s", + str_device[device_index], strbuf->str); + offset++; + length--; + device_index++; + } + break; + } + default: + { + break; + } + } } @@ -3020,18 +3118,21 @@ decode_audio_config(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_audio_padded_path(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length, + guint8 opcode _U_, 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)); + proto_tree *ua3g_body_tree; + + if (!ua3g_body_item) + return; + + 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)); } @@ -3043,37 +3144,42 @@ decode_audio_padded_path(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_on_off_level(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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))); - } - } + guint8 command; + proto_tree *ua3g_body_tree; + + command = 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, ": %s", + STR_ON_OFF(command)); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + STR_ON_OFF(command)); + proto_item_append_text(ua3g_body_item, " - %s", + STR_ON_OFF(command)); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + STR_ON_OFF(command)); + 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))); + } + } } @@ -3082,63 +3188,70 @@ decode_on_off_level(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_ring(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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)); - } + guint8 command; + 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} + }; + static value_string_ext str_cadence_ext = VALUE_STRING_EXT_INIT(str_cadence); + + command = 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, ": %s", + STR_ON_OFF(command)); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + STR_ON_OFF(command)); + proto_item_append_text(ua3g_body_item, " - %s", + STR_ON_OFF(command)); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, offset, + 1, command, "Command: %s", + STR_ON_OFF(command)); + 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_ext_const(tvb_get_guint8(tvb, offset), &str_cadence_ext, "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", + STR_ON_OFF(tvb_get_guint8(tvb, offset) & 0x80)); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Progressive: %d", + (tvb_get_guint8(tvb, offset) & 0x03)); + } } @@ -3147,246 +3260,258 @@ decode_ring(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_ua_dwl_protocol(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_item, proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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)); - /*Fix Clang Warning*/ - /*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; - } - } + guint8 command; + 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} + }; + static value_string_ext str_command_ext = VALUE_STRING_EXT_INIT(str_command); + + command = 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, ": %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, + offset, 1, command, "Command: %s", + val_to_str_ext_const(command, &str_command_ext, "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 gchar *str_mem_size[] = { + "No Check", + "128 Kbytes", + "256 Kbytes", + "512 Kbytes", + "1 Mbytes", + "2 Mbytes", + "4 Mbytes", + "8 Mbytes" + }; + + static const gchar *str_bin_info[] = { + "Uncompressed Binary", + "LZO Compressed Binary" + }; + + if (length > 7) { /* Not R1 */ + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "Force Mode: %s", + val_to_str_const(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_const(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 */ + guint8 val; + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Files Included: %sBoot Binary Included, %sLoader Binary Included," + " %sAppli Binary Included, %sDatas Binary Included", + (val & 0x01) ? "" : "No ", + (val & 0x02) ? "" : "No ", + (val & 0x04) ? "" : "No ", + (val & 0x08) ? "" : "No "); + offset++; + length--; + + val = tvb_get_guint8(tvb, offset); + 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", + STR_YES_NO(val & 0x01), + STR_YES_NO(val & 0x02), + STR_YES_NO(val & 0x04), + val_to_str_const(((tvb_get_guint8(tvb, offset) & 0xE0) >> 5), str_mode_selection_country, "Unknown")); + offset++; + length--; + + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Hardware Selection: For Ivanoe 1: %s, For Ivanoe 2: %s", + STR_YES_NO(val & 0x01), + STR_YES_NO(val & 0x02)); + offset++; + length--; + + val = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Memory Sizes Required: Flash Min Size: %s, External Ram Min Size: %s", + str_mem_size[(val & 0x07)], + str_mem_size[(val & 0x38) >> 3]); + offset++; + length--; + } else { /* R1 */ + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Binary Information: %s, Country/Operator/CLient Identifier ?", + str_bin_info[tvb_get_guint8(tvb, offset) & 0x01]); + 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} + }; + static value_string_ext str_status_ext = VALUE_STRING_EXT_INIT(str_status); + + 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_ext_const(tvb_get_guint8(tvb, offset), &str_status_ext, "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_const(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_const(tvb_get_guint8(tvb, offset), str_ack_status, "Unknown")); + break; + } + case 0x04: /* Downloading End (MESSAGE FROM THE SYSTEM) */ + default: + { + break; + } + } } @@ -3395,34 +3520,17 @@ decode_ua_dwl_protocol(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_digit_dialed(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length _U_, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length _U_, guint8 opcode _U_, + 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")); + proto_tree *ua3g_body_tree; + + if (!ua3g_body_item) + return; + + 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_ext_const(tvb_get_guint8(tvb, offset), &str_digit_ext, "Unknown")); } @@ -3431,32 +3539,35 @@ decode_digit_dialed(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_subdevice_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length, guint8 opcode _U_, + 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--; - } + proto_tree *ua3g_body_tree; + int i = 0; + + if (!ua3g_body_item) + return; + + 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--; + } } @@ -3465,674 +3576,687 @@ decode_subdevice_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_ ---------------------------------------------------------------------------*/ static void decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo, guint offset, guint length, - guint8 opcode _U_, proto_item *ua3g_item, - proto_item *ua3g_body_item) + packet_info *pinfo, guint offset, guint length, + guint8 opcode _U_, proto_item *ua3g_item, + proto_item *ua3g_body_item) { - guint8 command = tvb_get_guint8(tvb, offset); - gint *lengthp = 0; - proto_tree *ua3g_body_tree; - proto_item *ua3g_param_item; - proto_tree *ua3g_param_tree; - emem_strbuf_t *strbuf = ep_strbuf_new_label(""); - 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 */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, - val_to_str((guint8)(param_value), str_compressor, "Default Codec")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, - "Port Lan Speed: %d - Port Lan Duplex: %d", - tvb_get_guint8(tvb, offset + 2), - tvb_get_guint8(tvb, offset + 3)); - } else if(parameter_length == 4) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, - "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 { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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) { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%02x", tvb_get_guint8(tvb, offset + 2)); - } - - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, ":"); - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, lengthp)); - } - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "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"), strbuf->str); - } 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", strbuf->str); - offset += parameter_length; - length -= parameter_length; - } - } - break; - } - case 0x03: - { - int i, parameter_id, parameter_length; - int element_length = 1; - 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} - }; - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%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 */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 3)); - for(i = 2; i <= parameter_length; i++) { - ep_strbuf_append(strbuf, "."); - ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+2+i)); - } - break; - } - case 0x0A: - case 0x0B: - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "\""); - for(i = 1; i <= parameter_length; i++) { - if(isprint(tvb_get_guint8(tvb, offset + 2 + i))) - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+2+i, lengthp)); - else - ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+2+i, lengthp)); - } - ep_strbuf_append(strbuf, "\""); - 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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, - val_to_str((guint8)(param_value), str_compressor, "Default Codec")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "Parameter Value Too Long (more than 64 bits)"); - } - - break; - } - case 0x10: /* VAD */ - case 0x11: /* ECE */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, - val_to_str((guint8)(param_value), str_voice_mode, "Unknown")); - } else { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append(strbuf, "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: %d", - ((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} - }; - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%s", val_to_str(tvb_get_guint8(tvb, offset + 3), str_bool, "True")); - break; - } - case 0x2F: /* 802.1p Priority */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", (tvb_get_guint8(tvb, offset + 3) & 0x07)); - break; - } - case 0x30: /* VLAN Id */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%d", (tvb_get_ntohs(tvb, offset + 3) & 0x0FFF)); - break; - } - case 0x31: /* DiffServ */ - { - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%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))); - } - ep_strbuf_truncate(strbuf, 0); - ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", 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"), strbuf->str); - 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", strbuf->str); - offset += parameter_length; - length -= parameter_length; - } - break; - } - } - - } - break; - } - default: - { - break; - } - } + guint8 command; + proto_tree *ua3g_body_tree; + proto_item *ua3g_param_item; + proto_tree *ua3g_param_tree; + + static const value_string str_command[] = { + {0x00, "Init"}, + {0x01, "Incident"}, + {0x02, "Get Parameters Value Response"}, + {0x03, "QOS Ticket RSP"}, + {0, NULL} + }; + + command = 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, ": %s", + val_to_str_const(command, str_command, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_const(command, str_command, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_const(command, str_command, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_ip, tvb, offset, + 1, command, "Command: %s", + val_to_str_const(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_const(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: + { + emem_strbuf_t *strbuf; + 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} + }; + static value_string_ext str_parameter_id_ext = VALUE_STRING_EXT_INIT(str_parameter_id); + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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 */ + { + ep_strbuf_append_printf(strbuf, "%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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 2)); + + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+1+i)); + } + 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 <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 1 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, + val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); + } else { + ep_strbuf_append_printf(strbuf, "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) { + ep_strbuf_append_printf(strbuf, + "Port Lan Speed: %d - Port Lan Duplex: %d", + tvb_get_guint8(tvb, offset + 2), + tvb_get_guint8(tvb, offset + 3)); + } else if (parameter_length == 4) { + ep_strbuf_append_printf(strbuf, + "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 { + ep_strbuf_append_printf(strbuf, "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 */ + { + ep_strbuf_append_printf(strbuf, "%02x", tvb_get_guint8(tvb, offset + 2)); + + + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, ":"); + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+1+i, NULL)); + } + break; + } + default: + { + if (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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", param_value); + } else { + ep_strbuf_append_printf(strbuf, "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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 2, "%s", + val_to_str_ext_const(parameter_id, &str_parameter_id_ext, "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_ext_const(parameter_id, &str_parameter_id_ext, "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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + } + break; + } + case 0x03: + { + emem_strbuf_t *strbuf; + int i, parameter_id, parameter_length; + int element_length = 1; + int framing_rtp = 0; +#define PVT_ROWS 15 +#define PVT_COLS 50 + char parameter_value_tab[PVT_ROWS][PVT_COLS]; /* XXX: Use ep_alloc'd memory */ + + static const value_string str_parameter_id[] = { + {0x01, "Date Of End Of Communication"}, + {0x02, "Node Number"}, + {0x03, "Ticket Protocol Version"}, + {0x06, "Equipment 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 value_string_ext str_parameter_id_ext = VALUE_STRING_EXT_INIT(str_parameter_id); + + 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} + }; + + strbuf = ep_strbuf_new_label(NULL); + + while (length > 0) { + ep_strbuf_truncate(strbuf, 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} + }; + ep_strbuf_append_printf(strbuf, "%s, %s", + val_to_str_const(tvb_get_guint8(tvb, offset + 3), str_first_byte, "Unknown"), + val_to_str_const(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 */ + { + ep_strbuf_append_printf(strbuf, "%d", tvb_get_guint8(tvb, offset + 3)); + for (i = 2; i <= parameter_length; i++) { + ep_strbuf_append(strbuf, "."); + ep_strbuf_append_printf(strbuf, "%u", tvb_get_guint8(tvb, offset+2+i)); + } + break; + } + case 0x0A: + case 0x0B: + { + ep_strbuf_append(strbuf, "\""); + for (i = 1; i <= parameter_length; i++) { + /* XXX: Advancing thru param byte by byte, yet using stringz ?? */ + /* XXX: ! isprint() action same as for isprint() ?? */ + if (isprint(tvb_get_guint8(tvb, offset + 2 + i))) + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+2+i, NULL)); + else + ep_strbuf_append(strbuf, tvb_get_const_stringz(tvb, offset+2+i, NULL)); + } + ep_strbuf_append(strbuf, "\""); + 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 <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, + val_to_str_const((guint8)(param_value), str_compressor, "Default Codec")); + } else { + ep_strbuf_append(strbuf, "Parameter Value Too Long (more than 64 bits)"); + } + + break; + } + case 0x10: /* VAD */ + case 0x11: /* ECE */ + { + ep_strbuf_append_printf(strbuf, "%s", + STR_ON_OFF(tvb_get_guint8(tvb, offset + 3))); + 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 <= 8) { + guint64 param_value = 0; + + for (i = parameter_length; i > 0; i--) { /* XXX: Not needed since only LO byte used ? */ + param_value += (tvb_get_guint8(tvb, offset + 2 + i) << (8 * (parameter_length - i))); + } + ep_strbuf_append(strbuf, + val_to_str_const((guint8)(param_value), str_voice_mode, "Unknown")); + } else { + ep_strbuf_append(strbuf, "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 < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "%s: %d", + val_to_str_const(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} + }; + static value_string_ext str_range_ext = VALUE_STRING_EXT_INIT(str_range); + + element_length = 2; + for (i = 0; (i < (parameter_length / element_length)) && (i < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "%s: %d", + val_to_str_ext_const(i, &str_range_ext, "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} + }; + static value_string_ext str_range_ext = VALUE_STRING_EXT_INIT(str_range); + + element_length = 2; + for (i = 0; (i < (parameter_length / element_length)) && (i < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "%s: %d", + val_to_str_ext_const(i, &str_range_ext, "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 < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "+/- %3d ms: %d", + ((2 * i) + 1) * framing_rtp / 2, + tvb_get_ntohl(tvb, offset + 3 + 4 * i)); + } + break; + } + case 0x2E: /* 802.1 Q Used */ + { + ep_strbuf_append(strbuf, + tvb_get_guint8(tvb, offset + 3) ? "True" : "False"); + break; + } + case 0x2F: /* 802.1p Priority */ + { + ep_strbuf_append_printf(strbuf, "%d", (tvb_get_guint8(tvb, offset + 3) & 0x07)); + break; + } + case 0x30: /* VLAN Id */ + { + ep_strbuf_append_printf(strbuf, "%d", (tvb_get_ntohs(tvb, offset + 3) & 0x0FFF)); + break; + } + case 0x31: /* DiffServ */ + { + ep_strbuf_append_printf(strbuf, "%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} + }; + static value_string_ext str_range_ext = VALUE_STRING_EXT_INIT(str_range); + + element_length = 2; + for (i = 0; (i < (parameter_length / element_length)) && (i < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "%s: %d", + val_to_str_ext_const(i, &str_range_ext, "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} + }; + static value_string_ext str_range_ext = VALUE_STRING_EXT_INIT(str_range); + + element_length = 2; + for (i = 0; (i < (parameter_length / element_length)) && (i < PVT_ROWS); i++) { + g_snprintf(parameter_value_tab[i], PVT_COLS, "%s: %d", + val_to_str_ext_const(i, &str_range_ext, "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))); + } + ep_strbuf_append_printf(strbuf, "%" G_GINT64_MODIFIER "u", 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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown")); + proto_tree_add_text(ua3g_body_tree, tvb, offset + 3, + parameter_length, " %s", + val_to_str_const(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_ext_const(parameter_id, &str_parameter_id_ext, "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 < PVT_ROWS); i++) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, + element_length, " %s", parameter_value_tab[i]); + offset += element_length; + length -= element_length; + } + if (i >= PVT_ROWS) { + gint length_remaining = parameter_length - PVT_ROWS*element_length; + proto_tree_add_text(ua3g_body_tree, + tvb, offset, length_remaining, + "Unknown Parameter Data"); + offset += length_remaining; + length -= length_remaining; + } + 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_ext_const(parameter_id, &str_parameter_id_ext, "Unknown"), strbuf->str); + } else { + ua3g_param_item = proto_tree_add_text(ua3g_body_tree, tvb, offset, + parameter_length + 3, "%s", + val_to_str_ext_const(parameter_id, &str_parameter_id_ext, "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_ext_const(parameter_id, &str_parameter_id_ext, "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", strbuf->str); + offset += parameter_length; + length -= parameter_length; + } + break; + } + } + + } + break; + } + default: + { + break; + } + } } @@ -4142,328 +4266,338 @@ decode_cs_ip_device_routing(proto_tree *tree _U_, tvbuff_t *tvb, ---------------------------------------------------------------------------*/ static void decode_unsolicited_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, - guint offset, guint length, guint8 opcode, - proto_item *ua3g_item, proto_item *ua3g_body_item) + 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; - } - } + guint8 command; + 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} + }; + static value_string_ext str_command_ext = VALUE_STRING_EXT_INIT(str_command); + + command = tvb_get_guint8(tvb, offset); + + if (opcode != 0x21) { + /* 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_ext_const(command, &str_command_ext, "Unknown")); + + if (!ua3g_body_item) + return; + + /* add text to the frame tree */ + proto_item_append_text(ua3g_item, ", %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + proto_item_append_text(ua3g_body_item, " - %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + proto_tree_add_uint_format(ua3g_body_tree, hf_ua3g_command, tvb, + offset, 1, command, "Command: %s", + val_to_str_ext_const(command, &str_command_ext, "Unknown")); + offset++; + length--; + } else { + if (!ua3g_body_item) + return; + + 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_const(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_const(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_const((((tvb_get_guint8(tvb, offset) & 0xC0) >> 6) + vta_type), str_subtype, "Unknown"), + val_to_str_const(((tvb_get_guint8(tvb, offset) & 0x38) >> 3), str_generation, "Unknown"), + val_to_str_const((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_const(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_const((((tvb_get_guint8(tvb, offset) & 0xE0) >> 5) + vta_type), str_hard_vta_type, "Unknown"), + val_to_str_const(((tvb_get_guint8(tvb, offset) & 0x1C) >> 2), str_hard_design, "Unknown"), + val_to_str_const((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", + STR_ON_OFF(tvb_get_guint8(tvb, offset))); + 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_const(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_const((tvb_get_guint8(tvb, offset) & 0x03), str_hard_config_chip, "Unknown"), + val_to_str_const(((tvb_get_guint8(tvb, offset) & 0x1C) >> 2), str_hard_config_flash, "Unknown"), + val_to_str_const(((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_const(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_const((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", + STR_ON_OFF(tvb_get_guint8(tvb, offset))); + 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; + } + } } @@ -4475,25 +4609,31 @@ decode_unsolicited_msg(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo, ---------------------------------------------------------------------------*/ static void decode_key_number(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode _U_, - proto_item *ua3g_body_item _U_) + guint offset, guint length, guint8 opcode _U_, + proto_item *ua3g_body_item _U_) { -/* 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(tree, tvb, offset, length, - "Key Number: Row %d, Column %d", - (tvb_get_guint8(tvb, offset) & 0xF0), (tvb_get_guint8(tvb, offset) & 0x0F)); - } +#if 0 + proto_tree *ua3g_body_tree; + static const value_string str_first_parameter[] = { + {0x01, "Production Test Command"}, + {0x06, "Reserved For Compatibility"}, + {0x3B, "Volume"}, + {0x42, "Subdevice Address"}, + {0, NULL} + }; +#endif + + if (!tree) + return; + + if (length > 0) { +#if 0 + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); +#endif + proto_tree_add_text(tree, tvb, offset, length, + "Key Number: Row %d, Column %d", + (tvb_get_guint8(tvb, offset) & 0xF0), (tvb_get_guint8(tvb, offset) & 0x0F)); + } } @@ -4502,14 +4642,17 @@ decode_key_number(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_i_m_here(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length _U_, guint8 opcode _U_, - proto_item *ua3g_body_item) + guint offset, guint length _U_, guint8 opcode _U_, + proto_item *ua3g_body_item) { - proto_tree *ua3g_body_tree; + proto_tree *ua3g_body_tree; + + if (!ua3g_body_item) + return; - 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")); + 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_const(tvb_get_guint8(tvb, offset), str_device_type, "Unknown")); } @@ -4519,51 +4662,54 @@ decode_i_m_here(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_special_key(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, - guint offset, guint length, guint8 opcode, - proto_item *ua3g_body_item) + 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")); - } + guint8 special_key_status; + 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 char *const str_special_key_name[] = { + "Shift ", + "Ctrl ", + "Alt ", + "Cmd ", + "Shift'", + "Ctrl' ", + "Alt' ", + "Cmd' " + }; + + if (!ua3g_body_item) + return; + + 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_const((tvb_get_guint8(tvb, offset) & 0x02), str_parameters, "Unknown")); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Hookswitch Status: %shook", + STR_ON_OFF(tvb_get_guint8(tvb, offset) & 0x01)); + offset++; + length--; + } + + special_key_status = tvb_get_guint8(tvb, offset); + for (i = 0; i < 8; i++) { + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, "%s: %s", + str_special_key_name[i], + val_to_str_const(special_key_status & (0x01 << i), str_special_key_status, "Pressed")); + } } @@ -4572,24 +4718,29 @@ decode_special_key(proto_tree *tree _U_, tvbuff_t *tvb, packet_info *pinfo _U_, ---------------------------------------------------------------------------*/ static void decode_subdevice_state(proto_tree *tree _U_, tvbuff_t *tvb, - packet_info *pinfo _U_, guint offset, guint length _U_, - guint8 opcode _U_, proto_item *ua3g_body_item) + packet_info *pinfo _U_, guint offset, guint length _U_, + guint8 opcode _U_, 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++; - } + proto_tree *ua3g_body_tree; + guint8 info; + int i; + + if (!ua3g_body_item) + return; + + ua3g_body_tree = proto_item_add_subtree(ua3g_body_item, ett_ua3g_body); + + for (i = 0; i <= 7; i++) { + info = tvb_get_guint8(tvb, offset); + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Subdevice %d State: %d", + i, info & 0x0F); + i++; + proto_tree_add_text(ua3g_body_tree, tvb, offset, 1, + "Subdevice %d State: %d", + i, (info & 0xF0) >> 4); + offset++; + } } @@ -4599,410 +4750,412 @@ decode_subdevice_state(proto_tree *tree _U_, tvbuff_t *tvb, 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; - - if(tree) { - ua3g_item = proto_tree_add_item(tree, proto_ua3g, tvb, 0, -1, ENC_NA); - 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; - } - } - } - } + gint offset = 0; + proto_item *ua3g_item; + proto_tree *ua3g_tree; + proto_item *ua3g_body_item = NULL; + gint length; + guint8 opcode; + value_string_ext *opcodes_vals_ext_p; + + ua3g_item = proto_tree_add_item(tree, proto_ua3g, tvb, 0, -1, ENC_NA); + ua3g_tree = proto_item_add_subtree(ua3g_item, ett_ua3g); + + if (message_direction == SYS_TO_TERM) { + opcodes_vals_ext_p = &opcodes_vals_sys_ext; + } else + opcodes_vals_ext_p = &opcodes_vals_term_ext; + + /* Length of the UA Message */ + length = tvb_get_letohs(tvb, offset); + + /* add text to the frame "INFO" column */ + 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); + + /* Useful 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_ext_const(opcode, opcodes_vals_ext_p, "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_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); + + proto_item_append_text(ua3g_item, ", %s", val_to_str_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); + + if (length > 0) + ua3g_body_item = proto_tree_add_text(ua3g_tree, tvb, offset, + length, "UA3G Body - %s", + val_to_str_ext_const(opcode, opcodes_vals_ext_p, "Unknown")); + + if (message_direction == SYS_TO_TERM) { + switch (opcode) { + case SC_PRODUCTION_TEST: /* 0x01 */ + case SC_SUBDEVICE_RESET: /* 0x06 */ + case SC_ARE_YOU_THERE: /* 0x2B */ + case SC_SET_SPEAKER_VOL: /* 0x3B */ + case SC_TRACE_ON: /* 0x42 */ + { + decode_with_one_parameter(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SUBDEVICE_ESCAPE: /* 0x02 */ + { + decode_subdevice_escape(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SOFT_RESET: /* 0x03 */ + { + decode_software_reset(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_IP_PHONE_WARMSTART: /* 0x04 */ + { + decode_ip_phone_warmstart(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SUPER_MSG: /* 0x0B */ + case SC_SUPER_MSG_2: /* 0x17 */ + { + decode_super_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SEGMENT_MSG: /* 0x0C */ + { + decode_segment_msg(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_IP_DEVICE_ROUTING: /* 0x13 */ + { + decode_ip_device_routing(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_DEBUG_IN_LINE: /* 0x18 */ + { + decode_debug_in_line(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_LED_COMMAND: /* 0x21 */ + { + decode_led_command(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_LCD_LINE_1_CMD: /* 0x27 */ + case SC_LCD_LINE_2_CMD: /* 0x28 */ + { + decode_lcd_line_cmd(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_MAIN_VOICE_MODE: /* 0x29 */ + { + decode_main_voice_mode(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_SUBDEVICE_METASTATE: /* 0x2C */ + { + decode_subdevice_metastate(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_DWL_DTMF_CLCK_FORMAT: /* 0x30 */ + { + decode_dwl_dtmf_clck_format(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SET_CLCK: /* 0x31 */ + { + decode_set_clck(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_VOICE_CHANNEL: /* 0x32 */ + { + decode_voice_channel(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_EXTERNAL_RINGING: /* 0x33 */ + { + decode_external_ringing(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_LCD_CURSOR: /* 0x35 */ + { + decode_lcd_cursor(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_DWL_SPECIAL_CHAR: /* 0x36 */ + { + decode_dwl_special_char(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SET_CLCK_TIMER_POS: /* 0x38 */ + { + decode_set_clck_timer_pos(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_SET_LCD_CONTRAST: /* 0x39 */ + { + decode_set_lcd_contrast(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_BEEP: /* 0x3C */ + { + decode_beep(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_SIDETONE: /* 0x3D */ + { + decode_sidetone(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_RINGING_CADENCE: /* 0x3E */ + { + decode_ringing_cadence(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_MUTE: /* 0x3F */ + { + decode_mute(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_FEEDBACK: /* 0x40 */ + { + decode_feedback(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_READ_PERIPHERAL: /* 0x44 */ + case SC_WRITE_PERIPHERAL: /* 0x45 */ + { + decode_r_w_peripheral(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_ICON_CMD: /* 0x47 */ + { + decode_icon_cmd(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_AUDIO_CONFIG: /* 0x49 */ + { + decode_audio_config(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_AUDIO_PADDED_PATH: /* 0x4A */ + { + decode_audio_padded_path(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_body_item); + break; + } + case SC_KEY_RELEASE: /* 0x41 */ + case SC_AMPLIFIED_HANDSET: /* 0x48 */ + case SC_LOUDSPEAKER: /* 0x4D */ + case SC_ANNOUNCE: /* 0x4E */ + { + decode_on_off_level(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_RING: /* 0x4F */ + { + decode_ring(ua3g_tree, tvb, pinfo, offset, length, opcode, ua3g_item, ua3g_body_item); + break; + } + case SC_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 SC_NOP: /* 0x00 */ + case SC_HE_ROUTING: /* 0x05 NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_LOOPBACK_ON: /* 0x07 */ + case SC_LOOPBACK_OFF: /* 0x08 */ + case SC_VIDEO_ROUTING: /* 0x09 NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_REMOTE_UA_ROUTING: /* 0x0D NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_VERY_REMOTE_UA_ROUTING: /* 0x0E NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_OSI_ROUTING: /* 0x0F NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_ABC_A_ROUTING: /* 0x11 NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_IBS_ROUTING: /* 0x12 NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_M_REFLEX_HUB_ROUTING: /* 0x14 NOT DECODED - No description in 3AK 29000 0556 DSZZA */ + case SC_START_BUZZER: /* 0x22 */ + case SC_STOP_BUZZER: /* 0x23 */ + case SC_ENABLE_DTMF: /* 0x24 */ + case SC_DISABLE_DTMF: /* 0x25 */ + case SC_CLEAR_LCD_DISP: /* 0x26 */ + case SC_VERSION_INQUIRY: /* 0x2A */ + case SC_VTA_STATUS_INQUIRY: /* 0x2D */ + case SC_SUBDEVICE_STATE: /* 0x2E */ + case SC_AUDIO_IDLE: /* 0x3A */ + case SC_TRACE_OFF: /* 0x43 */ + case SC_ALL_ICONS_OFF: /* 0x46 */ + case SC_RELEASE_RADIO_LINK: /* 0x4B */ + case SC_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) +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)); + 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) { +#if 0 /* Future */ dissector_handle_t handle_ua3g = find_dissector("ua3g"); - /* hooking of UA3G on UDP */ - register_dissector_table("ua3g.opcode", "ua3g.opcode", - FT_UINT8, BASE_HEX); + /* hooking of UA3G on UA */ - dissector_add_uint("ua3g.opcode", 0x15, handle_ua3g); + dissector_add_uint("ua.opcode", 0x15, handle_ua3g); +#endif } diff --git a/epan/dissectors/packet-uasip.c b/epan/dissectors/packet-uasip.c index f301944b0e..6e55050134 100644 --- a/epan/dissectors/packet-uasip.c +++ b/epan/dissectors/packet-uasip.c @@ -27,548 +27,500 @@ # 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" + +#include "packet-uaudp.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; +#if 0 +static int uasip_tap = -1; +#endif + +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 gboolean noesip_enabled = FALSE; 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) +/* XXX: Presumably there's a util function for this */ +static 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; + 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; - } + 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); - /*Fix Clang Warning*/ - /*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); + proto_item *uasip_item; + proto_tree *uasip_tree; + guint8 opcode; + gint offset = 0; + + if (noesip_enabled) + { + col_append_str(pinfo->cinfo, COL_PROTOCOL, "/NOE"); + } + else + { + 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_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); + } + + uasip_item = proto_tree_add_protocol_format(tree, proto_uasip, tvb, 0, 5, + "SIP/NOE Protocol, %s", + val_to_str_ext(opcode, &uaudp_opcode_str_ext, "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: + { + if (!tree) + break; + 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) + { + col_add_fstr(pinfo->cinfo, COL_INFO, "NACK"); + } + else + { + 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 + { + col_add_str(pinfo->cinfo, COL_INFO, "DATA - Couldn't resolve direction."); + } + } + else + { + 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; + } +#if 0 + tap_queue_packet(uasip_tap, pinfo, &ua_tap_info); +#endif } 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); + 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(void) { - 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");*/ + module_t *uasip_module; + + static hf_register_info hf_uasip[] = { + { + &hf_uasip_opcode, + { + "Opcode", + "uasip.opcode", + FT_UINT8, + BASE_DEC | BASE_EXT_STRING, + &uaudp_opcode_str_ext, + 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); +#if 0 + uasip_tap = register_tap("uasip"); +#endif } 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); + dissector_handle_t uasip_handle; + static gboolean prefs_initialized = FALSE; + + if (!prefs_initialized) + { + uasip_handle = create_dissector_handle(dissect_uasip, proto_uasip); + dissector_add_string("media_type", "application/octet-stream", uasip_handle); + 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; + } + + 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(""); + } } diff --git a/epan/dissectors/packet-uaudp.c b/epan/dissectors/packet-uaudp.c index 8fca31232d..da67a88d02 100644 --- a/epan/dissectors/packet-uaudp.c +++ b/epan/dissectors/packet-uaudp.c @@ -27,24 +27,23 @@ # 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" +#include "packet-uaudp.h" /* GLOBALS */ +#if 0 +static dissector_table_t uaudp_opcode_dissector_table; +#endif + +#if 0 static int uaudp_tap = -1; +#endif static tap_struct_uaudp ua_tap_info; @@ -70,620 +69,614 @@ 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 gboolean decode_ua = TRUE; 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 } + { 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 } }; +value_string_ext uaudp_opcode_str_ext = VALUE_STRING_EXT_INIT(uaudp_opcode_str); - +#if 0 /* XXX: Unused ? */ static const value_string uaudp_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 } + { 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 } }; - +value_string_ext uaudp_connect_vals_ext = VALUE_STRING_EXT_INIT(uaudp_connect_vals); +#endif static dissector_handle_t ua_sys_to_term_handle; static dissector_handle_t ua_term_to_sys_handle; - typedef struct { - const char *name; - const char *text; - guint port; - guint last_port; + const char *name; + const char *text; + guint port; + guint last_port; } prefs_uaudp_t; -#define MAX_TERMINAL_PORTS 4 - -static prefs_uaudp_t ports[MAX_TERMINAL_PORTS] = +static prefs_uaudp_t 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}, -}; -/* - {"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} + {"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}, +#if 0 + {"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} +#endif }; -*/ +#define MAX_TERMINAL_PORTS array_length(ports) -guint find_terminal_port(guint port) +static gboolean find_terminal_port(guint port) { - int i; - for (i=0; i<MAX_TERMINAL_PORTS; i++) - if (ports[i].port == port) - return 1; - return 0; + int i; + for (i=0; i<MAX_TERMINAL_PORTS; i++) + if (ports[i].port == port) + return TRUE; + return FALSE; } 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; - } + 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; + } } /* UA/UDP DISSECTOR */ static void _dissect_uaudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - e_ua_direction direction) + 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"); - - /* get the identifer, it means operation code */ - opcode = tvb_get_guint8(tvb, offset); - offset++; - - 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) - { - 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: - { - 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 UAUDP_NACK: - { - proto_tree_add_uint(uaudp_tree, - hf_uaudp_expseq, - tvb, - offset, - 2, - tvb_get_ntohs(tvb, offset)); - /*Fix Clang Warning*/ - /*offset += 2;*/ - break; - } - - 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 (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 { - /* print in "INFO" column */ - if (check_col(pinfo->cinfo, COL_INFO)) - col_add_str(pinfo->cinfo, - COL_INFO, - "Data ACK"); - } - break; - } - default: - break; - } - } - tap_queue_packet(uaudp_tap, pinfo, &ua_tap_info); + gint offset = 0; + guint8 opcode; + proto_item *uaudp_item; + proto_tree *uaudp_tree; + + col_set_str(pinfo->cinfo, COL_PROTOCOL, "UAUDP"); + + /* get the identifier; it means operation code */ + opcode = tvb_get_guint8(tvb, offset); + offset += 1; + + 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_ext(opcode, &uaudp_opcode_str_ext, "unknown (0x%02x)")); + + uaudp_item = proto_tree_add_protocol_format(tree, proto_uaudp, tvb, 0, 5, + "Universal Alcatel/UDP Encapsulation Protocol, %s", + val_to_str_ext(opcode, &uaudp_opcode_str_ext, "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: + { + if (!tree) + break; + 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 UAUDP_NACK: + { + proto_tree_add_uint(uaudp_tree, + hf_uaudp_expseq, + tvb, + offset, + 2, + tvb_get_ntohs(tvb, offset)); + break; + } + + 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_reported_length(tvb) - offset; + + /* if there is remaining data, call the UA dissector */ + 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 { + /* XXX: expert ?? */ + 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 { + /* print in "INFO" column */ + col_add_str(pinfo->cinfo, + COL_INFO, + "Data ACK"); + } + break; + } + default: + break; + } +#if 0 + tap_queue_packet(uaudp_tap, pinfo, &ua_tap_info); +#endif } +#if 0 +/* XXX: The following are never actually used ?? */ static void dissect_uaudp_dir_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN); + _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN); } static void dissect_uaudp_term_to_serv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); + _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); } static void dissect_uaudp_serv_to_term(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM); + _dissect_uaudp(tvb, pinfo, tree, SYS_TO_TERM); } +#endif /* * UA/UDP DISSECTOR - * Ethereal packet dissector entry point - */ + Wireshark 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; - } - else if (memcmp((pinfo->dst).data, sys_ip, 4*sizeof(guint8)) == 0) - { - _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); - return; - } - } - - /* 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; - } - - _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN); + /* server address, if present, has precedence on ports */ + 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; + } + else if (memcmp((pinfo->dst).data, sys_ip, 4*sizeof(guint8)) == 0) + { + _dissect_uaudp(tvb, pinfo, tree, TERM_TO_SYS); + return; + } + } + + /* 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; + } + + _dissect_uaudp(tvb, pinfo, tree, DIR_UNKNOWN); } - -gboolean str_to_addr_ip(const gchar *addr, guint8 *ad) +/* XXX: Presumably there's a util fcn for this ... */ +static 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++; - } - if(value > 255) - { - return FALSE; - } - ad[i] = value; - p++; - } - - return TRUE; + int i; + 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; } -/* Register the protocol with Ethereal */ +/* Register the protocol with Wireshark */ void proto_reg_handoff_uaudp(void); void proto_register_uaudp(void) { - 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(uaudp_opcode_str), - 0x0, - "UA/UDP Opcode", - 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 - } - }, - }; - - /* Setup protocol subtree array */ - static gint *ett[] = - { - &ett_uaudp, - }; - - /* Register the protocol name and description */ - proto_uaudp = proto_register_protocol("UA/UDP Encapsulation 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); - - /* 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)); - - /* Register preferences */ - uaudp_module = prefs_register_protocol(proto_uaudp, proto_reg_handoff_uaudp); + 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 | BASE_EXT_STRING, + &uaudp_opcode_str_ext, + 0x0, + "UA/UDP Opcode", + 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 + } + }, + }; + + /* Setup protocol subtree array */ + static gint *ett[] = + { + &ett_uaudp, + }; + + /* Register the protocol name and description */ + proto_uaudp = proto_register_protocol("UA/UDP Encapsulation Protocol", + "UAUDP", + "uaudp"); + + register_dissector("uaudp", dissect_uaudp, proto_uaudp); +#if 0 /* XXX: Not used ?? */ + 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); +#endif -/* - 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); - - /* Register tap listener */ -/* uaudp_tap = register_tap("uaudp");*/ + proto_register_field_array(proto_uaudp, hf_uaudp, array_length(hf_uaudp)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register preferences */ + uaudp_module = prefs_register_protocol(proto_uaudp, proto_reg_handoff_uaudp); + +#if 0 + prefs_register_bool_preference(uaudp_module, "enable", + "Enable UA/UDP decoding based on preferences", + "Enable UA/UDP decoding based on preferences", + &decode_ua); +#endif + 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); + +#if 0 + /* Register tap */ + uaudp_tap = register_tap("uaudp");*/ +#endif } -/* 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) +void proto_reg_handoff_uaudp(void) { - static gboolean prefs_initialized = FALSE; - static dissector_handle_t uaudp_handle; - int i; - - if(!prefs_initialized) - { - 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 - { - for(i=0; i<MAX_TERMINAL_PORTS; i++) - { - dissector_delete_uint("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(""); - } - } - - if(decode_ua) - { - for(i=0; i < MAX_TERMINAL_PORTS; i++) - { - dissector_add_uint("udp.port", ports[i].port, uaudp_handle); - ports[i].last_port = ports[i].port; - } - } + static gboolean prefs_initialized = FALSE; + static dissector_handle_t uaudp_handle; + int i; + + if (!prefs_initialized) + { + uaudp_handle = find_dissector("uaudp"); + ua_sys_to_term_handle = find_dissector("ua_sys_to_term"); + ua_term_to_sys_handle = find_dissector("ua_term_to_sys"); +#if 0 + uaudp_opcode_dissector_table = + register_dissector_table("uaudp.opcode", + "UAUDP opcode", + FT_UINT8, + BASE_DEC); +#endif + prefs_initialized = TRUE; + } + else + { + for (i=0; i<MAX_TERMINAL_PORTS; i++) + { + dissector_delete_uint("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(""); + } + } + + if (decode_ua) + { + for (i=0; i < MAX_TERMINAL_PORTS; i++) + { + dissector_add_uint("udp.port", ports[i].port, uaudp_handle); + ports[i].last_port = ports[i].port; + } + } } diff --git a/epan/dissectors/packet-uaudp.h b/epan/dissectors/packet-uaudp.h index fb05171dab..3dd9a481f7 100644 --- a/epan/dissectors/packet-uaudp.h +++ b/epan/dissectors/packet-uaudp.h @@ -26,8 +26,6 @@ #ifndef _PACKET_UAUDP_H_ #define _PACKET_UAUDP_H_ -#include <gmodule.h> - #define UAUDP_CONNECT 0 #define UAUDP_CONNECT_ACK 1 #define UAUDP_RELEASE 2 @@ -37,6 +35,21 @@ #define UAUDP_NACK 6 #define UAUDP_DATA 7 +#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 + +extern value_string_ext uaudp_opcode_str_ext; +#if 0 +extern value_string_ext uaudp_connect_vals_ext; +#endif + typedef enum _e_ua_direction { SYS_TO_TERM, /* system -> terminal */ TERM_TO_SYS, /* terminal -> system */ |