/src/wireshark/epan/dissectors/packet-hiqnet.c
Line | Count | Source |
1 | | /* packet-hiqnet.c |
2 | | * Harman HiQnet protocol dissector for Wireshark |
3 | | * By Raphael Doursenaud <rdoursenaud@free.fr> |
4 | | * Copyright 2014 Raphael Doursenaud |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | */ |
12 | | |
13 | | #include "config.h" |
14 | | |
15 | | #include <epan/packet.h> |
16 | | #include <epan/expert.h> |
17 | | #include "packet-tcp.h" |
18 | | |
19 | | /* |
20 | | * See |
21 | | * https://adn.harmanpro.com/site_elements/resources/487_1411413911/HiQnet_third-party_programmers_quick-start_guide_original.pdf |
22 | | * https://adn.harmanpro.com/site_elements/resources/515_1414083576/HiQnet_Third_Party_Programmers_Guide_v2_original.pdf |
23 | | */ |
24 | | |
25 | 28 | #define HIQNET_PORT 3804 |
26 | | |
27 | 28 | #define HIQNET_FLAGS_MASK 0x016f |
28 | | |
29 | 14 | #define HIQNET_REQACK_FLAG 0x0001 |
30 | 14 | #define HIQNET_ACK_FLAG 0x0002 |
31 | 820 | #define HIQNET_INFO_FLAG 0x0004 |
32 | 176 | #define HIQNET_ERROR_FLAG 0x0008 |
33 | 14 | #define HIQNET_GUARANTEED_FLAG 0x0020 |
34 | 176 | #define HIQNET_MULTIPART_FLAG 0x0040 |
35 | 176 | #define HIQNET_SESSION_NUMBER_FLAG 0x0100 |
36 | | |
37 | 14 | #define HIQNET_SUBSCRIPTION_TYPE_MASK 0x07 |
38 | | |
39 | 14 | #define HIQNET_SUBSCRIPTION_FLAGS_MASK 0x0001 |
40 | | |
41 | 14 | #define HIQNET_CATEGORIES_MASK 0x00004ffe |
42 | | |
43 | 14 | #define HIQNET_APPLICATION_CAT 0x00000002 |
44 | 14 | #define HIQNET_CONF_CAT 0x00000004 |
45 | 14 | #define HIQNET_AUDIONET_CAT 0x00000008 |
46 | 14 | #define HIQNET_CTRLNET_CAT 0x00000010 |
47 | 14 | #define HIQNET_VENDNET_CAT 0x00000020 |
48 | 14 | #define HIQNET_STARTUP_CAT 0x00000040 |
49 | 14 | #define HIQNET_DSP_CAT 0x00000080 |
50 | 14 | #define HIQNET_MISC_CAT 0x00000100 |
51 | 14 | #define HIQNET_CTRLLOG_CAT 0x00000200 |
52 | 14 | #define HIQNET_FOREIGNPROTO_CAT 0x00000400 |
53 | 14 | #define HIQNET_DIGIO_CAT 0x00000800 |
54 | 14 | #define HIQNET_CTRLSURF_CAT 0x00004000 |
55 | | |
56 | | /* Routing layer message IDs */ |
57 | 5 | #define HIQNET_DISCOINFO_MSG 0x0000 |
58 | 0 | #define HIQNET_RESERVED0_MSG 0x0001 |
59 | 11 | #define HIQNET_GETNETINFO_MSG 0x0002 |
60 | 0 | #define HIQNET_RESERVED1_MSG 0x0003 |
61 | 0 | #define HIQNET_REQADDR_MSG 0x0004 |
62 | 0 | #define HIQNET_ADDRUSED_MSG 0x0005 |
63 | 0 | #define HIQNET_SETADDR_MSG 0x0006 |
64 | 4 | #define HIQNET_GOODBYE_MSG 0x0007 |
65 | 0 | #define HIQNET_HELLO_MSG 0x0008 |
66 | | |
67 | | /* Other message IDs */ |
68 | 49 | #define HIQNET_MULTPARMSET_MSG 0x0100 |
69 | 23 | #define HIQNET_MULTOBJPARMSET_MSG 0x0101 |
70 | 2 | #define HIQNET_PARMSETPCT_MSG 0x0102 |
71 | 12 | #define HIQNET_MULTPARMGET_MSG 0x0103 |
72 | 8 | #define HIQNET_GETATTR_MSG 0x010d |
73 | 0 | #define HIQNET_SETATTR_MSG 0x010e /* Reverse engineered. Not part of the official spec. */ |
74 | 5 | #define HIQNET_MULTPARMSUB_MSG 0x010f |
75 | 3 | #define HIQNET_PARMSUBPCT_MSG 0x0111 |
76 | 3 | #define HIQNET_MULTPARMUNSUB_MSG 0x0112 |
77 | 0 | #define HIQNET_PARMSUBALL_MSG 0x0113 |
78 | 0 | #define HIQNET_PARMUNSUBALL_MSG 0x0114 |
79 | 0 | #define HIQNET_SUBEVTLOGMSGS_MSG 0x0115 |
80 | 1 | #define HIQNET_GETVDLIST_MSG 0x011a |
81 | 1 | #define HIQNET_STORE_MSG 0x0124 |
82 | 0 | #define HIQNET_RECALL_MSG 0x0125 |
83 | 1 | #define HIQNET_LOCATE_MSG 0x0129 |
84 | 1 | #define HIQNET_UNSUBEVTLOGMSGS_MSG 0x012b |
85 | 0 | #define HIQNET_REQEVTLOG_MSG 0x012c |
86 | | |
87 | 483 | #define HIQNET_TCPIP_NET 1 |
88 | 483 | #define HIQNET_RS232_NET 4 |
89 | | |
90 | | static const value_string device_attributes_names[] = { |
91 | | { 0, "Class Name" }, |
92 | | { 1, "Name String" }, |
93 | | /* Device Manager attributes */ |
94 | | { 2, "Flags" }, |
95 | | { 3, "Serial Number" }, |
96 | | { 4, "Software Version" }, |
97 | | { 0, NULL } |
98 | | }; |
99 | | |
100 | | static const value_string messageidnames[] = { |
101 | | { HIQNET_DISCOINFO_MSG, "DiscoInfo" }, |
102 | | { HIQNET_RESERVED0_MSG, "Reserved" }, |
103 | | { HIQNET_GETNETINFO_MSG, "GetNetworkInfo" }, |
104 | | { HIQNET_RESERVED1_MSG, "Reserved" }, |
105 | | { HIQNET_REQADDR_MSG, "RequestAddress" }, |
106 | | { HIQNET_ADDRUSED_MSG, "AddressUsed" }, |
107 | | { HIQNET_SETADDR_MSG, "SetAddress" }, |
108 | | { HIQNET_GOODBYE_MSG, "Goodbye" }, |
109 | | { HIQNET_HELLO_MSG, "Hello" }, |
110 | | { HIQNET_MULTPARMSET_MSG, "MultiParamSet" }, |
111 | | { HIQNET_MULTOBJPARMSET_MSG, "MultiObjectParamSet" }, |
112 | | { HIQNET_PARMSETPCT_MSG, "ParamSetPercent" }, |
113 | | { HIQNET_MULTPARMGET_MSG, "MultiParamGet" }, |
114 | | { HIQNET_GETATTR_MSG, "GetAttributes" }, |
115 | | { HIQNET_SETATTR_MSG, "SetAttribute" }, /* Reverse engineered. Not part of the official spec. */ |
116 | | { HIQNET_MULTPARMSUB_MSG, "MultiParamSubscribe" }, |
117 | | { HIQNET_PARMSUBPCT_MSG, "ParamSubscribePercent" }, |
118 | | { HIQNET_MULTPARMUNSUB_MSG, "MultiParamUnsubscribe" }, |
119 | | { HIQNET_PARMSUBALL_MSG, "ParameterSubscribeAll" }, |
120 | | { HIQNET_PARMUNSUBALL_MSG, "ParameterUnSubscribeAll" }, |
121 | | { HIQNET_SUBEVTLOGMSGS_MSG, "Subscribe Event Log Messages" }, |
122 | | { HIQNET_GETVDLIST_MSG, "GetVDList" }, |
123 | | { HIQNET_STORE_MSG, "Store" }, |
124 | | { HIQNET_RECALL_MSG, "Recall" }, |
125 | | { HIQNET_LOCATE_MSG, "Locate" }, |
126 | | { HIQNET_UNSUBEVTLOGMSGS_MSG, "Unsubscribe Event Log Messages" }, |
127 | | { HIQNET_REQEVTLOG_MSG, "Request Event Log" }, |
128 | | { 0, NULL } |
129 | | }; |
130 | | |
131 | | #if 0 |
132 | | static const value_string flagnames[] = { |
133 | | { HIQNET_REQACK_FLAG, "Request Acknowledgement" }, |
134 | | { HIQNET_ACK_FLAG, "Acknowledgement" }, |
135 | | { HIQNET_INFO_FLAG, "Information" }, |
136 | | { HIQNET_ERROR_FLAG, "Error" }, |
137 | | { HIQNET_GUARANTEED_FLAG, "Guaranteed" }, |
138 | | { HIQNET_MULTIPART_FLAG, "Multi-part" }, |
139 | | { HIQNET_SESSION_NUMBER_FLAG, "Session Number" }, |
140 | | { 0, NULL } |
141 | | }; |
142 | | #endif |
143 | | |
144 | 866 | #define HIQNET_DATATYPE_BYTE 0 |
145 | 219 | #define HIQNET_DATATYPE_UBYTE 1 |
146 | 142 | #define HIQNET_DATATYPE_WORD 2 |
147 | 118 | #define HIQNET_DATATYPE_UWORD 3 |
148 | 62 | #define HIQNET_DATATYPE_LONG 4 |
149 | 74 | #define HIQNET_DATATYPE_ULONG 5 |
150 | 37 | #define HIQNET_DATATYPE_FLOAT32 6 |
151 | 102 | #define HIQNET_DATATYPE_FLOAT64 7 |
152 | 36 | #define HIQNET_DATATYPE_BLOCK 8 |
153 | 8 | #define HIQNET_DATATYPE_STRING 9 |
154 | 62 | #define HIQNET_DATATYPE_LONG64 10 |
155 | 35 | #define HIQNET_DATATYPE_ULONG64 11 |
156 | | |
157 | | static const value_string datatypenames[] = { |
158 | | { HIQNET_DATATYPE_BYTE, "BYTE" }, |
159 | | { HIQNET_DATATYPE_UBYTE, "UBYTE" }, |
160 | | { HIQNET_DATATYPE_WORD, "WORD" }, |
161 | | { HIQNET_DATATYPE_UWORD, "UWORD" }, |
162 | | { HIQNET_DATATYPE_LONG, "LONG" }, |
163 | | { HIQNET_DATATYPE_ULONG, "ULONG" }, |
164 | | { HIQNET_DATATYPE_FLOAT32, "FLOAT32" }, |
165 | | { HIQNET_DATATYPE_FLOAT64, "FLOAT64" }, |
166 | | { HIQNET_DATATYPE_BLOCK, "BLOCK" }, |
167 | | { HIQNET_DATATYPE_STRING, "STRING" }, |
168 | | { HIQNET_DATATYPE_LONG64, "LONG64" }, |
169 | | { HIQNET_DATATYPE_ULONG64, "ULONG64" }, |
170 | | { 0, NULL } |
171 | | }; |
172 | | |
173 | | static const value_string actionnames[] = { |
174 | | { 0, "Parameters" }, |
175 | | { 1, "Subscriptions" }, |
176 | | { 2, "Scenes" }, |
177 | | { 3, "Snapshots" }, |
178 | | { 4, "Presets" }, |
179 | | { 5, "Venue" }, |
180 | | { 0, NULL } |
181 | | }; |
182 | | |
183 | | static const value_string timenames[] = { |
184 | | { 0x0000, "Turn off locate LEDs" }, |
185 | | { 0xffff, "Turn on locate LEDs" }, |
186 | | { 0, NULL } |
187 | | }; |
188 | | |
189 | | static const value_string eventcategorynames[] = { |
190 | | { 0, "Unassigned" }, |
191 | | { 1, "Application" }, |
192 | | { 2, "Configuration" }, |
193 | | { 3, "Audio Network" }, |
194 | | { 4, "Control Network" }, |
195 | | { 5, "Vendor Network" }, |
196 | | { 6, "Startup" }, |
197 | | { 7, "DSP" }, |
198 | | { 8, "Miscellaneous" }, |
199 | | { 9, "Control Logic" }, |
200 | | { 10, "Foreign Protocol" }, |
201 | | { 11, "Digital I/O" }, |
202 | | { 12, "Unassigned" }, |
203 | | { 13, "Unassigned" }, |
204 | | { 14, "Control Surface" }, |
205 | | { 15, "Unassigned" }, |
206 | | { 16, "Unassigned" }, |
207 | | { 17, "Unassigned" }, |
208 | | { 18, "Unassigned" }, |
209 | | { 19, "Unassigned" }, |
210 | | { 20, "Unassigned" }, |
211 | | { 21, "Unassigned" }, |
212 | | { 22, "Unassigned" }, |
213 | | { 23, "Unassigned" }, |
214 | | { 24, "Unassigned" }, |
215 | | { 25, "Unassigned" }, |
216 | | { 26, "Unassigned" }, |
217 | | { 27, "Unassigned" }, |
218 | | { 28, "Unassigned" }, |
219 | | { 29, "Unassigned" }, |
220 | | { 30, "Unassigned" }, |
221 | | { 31, "Unassigned" }, |
222 | | { 0, NULL } |
223 | | }; |
224 | | |
225 | | static const value_string eventidnames[] = { |
226 | | { 0x0001, "Invalid Version" }, |
227 | | { 0x0002, "Invalid Length" }, |
228 | | { 0x0003, "Invalid Virtual Device" }, |
229 | | { 0x0004, "Invalid Object" }, |
230 | | { 0x0005, "Invalid Parameter" }, |
231 | | { 0x0006, "Invalid Message ID" }, |
232 | | { 0x0007, "Invalid Value" }, |
233 | | { 0x0008, "Resource Unavailable" }, |
234 | | { 0x0009, "Unsupported" }, |
235 | | { 0x000a, "Invalid Virtual Device Class" }, |
236 | | { 0x000b, "Invalid Object Class" }, |
237 | | { 0x000c, "Invalid Parameter Class" }, |
238 | | { 0x000d, "Invalid Attribute ID" }, |
239 | | { 0x000e, "Invalid DataType" }, |
240 | | { 0x000f, "Invalid Configuration" }, |
241 | | { 0x0010, "Flash Error" }, |
242 | | { 0x0011, "Not a Router" }, |
243 | | { 0, NULL } |
244 | | }; |
245 | | |
246 | | static const value_string prioritynames[] = { |
247 | | { 0, "Fault" }, |
248 | | { 1, "Warning" }, |
249 | | { 2, "Information" }, |
250 | | { 0, NULL } |
251 | | }; |
252 | | |
253 | | static const value_string networknames[] = { |
254 | | { HIQNET_TCPIP_NET, "TCP/IP" }, |
255 | | { 2, "Reserved" }, |
256 | | { 3, "Reserved" }, |
257 | | { HIQNET_RS232_NET, "RS232" }, |
258 | | { 0, NULL } |
259 | | }; |
260 | | |
261 | | static const value_string paritynames[] = { |
262 | | { 0, "None" }, |
263 | | { 1, "Odd" }, |
264 | | { 2, "Even" }, |
265 | | { 3, "Mark" }, |
266 | | { 4, "Space" }, |
267 | | { 0, NULL } |
268 | | }; |
269 | | |
270 | | static const value_string stopbitsnames[] = { |
271 | | { 0, "1 Bits" }, |
272 | | { 1, "1.5 Bits" }, |
273 | | { 2, "2 Bits" }, |
274 | | { 0, NULL } |
275 | | }; |
276 | | |
277 | | static const value_string flowcontrolnames[] = { |
278 | | { 0, "None" }, |
279 | | { 1, "Hardware" }, |
280 | | { 2, "XON/OFF" }, |
281 | | { 0, NULL } |
282 | | }; |
283 | | |
284 | | static int proto_hiqnet; |
285 | | |
286 | | static int hf_hiqnet_version; |
287 | | |
288 | | static int ett_hiqnet; |
289 | | static int ett_hiqnet_flags; |
290 | | static int ett_hiqnet_cats; |
291 | | |
292 | | static int hf_hiqnet_headerlen; |
293 | | static int hf_hiqnet_messagelen; |
294 | | static int hf_hiqnet_sourcedev; |
295 | | static int hf_hiqnet_sourceaddr; |
296 | | static int hf_hiqnet_destdev; |
297 | | static int hf_hiqnet_destaddr; |
298 | | static int hf_hiqnet_messageid; |
299 | | static int hf_hiqnet_flags; |
300 | | static int hf_hiqnet_reqack_flag; |
301 | | static int hf_hiqnet_ack_flag; |
302 | | static int hf_hiqnet_info_flag; |
303 | | static int hf_hiqnet_error_flag; |
304 | | static int hf_hiqnet_guaranteed_flag; |
305 | | static int hf_hiqnet_multipart_flag; |
306 | | static int hf_hiqnet_session_number_flag; |
307 | | static int hf_hiqnet_hopcnt; |
308 | | static int hf_hiqnet_seqnum; |
309 | | static int hf_hiqnet_errcode; |
310 | | static int hf_hiqnet_errstr; |
311 | | static int hf_hiqnet_startseqno; |
312 | | static int hf_hiqnet_rembytes; |
313 | | static int hf_hiqnet_sessnum; |
314 | | static int hf_hiqnet_cost; |
315 | | static int hf_hiqnet_sernumlen; |
316 | | static int hf_hiqnet_sernum; |
317 | | static int hf_hiqnet_maxmsgsize; |
318 | | static int hf_hiqnet_keepaliveperiod; |
319 | | static int hf_hiqnet_netid; |
320 | | static int hf_hiqnet_macaddr; |
321 | | static int hf_hiqnet_dhcp; |
322 | | static int hf_hiqnet_ipaddr; |
323 | | static int hf_hiqnet_subnetmsk; |
324 | | static int hf_hiqnet_gateway; |
325 | | static int hf_hiqnet_flagmask; |
326 | | static int hf_hiqnet_paramcount; |
327 | | static int hf_hiqnet_paramid; |
328 | | static int hf_hiqnet_vdobject; |
329 | | static int hf_hiqnet_subtype; |
330 | | static int hf_hiqnet_sensrate; |
331 | | static int hf_hiqnet_subflags; |
332 | | static int hf_hiqnet_subcount; |
333 | | static int hf_hiqnet_pubparmid; |
334 | | static int hf_hiqnet_subaddr; |
335 | | static int hf_hiqnet_subparmid; |
336 | | static int hf_hiqnet_reserved0; |
337 | | static int hf_hiqnet_reserved1; |
338 | | static int hf_hiqnet_attrcount; |
339 | | static int hf_hiqnet_attrid; |
340 | | static int hf_hiqnet_datatype; |
341 | | static int hf_hiqnet_datalen; |
342 | | static int hf_hiqnet_byte_value; |
343 | | static int hf_hiqnet_ubyte_value; |
344 | | static int hf_hiqnet_word_value; |
345 | | static int hf_hiqnet_uword_value; |
346 | | static int hf_hiqnet_long_value; |
347 | | static int hf_hiqnet_ulong_value; |
348 | | static int hf_hiqnet_float32_value; |
349 | | static int hf_hiqnet_float64_value; |
350 | | static int hf_hiqnet_block_value; |
351 | | static int hf_hiqnet_string_value; |
352 | | static int hf_hiqnet_long64_value; |
353 | | static int hf_hiqnet_ulong64_value; |
354 | | static int hf_hiqnet_wrkgrppath; |
355 | | static int hf_hiqnet_numvds; |
356 | | static int hf_hiqnet_vdaddr; |
357 | | static int hf_hiqnet_vdclassid; |
358 | | static int hf_hiqnet_stract; |
359 | | static int hf_hiqnet_strnum; |
360 | | static int hf_hiqnet_scope; |
361 | | static int hf_hiqnet_recact; |
362 | | static int hf_hiqnet_recnum; |
363 | | static int hf_hiqnet_strlen; |
364 | | static int hf_hiqnet_time; |
365 | | static int hf_hiqnet_maxdatasize; |
366 | | static int hf_hiqnet_catfilter; |
367 | | static int hf_hiqnet_app_cat; |
368 | | static int hf_hiqnet_conf_cat; |
369 | | static int hf_hiqnet_audionet_cat; |
370 | | static int hf_hiqnet_ctrlnet_cat; |
371 | | static int hf_hiqnet_vendnet_cat; |
372 | | static int hf_hiqnet_startup_cat; |
373 | | static int hf_hiqnet_dsp_cat; |
374 | | static int hf_hiqnet_misc_cat; |
375 | | static int hf_hiqnet_ctrlog_cat; |
376 | | static int hf_hiqnet_foreignproto_cat; |
377 | | static int hf_hiqnet_digio_cat; |
378 | | static int hf_hiqnet_ctrlsurf_cat; |
379 | | static int hf_hiqnet_entrieslen; |
380 | | static int hf_hiqnet_category; |
381 | | static int hf_hiqnet_eventid; |
382 | | static int hf_hiqnet_priority; |
383 | | static int hf_hiqnet_eventseqnum; |
384 | | static int hf_hiqnet_eventtime; |
385 | | static int hf_hiqnet_eventdate; |
386 | | static int hf_hiqnet_eventinfo; |
387 | | static int hf_hiqnet_eventadddata; |
388 | | static int hf_hiqnet_objcount; |
389 | | static int hf_hiqnet_paramval; |
390 | | static int hf_hiqnet_ifacecount; |
391 | | static int hf_hiqnet_comid; |
392 | | static int hf_hiqnet_baudrate; |
393 | | static int hf_hiqnet_parity; |
394 | | static int hf_hiqnet_stopbits; |
395 | | static int hf_hiqnet_databits; |
396 | | static int hf_hiqnet_flowcontrol; |
397 | | static int hf_hiqnet_devaddr; |
398 | | static int hf_hiqnet_newdevaddr; |
399 | | |
400 | | static expert_field ei_hiqnet_datatype; |
401 | | |
402 | | static int * const hiqnet_flag_fields[] = { |
403 | | &hf_hiqnet_reqack_flag, |
404 | | &hf_hiqnet_ack_flag, |
405 | | &hf_hiqnet_info_flag, |
406 | | &hf_hiqnet_error_flag, |
407 | | &hf_hiqnet_guaranteed_flag, |
408 | | &hf_hiqnet_multipart_flag, |
409 | | &hf_hiqnet_session_number_flag, |
410 | | NULL |
411 | | }; |
412 | | |
413 | | static int * const hiqnet_cat_fields[] = { |
414 | | &hf_hiqnet_app_cat, |
415 | | &hf_hiqnet_conf_cat, |
416 | | &hf_hiqnet_audionet_cat, |
417 | | &hf_hiqnet_ctrlnet_cat, |
418 | | &hf_hiqnet_vendnet_cat, |
419 | | &hf_hiqnet_startup_cat, |
420 | | &hf_hiqnet_dsp_cat, |
421 | | &hf_hiqnet_misc_cat, |
422 | | &hf_hiqnet_ctrlog_cat, |
423 | | &hf_hiqnet_foreignproto_cat, |
424 | | &hf_hiqnet_digio_cat, |
425 | | &hf_hiqnet_ctrlsurf_cat, |
426 | | NULL |
427 | | }; |
428 | | |
429 | | void proto_register_hiqnet(void); |
430 | | void proto_reg_handoff_hiqnet(void); |
431 | | |
432 | | static dissector_handle_t hiqnet_udp_handle; |
433 | | static dissector_handle_t hiqnet_tcp_handle; |
434 | | |
435 | | static void |
436 | 406 | hiqnet_display_vdobjectaddr(proto_tree *hiqnet_tree, int hf_hiqnet, tvbuff_t *tvb, int offset) { |
437 | 406 | proto_tree_add_bytes_format_value(hiqnet_tree, hf_hiqnet, tvb, offset, 4, NULL, |
438 | 406 | "%u.%u.%u.%u", |
439 | 406 | tvb_get_uint8(tvb, offset), /* Virtual Device address */ |
440 | 406 | tvb_get_uint8(tvb, offset + 1), /* Object address part 1 */ |
441 | 406 | tvb_get_uint8(tvb, offset + 2), /* Object address part 2 */ |
442 | 406 | tvb_get_uint8(tvb, offset + 3)); /* Object address part 3 */ |
443 | 406 | } |
444 | | |
445 | | |
446 | | static int |
447 | 5 | hiqnet_display_tcpipnetinfo(proto_tree *hiqnet_payload_tree, tvbuff_t *tvb, int offset) { |
448 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_macaddr, tvb, offset, 6, ENC_NA); |
449 | 5 | offset += 6; |
450 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_dhcp, tvb, offset, 1, ENC_BIG_ENDIAN); |
451 | 5 | offset += 1; |
452 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_ipaddr, tvb, offset, 4, ENC_BIG_ENDIAN); |
453 | 5 | offset += 4; |
454 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subnetmsk, tvb, offset, 4, ENC_BIG_ENDIAN); |
455 | 5 | offset += 4; |
456 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_gateway, tvb, offset, 4, ENC_BIG_ENDIAN); |
457 | 5 | offset += 4; |
458 | 5 | return offset; |
459 | 5 | } |
460 | | |
461 | | |
462 | | static int |
463 | 10 | hiqnet_display_rs232netinfo(proto_tree *hiqnet_payload_tree, tvbuff_t *tvb, int offset) { |
464 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_comid, tvb, offset, 1, ENC_BIG_ENDIAN); |
465 | 10 | offset += 1; |
466 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_baudrate, tvb, offset, 4, ENC_BIG_ENDIAN); |
467 | 10 | offset += 4; |
468 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_parity, tvb, offset, 1, ENC_BIG_ENDIAN); |
469 | 10 | offset += 1; |
470 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_stopbits, tvb, offset, 1, ENC_BIG_ENDIAN); |
471 | 10 | offset += 1; |
472 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_databits, tvb, offset, 1, ENC_BIG_ENDIAN); |
473 | 10 | offset += 1; |
474 | 10 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_flowcontrol, tvb, offset, 1, ENC_BIG_ENDIAN); |
475 | 10 | offset += 1; |
476 | 10 | return offset; |
477 | 10 | } |
478 | | |
479 | | |
480 | | static int |
481 | 483 | hiqnet_display_netinfo(proto_tree *hiqnet_payload_tree, tvbuff_t *tvb, int offset) { |
482 | 483 | uint8_t netid = 0; |
483 | 483 | proto_tree_add_item_ret_uint8(hiqnet_payload_tree, hf_hiqnet_netid, tvb, offset, 1, ENC_BIG_ENDIAN, &netid); |
484 | 483 | offset += 1; |
485 | 483 | if (netid == HIQNET_TCPIP_NET) { |
486 | 5 | offset = hiqnet_display_tcpipnetinfo(hiqnet_payload_tree, tvb, offset); |
487 | 5 | } |
488 | 483 | if (netid == HIQNET_RS232_NET) { |
489 | 10 | offset = hiqnet_display_rs232netinfo(hiqnet_payload_tree, tvb, offset); |
490 | 10 | } |
491 | 483 | return offset; |
492 | 483 | } |
493 | | |
494 | | |
495 | | static int |
496 | 17 | hiqnet_display_sernum(proto_tree *hiqnet_payload_tree, tvbuff_t *tvb, int offset) { |
497 | 17 | uint16_t str_len; |
498 | 17 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_sernumlen, tvb, offset, 2, ENC_BIG_ENDIAN, &str_len); |
499 | 17 | offset += 2; |
500 | 17 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_sernum, tvb, offset, str_len, ENC_NA); |
501 | 17 | offset += str_len; |
502 | 17 | return offset; |
503 | 17 | } |
504 | | |
505 | | |
506 | | static int |
507 | 107 | hiqnet_display_paramsub(proto_tree *hiqnet_payload_tree, tvbuff_t *tvb, int offset) { |
508 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_pubparmid, tvb, offset, 2, ENC_BIG_ENDIAN); |
509 | 107 | offset += 2; |
510 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subtype, tvb, offset, 1, ENC_BIG_ENDIAN); |
511 | 107 | offset += 1; |
512 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subaddr, tvb, offset, 6, ENC_NA); |
513 | 107 | offset += 6; |
514 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subparmid, tvb, offset, 2, ENC_BIG_ENDIAN); |
515 | 107 | offset += 2; |
516 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_reserved0, tvb, offset, 1, ENC_NA); |
517 | 107 | offset += 1; |
518 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_reserved1, tvb, offset, 2, ENC_NA); |
519 | 107 | offset += 2; |
520 | 107 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_sensrate, tvb, offset, 2, ENC_BIG_ENDIAN); |
521 | 107 | offset += 2; |
522 | 107 | return offset; |
523 | 107 | } |
524 | | |
525 | | |
526 | | /* TODO: decode flags for attributes and parameters */ |
527 | | static int |
528 | 5.00k | hiqnet_display_data(proto_tree *hiqnet_payload_tree, packet_info *pinfo, tvbuff_t *tvb, int offset) { |
529 | 5.00k | uint32_t datatype; |
530 | 5.00k | uint32_t datalen; |
531 | 5.00k | proto_item* ti; |
532 | | |
533 | 5.00k | ti = proto_tree_add_item_ret_uint(hiqnet_payload_tree, hf_hiqnet_datatype, tvb, offset, 1, ENC_BIG_ENDIAN, &datatype); |
534 | 5.00k | offset += 1; |
535 | 5.00k | switch (datatype) { |
536 | | |
537 | 866 | case HIQNET_DATATYPE_BYTE: |
538 | 866 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_byte_value, tvb, offset, 1, ENC_BIG_ENDIAN); |
539 | 866 | offset += 1; |
540 | 866 | break; |
541 | | |
542 | 219 | case HIQNET_DATATYPE_UBYTE: |
543 | 219 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_ubyte_value, tvb, offset, 1, ENC_BIG_ENDIAN); |
544 | 219 | offset += 1; |
545 | 219 | break; |
546 | | |
547 | 142 | case HIQNET_DATATYPE_WORD: |
548 | 142 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_word_value, tvb, offset, 2, ENC_BIG_ENDIAN); |
549 | 142 | offset += 2; |
550 | 142 | break; |
551 | | |
552 | 118 | case HIQNET_DATATYPE_UWORD: |
553 | 118 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_uword_value, tvb, offset, 2, ENC_BIG_ENDIAN); |
554 | 118 | offset += 2; |
555 | 118 | break; |
556 | | |
557 | 62 | case HIQNET_DATATYPE_LONG: |
558 | 62 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_long_value, tvb, offset, 4, ENC_BIG_ENDIAN); |
559 | 62 | offset += 4; |
560 | 62 | break; |
561 | | |
562 | 74 | case HIQNET_DATATYPE_ULONG: |
563 | 74 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_ulong_value, tvb, offset, 4, ENC_BIG_ENDIAN); |
564 | 74 | offset += 4; |
565 | 74 | break; |
566 | | |
567 | 37 | case HIQNET_DATATYPE_FLOAT32: |
568 | 37 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_float32_value, tvb, offset, 4, ENC_BIG_ENDIAN); |
569 | 37 | offset += 4; |
570 | 37 | break; |
571 | | |
572 | 102 | case HIQNET_DATATYPE_FLOAT64: |
573 | 102 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_float64_value, tvb, offset, 8, ENC_BIG_ENDIAN); |
574 | 102 | offset += 8; |
575 | 102 | break; |
576 | | |
577 | 36 | case HIQNET_DATATYPE_BLOCK: |
578 | 36 | proto_tree_add_item_ret_uint(hiqnet_payload_tree, hf_hiqnet_datalen, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); |
579 | 36 | offset += 2; |
580 | 36 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_block_value, tvb, offset, datalen, ENC_NA); |
581 | 36 | offset += datalen; |
582 | 36 | break; |
583 | | |
584 | 8 | case HIQNET_DATATYPE_STRING: |
585 | 8 | proto_tree_add_item_ret_uint(hiqnet_payload_tree, hf_hiqnet_datalen, tvb, offset, 2, ENC_BIG_ENDIAN, &datalen); |
586 | 8 | offset += 2; |
587 | 8 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_string_value, tvb, offset, datalen, ENC_UCS_2|ENC_BIG_ENDIAN); |
588 | 8 | offset += datalen; |
589 | 8 | break; |
590 | | |
591 | 62 | case HIQNET_DATATYPE_LONG64: |
592 | 62 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_long64_value, tvb, offset, 8, ENC_BIG_ENDIAN); |
593 | 62 | offset += 8; |
594 | 62 | break; |
595 | | |
596 | 35 | case HIQNET_DATATYPE_ULONG64: |
597 | 35 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_ulong64_value, tvb, offset, 8, ENC_BIG_ENDIAN); |
598 | 35 | offset += 8; |
599 | 35 | break; |
600 | | |
601 | 3.22k | default: |
602 | | /* Flag an error, and punt and assume these values have no length. */ |
603 | 3.22k | expert_add_info(pinfo, ti, &ei_hiqnet_datatype); |
604 | 3.22k | break; |
605 | 5.00k | } |
606 | 4.95k | return offset; |
607 | 5.00k | } |
608 | | |
609 | | static int |
610 | | dissect_hiqnet_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) |
611 | 171 | { |
612 | 171 | uint8_t headerlen; |
613 | 171 | uint32_t messagelen; |
614 | 171 | uint16_t srcdev = 0; |
615 | 171 | uint8_t srcvdaddr = 0; |
616 | 171 | uint8_t srcob0addr = 0; |
617 | 171 | uint8_t srcob1addr = 0; |
618 | 171 | uint8_t srcob2addr = 0; |
619 | 171 | uint16_t dstdev = 0; |
620 | 171 | uint8_t dstvdaddr = 0; |
621 | 171 | uint8_t dstob0addr = 0; |
622 | 171 | uint8_t dstob1addr = 0; |
623 | 171 | uint8_t dstob2addr = 0; |
624 | 171 | uint16_t messageid = 0; |
625 | 171 | uint16_t flags; |
626 | 171 | uint16_t paramcount = 0; |
627 | 171 | uint16_t subcount = 0; |
628 | 171 | uint16_t attrcount = 0; |
629 | 171 | int str_len = 0; |
630 | 171 | uint16_t vdscount = 0; |
631 | 171 | uint16_t eventscount = 0; |
632 | 171 | uint16_t objcount = 0; |
633 | 171 | uint16_t ifacecount = 0; |
634 | | |
635 | 171 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "HiQnet"); |
636 | | /* Clear out stuff in the info column */ |
637 | 171 | col_clear(pinfo->cinfo,COL_INFO); |
638 | | |
639 | 171 | srcdev = tvb_get_ntohs(tvb, 6); |
640 | 171 | srcvdaddr = tvb_get_uint8(tvb, 8); |
641 | 171 | srcob0addr = tvb_get_uint8(tvb, 9); |
642 | 171 | srcob1addr = tvb_get_uint8(tvb, 10); |
643 | 171 | srcob2addr = tvb_get_uint8(tvb, 11); |
644 | 171 | dstdev = tvb_get_ntohs(tvb, 12); |
645 | 171 | dstvdaddr = tvb_get_uint8(tvb, 14); |
646 | 171 | dstob0addr = tvb_get_uint8(tvb, 15); |
647 | 171 | dstob1addr = tvb_get_uint8(tvb, 16); |
648 | 171 | dstob2addr = tvb_get_uint8(tvb, 17); |
649 | 171 | messageid = tvb_get_ntohs(tvb, 18); |
650 | 171 | col_add_fstr(pinfo->cinfo, COL_INFO, "Msg: %s, Src: %u.%u.%u.%u.%u, Dst: %u.%u.%u.%u.%u", |
651 | 171 | val_to_str(pinfo->pool, messageid, messageidnames, "Unknown (0x%04x)"), |
652 | 171 | srcdev, srcvdaddr, srcob0addr, srcob1addr, srcob2addr, |
653 | 171 | dstdev, dstvdaddr, dstob0addr, dstob1addr, dstob2addr); |
654 | | |
655 | 171 | if (tree) { /* we are being asked for details */ |
656 | 162 | proto_item *ti = NULL; |
657 | 162 | proto_item *item = NULL; |
658 | 162 | proto_tree *hiqnet_tree = NULL; |
659 | 162 | proto_tree *hiqnet_header_tree = NULL; |
660 | 162 | proto_tree *hiqnet_session_tree = NULL; |
661 | 162 | proto_tree *hiqnet_error_tree = NULL; |
662 | 162 | proto_tree *hiqnet_multipart_tree = NULL; |
663 | 162 | proto_tree *hiqnet_payload_tree = NULL; |
664 | 162 | proto_tree *hiqnet_parameter_tree = NULL; |
665 | 162 | proto_tree *hiqnet_attribute_tree = NULL; |
666 | 162 | proto_tree *hiqnet_vds_tree = NULL; |
667 | 162 | proto_tree *hiqnet_event_tree = NULL; |
668 | 162 | proto_tree *hiqnet_subscription_tree = NULL; |
669 | 162 | proto_tree *hiqnet_object_tree = NULL; |
670 | 162 | proto_tree *hiqnet_ifaces_tree = NULL; |
671 | 162 | unsigned offset = 0; |
672 | | |
673 | 162 | messagelen = tvb_get_ntohl(tvb, 2); |
674 | 162 | ti = proto_tree_add_item(tree, proto_hiqnet, tvb, 0, messagelen, ENC_NA); |
675 | 162 | proto_item_append_text(ti, ", Msg: %s", |
676 | 162 | val_to_str(pinfo->pool, messageid, messageidnames, "Unknown (0x%04x)")); |
677 | 162 | proto_item_append_text(ti, ", Src %u.%u.%u.%u.%u", |
678 | 162 | srcdev, srcvdaddr, srcob0addr, srcob1addr, srcob2addr); |
679 | 162 | proto_item_append_text(ti, ", Dst: %u.%u.%u.%u.%u", |
680 | 162 | dstdev, dstvdaddr, dstob0addr, dstob1addr, dstob2addr); |
681 | 162 | hiqnet_tree = proto_item_add_subtree(ti, ett_hiqnet); |
682 | | |
683 | | /* Header subtree */ |
684 | 162 | headerlen = tvb_get_uint8(tvb, 1); |
685 | 162 | hiqnet_header_tree = proto_tree_add_subtree(hiqnet_tree, tvb, 0, headerlen, ett_hiqnet, NULL, "Header"); |
686 | | |
687 | | /* Standard header */ |
688 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_version, tvb, offset, 1, ENC_BIG_ENDIAN); |
689 | 162 | offset += 1; |
690 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_headerlen, tvb, offset, 1, ENC_BIG_ENDIAN); |
691 | 162 | offset += 1; |
692 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_messagelen, tvb, offset, 4, ENC_BIG_ENDIAN); |
693 | 162 | offset += 4; |
694 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_sourcedev, tvb, offset, 2, ENC_BIG_ENDIAN); |
695 | 162 | item = proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
696 | 162 | proto_item_set_hidden(item); |
697 | 162 | offset += 2; |
698 | 162 | hiqnet_display_vdobjectaddr(hiqnet_header_tree, hf_hiqnet_sourceaddr, tvb, offset); |
699 | 162 | offset += 4; |
700 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_destdev, tvb, offset, 2, ENC_BIG_ENDIAN); |
701 | 162 | item = proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
702 | 162 | proto_item_set_hidden(item); |
703 | 162 | offset += 2; |
704 | 162 | hiqnet_display_vdobjectaddr(hiqnet_header_tree, hf_hiqnet_destaddr, tvb, offset); |
705 | 162 | offset += 4; |
706 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_messageid, tvb, offset, 2, ENC_BIG_ENDIAN); |
707 | 162 | offset += 2; |
708 | 162 | flags = tvb_get_ntohs(tvb, offset); |
709 | 162 | proto_tree_add_bitmask(hiqnet_header_tree, tvb, offset, hf_hiqnet_flags, |
710 | 162 | ett_hiqnet_flags, hiqnet_flag_fields, ENC_BIG_ENDIAN); |
711 | 162 | offset += 2; |
712 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_hopcnt, tvb, offset, 1, ENC_BIG_ENDIAN); |
713 | 162 | offset += 1; |
714 | 162 | proto_tree_add_item(hiqnet_header_tree, hf_hiqnet_seqnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
715 | 162 | offset += 2; |
716 | | |
717 | | /* Optional headers */ |
718 | 162 | if (flags & HIQNET_ERROR_FLAG) { |
719 | | /* TODO: mark the erroneous frame */ |
720 | 32 | hiqnet_error_tree = proto_tree_add_subtree(hiqnet_header_tree, tvb, offset, 2, ett_hiqnet, NULL, "Error"); |
721 | 32 | proto_tree_add_item(hiqnet_error_tree, hf_hiqnet_errcode, tvb, offset, 1, ENC_BIG_ENDIAN); |
722 | 32 | offset += 1; |
723 | 32 | proto_tree_add_item(hiqnet_error_tree, hf_hiqnet_errstr, tvb, offset, headerlen - offset, ENC_UCS_2|ENC_BIG_ENDIAN); |
724 | 32 | } |
725 | 162 | if (flags & HIQNET_MULTIPART_FLAG) { |
726 | | /* TODO: rebuild the full message */ |
727 | 22 | hiqnet_multipart_tree = proto_tree_add_subtree(hiqnet_header_tree, tvb, offset, 2, ett_hiqnet, NULL, "Multi-part"); |
728 | 22 | proto_tree_add_item(hiqnet_multipart_tree, hf_hiqnet_startseqno, tvb, offset, 1, ENC_BIG_ENDIAN); |
729 | 22 | offset += 1; |
730 | 22 | proto_tree_add_item(hiqnet_multipart_tree, hf_hiqnet_rembytes, tvb, offset, 4, ENC_BIG_ENDIAN); |
731 | 22 | offset += 4; |
732 | 22 | } |
733 | 162 | if (flags & HIQNET_SESSION_NUMBER_FLAG) { |
734 | 79 | hiqnet_session_tree = proto_tree_add_subtree(hiqnet_header_tree, tvb, offset, 2, ett_hiqnet, NULL, "Session"); |
735 | 79 | proto_tree_add_item(hiqnet_session_tree, hf_hiqnet_sessnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
736 | 79 | } |
737 | | |
738 | | /* Payload(s) */ |
739 | 162 | offset = headerlen; /* Make sure we are at the payload start */ |
740 | 162 | hiqnet_payload_tree = proto_tree_add_subtree( |
741 | 162 | hiqnet_tree, tvb, offset, messagelen - headerlen, ett_hiqnet, NULL, "Payload"); |
742 | 162 | switch(messageid) { |
743 | 5 | case HIQNET_DISCOINFO_MSG : |
744 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
745 | 5 | offset += 2; |
746 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_cost, tvb, offset, 1, ENC_BIG_ENDIAN); |
747 | 5 | offset += 1; |
748 | 5 | offset = hiqnet_display_sernum(hiqnet_payload_tree, tvb, offset); |
749 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_maxmsgsize, tvb, offset, 4, ENC_BIG_ENDIAN); |
750 | 5 | offset += 4; |
751 | 5 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_keepaliveperiod, tvb, offset, 2, ENC_BIG_ENDIAN); |
752 | 5 | offset += 2; |
753 | 5 | hiqnet_display_netinfo(hiqnet_payload_tree, tvb, offset); |
754 | 5 | break; |
755 | 0 | case HIQNET_HELLO_MSG : |
756 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_sessnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
757 | 0 | offset += 2; |
758 | 0 | proto_tree_add_bitmask(hiqnet_payload_tree, tvb, offset, hf_hiqnet_flagmask, |
759 | 0 | ett_hiqnet_flags, hiqnet_flag_fields, ENC_BIG_ENDIAN); |
760 | 0 | break; |
761 | 12 | case HIQNET_MULTPARMGET_MSG : |
762 | 12 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_paramcount, tvb, offset, 2, ENC_BIG_ENDIAN, ¶mcount); |
763 | 12 | offset += 2; |
764 | 798 | while (paramcount > 0) { |
765 | 786 | hiqnet_parameter_tree = proto_tree_add_subtree( |
766 | 786 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Parameter"); |
767 | 786 | proto_tree_add_item(hiqnet_parameter_tree, hf_hiqnet_paramid, tvb, offset, 2, ENC_BIG_ENDIAN); |
768 | 786 | offset += 2; |
769 | 786 | if (flags & HIQNET_INFO_FLAG) { /* This is not a request */ |
770 | 367 | offset = hiqnet_display_data(hiqnet_parameter_tree, pinfo, tvb, offset); |
771 | 367 | } |
772 | 786 | paramcount -= 1; |
773 | 786 | } |
774 | 12 | break; |
775 | 49 | case HIQNET_MULTPARMSET_MSG : |
776 | 49 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_paramcount, tvb, offset, 2, ENC_BIG_ENDIAN, ¶mcount); |
777 | 49 | offset += 2; |
778 | 3.00k | while (paramcount > 0) { |
779 | 2.95k | hiqnet_parameter_tree = proto_tree_add_subtree( |
780 | 2.95k | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Parameter"); |
781 | 2.95k | proto_tree_add_item(hiqnet_parameter_tree, hf_hiqnet_paramid, tvb, offset, 2, ENC_BIG_ENDIAN); |
782 | 2.95k | offset += 2; |
783 | 2.95k | offset = hiqnet_display_data(hiqnet_parameter_tree, pinfo, tvb, offset); |
784 | 2.95k | paramcount -= 1; |
785 | 2.95k | } |
786 | 49 | break; |
787 | 0 | case HIQNET_PARMSUBALL_MSG : |
788 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
789 | 0 | offset += 2; |
790 | 0 | hiqnet_display_vdobjectaddr(hiqnet_payload_tree, hf_hiqnet_vdobject, tvb, offset); |
791 | 0 | offset += 4; |
792 | | /* TODO: can be decoded in two ways (old and new) */ |
793 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subtype, tvb, offset, 1, ENC_BIG_ENDIAN); |
794 | 0 | offset += 1; |
795 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_sensrate, tvb, offset, 2, ENC_BIG_ENDIAN); |
796 | 0 | offset += 2; |
797 | | /* TODO: decode and display */ |
798 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subflags, tvb, offset, 2, ENC_BIG_ENDIAN); |
799 | 0 | break; |
800 | 0 | case HIQNET_PARMUNSUBALL_MSG : /* Reverse engineered. Not part of the official spec. */ |
801 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
802 | 0 | offset += 2; |
803 | 0 | hiqnet_display_vdobjectaddr(hiqnet_payload_tree, hf_hiqnet_vdobject, tvb, offset); |
804 | 0 | offset += 4; |
805 | | /* TODO: can be decoded in two ways (old and new) */ |
806 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_subtype, tvb, offset, 1, ENC_BIG_ENDIAN); |
807 | 0 | break; |
808 | 5 | case HIQNET_MULTPARMSUB_MSG : |
809 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
810 | 5 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_subcount, tvb, offset, 2, ENC_BIG_ENDIAN, &subcount); |
811 | 5 | offset += 2; |
812 | 97 | while (subcount > 0) { |
813 | 92 | hiqnet_subscription_tree = proto_tree_add_subtree( |
814 | 92 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Subscription"); |
815 | 92 | offset = hiqnet_display_paramsub(hiqnet_subscription_tree, tvb, offset); |
816 | 92 | subcount -= 1; |
817 | 92 | } |
818 | 5 | break; |
819 | 4 | case HIQNET_GOODBYE_MSG : |
820 | 4 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
821 | 4 | break; |
822 | 8 | case HIQNET_GETATTR_MSG : |
823 | 8 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_attrcount, tvb, offset, 2, ENC_BIG_ENDIAN, &attrcount); |
824 | 8 | offset += 2; |
825 | 8 | if (flags & HIQNET_INFO_FLAG) { /* This not a request */ |
826 | 59 | while (attrcount > 0) { |
827 | 52 | hiqnet_attribute_tree = proto_tree_add_subtree( |
828 | 52 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Attribute"); |
829 | 52 | proto_tree_add_item(hiqnet_attribute_tree, hf_hiqnet_attrid, tvb, offset, 2, ENC_BIG_ENDIAN); |
830 | 52 | offset += 2; |
831 | 52 | offset = hiqnet_display_data(hiqnet_attribute_tree, pinfo, tvb, offset); |
832 | 52 | attrcount -= 1; |
833 | 52 | } |
834 | 7 | } else { /* This may be a request */ |
835 | 1 | while (attrcount > 0) { |
836 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_attrid, tvb, offset, 2, ENC_BIG_ENDIAN); |
837 | 0 | offset += 2; |
838 | 0 | attrcount -= 1; |
839 | 0 | } |
840 | 1 | } |
841 | 8 | break; |
842 | 1 | case HIQNET_GETVDLIST_MSG : |
843 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
844 | 1 | str_len = tvb_get_ntohs(tvb, offset); |
845 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_strlen, tvb, offset, 2, ENC_BIG_ENDIAN); |
846 | 1 | offset += 2; |
847 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_wrkgrppath, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
848 | 1 | offset += str_len; |
849 | 1 | if (flags & HIQNET_INFO_FLAG) { /* This is not a request */ |
850 | 1 | vdscount = tvb_get_ntohs(tvb, offset); |
851 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_numvds, tvb, offset, 2, ENC_BIG_ENDIAN); |
852 | 1 | offset += 2; |
853 | 14 | while (vdscount > 0) { |
854 | 13 | hiqnet_vds_tree = proto_tree_add_subtree( |
855 | 13 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Virtual Devices"); |
856 | 13 | proto_tree_add_item(hiqnet_vds_tree, hf_hiqnet_vdaddr, tvb, offset, 1, ENC_BIG_ENDIAN); |
857 | 13 | offset += 1; |
858 | 13 | proto_tree_add_item(hiqnet_vds_tree, hf_hiqnet_vdclassid, tvb, offset, 2, ENC_BIG_ENDIAN); |
859 | 13 | offset += 2; |
860 | 13 | vdscount -= 1; |
861 | 13 | } |
862 | 1 | } |
863 | 1 | break; |
864 | 1 | case HIQNET_STORE_MSG : |
865 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
866 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_stract, tvb, offset, 1, ENC_BIG_ENDIAN); |
867 | 1 | offset += 1; |
868 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_strnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
869 | 1 | offset += 2; |
870 | 1 | str_len = tvb_get_ntohs(tvb, offset); |
871 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_strlen, tvb, offset, 2, ENC_BIG_ENDIAN); |
872 | 1 | offset += 2; |
873 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_wrkgrppath, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
874 | 1 | offset += str_len; |
875 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_scope, tvb, offset, 1, ENC_BIG_ENDIAN); |
876 | 1 | break; |
877 | 0 | case HIQNET_RECALL_MSG : |
878 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_recact, tvb, offset, 1, ENC_BIG_ENDIAN); |
879 | 0 | offset += 1; |
880 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_recnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
881 | 0 | offset += 2; |
882 | 0 | str_len = tvb_get_ntohs(tvb, offset); |
883 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_strlen, tvb, offset, 2, ENC_BIG_ENDIAN); |
884 | 0 | offset += 2; |
885 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_wrkgrppath, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
886 | 0 | offset += str_len; |
887 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_scope, tvb, offset, 1, ENC_BIG_ENDIAN); |
888 | 0 | break; |
889 | 1 | case HIQNET_LOCATE_MSG : |
890 | 1 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_time, tvb, offset, 2, ENC_BIG_ENDIAN); |
891 | 1 | offset += 2; |
892 | 1 | hiqnet_display_sernum(hiqnet_payload_tree, tvb, offset); |
893 | 1 | break; |
894 | 0 | case HIQNET_SUBEVTLOGMSGS_MSG : |
895 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_maxdatasize, tvb, offset, 2, ENC_BIG_ENDIAN); |
896 | 0 | offset += 2; |
897 | 0 | proto_tree_add_bitmask(hiqnet_payload_tree, tvb, offset, hf_hiqnet_catfilter, |
898 | 0 | ett_hiqnet_cats, hiqnet_cat_fields, ENC_BIG_ENDIAN); |
899 | 0 | break; |
900 | 1 | case HIQNET_UNSUBEVTLOGMSGS_MSG : |
901 | 1 | proto_tree_add_bitmask(hiqnet_payload_tree, tvb, offset, hf_hiqnet_catfilter, |
902 | 1 | ett_hiqnet_cats, hiqnet_cat_fields, ENC_BIG_ENDIAN); |
903 | 1 | break; |
904 | 0 | case HIQNET_REQEVTLOG_MSG : |
905 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
906 | 0 | if (flags & HIQNET_INFO_FLAG) { /* This is not a request */ |
907 | 0 | eventscount = tvb_get_ntohs(tvb, offset); |
908 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_entrieslen, tvb, offset, 2, ENC_BIG_ENDIAN); |
909 | 0 | offset += 2; |
910 | 0 | while (eventscount > 0) { |
911 | 0 | hiqnet_event_tree = proto_tree_add_subtree( |
912 | 0 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Event"); |
913 | |
|
914 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_category, tvb, offset, 2, ENC_BIG_ENDIAN); |
915 | 0 | offset += 2; |
916 | |
|
917 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_eventid, tvb, offset, 2, ENC_BIG_ENDIAN); |
918 | 0 | offset += 2; |
919 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_priority, tvb, offset, 1, ENC_BIG_ENDIAN); |
920 | 0 | offset += 1; |
921 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_eventseqnum, tvb, offset, 4, ENC_BIG_ENDIAN); |
922 | 0 | offset += 4; |
923 | 0 | str_len = tvb_get_ntohs(tvb, offset); |
924 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_eventtime, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
925 | 0 | offset += str_len; |
926 | 0 | str_len = tvb_get_ntohs(tvb, offset); |
927 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_eventdate, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
928 | 0 | offset += str_len; |
929 | 0 | str_len = tvb_get_ntohs(tvb, offset); |
930 | 0 | proto_tree_add_item(hiqnet_event_tree, hf_hiqnet_eventinfo, tvb, offset, str_len, ENC_UCS_2|ENC_BIG_ENDIAN); |
931 | 0 | offset += str_len; |
932 | 0 | str_len = tvb_get_ntohs(tvb, offset); |
933 | 0 | proto_tree_add_item( |
934 | 0 | hiqnet_event_tree, hf_hiqnet_eventadddata, tvb, offset, str_len, ENC_NA); |
935 | 0 | offset += str_len; |
936 | 0 | eventscount -= 1; |
937 | 0 | } |
938 | 0 | } |
939 | 0 | break; |
940 | 3 | case HIQNET_MULTPARMUNSUB_MSG : |
941 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
942 | 3 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_subcount, tvb, offset, 2, ENC_BIG_ENDIAN, &subcount); |
943 | 3 | offset += 2; |
944 | 29 | while (subcount > 0) { |
945 | 26 | hiqnet_subscription_tree = proto_tree_add_subtree( |
946 | 26 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Subscription"); |
947 | 26 | proto_tree_add_item(hiqnet_subscription_tree, hf_hiqnet_pubparmid, tvb, offset, 2, ENC_BIG_ENDIAN); |
948 | 26 | offset += 2; |
949 | 26 | proto_tree_add_item(hiqnet_subscription_tree, hf_hiqnet_subparmid, tvb, offset, 2, ENC_BIG_ENDIAN); |
950 | 26 | offset += 2; |
951 | 26 | subcount -= 1; |
952 | 26 | } |
953 | 3 | break; |
954 | 23 | case HIQNET_MULTOBJPARMSET_MSG : |
955 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
956 | 23 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_objcount, tvb, offset, 2, ENC_BIG_ENDIAN, &objcount); |
957 | 23 | offset += 2; |
958 | 105 | while (objcount > 0) { |
959 | 82 | hiqnet_object_tree = proto_tree_add_subtree( |
960 | 82 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Object"); |
961 | 82 | hiqnet_display_vdobjectaddr(hiqnet_header_tree, hf_hiqnet_vdobject, tvb, offset); |
962 | 82 | offset += 4; |
963 | 82 | proto_tree_add_item_ret_uint16(hiqnet_object_tree, hf_hiqnet_paramcount, tvb, offset, 2, ENC_BIG_ENDIAN, ¶mcount); |
964 | 82 | offset += 2; |
965 | 1.73k | while (paramcount > 0) { |
966 | 1.65k | hiqnet_parameter_tree = proto_tree_add_subtree( |
967 | 1.65k | hiqnet_object_tree, tvb, offset, -1, ett_hiqnet, NULL, "Parameter"); |
968 | 1.65k | proto_tree_add_item(hiqnet_parameter_tree, hf_hiqnet_paramid, tvb, offset, 2, ENC_BIG_ENDIAN); |
969 | 1.65k | offset += 2; |
970 | 1.65k | offset = hiqnet_display_data(hiqnet_parameter_tree, pinfo, tvb, offset); |
971 | 1.65k | paramcount -= 1; |
972 | 1.65k | } |
973 | 82 | objcount -= 1; |
974 | 82 | } |
975 | 23 | break; |
976 | 2 | case HIQNET_PARMSETPCT_MSG : |
977 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
978 | 2 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_paramcount, tvb, offset, 2, ENC_BIG_ENDIAN, ¶mcount); |
979 | 2 | offset += 2; |
980 | 78 | while (paramcount > 0) { |
981 | 76 | hiqnet_parameter_tree = proto_tree_add_subtree( |
982 | 76 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Parameter"); |
983 | 76 | proto_tree_add_item(hiqnet_parameter_tree, hf_hiqnet_paramid, tvb, offset, 2, ENC_BIG_ENDIAN); |
984 | 76 | offset += 2; |
985 | | /* TODO: docode paramval is in percentage represented as a 1.15 signed fixed point format */ |
986 | 76 | proto_tree_add_item(hiqnet_parameter_tree, hf_hiqnet_paramval, tvb, offset, 2, ENC_BIG_ENDIAN); |
987 | 76 | offset += 2; |
988 | 76 | paramcount -= 1; |
989 | 76 | } |
990 | 2 | break; |
991 | 3 | case HIQNET_PARMSUBPCT_MSG : |
992 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
993 | 3 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_subcount, tvb, offset, 2, ENC_BIG_ENDIAN, &subcount); |
994 | 3 | offset += 2; |
995 | 19 | while (subcount > 0) { |
996 | 16 | hiqnet_subscription_tree = proto_tree_add_subtree( |
997 | 16 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Subscription"); |
998 | 16 | offset = hiqnet_display_paramsub(hiqnet_subscription_tree, tvb, offset); |
999 | 16 | subcount -= 1; |
1000 | 16 | } |
1001 | 3 | break; |
1002 | 11 | case HIQNET_GETNETINFO_MSG : |
1003 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
1004 | 11 | offset = hiqnet_display_sernum(hiqnet_payload_tree, tvb, offset); |
1005 | 11 | if (flags & HIQNET_INFO_FLAG) { /* This is not a request */ |
1006 | 11 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_ifacecount, tvb, offset, 2, ENC_BIG_ENDIAN, &ifacecount); |
1007 | 11 | offset += 2; |
1008 | 497 | while (ifacecount > 0) { |
1009 | 486 | hiqnet_ifaces_tree = proto_tree_add_subtree( |
1010 | 486 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Interface"); |
1011 | 486 | proto_tree_add_item(hiqnet_ifaces_tree, hf_hiqnet_maxmsgsize, tvb, offset, 4, ENC_BIG_ENDIAN); |
1012 | 486 | offset += 4; |
1013 | 486 | offset = hiqnet_display_netinfo(hiqnet_ifaces_tree, tvb, offset); |
1014 | 486 | ifacecount -= 1; |
1015 | 486 | } |
1016 | 11 | } |
1017 | 11 | break; |
1018 | 0 | case HIQNET_REQADDR_MSG : |
1019 | | /* FIXME: Not tested, straight from the spec, never occurred with the devices I own */ |
1020 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_devaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
1021 | 0 | break; |
1022 | 0 | case HIQNET_SETADDR_MSG : |
1023 | 0 | offset = hiqnet_display_sernum(hiqnet_payload_tree, tvb, offset); |
1024 | 0 | proto_tree_add_item(hiqnet_payload_tree, hf_hiqnet_newdevaddr, tvb, offset, 2, ENC_BIG_ENDIAN); |
1025 | 0 | offset += 2; |
1026 | 0 | hiqnet_display_netinfo(hiqnet_payload_tree, tvb, offset); |
1027 | 0 | break; |
1028 | 0 | case HIQNET_SETATTR_MSG : /* Reverse engineered. Not part of the official spec. */ |
1029 | 0 | proto_tree_add_item_ret_uint16(hiqnet_payload_tree, hf_hiqnet_attrcount, tvb, offset, 2, ENC_BIG_ENDIAN, &attrcount); |
1030 | 0 | offset += 2; |
1031 | 0 | while (attrcount > 0) { |
1032 | 0 | hiqnet_attribute_tree = proto_tree_add_subtree( |
1033 | 0 | hiqnet_payload_tree, tvb, offset, -1, ett_hiqnet, NULL, "Attribute"); |
1034 | 0 | proto_tree_add_item(hiqnet_attribute_tree, hf_hiqnet_attrid, tvb, offset, 2, ENC_BIG_ENDIAN); |
1035 | 0 | offset += 2; |
1036 | 0 | offset = hiqnet_display_data(hiqnet_attribute_tree, pinfo, tvb, offset); |
1037 | 0 | attrcount -= 1; |
1038 | 0 | } |
1039 | 0 | break; |
1040 | | /* FIXME: Messages unknown, assumed without payload */ |
1041 | 0 | case HIQNET_RESERVED0_MSG: |
1042 | 0 | case HIQNET_RESERVED1_MSG: |
1043 | | /* Message without payload */ |
1044 | 0 | case HIQNET_ADDRUSED_MSG: |
1045 | 0 | break; |
1046 | 15 | default : /* Unknown message or malformed packet */ |
1047 | | /* TODO: display something useful? */ |
1048 | 15 | break; |
1049 | 162 | } |
1050 | 162 | } |
1051 | 43 | return tvb_reported_length(tvb); |
1052 | 171 | } |
1053 | | |
1054 | | |
1055 | | static unsigned |
1056 | | get_hiqnet_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) |
1057 | 171 | { |
1058 | | /* length is at offset + 2 */ |
1059 | 171 | return tvb_get_ntohl(tvb, offset + 2); |
1060 | 171 | } |
1061 | | |
1062 | | /* Fixme: For multiple hiqnet PDUS in a single TCP or UDP packet, |
1063 | | the INFO column shows the information only for the last PDU */ |
1064 | | |
1065 | | static int |
1066 | | dissect_hiqnet_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1067 | 61 | { |
1068 | 61 | tcp_dissect_pdus(tvb, pinfo, tree, true, 6, |
1069 | 61 | get_hiqnet_pdu_len, dissect_hiqnet_pdu, data); |
1070 | 61 | return tvb_captured_length(tvb); |
1071 | 61 | } |
1072 | | |
1073 | | static int |
1074 | | dissect_hiqnet_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1075 | 94 | { |
1076 | 94 | int offset = 0; |
1077 | 94 | tvbuff_t *next_tvb; |
1078 | 94 | int offset_before; |
1079 | 94 | unsigned plen; |
1080 | | |
1081 | | /* loop on (possibly multiple) hiqnet PDUs in UDP payload */ |
1082 | 192 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
1083 | 101 | plen = get_hiqnet_pdu_len(pinfo, tvb, offset, NULL); |
1084 | | |
1085 | 101 | next_tvb = tvb_new_subset_length(tvb, offset, plen); |
1086 | | |
1087 | 101 | dissect_hiqnet_pdu(next_tvb, pinfo, tree, data); |
1088 | | |
1089 | | /* |
1090 | | * Step to the next PDU. |
1091 | | * Make sure we don't overflow. |
1092 | | */ |
1093 | 101 | offset_before = offset; |
1094 | 101 | offset += plen; |
1095 | 101 | if (offset <= offset_before) |
1096 | 3 | break; |
1097 | 101 | } |
1098 | 94 | return tvb_captured_length(tvb); |
1099 | 94 | } |
1100 | | |
1101 | | void |
1102 | | proto_register_hiqnet(void) |
1103 | 14 | { |
1104 | 14 | static hf_register_info hf[] = { |
1105 | 14 | { &hf_hiqnet_version, |
1106 | 14 | { "Version", "hiqnet.version", |
1107 | 14 | FT_UINT8, BASE_DEC, |
1108 | 14 | NULL, 0x0, |
1109 | 14 | NULL, HFILL } |
1110 | 14 | }, |
1111 | 14 | { &hf_hiqnet_headerlen, |
1112 | 14 | { "Header length", "hiqnet.hlen", |
1113 | 14 | FT_UINT16, BASE_DEC, |
1114 | 14 | NULL, 0x0, |
1115 | 14 | NULL, HFILL } |
1116 | 14 | }, |
1117 | 14 | { &hf_hiqnet_messagelen, |
1118 | 14 | { "Message length", "hiqnet.mlen", |
1119 | 14 | FT_UINT32, BASE_DEC, |
1120 | 14 | NULL, 0x0, |
1121 | 14 | NULL, HFILL } |
1122 | 14 | }, |
1123 | 14 | { &hf_hiqnet_sourcedev, |
1124 | 14 | { "Source device", "hiqnet.srcdev", |
1125 | 14 | FT_UINT16, BASE_DEC_HEX, |
1126 | 14 | NULL, 0x0, |
1127 | 14 | NULL, HFILL } |
1128 | 14 | }, |
1129 | 14 | { &hf_hiqnet_sourceaddr, |
1130 | 14 | { "Source address", "hiqnet.srcaddr", |
1131 | 14 | FT_BYTES, BASE_NONE, |
1132 | 14 | NULL, 0x0, |
1133 | 14 | NULL, HFILL } |
1134 | 14 | }, |
1135 | 14 | { &hf_hiqnet_destdev, |
1136 | 14 | { "Destination device", "hiqnet.dstdev", |
1137 | 14 | FT_UINT16, BASE_DEC_HEX, |
1138 | 14 | NULL, 0x0, |
1139 | 14 | NULL, HFILL } |
1140 | 14 | }, |
1141 | 14 | { &hf_hiqnet_destaddr, |
1142 | 14 | { "Destination address", "hiqnet.dstaddr", |
1143 | 14 | FT_BYTES, BASE_NONE, |
1144 | 14 | NULL, 0x0, |
1145 | 14 | NULL, HFILL } |
1146 | 14 | }, |
1147 | 14 | { &hf_hiqnet_messageid, |
1148 | 14 | { "Message ID", "hiqnet.msgid", |
1149 | 14 | FT_UINT16, BASE_HEX, |
1150 | 14 | VALS(messageidnames), 0x0, |
1151 | 14 | NULL, HFILL } |
1152 | 14 | }, |
1153 | 14 | { &hf_hiqnet_flags, |
1154 | 14 | { "Flags", "hiqnet.flags", |
1155 | 14 | FT_UINT16, BASE_HEX, |
1156 | 14 | NULL, HIQNET_FLAGS_MASK, |
1157 | 14 | NULL, HFILL } |
1158 | 14 | }, |
1159 | 14 | { &hf_hiqnet_reqack_flag, |
1160 | 14 | { "Request Acknowledgement", "hiqnet.flags.reqack", |
1161 | 14 | FT_BOOLEAN, 16, |
1162 | 14 | NULL, HIQNET_REQACK_FLAG, |
1163 | 14 | NULL, HFILL } |
1164 | 14 | }, |
1165 | 14 | { &hf_hiqnet_ack_flag, |
1166 | 14 | { "Acknowledgement", "hiqnet.flags.ack", |
1167 | 14 | FT_BOOLEAN, 16, |
1168 | 14 | NULL, HIQNET_ACK_FLAG, |
1169 | 14 | NULL, HFILL } |
1170 | 14 | }, |
1171 | 14 | { &hf_hiqnet_info_flag, |
1172 | 14 | { "Information", "hiqnet.flags.info", |
1173 | 14 | FT_BOOLEAN, 16, |
1174 | 14 | NULL, HIQNET_INFO_FLAG, |
1175 | 14 | NULL, HFILL } |
1176 | 14 | }, |
1177 | 14 | { &hf_hiqnet_error_flag, |
1178 | 14 | { "Error", "hiqnet.flags.error", |
1179 | 14 | FT_BOOLEAN, 16, |
1180 | 14 | NULL, HIQNET_ERROR_FLAG, |
1181 | 14 | NULL, HFILL } |
1182 | 14 | }, |
1183 | 14 | { &hf_hiqnet_guaranteed_flag, |
1184 | 14 | { "Guaranteed", "hiqnet.flags.guar", |
1185 | 14 | FT_BOOLEAN, 16, |
1186 | 14 | NULL, HIQNET_GUARANTEED_FLAG, |
1187 | 14 | NULL, HFILL } |
1188 | 14 | }, |
1189 | 14 | { &hf_hiqnet_multipart_flag, |
1190 | 14 | { "Multipart", "hiqnet.flags.multi", |
1191 | 14 | FT_BOOLEAN, 16, |
1192 | 14 | NULL, HIQNET_MULTIPART_FLAG, |
1193 | 14 | NULL, HFILL } |
1194 | 14 | }, |
1195 | 14 | { &hf_hiqnet_session_number_flag, |
1196 | 14 | { "Session Number", "hiqnet.flags.session_number", |
1197 | 14 | FT_BOOLEAN, 16, |
1198 | 14 | NULL, HIQNET_SESSION_NUMBER_FLAG, |
1199 | 14 | NULL, HFILL } |
1200 | 14 | }, |
1201 | 14 | { &hf_hiqnet_hopcnt, |
1202 | 14 | { "Hop count", "hiqnet.hc", |
1203 | 14 | FT_UINT8, BASE_DEC, |
1204 | 14 | NULL, 0x0, |
1205 | 14 | NULL, HFILL } |
1206 | 14 | }, |
1207 | 14 | { &hf_hiqnet_seqnum, |
1208 | 14 | { "Sequence number", "hiqnet.seqnum", |
1209 | 14 | FT_UINT16, BASE_DEC, |
1210 | 14 | NULL, 0x0, |
1211 | 14 | NULL, HFILL } |
1212 | 14 | }, |
1213 | 14 | { &hf_hiqnet_errcode, |
1214 | 14 | { "Error code", "hiqnet.errcode", |
1215 | 14 | FT_UINT8, BASE_DEC_HEX, |
1216 | 14 | NULL, 0x0, |
1217 | 14 | NULL, HFILL } |
1218 | 14 | }, |
1219 | 14 | { &hf_hiqnet_errstr, |
1220 | 14 | { "Error string", "hiqnet.errstr", |
1221 | 14 | FT_STRINGZ, BASE_NONE, |
1222 | 14 | NULL, 0x0, |
1223 | 14 | NULL, HFILL } |
1224 | 14 | }, |
1225 | 14 | { &hf_hiqnet_startseqno, |
1226 | 14 | { "Start seq. no.", "hiqnet.ssno", |
1227 | 14 | FT_UINT8, BASE_DEC, |
1228 | 14 | NULL, 0x0, |
1229 | 14 | NULL, HFILL } |
1230 | 14 | }, |
1231 | 14 | { &hf_hiqnet_rembytes, |
1232 | 14 | { "Remaining bytes", "hiqnet.rembytes", |
1233 | 14 | FT_UINT32, BASE_DEC, |
1234 | 14 | NULL, 0x0, |
1235 | 14 | NULL, HFILL } |
1236 | 14 | }, |
1237 | 14 | { &hf_hiqnet_sessnum, |
1238 | 14 | { "Session number", "hiqnet.sessnum", |
1239 | 14 | FT_UINT16, BASE_DEC, |
1240 | 14 | NULL, 0x0, |
1241 | 14 | NULL, HFILL } |
1242 | 14 | }, |
1243 | 14 | { &hf_hiqnet_cost, |
1244 | 14 | { "Cost", "hiqnet.cost", |
1245 | 14 | FT_UINT8, BASE_DEC, |
1246 | 14 | NULL, 0x0, |
1247 | 14 | NULL, HFILL } |
1248 | 14 | }, |
1249 | 14 | { &hf_hiqnet_sernumlen, |
1250 | 14 | { "Serial number length", "hiqnet.sernumlen", |
1251 | 14 | FT_UINT16, BASE_DEC, |
1252 | 14 | NULL, 0x0, |
1253 | 14 | NULL, HFILL } |
1254 | 14 | }, |
1255 | 14 | { &hf_hiqnet_sernum, |
1256 | 14 | { "Serial number", "hiqnet.sernum", |
1257 | 14 | FT_BYTES, BASE_NONE, |
1258 | 14 | NULL, 0x0, |
1259 | 14 | NULL, HFILL } |
1260 | 14 | }, |
1261 | 14 | { &hf_hiqnet_maxmsgsize, |
1262 | 14 | { "Max message size", "hiqnet.maxmsgsize", |
1263 | 14 | FT_UINT32, BASE_DEC, |
1264 | 14 | NULL, 0x0, |
1265 | 14 | NULL, HFILL } |
1266 | 14 | }, |
1267 | 14 | { &hf_hiqnet_keepaliveperiod, |
1268 | 14 | { "Keepalive period (ms)", "hiqnet.keepaliveperiod", |
1269 | 14 | FT_UINT16, BASE_DEC, |
1270 | 14 | NULL, 0x0, |
1271 | 14 | NULL, HFILL } |
1272 | 14 | }, |
1273 | 14 | { &hf_hiqnet_netid, |
1274 | 14 | { "Network ID", "hiqnet.netid", |
1275 | 14 | FT_UINT8, BASE_DEC, |
1276 | 14 | VALS(networknames), 0x0, |
1277 | 14 | NULL, HFILL } |
1278 | 14 | }, |
1279 | 14 | { &hf_hiqnet_macaddr, |
1280 | 14 | { "MAC address", "hiqnet.macaddr", |
1281 | 14 | FT_ETHER, BASE_NONE, |
1282 | 14 | NULL, 0x0, |
1283 | 14 | NULL, HFILL } |
1284 | 14 | }, |
1285 | 14 | { &hf_hiqnet_dhcp, |
1286 | 14 | { "DHCP", "hiqnet.dhcp", |
1287 | 14 | FT_BOOLEAN, BASE_NONE, |
1288 | 14 | NULL, 0x0, |
1289 | 14 | NULL, HFILL } |
1290 | 14 | }, |
1291 | 14 | { &hf_hiqnet_ipaddr, |
1292 | 14 | { "IP Address", "hiqnet.ipaddr", |
1293 | 14 | FT_IPv4, BASE_NONE, |
1294 | 14 | NULL, 0x0, |
1295 | 14 | NULL, HFILL } |
1296 | 14 | }, |
1297 | 14 | { &hf_hiqnet_subnetmsk, |
1298 | 14 | { "Subnet mask", "hiqnet.subnetmsk", |
1299 | 14 | FT_IPv4, BASE_NONE, |
1300 | 14 | NULL, 0x0, |
1301 | 14 | NULL, HFILL } |
1302 | 14 | }, |
1303 | 14 | { &hf_hiqnet_gateway, |
1304 | 14 | { "Gateway", "hiqnet.gateway", |
1305 | 14 | FT_IPv4, BASE_NONE, |
1306 | 14 | NULL, 0x0, |
1307 | 14 | NULL, HFILL } |
1308 | 14 | }, |
1309 | 14 | { &hf_hiqnet_flagmask, |
1310 | 14 | { "Flag mask", "hiqnet.flagmask", |
1311 | 14 | FT_UINT16, BASE_HEX, |
1312 | 14 | NULL, HIQNET_FLAGS_MASK, |
1313 | 14 | NULL, HFILL } |
1314 | 14 | }, |
1315 | 14 | { &hf_hiqnet_paramcount, |
1316 | 14 | { "Parameter count", "hiqnet.paramcount", |
1317 | 14 | FT_UINT16, BASE_DEC, |
1318 | 14 | NULL, 0x0, |
1319 | 14 | NULL, HFILL } |
1320 | 14 | }, |
1321 | 14 | { &hf_hiqnet_paramid, |
1322 | 14 | { "Parameter ID", "hiqnet.paramid", |
1323 | 14 | FT_UINT16, BASE_DEC, |
1324 | 14 | NULL, 0x0, |
1325 | 14 | NULL, HFILL } |
1326 | 14 | }, |
1327 | 14 | { &hf_hiqnet_vdobject, |
1328 | 14 | { "Virtual Device Object", "hiqnet.vdobject", |
1329 | 14 | FT_BYTES, BASE_NONE, |
1330 | 14 | NULL, 0x0, |
1331 | 14 | NULL, HFILL } |
1332 | 14 | }, |
1333 | 14 | { &hf_hiqnet_subtype, |
1334 | 14 | { "Subscription Type (New Style)", "hiqnet.subtype", |
1335 | 14 | FT_UINT8, BASE_DEC, |
1336 | 14 | NULL, HIQNET_SUBSCRIPTION_TYPE_MASK, |
1337 | 14 | NULL, HFILL } |
1338 | 14 | }, |
1339 | | /* FIXME: decode old style subscription type |
1340 | | { &hf_hiqnet_subtypeold, |
1341 | | { "Subscription Type (Old Style)", "hiqnet.subtype", |
1342 | | FT_UINT8, BASE_DEC, |
1343 | | VALS(subscription_types_oldstyle_names), 0x0, |
1344 | | NULL, HFILL } |
1345 | | }, |
1346 | | */ |
1347 | 14 | { &hf_hiqnet_sensrate, |
1348 | 14 | { "Sensor Rate (ms)", "hiqnet.sensrate", |
1349 | 14 | FT_UINT16, BASE_DEC, |
1350 | 14 | NULL, 0x0, |
1351 | 14 | NULL, HFILL } |
1352 | 14 | }, |
1353 | 14 | { &hf_hiqnet_subflags, |
1354 | 14 | { "Subscription Flags", "hiqnet.subflags", |
1355 | 14 | FT_UINT16, BASE_HEX, |
1356 | 14 | NULL, HIQNET_SUBSCRIPTION_FLAGS_MASK, |
1357 | 14 | NULL, HFILL } |
1358 | 14 | }, |
1359 | 14 | { &hf_hiqnet_subcount, |
1360 | 14 | { "No of Subscriptions", "hiqnet.subcount", |
1361 | 14 | FT_UINT16, BASE_DEC, |
1362 | 14 | NULL, 0x0, |
1363 | 14 | NULL, HFILL } |
1364 | 14 | }, |
1365 | 14 | { &hf_hiqnet_pubparmid, |
1366 | 14 | { "Publisher Parameter ID", "hiqnet.pubparmid", |
1367 | 14 | FT_UINT16, BASE_DEC, |
1368 | 14 | NULL, 0x0, |
1369 | 14 | NULL, HFILL } |
1370 | 14 | }, |
1371 | 14 | { &hf_hiqnet_subaddr, |
1372 | 14 | { "Subscriber Address", "hiqnet.subaddr", |
1373 | 14 | FT_BYTES, BASE_NONE, |
1374 | 14 | NULL, 0x0, |
1375 | 14 | NULL, HFILL } |
1376 | 14 | }, |
1377 | 14 | { &hf_hiqnet_subparmid, |
1378 | 14 | { "Subscriber Parameter ID", "hiqnet.subparmid", |
1379 | 14 | FT_UINT16, BASE_DEC, |
1380 | 14 | NULL, 0x0, |
1381 | 14 | NULL, HFILL } |
1382 | 14 | }, |
1383 | 14 | { &hf_hiqnet_reserved0, |
1384 | 14 | { "Reserved", "hiqnet.reserved0", |
1385 | 14 | FT_BYTES, BASE_NONE, |
1386 | 14 | NULL, 0x0, |
1387 | 14 | NULL, HFILL } |
1388 | 14 | }, |
1389 | 14 | { &hf_hiqnet_reserved1, |
1390 | 14 | { "Reserved", "hiqnet.reserved1", |
1391 | 14 | FT_BYTES, BASE_NONE, |
1392 | 14 | NULL, 0x0, |
1393 | 14 | NULL, HFILL } |
1394 | 14 | }, |
1395 | 14 | { &hf_hiqnet_attrcount, |
1396 | 14 | { "Attribute count", "hiqnet.attrcount", |
1397 | 14 | FT_UINT16, BASE_DEC, |
1398 | 14 | NULL, 0x0, |
1399 | 14 | NULL, HFILL } |
1400 | 14 | }, |
1401 | 14 | { &hf_hiqnet_attrid, |
1402 | 14 | { "Attribute ID", "hiqnet.attrid", |
1403 | 14 | FT_UINT16, BASE_DEC, |
1404 | 14 | VALS(device_attributes_names), 0x0, |
1405 | 14 | NULL, HFILL } |
1406 | 14 | }, |
1407 | 14 | { &hf_hiqnet_datatype, |
1408 | 14 | { "Data type", "hiqnet.datatype", |
1409 | 14 | FT_UINT8, BASE_HEX, |
1410 | 14 | VALS(datatypenames), 0x0, |
1411 | 14 | NULL, HFILL } |
1412 | 14 | }, |
1413 | 14 | { &hf_hiqnet_datalen, |
1414 | 14 | { "Data length", "hiqnet.datalen", |
1415 | 14 | FT_UINT16, BASE_DEC, |
1416 | 14 | NULL, 0x0, |
1417 | 14 | NULL, HFILL } |
1418 | 14 | }, |
1419 | 14 | { &hf_hiqnet_byte_value, |
1420 | 14 | { "Value", "hiqnet.byte_value", |
1421 | 14 | FT_INT8, BASE_DEC, |
1422 | 14 | NULL, 0x0, |
1423 | 14 | NULL, HFILL } |
1424 | 14 | }, |
1425 | 14 | { &hf_hiqnet_ubyte_value, |
1426 | 14 | { "Value", "hiqnet.ubyte_value", |
1427 | 14 | FT_UINT8, BASE_DEC_HEX, |
1428 | 14 | NULL, 0x0, |
1429 | 14 | NULL, HFILL } |
1430 | 14 | }, |
1431 | 14 | { &hf_hiqnet_word_value, |
1432 | 14 | { "Value", "hiqnet.word_value", |
1433 | 14 | FT_INT16, BASE_DEC, |
1434 | 14 | NULL, 0x0, |
1435 | 14 | NULL, HFILL } |
1436 | 14 | }, |
1437 | 14 | { &hf_hiqnet_uword_value, |
1438 | 14 | { "Value", "hiqnet.uword_value", |
1439 | 14 | FT_UINT16, BASE_DEC_HEX, |
1440 | 14 | NULL, 0x0, |
1441 | 14 | NULL, HFILL } |
1442 | 14 | }, |
1443 | 14 | { &hf_hiqnet_long_value, |
1444 | 14 | { "Value", "hiqnet.long_value", |
1445 | 14 | FT_INT32, BASE_DEC, |
1446 | 14 | NULL, 0x0, |
1447 | 14 | NULL, HFILL } |
1448 | 14 | }, |
1449 | 14 | { &hf_hiqnet_ulong_value, |
1450 | 14 | { "Value", "hiqnet.ulong_value", |
1451 | 14 | FT_UINT32, BASE_DEC_HEX, |
1452 | 14 | NULL, 0x0, |
1453 | 14 | NULL, HFILL } |
1454 | 14 | }, |
1455 | 14 | { &hf_hiqnet_float32_value, |
1456 | 14 | { "Value", "hiqnet.float32_value", |
1457 | 14 | FT_FLOAT, BASE_NONE, |
1458 | 14 | NULL, 0x0, |
1459 | 14 | NULL, HFILL } |
1460 | 14 | }, |
1461 | 14 | { &hf_hiqnet_float64_value, |
1462 | 14 | { "Value", "hiqnet.float64_value", |
1463 | 14 | FT_DOUBLE, BASE_NONE, |
1464 | 14 | NULL, 0x0, |
1465 | 14 | NULL, HFILL } |
1466 | 14 | }, |
1467 | 14 | { &hf_hiqnet_block_value, |
1468 | 14 | { "Value", "hiqnet.block_value", |
1469 | 14 | FT_BYTES, BASE_NONE, |
1470 | 14 | NULL, 0x0, |
1471 | 14 | NULL, HFILL } |
1472 | 14 | }, |
1473 | | /* Counted *and* null-terminated */ |
1474 | 14 | { &hf_hiqnet_string_value, |
1475 | 14 | { "Value", "hiqnet.string_value", |
1476 | 14 | FT_STRINGZ, BASE_NONE, |
1477 | 14 | NULL, 0x0, |
1478 | 14 | NULL, HFILL } |
1479 | 14 | }, |
1480 | 14 | { &hf_hiqnet_long64_value, |
1481 | 14 | { "Value", "hiqnet.long64_value", |
1482 | 14 | FT_INT64, BASE_DEC, |
1483 | 14 | NULL, 0x0, |
1484 | 14 | NULL, HFILL } |
1485 | 14 | }, |
1486 | 14 | { &hf_hiqnet_ulong64_value, |
1487 | 14 | { "Value", "hiqnet.ulong64_value", |
1488 | 14 | FT_UINT64 , BASE_DEC_HEX, |
1489 | 14 | NULL, 0x0, |
1490 | 14 | NULL, HFILL } |
1491 | 14 | }, |
1492 | 14 | { &hf_hiqnet_wrkgrppath, |
1493 | 14 | { "Workgroup Path", "hiqnet.wrkgrppath", |
1494 | 14 | FT_STRINGZ, BASE_NONE, |
1495 | 14 | NULL, 0x0, |
1496 | 14 | NULL, HFILL } |
1497 | 14 | }, |
1498 | 14 | { &hf_hiqnet_numvds, |
1499 | 14 | { "Number of Virtual Devices", "hiqnet.numvds", |
1500 | 14 | FT_UINT16, BASE_DEC, |
1501 | 14 | NULL, 0x0, |
1502 | 14 | NULL, HFILL } |
1503 | 14 | }, |
1504 | 14 | { &hf_hiqnet_vdaddr, |
1505 | 14 | { "Virtual Device Address", "hiqnet.vdaddr", |
1506 | 14 | FT_UINT8, BASE_DEC, |
1507 | 14 | NULL, 0x0, |
1508 | 14 | NULL, HFILL } |
1509 | 14 | }, |
1510 | 14 | { &hf_hiqnet_vdclassid, |
1511 | 14 | { "Virtual Device Class ID", "hiqnet.vdclassid", |
1512 | 14 | FT_UINT16, BASE_HEX, |
1513 | 14 | NULL, 0x0, |
1514 | 14 | NULL, HFILL } |
1515 | 14 | }, |
1516 | 14 | { &hf_hiqnet_stract, |
1517 | 14 | { "Store Action", "hiqnet.stract", |
1518 | 14 | FT_UINT8, BASE_DEC, |
1519 | 14 | VALS(actionnames), 0x0, |
1520 | 14 | NULL, HFILL } |
1521 | 14 | }, |
1522 | 14 | { &hf_hiqnet_strnum, |
1523 | 14 | { "Store Number", "hiqnet.strnum", |
1524 | 14 | FT_UINT16, BASE_DEC, |
1525 | 14 | NULL, 0x0, |
1526 | 14 | NULL, HFILL } |
1527 | 14 | }, |
1528 | 14 | { &hf_hiqnet_scope, |
1529 | 14 | { "Scope", "hiqnet.scope", |
1530 | 14 | FT_UINT8, BASE_HEX, |
1531 | 14 | NULL, 0x0, |
1532 | 14 | NULL, HFILL } |
1533 | 14 | }, |
1534 | 14 | { &hf_hiqnet_recact, |
1535 | 14 | { "Recall Action", "hiqnet.rec.act", |
1536 | 14 | FT_UINT8, BASE_DEC, |
1537 | 14 | VALS(actionnames), 0x0, |
1538 | 14 | NULL, HFILL } |
1539 | 14 | }, |
1540 | 14 | { &hf_hiqnet_recnum, |
1541 | 14 | { "Recall Number", "hiqnet.recnum", |
1542 | 14 | FT_UINT16, BASE_DEC, |
1543 | 14 | NULL, 0x0, |
1544 | 14 | NULL, HFILL } |
1545 | 14 | }, |
1546 | 14 | { &hf_hiqnet_strlen, |
1547 | 14 | { "String length", "hiqnet.strlen", |
1548 | 14 | FT_UINT16, BASE_DEC, |
1549 | 14 | NULL, 0x0, |
1550 | 14 | NULL, HFILL } |
1551 | 14 | }, |
1552 | 14 | { &hf_hiqnet_time, |
1553 | 14 | { "Locate time (ms)", "hiqnet.time", |
1554 | 14 | FT_UINT16, BASE_DEC, |
1555 | 14 | VALS(timenames), 0x0, |
1556 | 14 | NULL, HFILL } |
1557 | 14 | }, |
1558 | 14 | { &hf_hiqnet_maxdatasize, |
1559 | 14 | { "Maximum Data Size", "hiqnet.maxdatasize", |
1560 | 14 | FT_UINT16, BASE_DEC, |
1561 | 14 | NULL, 0x0, |
1562 | 14 | NULL, HFILL } |
1563 | 14 | }, |
1564 | 14 | { &hf_hiqnet_catfilter, |
1565 | 14 | { "Category Filter", "hiqnet.catfilter", |
1566 | 14 | FT_UINT32, BASE_HEX, |
1567 | 14 | NULL, HIQNET_CATEGORIES_MASK, |
1568 | 14 | NULL, HFILL } |
1569 | 14 | }, |
1570 | 14 | { &hf_hiqnet_app_cat, |
1571 | 14 | { "Application", "hiqnet.appcat", |
1572 | 14 | FT_BOOLEAN, 32, |
1573 | 14 | NULL, HIQNET_APPLICATION_CAT, |
1574 | 14 | NULL, HFILL } |
1575 | 14 | }, |
1576 | 14 | { &hf_hiqnet_conf_cat, |
1577 | 14 | { "Configuration", "hiqnet.confcat", |
1578 | 14 | FT_BOOLEAN, 32, |
1579 | 14 | NULL, HIQNET_CONF_CAT, |
1580 | 14 | NULL, HFILL } |
1581 | 14 | }, |
1582 | 14 | { &hf_hiqnet_audionet_cat, |
1583 | 14 | { "Audio Network", "hiqnet.audionetcat", |
1584 | 14 | FT_BOOLEAN, 32, |
1585 | 14 | NULL, HIQNET_AUDIONET_CAT, |
1586 | 14 | NULL, HFILL } |
1587 | 14 | }, |
1588 | 14 | { &hf_hiqnet_ctrlnet_cat, |
1589 | 14 | { "Control Network", "hiqnet.ctrlnetcat", |
1590 | 14 | FT_BOOLEAN, 32, |
1591 | 14 | NULL, HIQNET_CTRLNET_CAT, |
1592 | 14 | NULL, HFILL } |
1593 | 14 | }, |
1594 | 14 | { &hf_hiqnet_vendnet_cat, |
1595 | 14 | { "Vendor Network", "hiqnet.vendnetcat", |
1596 | 14 | FT_BOOLEAN, 32, |
1597 | 14 | NULL, HIQNET_VENDNET_CAT, |
1598 | 14 | NULL, HFILL } |
1599 | 14 | }, |
1600 | 14 | { &hf_hiqnet_startup_cat, |
1601 | 14 | { "Startup", "hiqnet.startupcat", |
1602 | 14 | FT_BOOLEAN, 32, |
1603 | 14 | NULL, HIQNET_STARTUP_CAT, |
1604 | 14 | NULL, HFILL } |
1605 | 14 | }, |
1606 | 14 | { &hf_hiqnet_dsp_cat, |
1607 | 14 | { "DSP", "hiqnet.dspcat", |
1608 | 14 | FT_BOOLEAN, 32, |
1609 | 14 | NULL, HIQNET_DSP_CAT, |
1610 | 14 | NULL, HFILL } |
1611 | 14 | }, |
1612 | 14 | { &hf_hiqnet_misc_cat, |
1613 | 14 | { "Miscellaneous", "hiqnet.misccat", |
1614 | 14 | FT_BOOLEAN, 32, |
1615 | 14 | NULL, HIQNET_MISC_CAT, |
1616 | 14 | NULL, HFILL } |
1617 | 14 | }, |
1618 | 14 | { &hf_hiqnet_ctrlog_cat, |
1619 | 14 | { "Control Logic", "hiqnet.crtllogcat", |
1620 | 14 | FT_BOOLEAN, 32, |
1621 | 14 | NULL, HIQNET_CTRLLOG_CAT, |
1622 | 14 | NULL, HFILL } |
1623 | 14 | }, |
1624 | 14 | { &hf_hiqnet_foreignproto_cat, |
1625 | 14 | { "Foreign Protocol", "hiqnet.foreignprotocat", |
1626 | 14 | FT_BOOLEAN, 32, |
1627 | 14 | NULL, HIQNET_FOREIGNPROTO_CAT, |
1628 | 14 | NULL, HFILL } |
1629 | 14 | }, |
1630 | 14 | { &hf_hiqnet_digio_cat, |
1631 | 14 | { "Digital I/O", "hiqnet.digiocat", |
1632 | 14 | FT_BOOLEAN, 32, |
1633 | 14 | NULL, HIQNET_DIGIO_CAT, |
1634 | 14 | NULL, HFILL } |
1635 | 14 | }, |
1636 | 14 | { &hf_hiqnet_ctrlsurf_cat, |
1637 | 14 | { "Control Surface", "hiqnet.ctrlsurfcat", |
1638 | 14 | FT_BOOLEAN, 32, |
1639 | 14 | NULL, HIQNET_CTRLSURF_CAT, |
1640 | 14 | NULL, HFILL } |
1641 | 14 | }, |
1642 | 14 | { &hf_hiqnet_entrieslen, |
1643 | 14 | { "Number of Entries", "hiqnet.entrieslen", |
1644 | 14 | FT_UINT16, BASE_DEC, |
1645 | 14 | NULL, 0x0, |
1646 | 14 | NULL, HFILL } |
1647 | 14 | }, |
1648 | 14 | { &hf_hiqnet_category, |
1649 | 14 | { "Category", "hiqnet.cat", |
1650 | 14 | FT_UINT16, BASE_HEX, |
1651 | 14 | VALS(eventcategorynames), 0x0, |
1652 | 14 | NULL, HFILL } |
1653 | 14 | }, |
1654 | 14 | { &hf_hiqnet_eventid, |
1655 | 14 | { "Event ID", "hiqnet.eventid", |
1656 | 14 | FT_UINT16, BASE_DEC, |
1657 | 14 | VALS(eventidnames), 0x0, |
1658 | 14 | NULL, HFILL } |
1659 | 14 | }, |
1660 | 14 | { &hf_hiqnet_priority, |
1661 | 14 | { "Priority", "hiqnet.priority", |
1662 | 14 | FT_UINT8, BASE_DEC, |
1663 | 14 | VALS(prioritynames), 0x0, |
1664 | 14 | NULL, HFILL } |
1665 | 14 | }, |
1666 | 14 | { &hf_hiqnet_eventseqnum, |
1667 | 14 | { "Sequence Number", "hiqnet.eventseqnum", |
1668 | 14 | FT_UINT32, BASE_DEC, |
1669 | 14 | NULL, 0x0, |
1670 | 14 | NULL, HFILL } |
1671 | 14 | }, |
1672 | 14 | { &hf_hiqnet_eventtime, |
1673 | 14 | { "Time", "hiqnet.eventtime", |
1674 | 14 | FT_STRING, BASE_NONE, |
1675 | 14 | NULL, 0x0, |
1676 | 14 | NULL, HFILL } |
1677 | 14 | }, |
1678 | 14 | { &hf_hiqnet_eventdate, |
1679 | 14 | { "Date", "hiqnet.eventdate", |
1680 | 14 | FT_STRING, BASE_NONE, |
1681 | 14 | NULL, 0x0, |
1682 | 14 | NULL, HFILL } |
1683 | 14 | }, |
1684 | 14 | { &hf_hiqnet_eventinfo, |
1685 | 14 | { "Information", "hiqnet.information", |
1686 | 14 | FT_STRING, BASE_NONE, |
1687 | 14 | NULL, 0x0, |
1688 | 14 | NULL, HFILL } |
1689 | 14 | }, |
1690 | 14 | { &hf_hiqnet_eventadddata, |
1691 | 14 | { "Additional Data", "hiqnet.eventadddata", |
1692 | 14 | FT_BYTES, BASE_NONE, |
1693 | 14 | NULL, 0x0, |
1694 | 14 | NULL, HFILL } |
1695 | 14 | }, |
1696 | 14 | { &hf_hiqnet_objcount, |
1697 | 14 | { "Object Count", "hiqnet.objcount", |
1698 | 14 | FT_UINT16, BASE_DEC, |
1699 | 14 | NULL, 0x0, |
1700 | 14 | NULL, HFILL } |
1701 | 14 | }, |
1702 | 14 | { &hf_hiqnet_paramval, |
1703 | 14 | { "Parameter Value (%)", "hiqnet.paramval", |
1704 | 14 | FT_INT16, BASE_DEC, |
1705 | 14 | NULL, 0x0, |
1706 | 14 | NULL, HFILL } |
1707 | 14 | }, |
1708 | 14 | { &hf_hiqnet_ifacecount, |
1709 | 14 | { "Interface Count", "hiqnet.ifacecount", |
1710 | 14 | FT_UINT16, BASE_DEC, |
1711 | 14 | NULL, 0x0, |
1712 | 14 | NULL, HFILL } |
1713 | 14 | }, |
1714 | 14 | { &hf_hiqnet_comid, |
1715 | 14 | { "Com Port Identifier", "hiqnet.comid", |
1716 | 14 | FT_UINT8, BASE_DEC, |
1717 | 14 | NULL, 0x0, |
1718 | 14 | NULL, HFILL } |
1719 | 14 | }, |
1720 | 14 | { &hf_hiqnet_baudrate, |
1721 | 14 | { "Baud Rate", "hiqnet.baudrate", |
1722 | 14 | FT_UINT32, BASE_DEC, |
1723 | 14 | NULL, 0x0, |
1724 | 14 | NULL, HFILL } |
1725 | 14 | }, |
1726 | 14 | { &hf_hiqnet_parity, |
1727 | 14 | { "Parity", "hiqnet.parity", |
1728 | 14 | FT_UINT8, BASE_DEC, |
1729 | 14 | VALS(paritynames), 0x0, |
1730 | 14 | NULL, HFILL } |
1731 | 14 | }, |
1732 | 14 | { &hf_hiqnet_stopbits, |
1733 | 14 | { "Stop Bits", "hiqnet.stopbits", |
1734 | 14 | FT_UINT8, BASE_DEC, |
1735 | 14 | VALS(stopbitsnames), 0x0, |
1736 | 14 | NULL, HFILL } |
1737 | 14 | }, |
1738 | 14 | { &hf_hiqnet_databits, |
1739 | 14 | { "Data Bits", "hiqnet.databits", |
1740 | 14 | FT_UINT8, BASE_DEC, |
1741 | 14 | NULL, 0x0, |
1742 | 14 | NULL, HFILL } |
1743 | 14 | }, |
1744 | 14 | { &hf_hiqnet_flowcontrol, |
1745 | 14 | { "Flowcontrol", "hiqnet.flowcontrol", |
1746 | 14 | FT_UINT8, BASE_DEC, |
1747 | 14 | VALS(flowcontrolnames), 0x0, |
1748 | 14 | NULL, HFILL } |
1749 | 14 | }, |
1750 | 14 | { &hf_hiqnet_devaddr, |
1751 | 14 | { "Device Address", "hiqnet.device", |
1752 | 14 | FT_UINT16, BASE_DEC_HEX, |
1753 | 14 | NULL, 0x0, |
1754 | 14 | NULL, HFILL } |
1755 | 14 | }, |
1756 | 14 | { &hf_hiqnet_newdevaddr, |
1757 | 14 | { "New Device Address", "hiqnet.device", |
1758 | 14 | FT_UINT16, BASE_DEC_HEX, |
1759 | 14 | NULL, 0x0, |
1760 | 14 | NULL, HFILL } |
1761 | 14 | } |
1762 | 14 | }; |
1763 | | |
1764 | | /* Setup protocol subtree array */ |
1765 | 14 | static int *ett[] = { |
1766 | 14 | &ett_hiqnet, |
1767 | 14 | &ett_hiqnet_flags, |
1768 | 14 | &ett_hiqnet_cats |
1769 | 14 | }; |
1770 | | |
1771 | 14 | static ei_register_info ei[] = { |
1772 | 14 | { &ei_hiqnet_datatype, { "hiqnet.datatype.invalid", PI_PROTOCOL, PI_WARN, "Invalid datatype", EXPFILL }}, |
1773 | 14 | }; |
1774 | | |
1775 | 14 | expert_module_t* expert_hiqnet; |
1776 | | |
1777 | 14 | proto_hiqnet = proto_register_protocol ("Harman HiQnet", "HiQnet", "hiqnet"); |
1778 | | |
1779 | 14 | proto_register_field_array(proto_hiqnet, hf, array_length(hf)); |
1780 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
1781 | 14 | expert_hiqnet = expert_register_protocol(proto_hiqnet); |
1782 | 14 | expert_register_field_array(expert_hiqnet, ei, array_length(ei)); |
1783 | | |
1784 | 14 | hiqnet_udp_handle = register_dissector("hiqnet.udp", dissect_hiqnet_udp, proto_hiqnet); |
1785 | 14 | hiqnet_tcp_handle = register_dissector("hiqnet.tcp", dissect_hiqnet_tcp, proto_hiqnet); |
1786 | 14 | } |
1787 | | |
1788 | | |
1789 | | void |
1790 | | proto_reg_handoff_hiqnet(void) |
1791 | 14 | { |
1792 | 14 | dissector_add_uint_with_preference("udp.port", HIQNET_PORT, hiqnet_udp_handle); |
1793 | 14 | dissector_add_uint_with_preference("tcp.port", HIQNET_PORT, hiqnet_tcp_handle); |
1794 | 14 | } |
1795 | | |
1796 | | /* |
1797 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
1798 | | * |
1799 | | * Local variables: |
1800 | | * c-basic-offset: 4 |
1801 | | * indent-tabs-mode: nil |
1802 | | * End: |
1803 | | * |
1804 | | * vi: set shiftwidth=4 expandtab: |
1805 | | * :indentSize=4:noTabs=true: |
1806 | | */ |