HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-noe.c
bloba8cf3257bc2f66a0f2c58443951402bf279e9fba
1 /* packet-noe.c
2 * Routines for UA/UDP (Universal Alcatel over UDP) and NOE packet dissection.
3 * Copyright 2012, Alcatel-Lucent Enterprise <lars.ruoff@alcatel-lucent.com>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <glib.h>
30 #include "epan/packet.h"
31 #include <epan/wmem/wmem.h>
33 #define OPCODE_C_context 0
34 #define OPCODE_C_terminal 1
35 #define OPCODE_C_keyboard 2
36 #define OPCODE_C_audioconfig 3
37 #define OPCODE_C_security 4
38 #define OPCODE_C_leds 5
39 #define OPCODE_C_screen 6
40 #define OPCODE_C_date 7
41 #define OPCODE_C_AOMV 8
42 #define OPCODE_C_bluetooth 9
43 #define OPCODE_C_callstate 12
44 #define OPCODE_C_resource 13
45 #define OPCODE_C_widgets_default 14
46 #define OPCODE_C_framebox 128
47 #define OPCODE_C_tabbox 129
48 #define OPCODE_C_listbox 130
49 #define OPCODE_C_actionlistbox 131
50 #define OPCODE_C_textbox 132
51 #define OPCODE_C_actionbox 133
52 #define OPCODE_C_inputbox 134
53 #define OPCODE_C_checkbox 135
54 #define OPCODE_C_datebox 136
55 #define OPCODE_C_timerbox 137
56 #define OPCODE_C_popupbox 138
57 #define OPCODE_C_dialogbox 139
58 #define OPCODE_C_sliderbar 140
59 #define OPCODE_C_progressbar 141
60 #define OPCODE_C_imagebox 142
61 #define OPCODE_C_iconbox 143
62 #define OPCODE_C_AOMVbox 144
63 #define OPCODE_C_telephonicbox 145
64 #define OPCODE_C_keyboard_context 146
65 #define OPCODE_C_AOMEL 147
66 #define OPCODE_C_AOM10 148
67 #define OPCODE_C_AOM40 149
68 #define OPCODE_C_idletimer 150
69 #define OPCODE_C_telephonicboxitem 151
70 #define OPCODE_C_bluetooth_device 152
71 #define OPCODE_C_headerbox 153
72 #define OPCODE_C_ime_context 154
74 static const value_string val_str_class[] = {
75 {OPCODE_C_context , "Context"},
76 {OPCODE_C_terminal , "Terminal"},
77 {OPCODE_C_keyboard , "Keyboard"},
78 {OPCODE_C_audioconfig , "AudioConfig"},
79 {OPCODE_C_security , "Security"},
80 {OPCODE_C_leds , "Leds"},
81 {OPCODE_C_screen , "Screen"},
82 {OPCODE_C_date , "Date"},
83 {OPCODE_C_AOMV , "AOMV"},
84 {OPCODE_C_bluetooth , "Bluetooth"},
85 {OPCODE_C_callstate , "Callstate"},
86 {OPCODE_C_framebox , "FrameBox"},
87 {OPCODE_C_tabbox , "TabBox"},
88 {OPCODE_C_listbox , "ListBox"},
89 {OPCODE_C_actionlistbox , "ActionlistBox"},
90 {OPCODE_C_textbox , "TextBox"},
91 {OPCODE_C_actionbox , "ActionBox"},
92 {OPCODE_C_inputbox , "InputBox"},
93 {OPCODE_C_checkbox , "CheckBox"},
94 {OPCODE_C_datebox , "DateBox"},
95 {OPCODE_C_timerbox , "TimerBox"},
96 {OPCODE_C_popupbox , "PopupBox"},
97 {OPCODE_C_dialogbox , "DialogBox"},
98 {OPCODE_C_sliderbar , "SliderBar"},
99 {OPCODE_C_progressbar , "ProgressBar"},
100 {OPCODE_C_imagebox , "ImageBox"},
101 {OPCODE_C_iconbox , "IconBox"},
102 {OPCODE_C_AOMVbox , "AOMVBox"},
103 {OPCODE_C_telephonicbox , "TelephonicBox"},
104 {OPCODE_C_keyboard_context , "Keyboard_context"},
105 {OPCODE_C_AOMEL , "AOMEL"},
106 {OPCODE_C_AOM10 , "AOM10"},
107 {OPCODE_C_AOM40 , "AOM40"},
108 {OPCODE_C_idletimer , "IdleTimer"},
109 {OPCODE_C_telephonicboxitem , "TelephonicBoxItem"},
110 {OPCODE_C_bluetooth_device , "Bluetooth_device"},
111 {OPCODE_C_headerbox , "HeaderBox"},
112 {OPCODE_C_ime_context , "ime_context"},
113 {0, NULL}
115 static value_string_ext val_str_class_ext = VALUE_STRING_EXT_INIT(val_str_class);
117 #define OPCODE_P_B_objectid 0
118 #define OPCODE_P_B_ownership 1
119 #define OPCODE_P_B_reset_mode 2
120 #define OPCODE_P_B_mtu 3
121 #define OPCODE_P_B_negative_ack 4
122 #define OPCODE_P_B_type 5
123 #define OPCODE_P_B_help_timeout 6
124 #define OPCODE_P_B_longpress 7
125 #define OPCODE_P_B_count 8
126 #define OPCODE_P_B_eventmode 9
127 #define OPCODE_P_B_numpad_ownership 10
128 #define OPCODE_P_B_navigator_ownership 11
129 #define OPCODE_P_B_telephony_ownership 12
130 #define OPCODE_P_B_progkeys_ownership 13
131 #define OPCODE_P_B_alphakeys_ownership 14
132 #define OPCODE_P_B_numpad_eventmode 15
133 #define OPCODE_P_B_onoff 16
134 #define OPCODE_P_B_bpp 17
135 #define OPCODE_P_B_w 18
136 #define OPCODE_P_B_h 19
137 #define OPCODE_P_B_contrast 20
138 #define OPCODE_P_B_clearscreen 21
139 #define OPCODE_P_B_year 24
140 #define OPCODE_P_B_month 25
141 #define OPCODE_P_B_day 26
142 #define OPCODE_P_B_m 27
143 #define OPCODE_P_B_s 28
144 #define OPCODE_P_B_enable 29
145 #define OPCODE_P_B_address 30
146 #define OPCODE_P_B_port 31
147 #define OPCODE_P_B_protocol 32
148 #define OPCODE_P_B_name 33
149 #define OPCODE_P_B_checked 34
150 #define OPCODE_P_B_unchecked 35
151 #define OPCODE_P_B_anchorid 36
152 #define OPCODE_P_B_grid 37
153 #define OPCODE_P_B_x 38
154 #define OPCODE_P_B_y 39
155 #define OPCODE_P_B_visible 40
156 #define OPCODE_P_B_border 41
157 #define OPCODE_P_B_fontid 42
158 #define OPCODE_P_B_active 43
159 #define OPCODE_P_B_halign 44
160 #define OPCODE_P_B_valign 45
161 #define OPCODE_P_B_size 46
162 #define OPCODE_P_B_mode 47
163 #define OPCODE_P_B_showevent 48
164 #define OPCODE_P_B_showactive 49
165 #define OPCODE_P_B_action_active 50
166 #define OPCODE_P_B_action_count 51
167 #define OPCODE_P_B_foreground 52
168 #define OPCODE_P_B_background 53
169 #define OPCODE_P_B_icon 54
170 #define OPCODE_P_B_label 55
171 #define OPCODE_P_B_value 56
172 #define OPCODE_P_B_password 57
173 #define OPCODE_P_B_cursor 58
174 #define OPCODE_P_B_mask 59
175 #define OPCODE_P_B_qos_ticket 60
176 #define OPCODE_P_B_focus 61
177 #define OPCODE_P_B_state 62
178 #define OPCODE_P_B_format 63
179 #define OPCODE_P_B_incdec 64
180 #define OPCODE_P_B_value_notify 65
181 #define OPCODE_P_B_timeout 66
182 #define OPCODE_P_B_min 67
183 #define OPCODE_P_B_max 68
184 #define OPCODE_P_B_data 69
185 #define OPCODE_P_B_custversion 70
186 #define OPCODE_P_B_L10Nversion 71
187 #define OPCODE_P_B_append 72
188 #define OPCODE_P_B_shortpress 73
189 #define OPCODE_P_B_autorepeat 74
190 #define OPCODE_P_B_repetition 75
191 #define OPCODE_P_B_vsplit 76
192 #define OPCODE_P_B_accesskey 77
193 #define OPCODE_P_B_realcount 78
194 #define OPCODE_P_B_start 79
195 #define OPCODE_P_B_modal 80
196 #define OPCODE_P_B_session_timeout 81
197 #define OPCODE_P_B_softkeys_ownership 82
198 #define OPCODE_P_B_ringings_count 83
199 #define OPCODE_P_B_cod 84
200 #define OPCODE_P_B_bonded 85
201 #define OPCODE_P_B_link_key 86
202 #define OPCODE_P_B_pin 87
203 #define OPCODE_P_B_term_type 88
204 #define OPCODE_P_B_link_type 89
205 #define OPCODE_P_B_circular 90
206 #define OPCODE_P_B_autospread 91
207 #define OPCODE_P_B_backlight_timeout 92
208 #define OPCODE_P_B_screensaver_timeout 93
209 #define OPCODE_P_B_cycling 94
210 #define OPCODE_P_B_CS_idle_state 95
211 #define OPCODE_P_B_PS_idle_state 96
212 #define OPCODE_P_B_bonded_devices 97
213 #define OPCODE_P_B_serialnum 98
214 #define OPCODE_P_B_hardversion 99
215 #define OPCODE_P_B_softversion 100
216 #define OPCODE_P_B_rom_size 101
217 #define OPCODE_P_B_ram_size 102
218 #define OPCODE_P_B_reset_cause 103
219 #define OPCODE_P_B_cycling_time 104
220 #define OPCODE_P_B_inputborder 106
221 #define OPCODE_P_B_disablelongpress 107
222 #define OPCODE_P_B_all_icons_off 108
223 #define OPCODE_P_B_all_labels_off 109
224 #define OPCODE_P_B_widgets_size 110
225 #define OPCODE_P_B_list_type 111
226 #define OPCODE_P_B_frame_type 112
227 #define OPCODE_P_B_bth_ringing 113
228 #define OPCODE_P_B_URI 114
229 #define OPCODE_P_B_fetch_timeout 115
230 #define OPCODE_P_B_mask_subst 116
231 #define OPCODE_P_B_use_customisation 117
232 #define OPCODE_P_B_ADTTS_request 118
233 #define OPCODE_P_B_AP_mac_notify 119
234 #define OPCODE_P_B_page_active 120
235 #define OPCODE_P_B_overwrite 121
236 #define OPCODE_P_B_ime_lock 122
237 #define OPCODE_P_B_method 123
238 #define OPCODE_P_B_login 124
239 #define OPCODE_P_B_binary_suffix 125
240 #define OPCODE_P_B_binary_count 126
241 #define OPCODE_P_B_SIPCversion 127
242 #define OPCODE_P_A_dflt 128
243 #define OPCODE_P_A_shift 129
244 #define OPCODE_P_A_alt 130
245 #define OPCODE_P_A_key_ownership 131
246 #define OPCODE_P_A_key_eventmode 132
247 #define OPCODE_P_A_value 133
248 #define OPCODE_P_A_mode 134
249 #define OPCODE_P_A_color 135
250 #define OPCODE_P_A_type 136
251 #define OPCODE_P_A_icon 137
252 #define OPCODE_P_A_label 138
253 #define OPCODE_P_A_ownership 139
254 #define OPCODE_P_A_enable 140
255 #define OPCODE_P_A_state 141
256 #define OPCODE_P_A_name 142
257 #define OPCODE_P_A_number 143
258 #define OPCODE_P_A_action_icon 144
259 #define OPCODE_P_A_action_label 145
260 #define OPCODE_P_A_action_value 146
261 #define OPCODE_P_A_today 147
262 #define OPCODE_P_A_tomorrow 148
263 #define OPCODE_P_A_action_key 149
264 #define OPCODE_P_A_code 150
265 #define OPCODE_P_A_data 151
266 #define OPCODE_P_A_delay_max_handset 152
267 #define OPCODE_P_A_delay_max_handsfree 153
268 #define OPCODE_P_A_delay_tx 154
269 #define OPCODE_P_A_delay_rx 155
270 #define OPCODE_P_A_pem_data 156
271 #define OPCODE_P_A_serial_number 157
272 #define OPCODE_P_A_owner_name 158
273 #define OPCODE_P_A_issuer_name 159
274 #define OPCODE_P_A_end_date 160
276 static const value_string val_str_props[] = {
277 {OPCODE_P_B_objectid , "objectid"},
278 {OPCODE_P_B_ownership , "ownership"},
279 {OPCODE_P_B_reset_mode , "reset_mode"},
280 {OPCODE_P_B_mtu , "mtu"},
281 {OPCODE_P_B_negative_ack , "negative_ack"},
282 {OPCODE_P_B_type , "type"},
283 {OPCODE_P_B_help_timeout , "help_timeout"},
284 {OPCODE_P_B_longpress , "longpress"},
285 {OPCODE_P_B_count , "count"},
286 {OPCODE_P_B_eventmode , "eventmode"},
287 {OPCODE_P_B_numpad_ownership , "numpad_ownership"},
288 {OPCODE_P_B_navigator_ownership , "navigator_ownership"},
289 {OPCODE_P_B_telephony_ownership , "telephony_ownership"},
290 {OPCODE_P_B_progkeys_ownership , "progkeys_ownership"},
291 {OPCODE_P_B_alphakeys_ownership , "alphakeys_ownership"},
292 {OPCODE_P_B_numpad_eventmode , "numpad_eventmode"},
293 {OPCODE_P_B_onoff , "onoff"},
294 {OPCODE_P_B_bpp , "bpp"},
295 {OPCODE_P_B_w , "w"},
296 {OPCODE_P_B_h , "h"},
297 {OPCODE_P_B_contrast , "contrast"},
298 {OPCODE_P_B_clearscreen , "clearscreen"},
299 {OPCODE_P_B_year , "year"},
300 {OPCODE_P_B_month , "month"},
301 {OPCODE_P_B_day , "day"},
302 {OPCODE_P_B_m , "m"},
303 {OPCODE_P_B_s , "s"},
304 {OPCODE_P_B_enable , "enable"},
305 {OPCODE_P_B_address , "address"},
306 {OPCODE_P_B_name , "name"},
307 {OPCODE_P_B_anchorid , "anchorid"},
308 {OPCODE_P_B_grid , "grid"},
309 {OPCODE_P_B_x , "x"},
310 {OPCODE_P_B_y , "y"},
311 {OPCODE_P_B_visible , "visible"},
312 {OPCODE_P_B_border , "border"},
313 {OPCODE_P_B_fontid , "fontid"},
314 {OPCODE_P_B_active , "active"},
315 {OPCODE_P_B_halign , "halign"},
316 {OPCODE_P_B_valign , "valign"},
317 {OPCODE_P_B_size , "size"},
318 {OPCODE_P_B_mode , "mode"},
319 {OPCODE_P_B_showevent , "showevent"},
320 {OPCODE_P_B_showactive , "showactive"},
321 {OPCODE_P_B_icon , "icon"},
322 {OPCODE_P_B_label , "label"},
323 {OPCODE_P_B_value , "value"},
324 {OPCODE_P_B_password , "password"},
325 {OPCODE_P_B_cursor , "cursor"},
326 {OPCODE_P_B_mask , "mask"},
327 {OPCODE_P_B_qos_ticket , "qos_ticket"},
328 {OPCODE_P_B_focus , "focus"},
329 {OPCODE_P_B_state , "state"},
330 {OPCODE_P_B_format , "format"},
331 {OPCODE_P_B_incdec , "incdec"},
332 {OPCODE_P_B_value_notify , "value_notify"},
333 {OPCODE_P_B_timeout , "timeout"},
334 {OPCODE_P_B_min , "min"},
335 {OPCODE_P_B_max , "max"},
336 {OPCODE_P_B_data , "data"},
337 {OPCODE_P_B_custversion , "custversion"},
338 {OPCODE_P_B_L10Nversion , "L10Nversion"},
339 {OPCODE_P_B_append , "append"},
340 {OPCODE_P_B_shortpress , "shortpress"},
341 {OPCODE_P_B_autorepeat , "autorepeat"},
342 {OPCODE_P_B_repetition , "repetition"},
343 {OPCODE_P_B_vsplit , "vsplit"},
344 {OPCODE_P_B_accesskey , "accesskey"},
345 {OPCODE_P_B_realcount , "realcount"},
346 {OPCODE_P_B_start , "start"},
347 {OPCODE_P_B_modal , "modal"},
348 {OPCODE_P_B_session_timeout , "session_timeout"},
349 {OPCODE_P_B_softkeys_ownership , "softkeys_ownership"},
350 {OPCODE_P_B_ringings_count , "ringings_count"},
351 {OPCODE_P_B_cod , "cod"},
352 {OPCODE_P_B_bonded , "bonded"},
353 {OPCODE_P_B_link_key , "link_key"},
354 {OPCODE_P_B_pin , "pin"},
355 {OPCODE_P_B_term_type , "term_type"},
356 {OPCODE_P_B_link_type , "link_type"},
357 {OPCODE_P_B_circular , "circular"},
358 {OPCODE_P_B_autospread , "autospread"},
359 {OPCODE_P_B_backlight_timeout , "backlight_timeout"},
360 {OPCODE_P_B_screensaver_timeout , "screensaver_timeout"},
361 {OPCODE_P_B_cycling , "cycling"},
362 {OPCODE_P_B_CS_idle_state , "CS_idle_state"},
363 {OPCODE_P_B_PS_idle_state , "PS_idle_state"},
364 {OPCODE_P_B_bonded_devices , "bonded_devices"},
365 {OPCODE_P_B_serialnum , "serialnum"},
366 {OPCODE_P_B_hardversion , "hardversion"},
367 {OPCODE_P_B_softversion , "softversion"},
368 {OPCODE_P_B_rom_size , "rom_size"},
369 {OPCODE_P_B_ram_size , "ram_size"},
370 {OPCODE_P_B_reset_cause , "reset_cause"},
371 {OPCODE_P_B_cycling_time , "cycling_time"},
372 {OPCODE_P_B_inputborder , "inputborder"},
373 {OPCODE_P_B_disablelongpress , "disablelongpress"},
374 {OPCODE_P_B_all_icons_off , "all_icons_off"},
375 {OPCODE_P_B_all_labels_off , "all_labels_off"},
376 {OPCODE_P_B_widgets_size , "widgets_size"},
377 {OPCODE_P_B_list_type , "list_type"},
378 {OPCODE_P_B_frame_type , "frame_type"},
379 {OPCODE_P_B_bth_ringing , "bth_ringing"},
380 {OPCODE_P_B_URI , "URI"},
381 {OPCODE_P_B_fetch_timeout , "fetch_timeout"},
382 {OPCODE_P_B_mask_subst , "mask_subst"},
383 {OPCODE_P_B_use_customisation , "use_customisation"},
384 {OPCODE_P_B_page_active , "page_active"},
385 {OPCODE_P_B_overwrite , "overwrite"},
386 {OPCODE_P_B_ime_lock , "ime_lock"},
387 {OPCODE_P_B_method , "method"},
388 {OPCODE_P_B_login , "login"},
389 {OPCODE_P_B_binary_suffix , "binary_suffix"},
390 {OPCODE_P_B_binary_count , "binary_count"},
391 {OPCODE_P_B_SIPCversion , "SIPCversion"},
392 {OPCODE_P_A_key_ownership , "key_ownership"},
393 {OPCODE_P_A_key_eventmode , "key_eventmode"},
394 {OPCODE_P_A_value , "value"},
395 {OPCODE_P_A_mode , "mode"},
396 {OPCODE_P_A_color , "color"},
397 {OPCODE_P_A_type , "type"},
398 {OPCODE_P_A_icon , "icon"},
399 {OPCODE_P_A_label , "label"},
400 {OPCODE_P_A_ownership , "ownership"},
401 {OPCODE_P_A_enable , "enable"},
402 {OPCODE_P_A_state , "state"},
403 {OPCODE_P_A_name , "name"},
404 {OPCODE_P_A_number , "number"},
405 {OPCODE_P_A_action_icon , "action_icon"},
406 {OPCODE_P_A_action_label , "action_label"},
407 {OPCODE_P_A_action_value , "action_value"},
408 {OPCODE_P_A_today , "today"},
409 {OPCODE_P_A_tomorrow , "tomorrow"},
410 {OPCODE_P_A_code , "code"},
411 {OPCODE_P_A_data , "data"},
412 {OPCODE_P_A_delay_max_handset , "delay_max_handset"},
413 {OPCODE_P_A_delay_max_handsfree , "delay_max_handsfree"},
414 {OPCODE_P_A_delay_tx , "delay_tx"},
415 {OPCODE_P_A_delay_rx , "delay_rx"},
416 {OPCODE_P_A_pem_data , "pem_data"},
417 {OPCODE_P_A_serial_number , "serial_number"},
418 {OPCODE_P_A_owner_name , "owner_name"},
419 {OPCODE_P_A_issuer_name , "issuer_name"},
420 {OPCODE_P_A_end_date , "end_date"},
421 {0, NULL}
423 static value_string_ext val_str_props_ext = VALUE_STRING_EXT_INIT(val_str_props);
425 #define OPCODE_EVT_CONTEXT_SWITCH 0
426 #define OPCODE_EVT_RESET 1
427 #define OPCODE_EVT_KEY_PRESS 2
428 #define OPCODE_EVT_KEY_RELEASE 3
429 #define OPCODE_EVT_KEY_SHORTPRESS 4
430 #define OPCODE_EVT_KEY_LONGPRESS 5
431 #define OPCODE_EVT_ONHOOK 6
432 #define OPCODE_EVT_OFFHOOK 7
433 #define OPCODE_EVT_HELP 8
434 #define OPCODE_EVT_WIDGETS_GC 9
435 #define OPCODE_EVT_ERROR_PROTOCOL 10
436 #define OPCODE_EVT_ERROR_CREATE 11
437 #define OPCODE_EVT_ERROR_DELETE 12
438 #define OPCODE_EVT_ERROR_SET_PROPERTY 13
439 #define OPCODE_EVT_ERROR_GET_PROPERTY 14
440 #define OPCODE_EVT_SUCCESS_CREATE 15
441 #define OPCODE_EVT_SUCCESS_DELETE 16
442 #define OPCODE_EVT_SUCCESS_SET_PROPERTY 17
443 #define OPCODE_EVT_ERROR_INSERT_ITEM 18
444 #define OPCODE_EVT_ERROR_DELETE_ITEM 19
445 #define OPCODE_EVT_SUCCESS_INSERT_ITEM 20
446 #define OPCODE_EVT_DEVICE_PRESENCE 21
447 #define OPCODE_EVT_KEY_LINE 22
448 #define OPCODE_EVT_SUCCESS_DELETE_ITEM 23
449 #define OPCODE_EVT_BT_BONDING_RESULT 24
450 #define OPCODE_EVT_BT_KEY_SHORTPRESS 25
451 #define OPCODE_EVT_BT_KEY_LONGPRESS 26
452 #define OPCODE_EVT_BT_KEY_VERYLONGPRESS 27
453 #define OPCODE_EVT_LOCAL_APPLICATION 28
454 #define OPCODE_EVT_WARNING_CREATE 29
455 #define OPCODE_EVT_WARNING_SET_PROPERTY 30
456 #define OPCODE_EVT_ARP_SPOOFING 31
457 #define OPCODE_EVT_CHAR_NOT_FOUND 32
458 #define OPCODE_EVT_CHAR_BAD_LENGTH 33
459 #define OPCODE_EVT_QOS_TICKET 34
460 #define OPCODE_EVT_UA3_ERROR 35
461 #define OPCODE_EVT_TABBOX 128
462 #define OPCODE_EVT_LISTBOX 129
463 #define OPCODE_EVT_LISTBOX_FIRST 130
464 #define OPCODE_EVT_LISTBOX_LAST 131
465 #define OPCODE_EVT_ACTIONLISTBOX 132
466 #define OPCODE_EVT_ACTIONBOX 133
467 #define OPCODE_EVT_INPUTBOX 134
468 #define OPCODE_EVT_INPUTBOX_FOCUS_LOST 135
469 #define OPCODE_EVT_CHECKBOX 136
470 #define OPCODE_EVT_TIMERBOX 137
471 #define OPCODE_EVT_POPUPBOX_TIMEOUT 138
472 #define OPCODE_EVT_DIALOGBOX 139
473 #define OPCODE_EVT_SLIDERBAR 140
474 #define OPCODE_EVT_PROGRESSBAR 141
475 #define OPCODE_EVT_AOMVBOX 142
476 #define OPCODE_EVT_TELEPHONICBOX_FOCUS 143
477 #define OPCODE_EVT_AOM_INSERTED 144
478 #define OPCODE_EVT_AOM_REMOVED 145
479 #define OPCODE_EVT_AOM_KEY_PRESS 146
480 #define OPCODE_EVT_IDLETIMER 147
481 #define OPCODE_EVT_GET_PROPERTY_RESULT 148
482 #define OPCODE_EVT_AOM_KEY_RELEASE 149
483 #define OPCODE_EVT_POPUPBOX_DISMISSED 150
484 #define OPCODE_EVT_DIALOGBOX_TIMEOUT 151
485 #define OPCODE_EVT_DIALOGBOX_DISMISSED 152
486 #define OPCODE_EVT_BT_BONDED_DEVICE 153
487 #define OPCODE_EVT_BT_INQUIRY_RESULT 154
488 #define OPCODE_EVT_BT_NAME_DISCOVERY 155
489 #define OPCODE_EVT_IME_REMOTEOPEN 156
490 #define OPCODE_EVT_BT_BATTERY 158
491 #define OPCODE_EVT_IME_LIST 159
492 #define OPCODE_EVT_IME_CHANGE 160
493 #define OPCODE_EVT_IME_OPEN 161
494 #define OPCODE_EVT_TELEPHONICBOX_EVENT 162
495 #define OPCODE_EVT_ACTLISTBOX_TIMEOUT 163
496 #define OPCODE_EVT_ACTLISTBOX_DISMISSED 164
497 #define OPCODE_EVT_ADTTS_RESPONSE 165
498 #define OPCODE_EVT_AP_MAC 166
500 static const value_string val_str_event[] = {
501 {OPCODE_EVT_CONTEXT_SWITCH , "EVT_CONTEXT_SWITCH"},
502 {OPCODE_EVT_RESET , "EVT_RESET"},
503 {OPCODE_EVT_KEY_PRESS , "EVT_KEY_PRESS"},
504 {OPCODE_EVT_KEY_RELEASE , "EVT_KEY_RELEASE"},
505 {OPCODE_EVT_KEY_SHORTPRESS , "EVT_KEY_SHORTPRESS"},
506 {OPCODE_EVT_KEY_LONGPRESS , "EVT_KEY_LONGPRESS"},
507 {OPCODE_EVT_ONHOOK , "EVT_ONHOOK"},
508 {OPCODE_EVT_OFFHOOK , "EVT_OFFHOOK"},
509 {OPCODE_EVT_HELP , "EVT_HELP"},
510 {OPCODE_EVT_WIDGETS_GC , "EVT_WIDGETS_GC"},
511 {OPCODE_EVT_ERROR_PROTOCOL , "EVT_ERROR_PROTOCOL"},
512 {OPCODE_EVT_ERROR_CREATE , "EVT_ERROR_CREATE"},
513 {OPCODE_EVT_ERROR_DELETE , "EVT_ERROR_DELETE"},
514 {OPCODE_EVT_ERROR_SET_PROPERTY , "EVT_ERROR_SET_PROPERTY"},
515 {OPCODE_EVT_ERROR_GET_PROPERTY , "EVT_ERROR_GET_PROPERTY"},
516 {OPCODE_EVT_SUCCESS_CREATE , "EVT_SUCCESS_CREATE"},
517 {OPCODE_EVT_SUCCESS_DELETE , "EVT_SUCCESS_DELETE"},
518 {OPCODE_EVT_SUCCESS_SET_PROPERTY , "EVT_SUCCESS_SET_PROPERTY"},
519 {OPCODE_EVT_ERROR_INSERT_ITEM , "EVT_ERROR_INSERT_ITEM"},
520 {OPCODE_EVT_ERROR_DELETE_ITEM , "EVT_ERROR_DELETE_ITEM"},
521 {OPCODE_EVT_SUCCESS_INSERT_ITEM , "EVT_SUCCESS_INSERT_ITEM"},
522 {OPCODE_EVT_DEVICE_PRESENCE , "EVT_DEVICE_PRESENCE"},
523 {OPCODE_EVT_KEY_LINE , "EVT_KEY_LINE"},
524 {OPCODE_EVT_SUCCESS_DELETE_ITEM , "EVT_SUCCESS_DELETE_ITEM"},
525 {OPCODE_EVT_BT_BONDING_RESULT , "EVT_BT_BONDING_RESULT"},
526 {OPCODE_EVT_BT_KEY_SHORTPRESS , "EVT_BT_KEY_SHORTPRESS"},
527 {OPCODE_EVT_BT_KEY_LONGPRESS , "EVT_BT_KEY_LONGPRESS"},
528 {OPCODE_EVT_BT_KEY_VERYLONGPRESS , "EVT_BT_KEY_VERYLONGPRESS"},
529 {OPCODE_EVT_LOCAL_APPLICATION , "EVT_LOCAL_APPLICATION"},
530 {OPCODE_EVT_WARNING_CREATE , "EVT_WARNING_CREATE"},
531 {OPCODE_EVT_WARNING_SET_PROPERTY , "EVT_WARNING_SET_PROPERTY"},
532 {OPCODE_EVT_ARP_SPOOFING , "EVT_ARP_SPOOFING"},
533 {OPCODE_EVT_CHAR_NOT_FOUND , "EVT_CHAR_NOT_FOUND"},
534 {OPCODE_EVT_QOS_TICKET , "EVT_QOS_TICKET"},
535 {OPCODE_EVT_UA3_ERROR , "EVT_UA3_ERROR"},
536 {OPCODE_EVT_TABBOX , "EVT_TABBOX"},
537 {OPCODE_EVT_LISTBOX , "EVT_LISTBOX"},
538 {OPCODE_EVT_LISTBOX_FIRST , "EVT_LISTBOX_FIRST"},
539 {OPCODE_EVT_LISTBOX_LAST , "EVT_LISTBOX_LAST"},
540 {OPCODE_EVT_ACTIONLISTBOX , "EVT_ACTIONLISTBOX"},
541 {OPCODE_EVT_ACTIONBOX , "EVT_ACTIONBOX"},
542 {OPCODE_EVT_INPUTBOX , "EVT_INPUTBOX"},
543 {OPCODE_EVT_INPUTBOX_FOCUS_LOST , "EVT_INPUTBOX_FOCUS_LOST"},
544 {OPCODE_EVT_CHECKBOX , "EVT_CHECKBOX"},
545 {OPCODE_EVT_TIMERBOX , "EVT_TIMERBOX"},
546 {OPCODE_EVT_POPUPBOX_TIMEOUT , "EVT_POPUPBOX_TIMEOUT"},
547 {OPCODE_EVT_DIALOGBOX , "EVT_DIALOGBOX"},
548 {OPCODE_EVT_SLIDERBAR , "EVT_SLIDERBAR"},
549 {OPCODE_EVT_PROGRESSBAR , "EVT_PROGRESSBAR"},
550 {OPCODE_EVT_AOMVBOX , "EVT_AOMVBOX"},
551 {OPCODE_EVT_TELEPHONICBOX_FOCUS , "EVT_TELEPHONICBOX_FOCUS"},
552 {OPCODE_EVT_AOM_INSERTED , "EVT_AOM_INSERTED"},
553 {OPCODE_EVT_AOM_REMOVED , "EVT_AOM_REMOVED"},
554 {OPCODE_EVT_AOM_KEY_PRESS , "EVT_AOM_KEY_PRESS"},
555 {OPCODE_EVT_IDLETIMER , "EVT_IDLETIMER"},
556 {OPCODE_EVT_GET_PROPERTY_RESULT , "EVT_GET_PROPERTY_RESULT"},
557 {OPCODE_EVT_AOM_KEY_RELEASE , "EVT_AOM_KEY_RELEASE"},
558 {OPCODE_EVT_POPUPBOX_DISMISSED , "EVT_POPUPBOX_DISMISSED"},
559 {OPCODE_EVT_DIALOGBOX_TIMEOUT , "EVT_DIALOGBOX_TIMEOUT"},
560 {OPCODE_EVT_DIALOGBOX_DISMISSED , "EVT_DIALOGBOX_DISMISSED"},
561 {OPCODE_EVT_BT_BONDED_DEVICE , "EVT_BT_BONDED_DEVICE"},
562 {OPCODE_EVT_BT_INQUIRY_RESULT , "EVT_BT_INQUIRY_RESULT"},
563 {OPCODE_EVT_BT_NAME_DISCOVERY , "EVT_BT_NAME_DISCOVERY"},
564 {OPCODE_EVT_IME_REMOTEOPEN , "EVT_IME_REMOTEOPEN"},
565 {OPCODE_EVT_BT_BATTERY , "EVT_BT_BATTERY"},
566 {OPCODE_EVT_IME_LIST , "EVT_IME_LIST"},
567 {OPCODE_EVT_IME_CHANGE , "EVT_IME_CHANGE"},
568 {OPCODE_EVT_IME_OPEN , "EVT_IME_OPEN"},
569 {OPCODE_EVT_TELEPHONICBOX_EVENT , "EVT_TELEPHONICBOX_EVENT"},
570 {OPCODE_EVT_ACTLISTBOX_TIMEOUT , "EVT_ACTLISTBOX_TIMEOUT"},
571 {OPCODE_EVT_ACTLISTBOX_DISMISSED , "EVT_ACTLISTBOX_DISMISSED"},
572 {0, NULL}
574 static value_string_ext val_str_event_ext = VALUE_STRING_EXT_INIT(val_str_event);
576 #define P_BASIC 0
577 #define P_ARRAY 128
578 #define P_INVALID 255
579 #define P_INVALID_INDEX 255
581 #define C_STATIC 0
582 #define C_DYNAMIC 128
583 #define C_INVALID 255
585 #define E_INVALID 255
588 /*-----------------------------------------------------------------------------
589 globals
590 ---------------------------------------------------------------------------*/
591 static int proto_noe = -1;
592 static gint ett_noe = -1;
593 static gint ett_body = -1;
594 static gint ett_property = -1;
595 static gint ett_value = -1;
597 static int hf_noe_length = -1;
598 static int hf_noe_server = -1;
599 static int hf_noe_method_ack = -1;
600 static int hf_noe_method = -1;
601 static int hf_noe_class = -1;
602 static int hf_noe_event = -1;
603 static int hf_noe_objectid = -1;
604 static int hf_noe_method_index = -1;
605 static int hf_noe_pcode = -1;
606 static int hf_noe_psize = -1;
607 static int hf_noe_aindx = -1;
608 static int hf_noe_errcode = -1;
609 static int hf_noe_value = -1;
610 static int hf_noe_message = -1;
611 static int hf_noe_property_item_u8 = -1;
612 static int hf_noe_property_item_u16 = -1;
613 static int hf_noe_property_item_u24 = -1;
614 static int hf_noe_property_item_u32 = -1;
615 static int hf_noe_property_item_bytes = -1;
616 static int hf_event_value_u8 = -1;
617 static int hf_event_context_switch = -1;
618 static int hf_event_widget_gc = -1;
620 static const value_string servers_vals[] = {
621 {0x15, "Call Server"},
622 {0x16, "Presentation Server"},
623 {0, NULL}
625 static const value_string servers_short_vals[] = {
626 {0x15, "CS"},
627 {0x16, "PS"},
628 {0, NULL}
631 enum
633 METHOD_CREATE = 0x00,
634 METHOD_DELETE = 0x01,
635 METHOD_SET_PROPERTY = 0x02,
636 METHOD_GET_PROPERTY = 0x03,
637 METHOD_NOTIFY = 0x04,
638 METHOD_DELETE_ITEM = 0x05,
639 METHOD_INSERT_ITEM = 0x06,
640 METHOD_INVALID
642 static const value_string methods_vals[] = {
643 {METHOD_CREATE , "Create"},
644 {METHOD_DELETE , "Delete"},
645 {METHOD_SET_PROPERTY , "SetProperty"},
646 {METHOD_GET_PROPERTY , "GetProperty"},
647 {METHOD_NOTIFY , "Notify"},
648 {METHOD_DELETE_ITEM , "DeleteItem"},
649 {METHOD_INSERT_ITEM , "InsertItem"},
650 {0, NULL}
654 #define ERROR_INVALID_METHOD 0
655 #define ERROR_UNKNOWN_CLASS 1
656 #define ERROR_STATIC_CLASS 2
657 #define ERROR_DUPLICATE_OBJECTID 3
658 #define ERROR_UNKNOWN_PROPERTY_ 4
659 #define ERROR_BAD_INDEX 5
660 #define ERROR_BAD_LENGTH__ 6
661 #define ERROR_REQUIRED_MISSING 7
662 #define ERROR_BAD_VALUE 8
663 #define ERROR_READONLY_PROPERTY 9
664 #define ERROR_UNKNOWN_OBJECTID 10
665 #define ERROR_INVALID_CONTAINER 11
666 #define ERROR_PROPERTY_VMIN 12
667 #define ERROR_PROPERTY_VMAX 13
668 #define ERROR_POSITIVE_ACK 14
669 #define ERROR_NOT_IMPLEMENTED 15
670 #define ERROR_INVALID_CLASS 16
671 #define ERROR_INVALID_PROPERTY 17
672 #define ERROR_BAD_UTF8 18
674 #define ERROR_MESSAGE_DROP 128
675 #define ERROR_MAX_SET_PROPERTY 129
676 #define ERROR_INTERNAL 130
679 static const value_string errcode_vals[] = {
680 {ERROR_INVALID_METHOD , "An invalid method opcode was received"},
681 {ERROR_UNKNOWN_CLASS , "An invalid class opcode was received"},
682 {ERROR_STATIC_CLASS , "Trying to create or delete a static class"},
683 {ERROR_DUPLICATE_OBJECTID , "Trying to create an existing object"},
684 {ERROR_UNKNOWN_PROPERTY_ , "Property opcode doesn't exist in specified class"},
685 {ERROR_BAD_INDEX , "Bad property index (array overflow)"},
686 {ERROR_BAD_LENGTH__ , "Short message or bad property length"},
687 {ERROR_REQUIRED_MISSING , "A required property was not specified in create method"},
688 {ERROR_BAD_VALUE , "Bad property value"},
689 {ERROR_READONLY_PROPERTY , "Trying to set a read-only property"},
690 {ERROR_UNKNOWN_OBJECTID , "The specified object doesn't exist (delete, setProperty or getProperty methods)"},
691 {ERROR_INVALID_CONTAINER , "Invalid container"},
692 {ERROR_PROPERTY_VMIN , "Property value < property minimum value"},
693 {ERROR_PROPERTY_VMAX , "Property value > property maximum value"},
694 {ERROR_POSITIVE_ACK , "Positive ack requested with a getProperty method"},
695 {ERROR_NOT_IMPLEMENTED , "The specified property is not implemented"},
696 {ERROR_INVALID_CLASS , "Invalid class specified with insertItem and deleteItem"},
697 {ERROR_INVALID_PROPERTY , "Invalid property specified with insertItem and deleteItem"},
698 {ERROR_BAD_UTF8 , "Invalid UTF8 value in UA message"},
699 {ERROR_MESSAGE_DROP , "Decoder queue is full"},
700 {ERROR_MAX_SET_PROPERTY , "A maximum of 256 properties can be received in a setProperty method"},
701 {ERROR_INTERNAL , "Internal error"},
702 {0, NULL}
704 static value_string_ext errcode_vals_ext = VALUE_STRING_EXT_INIT(errcode_vals);
706 static const value_string str_key_name[] = {
707 {0x00 , "Null Char."},
708 {0x01 , "Start Of Header"},
709 {0x02 , "Start Of Text"},
710 {0x03 , "End Of Text"},
711 {0x04 , "End Of Transmission"},
712 {0x05 , "Enquiry"},
713 {0x06 , "Acknowledgment"},
714 {0x07 , "Bell"},
715 {0x08 , "Backspace"},
716 {0x09 , "Horizontal Tab"},
717 {0x0A , "Line Feed"},
718 {0x0B , "Vertical Tab"},
719 {0x0C , "Form Feed"},
720 {0x0D , "Enter"},
721 {0x0E , "Shift Out"},
722 {0x0F , "Shift In"},
723 {0x10 , "Data Link Escape"},
724 {0x11 , "Device Control 1"},
725 {0x12 , "Device Control 2"},
726 {0x13 , "Device Control 3"},
727 {0x14 , "Device Control 4"},
728 {0x15 , "Negative Acknowledgment"},
729 {0x16 , "Synchronous Idle"},
730 {0x17 , "End Of Trans. Block"},
731 {0x18 , "Cancel"},
732 {0x19 , "End Of Medium"},
733 {0x1A , "Substitute"},
734 {0x1B , "Escape"},
735 {0x1C , "File Separator"},
736 {0x1D , "Group Separator"},
737 {0x1E , "Request To Send"},
738 {0x1F , "Unit Separator"},
739 {0x20 , "Space"},
740 {0x7F , "Delete"},
741 {0xE0 , "a`"},
742 {0xE7 , "c,"},
743 {0xE8 , "e`"},
744 {0xE9 , "e'"},
745 {0xF9 , "u`"},
746 {0x20AC , "Euro Character"},
747 {0xE100 , "Release"},
748 {0xE101 , "Bis"},
749 {0xE102 , "Message"},
750 {0xE103 , "Handsfree"},
751 {0xE104 , "Mute"},
752 {0xE105 , "Volume Dec"},
753 {0xE106 , "Volume Inc"},
754 {0xE107 , "Hookswitch"},
755 {0xE110 , "Ok"},
756 {0xE111 , "Left"},
757 {0xE112 , "Right"},
758 {0xE113 , "Down"},
759 {0xE114 , "Up"},
760 {0xE115 , "Home"},
761 {0xE116 , "Help"},
762 {0xE117 , "Directory"},
763 {0xE120 , "ProgKey 0"},
764 {0xE121 , "ProgKey 1"},
765 {0xE122 , "ProgKey 2"},
766 {0xE123 , "ProgKey 3"},
767 {0xE124 , "ProgKey 4"},
768 {0xE125 , "ProgKey 5"},
769 {0xE130 , "SoftKey 0"},
770 {0xE131 , "SoftKey 1"},
771 {0xE132 , "SoftKey 2"},
772 {0xE133 , "SoftKey 3"},
773 {0xE134 , "SoftKey 4"},
774 {0xE135 , "SoftKey 5"},
775 {0xE136 , "SoftKey 6"},
776 {0xE137 , "SoftKey 7"},
777 {0xE138 , "SoftKey 8"},
778 {0xE139 , "SoftKey 9"},
779 {0, NULL}
781 static value_string_ext str_key_name_ext = VALUE_STRING_EXT_INIT(str_key_name);
783 static const value_string noe_event_str_struct[] = {
784 {0x00, "RJ9 Plug"},
785 {0x01, "BT Handset Link"},
786 {0, NULL}
789 /*-----------------------------------------------------------------------------
790 DECODE UTF8 TO UNICODE
791 This function translates an UTF8 vale to an UNICODE one.
792 Need to have at least 48 bits value.
793 ---------------------------------------------------------------------------*/
794 static guint64 decode_utf8(guint64 utf8)
796 static guint64 unicode;
798 if (utf8 <= G_GUINT64_CONSTANT(0xFF))
800 unicode =
801 utf8 & G_GUINT64_CONSTANT(0x7F);
803 else if (utf8 <= G_GUINT64_CONSTANT(0xFFFF))
805 unicode =
806 ((utf8 & G_GUINT64_CONSTANT(0x1F00) >> 2) +
807 (utf8 & G_GUINT64_CONSTANT(0x3F)));
809 else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFF))
811 unicode =
812 ((utf8 & G_GUINT64_CONSTANT(0x0F0000)) >> 4) +
813 ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) +
814 (utf8 & G_GUINT64_CONSTANT(0x3F));
816 else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFF))
818 unicode =
819 ((utf8 & G_GUINT64_CONSTANT(0x07000000)) >> 6) +
820 ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) +
821 ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) +
822 (utf8 & G_GUINT64_CONSTANT(0x3F));
824 else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFF))
826 unicode =
827 ((utf8 & G_GUINT64_CONSTANT(0x0300000000)) >> 8) +
828 ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) +
829 ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) +
830 ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) +
831 (utf8 & G_GUINT64_CONSTANT(0x3F));
833 else if (utf8 <= G_GUINT64_CONSTANT(0xFFFFFFFFFFFF))
835 unicode =
836 ((utf8 & G_GUINT64_CONSTANT(0x010000000000)) >> 10) +
837 ((utf8 & G_GUINT64_CONSTANT(0x3F00000000)) >> 8) +
838 ((utf8 & G_GUINT64_CONSTANT(0x3F000000)) >> 6) +
839 ((utf8 & G_GUINT64_CONSTANT(0x3F0000)) >> 4) +
840 ((utf8 & G_GUINT64_CONSTANT(0x3F00)) >> 2) +
841 (utf8 & G_GUINT64_CONSTANT(0x3F));
843 else
845 unicode = G_GUINT64_CONSTANT(0);
847 return unicode;
851 /*-----------------------------------------------------------------------------
852 DECODE KEY NAME
853 This function translates an UNICODE to the name associated.
854 Need to have at least 48 bits value.
855 ---------------------------------------------------------------------------*/
856 static char *decode_key_name(int unicode)
858 char *key_name;
860 key_name = (char *)wmem_alloc(wmem_packet_scope(), 10);
862 if ((unicode <= 0x20)
863 || (unicode == 0x7F)
864 || (unicode == 0xE0)
865 || (unicode == 0xE7)
866 || (unicode == 0xE8)
867 || (unicode == 0xE9)
868 || (unicode == 0xF9))
870 g_snprintf(key_name, 10, "%s", val_to_str_ext_const(unicode, &str_key_name_ext, "Unknown"));
872 else if (unicode <= 0xFF)
874 g_snprintf(key_name, 10, "%c", unicode);
876 else
878 g_snprintf(key_name, 10, "%s", val_to_str_ext_const(unicode, &str_key_name_ext, "Unknown"));
880 return key_name;
884 /*-----------------------------------------------------------------------------
885 DECODE EVT ERROR
886 ---------------------------------------------------------------------------*/
887 static void decode_evt_error(proto_tree *tree,
888 tvbuff_t *tvb,
889 guint offset,
890 guint length)
892 if (!tree)
893 return;
895 proto_tree_add_item(tree, hf_noe_errcode, tvb, offset, 2, ENC_BIG_ENDIAN);
896 offset += 2;
897 length -= 2;
899 proto_tree_add_item(tree, hf_noe_method, tvb, offset, 1, ENC_BIG_ENDIAN);
900 offset += 1;
901 length -= 1;
903 proto_tree_add_item(tree, hf_noe_class, tvb, offset, 1, ENC_BIG_ENDIAN);
904 offset += 1;
905 length -= 1;
907 proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
908 offset += 2;
909 length -= 2;
911 proto_tree_add_item(tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
912 offset += 1;
913 length -= 1;
915 proto_tree_add_item(tree, hf_noe_aindx, tvb, offset, 1, ENC_NA);
916 offset += 1;
917 length -= 1;
919 proto_tree_add_item(tree, hf_noe_length, tvb, offset, 2, ENC_BIG_ENDIAN);
920 offset += 2;
921 length -= 2;
923 proto_tree_add_item(tree, hf_noe_value, tvb, offset, 4, ENC_BIG_ENDIAN);
924 offset += 4;
925 length -= 4;
927 proto_tree_add_item(tree, hf_noe_message, tvb, offset, length, ENC_NA);
931 /*-----------------------------------------------------------------------------
932 MESSAGE BODY DECODER
933 This function decodes the message body of an 0x15 (and 0x16) UA3G message.
934 ---------------------------------------------------------------------------*/
935 static void decode_tlv(proto_tree *tree,
936 tvbuff_t *tvb,
937 guint offset,
938 guint length)
940 proto_item *property_item;
941 proto_tree *property_tree;
942 guint8 property_type;
943 guint16 property_length;
944 /* guint64 property_index;*/
946 /* add text to the frame tree */
947 property_item = proto_tree_add_text(tree,
948 tvb,
949 offset,
950 length,
951 "NOE Message Body");
952 property_tree = proto_item_add_subtree(property_item, ett_body);
954 while(length > 0)
956 property_type = tvb_get_guint8(tvb, offset);
957 proto_tree_add_item(property_tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
958 offset += 1;
959 length -= 1;
961 if (property_type >= P_ARRAY)
963 proto_tree_add_item(property_item, hf_noe_aindx, tvb, offset, 1, ENC_NA);
964 offset += 1;
965 length -= 1;
968 property_length = tvb_get_guint8(tvb, offset);
969 if (property_length & 0x80)
971 property_length = tvb_get_ntohs(tvb, offset);
972 property_length &= 0x7fff;
973 proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 2,
974 tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1));
975 offset += 2;
976 length -= 2;
978 else
980 proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 1,
981 tvb_get_guint8(tvb, offset));
982 offset += 1;
983 length -= 1;
986 switch(property_length)
988 case 0:
990 break;
992 case 1:
993 proto_tree_add_item(property_tree, hf_noe_property_item_u8, tvb, offset, 1, ENC_BIG_ENDIAN);
994 offset += 1;
995 length -= 1;
996 break;
997 case 2:
998 proto_tree_add_item(property_tree, hf_noe_property_item_u16, tvb, offset, 2, ENC_BIG_ENDIAN);
999 offset += 2;
1000 length -= 2;
1001 break;
1002 case 3:
1003 proto_tree_add_item(property_tree, hf_noe_property_item_u24, tvb, offset, 3, ENC_BIG_ENDIAN);
1004 offset += 3;
1005 length -= 3;
1006 break;
1007 case 4:
1008 proto_tree_add_item(property_tree, hf_noe_property_item_u32, tvb, offset, 4, ENC_BIG_ENDIAN);
1009 offset += 4;
1010 length -= 4;
1011 break;
1012 default:
1013 proto_tree_add_item(property_tree, hf_noe_property_item_bytes, tvb, offset, property_length, ENC_NA);
1014 offset += property_length;
1015 length -= property_length;
1016 break;
1023 /*-----------------------------------------------------------------------------
1024 GETPROPERTY MESSAGE BODY DECODER
1025 This function decodes the message body of an 0x15 (and 0x16) UA3G message.
1026 ---------------------------------------------------------------------------*/
1027 static void decode_getproperty_tlv(proto_tree *tree,
1028 tvbuff_t *tvb,
1029 guint offset,
1030 guint length)
1032 proto_item *body_item;
1033 proto_tree *body_tree;
1034 guint8 body_type;
1036 /* add text to the frame tree */
1037 body_item = proto_tree_add_text(tree,
1038 tvb,
1039 offset,
1040 length,
1041 "NOE Message Body");
1042 body_tree = proto_item_add_subtree(body_item, ett_property);
1044 while(length > 0)
1046 body_type = tvb_get_guint8(tvb, offset);
1047 proto_tree_add_item(body_tree, hf_noe_pcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1049 offset += 1;
1050 length -= 1;
1052 if (body_type >= P_ARRAY)
1054 proto_tree_add_item(body_item, hf_noe_aindx, tvb, offset, 1, ENC_NA);
1055 offset += 1;
1056 length -= 1;
1063 /*-----------------------------------------------------------------------------
1064 TERMINAL TO SERVER EVENT MESSAGE BODY DECODER
1065 This function decodes the message body of an 0x15 (and 0x16) UA3G message.
1066 ---------------------------------------------------------------------------*/
1067 static void decode_evt(proto_tree *tree,
1068 tvbuff_t *tvb,
1069 packet_info *pinfo,
1070 guint offset,
1071 guint length)
1073 proto_item *ti;
1074 guint8 event = tvb_get_guint8(tvb, offset);
1076 proto_tree_add_item(tree, hf_noe_event, tvb, offset, 1, ENC_BIG_ENDIAN);
1078 /* add text to the frame "INFO" column */
1079 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1080 val_to_str_ext_const(event, &val_str_event_ext, "Unknown"));
1081 /* update text of the main proto item */
1082 proto_item_append_text(tree, ", %s",
1083 val_to_str_ext_const(event, &val_str_event_ext, "Unknown"));
1085 offset += 1;
1086 length -= 1;
1088 switch(event)
1090 case OPCODE_EVT_BT_KEY_SHORTPRESS:
1091 case OPCODE_EVT_BT_KEY_LONGPRESS:
1092 case OPCODE_EVT_BT_KEY_VERYLONGPRESS:
1093 case OPCODE_EVT_KEY_LINE:
1094 case OPCODE_EVT_ONHOOK:
1095 case OPCODE_EVT_OFFHOOK:
1096 ti = proto_tree_add_item(tree, hf_event_value_u8, tvb, offset, 1, ENC_BIG_ENDIAN);
1097 proto_item_set_len(ti, length);
1098 break;
1099 case OPCODE_EVT_KEY_PRESS:
1100 case OPCODE_EVT_KEY_RELEASE:
1101 case OPCODE_EVT_KEY_SHORTPRESS:
1102 case OPCODE_EVT_KEY_LONGPRESS:
1103 case OPCODE_EVT_HELP:
1105 /* utf8_value is the utf8 value to translate into Unicode with the decode_uft8 function */
1106 guint64 utf8_value = 0;
1107 guint64 unicode_value;
1108 char *key_name;
1109 int pt_length = length;
1110 int pt_offset = offset;
1112 while(pt_length > 0)
1114 utf8_value = (utf8_value << 8) + tvb_get_guint8(tvb, pt_offset);
1115 pt_offset += 1;
1116 pt_length -= 1;
1118 unicode_value = decode_utf8(utf8_value);
1119 key_name = (char *)wmem_alloc(wmem_packet_scope(), 30);
1120 g_snprintf(key_name, 30, "\"%s\"", decode_key_name((int)unicode_value));
1122 /* add text to the frame "INFO" column */
1123 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", key_name);
1124 /* update text of the main proto item */
1125 proto_item_append_text(tree, ", %s",
1126 key_name);
1128 proto_tree_add_text(tree,
1129 tvb,
1130 offset,
1131 length,
1132 "Key Name: %s (UTF-8 Value: %s, Unicode Value: 0x%" G_GINT64_MODIFIER "x)",
1133 key_name,
1134 tvb_bytes_to_str(tvb, offset, length),
1135 unicode_value);
1136 break;
1138 case OPCODE_EVT_ERROR_PROTOCOL:
1139 case OPCODE_EVT_ERROR_CREATE:
1140 case OPCODE_EVT_ERROR_DELETE:
1141 case OPCODE_EVT_ERROR_SET_PROPERTY:
1142 case OPCODE_EVT_ERROR_GET_PROPERTY:
1144 decode_evt_error(tree, tvb, offset, length);
1145 break;
1147 case OPCODE_EVT_CONTEXT_SWITCH:
1148 proto_tree_add_item(tree, hf_event_context_switch, tvb, offset, 1, ENC_BIG_ENDIAN);
1149 break;
1150 case OPCODE_EVT_SUCCESS_CREATE:
1151 case OPCODE_EVT_SUCCESS_DELETE:
1152 case OPCODE_EVT_SUCCESS_SET_PROPERTY:
1153 case OPCODE_EVT_SUCCESS_INSERT_ITEM:
1154 case OPCODE_EVT_SUCCESS_DELETE_ITEM:
1155 proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
1156 break;
1157 case OPCODE_EVT_WIDGETS_GC:
1158 proto_tree_add_item(tree, hf_event_widget_gc, tvb, offset, 4, ENC_BIG_ENDIAN);
1159 break;
1160 case OPCODE_EVT_BT_BONDING_RESULT:
1162 proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
1163 offset += 2;
1164 /*length -= 2;*/
1166 /* XXX - should a 16-bit value be gotten if the size is only 8-bit? */
1167 proto_tree_add_text(tree,
1168 tvb,
1169 offset,
1171 "Bonded: %d",
1172 tvb_get_ntohs(tvb, offset));
1173 offset += 1;
1174 /*length -= 1;*/
1176 proto_tree_add_text(tree,
1177 tvb,
1178 offset,
1180 "Value: %d",
1181 tvb_get_ntohs(tvb, offset));
1182 break;
1184 default:
1185 proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
1186 offset += 2;
1187 length -= 2;
1189 if (length > 0)
1190 decode_tlv(tree, tvb, offset, length);
1191 break;
1197 /*-----------------------------------------------------------------------------
1198 METHOD DECODER
1199 This function decodes the method of an 0x15 (and 0x16) UA3G message.
1200 ---------------------------------------------------------------------------*/
1201 static void decode_mtd(proto_tree *tree,
1202 tvbuff_t *tvb,
1203 packet_info *pinfo,
1204 guint8 method,
1205 guint offset,
1206 guint length)
1208 guint8 noe_class = tvb_get_guint8(tvb, offset);
1210 proto_tree_add_item(tree, hf_noe_class, tvb, offset, 1, ENC_BIG_ENDIAN);
1212 /* add text to the frame "INFO" column */
1213 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1214 val_to_str_ext_const(noe_class, &val_str_class_ext, "Unknown"));
1215 /* update text of the main proto item */
1216 proto_item_append_text(tree, ", %s",
1217 val_to_str_ext_const(noe_class, &val_str_class_ext, "Unknown"));
1219 offset += 1;
1220 length -= 1;
1222 if (noe_class >= C_DYNAMIC)
1224 proto_tree_add_item(tree, hf_noe_objectid, tvb, offset, 2, ENC_BIG_ENDIAN);
1225 offset += 2;
1226 length -= 2;
1229 switch(method)
1231 case METHOD_INSERT_ITEM:
1233 proto_tree_add_item(tree, hf_noe_method_index, tvb, offset, 1, ENC_BIG_ENDIAN);
1234 offset += 1;
1235 length -= 1;
1236 if (length > 0)
1237 decode_tlv(tree, tvb, offset, length);
1238 break;
1240 case METHOD_DELETE_ITEM:
1242 proto_tree_add_item(tree, hf_noe_method_index, tvb, offset, 1, ENC_BIG_ENDIAN);
1243 break;
1245 case METHOD_GET_PROPERTY:
1247 decode_getproperty_tlv(tree, tvb, offset, length);
1248 break;
1250 default:
1252 if (length > 0)
1253 decode_tlv(tree, tvb, offset, length);
1254 break;
1260 /*-----------------------------------------------------------------------------
1261 NOE DISSECTOR
1262 ---------------------------------------------------------------------------*/
1263 static void dissect_noe(tvbuff_t *tvb,
1264 packet_info *pinfo,
1265 proto_tree *tree)
1267 proto_item *noe_item;
1268 proto_tree *noe_tree;
1269 gint length;
1270 guint8 server;
1271 guint8 method;
1272 gboolean methodack;
1273 gint offset = 0;
1275 noe_item = proto_tree_add_item(tree, proto_noe, tvb, 0, -1, ENC_NA);
1276 noe_tree = proto_item_add_subtree(noe_item, ett_noe);
1278 length = tvb_get_letohs(tvb, offset);
1280 proto_tree_add_uint(noe_tree,
1281 hf_noe_length,
1282 tvb,
1283 offset,
1285 length);
1286 offset += 2;
1288 server = tvb_get_guint8(tvb, offset);
1290 /* add text to the frame "INFO" column */
1291 col_append_fstr(pinfo->cinfo, COL_INFO, " - NOE Protocol (%s)",
1292 val_to_str_const(server, servers_short_vals, "Unknown"));
1294 proto_tree_add_uint(noe_tree,
1295 hf_noe_server,
1296 tvb,
1297 offset,
1299 server);
1300 offset += 1;
1301 length -= 1;;
1303 /* update text of the main proto item */
1304 proto_item_append_text(noe_item, ", %s",
1305 val_to_str_const(server, servers_short_vals, "Unknown"));
1307 method = tvb_get_guint8(tvb, offset);
1308 methodack = (method & 0x80) != 0;
1309 method = (method & 0x7f);
1311 proto_tree_add_uint_format_value(noe_tree,
1312 hf_noe_method,
1313 tvb,
1314 offset,
1316 method,
1317 "%s (%d)",
1318 val_to_str_const(method, methods_vals, "Unknown"),
1319 method);
1321 if (method >= METHOD_INVALID)
1322 return;
1324 /* add text to the frame "INFO" column */
1325 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
1326 val_to_str_const(method, methods_vals, "Unknown"));
1328 /* update text of the main proto item */
1329 proto_item_append_text(noe_item, ", %s",
1330 val_to_str_const(method, methods_vals, "Unknown"));
1332 if (method == METHOD_NOTIFY)
1334 offset += 1;
1335 length -= 1;
1336 decode_evt(noe_tree, tvb, pinfo, offset, length);
1338 else
1339 /* Create, Delete, SetProperty, GetProperty, DeleteItem, InsertItem properties */
1341 proto_tree_add_boolean(noe_tree,
1342 hf_noe_method_ack,
1343 tvb,
1344 offset,
1346 methodack);
1347 offset += 1;
1348 length -= 1;
1349 decode_mtd(noe_tree, tvb, pinfo, method, offset, length);
1355 /*-----------------------------------------------------------------------------
1356 DISSECTORS REGISTRATION FUNCTIONS
1357 ---------------------------------------------------------------------------*/
1358 void proto_register_noe(void)
1360 static hf_register_info hf_noe[] =
1362 { &hf_noe_length,
1364 "Length",
1365 "noe.length",
1366 FT_UINT16,
1367 BASE_DEC,
1368 NULL,
1369 0x0,
1370 "Method Length",
1371 HFILL
1374 { &hf_noe_server,
1376 "Server",
1377 "noe.server",
1378 FT_UINT8,
1379 BASE_HEX,
1380 VALS(servers_vals),
1381 0x0,
1382 "Method Opcode",
1383 HFILL
1386 { &hf_noe_method_ack,
1388 "Ack",
1389 "noe.method_ack",
1390 FT_BOOLEAN,
1391 BASE_NONE,
1392 NULL,
1393 0x0,
1394 "Method Acknowledge",
1395 HFILL
1398 { &hf_noe_method,
1400 "Method",
1401 "noe.method",
1402 FT_UINT8,
1403 BASE_DEC,
1404 VALS(methods_vals),
1405 0x0,
1406 "Method Opcode",
1407 HFILL
1410 { &hf_noe_class,
1412 "Class",
1413 "noe.class",
1414 FT_UINT8,
1415 BASE_DEC|BASE_EXT_STRING,
1416 &val_str_class_ext,
1417 0x0,
1418 "Class Opcode",
1419 HFILL
1422 { &hf_noe_event,
1424 "Event",
1425 "noe.event",
1426 FT_UINT8,
1427 BASE_DEC|BASE_EXT_STRING,
1428 &val_str_event_ext,
1429 0x0,
1430 "Event Opcode",
1431 HFILL
1434 { &hf_noe_objectid,
1436 "Objectid",
1437 "noe.objectid",
1438 FT_UINT16,
1439 BASE_HEX,
1440 NULL,
1441 0x0,
1442 "Object Identifier",
1443 HFILL
1446 { &hf_noe_method_index,
1448 "ItemIndx",
1449 "noe.item_index",
1450 FT_UINT8,
1451 BASE_DEC,
1452 NULL,
1453 0x0,
1454 "Delete/Insert Index",
1455 HFILL
1458 { &hf_noe_pcode,
1460 "Property",
1461 "noe.property",
1462 FT_UINT8,
1463 BASE_HEX|BASE_EXT_STRING,
1464 &val_str_props_ext,
1465 0x0,
1466 "Property Identifier",
1467 HFILL
1470 { &hf_noe_psize,
1472 "PropLength",
1473 "noe.prop_len",
1474 FT_UINT16,
1475 BASE_DEC,
1476 NULL,
1477 0x0,
1478 "Property Length",
1479 HFILL
1482 { &hf_noe_errcode,
1484 "ErrCode",
1485 "noe.errcode",
1486 FT_UINT16,
1487 BASE_DEC|BASE_EXT_STRING,
1488 &errcode_vals_ext,
1489 0x0,
1490 "Error Code",
1491 HFILL
1494 { &hf_noe_aindx,
1496 "ArrIndex",
1497 "noe.array_index",
1498 FT_UINT8,
1499 BASE_DEC,
1500 NULL,
1501 0x0,
1502 "Array Index",
1503 HFILL
1506 { &hf_noe_value,
1508 "Value",
1509 "noe.value",
1510 FT_UINT32,
1511 BASE_HEX,
1512 NULL,
1513 0x0,
1514 NULL,
1515 HFILL
1518 { &hf_noe_message,
1520 "Message",
1521 "noe.messages",
1522 FT_BYTES,
1523 BASE_NONE,
1524 NULL,
1525 0x0,
1526 NULL,
1527 HFILL
1530 { &hf_noe_property_item_u8,
1532 "Value",
1533 "noe.property_item.uint",
1534 FT_UINT8,
1535 BASE_DEC,
1536 NULL,
1537 0x0,
1538 NULL,
1539 HFILL
1542 { &hf_noe_property_item_u16,
1544 "Value",
1545 "noe.property_item.uint",
1546 FT_UINT16,
1547 BASE_DEC,
1548 NULL,
1549 0x0,
1550 NULL,
1551 HFILL
1554 { &hf_noe_property_item_u24,
1556 "Value",
1557 "noe.property_item.uint",
1558 FT_UINT24,
1559 BASE_DEC,
1560 NULL,
1561 0x0,
1562 NULL,
1563 HFILL
1566 { &hf_noe_property_item_u32,
1568 "Value",
1569 "noe.property_item.uint",
1570 FT_UINT32,
1571 BASE_DEC,
1572 NULL,
1573 0x0,
1574 NULL,
1575 HFILL
1578 { &hf_noe_property_item_bytes,
1580 "Value",
1581 "noe.property_item.bytes",
1582 FT_BYTES,
1583 BASE_NONE,
1584 NULL,
1585 0x0,
1586 NULL,
1587 HFILL
1590 { &hf_event_value_u8,
1592 "Value",
1593 "noe.event_value.uint",
1594 FT_UINT8,
1595 BASE_DEC,
1596 VALS(noe_event_str_struct),
1597 0x0,
1598 NULL,
1599 HFILL
1602 { &hf_event_context_switch,
1604 "Context",
1605 "noe.event_context_switch",
1606 FT_UINT8,
1607 BASE_DEC,
1608 VALS(servers_vals),
1609 0x0,
1610 NULL,
1611 HFILL
1614 { &hf_event_widget_gc,
1616 "FreeMem (bytes)",
1617 "noe.event_widget_gc",
1618 FT_UINT32,
1619 BASE_DEC,
1620 NULL,
1621 0x0,
1622 NULL,
1623 HFILL
1628 static gint *ett[] =
1630 &ett_noe,
1631 &ett_body,
1632 &ett_property,
1633 &ett_value,
1636 /* NOE dissector registration */
1637 proto_noe = proto_register_protocol("NOE Protocol", "NOE", "noe");
1639 proto_register_field_array(proto_noe, hf_noe, array_length(hf_noe));
1641 register_dissector("noe", dissect_noe, proto_noe);
1643 /* Common subtree array registration */
1644 proto_register_subtree_array(ett, array_length(ett));
1649 void proto_reg_handoff_noe(void)
1651 #if 0 /* Future */
1652 dissector_handle_t handle_noe = find_dissector("noe");
1654 /* hooking of NOE on UA */
1655 dissector_add_uint("ua.opcode", 0x15, handle_noe);
1656 #endif