1 /* packet-adwin-config.c
2 * Routines for ADwin configuration protocol dissection
3 * Copyright 2010, Thomas Boehne <TBoehne[AT]ADwin.de>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
17 #include "packet-tcp.h"
19 /* Forward declarations */
20 void proto_register_adwin_config(void);
21 void proto_reg_handoff_adwin_config(void);
23 /* This is registered to a different protocol */
24 #define ADWIN_CONFIGURATION_PORT 7000
26 #define UDPStatusLENGTH 52
27 #define UDPExtStatusLENGTH 432
28 #define UDPMessageLENGTH 100
29 #define UDPMessageLENGTH_wrong 104
30 #define UDPInitAckLENGTH 96
31 #define UDPIXP425FlashUpdateLENGTH 92
32 #define UDPOutLENGTH 22
34 #define STATUS_WITH_BOOTLOADER 0x00000001
35 #define STATUS_REPROGRAMMABLE 0x00000002
36 #define STATUS_CONFIGURABLE 0x00000004
37 #define STATUS_BOOTLOADER_BOOTS 0x00000008
38 #define STATUS_BOOTLOADER_REPROGRAMMABLE 0x00000010
39 #define STATUS_BOOTLOADER_RECEIVES_DATA 0x00000020
40 #define STATUS_BOOTLOADER_REPROGRAMMING_DONE 0x00000040
41 #define STATUS_WITH_EEPROM_SUPPORT 0x00000080
43 static const value_string pattern_mapping
[] = {
44 { 0x12343210, "Reset reset/socket counters"},
45 { 0x73241291, "Scan Netarm + IXP"},
46 { 0x37241291, "Scan IXP"},
50 static const value_string config_command_mapping
[] = {
51 { 100, "Apply all config values except MAC if MAC matches."},
52 { 105, "Apply all config values including MAC if current MAC is 00:50:C2:0A:22:EE."},
53 { 110, "Apply all config values including MAC."},
54 { 120, "Enable/Disable bootloader if MAC matches."},
55 { 130, "Write extended hardware info to EEPROM."},
59 static const string_string system_type_mapping
[] = {
68 static const string_string processor_type_mapping
[] = {
75 /* Initialize the protocol and registered fields */
76 static int proto_adwin_config
;
78 static int hf_adwin_config_bootloader
;
79 static int hf_adwin_config_command
;
80 static int hf_adwin_config_data
;
81 static int hf_adwin_config_date
;
82 static int hf_adwin_config_description
;
83 static int hf_adwin_config_dhcp
;
84 static int hf_adwin_config_filename
;
85 static int hf_adwin_config_filesize
;
86 static int hf_adwin_config_filetime
;
87 static int hf_adwin_config_updatetime
;
88 static int hf_adwin_config_gateway
;
89 static int hf_adwin_config_mac
;
90 static int hf_adwin_config_netmask_count
;
91 static int hf_adwin_config_netmask
;
92 static int hf_adwin_config_password
;
93 static int hf_adwin_config_path
;
94 static int hf_adwin_config_pattern
;
95 static int hf_adwin_config_port16
;
96 static int hf_adwin_config_port32
;
97 static int hf_adwin_config_reboot
;
98 static int hf_adwin_config_scan_id
;
99 static int hf_adwin_config_reply_broadcast
;
100 static int hf_adwin_config_revision
;
101 static int hf_adwin_config_processor_type_raw
;
102 static int hf_adwin_config_system_type_raw
;
103 static int hf_adwin_config_processor_type
;
104 static int hf_adwin_config_system_type
;
105 static int hf_adwin_config_server_ip
;
106 static int hf_adwin_config_server_version
;
107 static int hf_adwin_config_server_version_beta
;
108 static int hf_adwin_config_socketshutdowns
;
109 static int hf_adwin_config_status
;
110 static int hf_adwin_config_status_bootloader
;
111 static int hf_adwin_config_status_reprogrammable
;
112 static int hf_adwin_config_status_configurable
;
113 static int hf_adwin_config_status_bootloader_boots
;
114 static int hf_adwin_config_status_bootloader_reprogrammable
;
115 static int hf_adwin_config_status_bootloader_receive
;
116 static int hf_adwin_config_status_bootloader_reprogramming_done
;
117 static int hf_adwin_config_status_eeprom_support
;
118 static int hf_adwin_config_stream_length
;
119 static int hf_adwin_config_eeprom_support
;
120 static int hf_adwin_config_timeout
;
121 static int hf_adwin_config_timerresets
;
122 static int hf_adwin_config_disk_free
;
123 static int hf_adwin_config_disk_size
;
124 static int hf_adwin_config_unused
;
125 static int hf_adwin_config_version
;
126 static int hf_adwin_config_xilinx_version
;
128 /* Initialize the subtree pointers */
129 static int ett_adwin_config
;
130 static int ett_adwin_config_status
;
131 static int ett_adwin_config_debug
;
134 dissect_UDPStatus(tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
136 proto_tree
*debug_tree
;
139 static int * const status_flags
[] = {
140 &hf_adwin_config_status_bootloader
,
141 &hf_adwin_config_status_reprogrammable
,
142 &hf_adwin_config_status_configurable
,
143 &hf_adwin_config_status_bootloader_boots
,
144 &hf_adwin_config_status_bootloader_reprogrammable
,
145 &hf_adwin_config_status_bootloader_receive
,
146 &hf_adwin_config_status_bootloader_reprogramming_done
,
147 &hf_adwin_config_status_eeprom_support
,
154 dt
= proto_tree_add_item(adwin_tree
, proto_adwin_config
, tvb
, 0, -1, ENC_NA
);
155 debug_tree
= proto_item_add_subtree(dt
, ett_adwin_config_debug
);
156 proto_item_set_text(dt
, "ADwin Debug information");
158 proto_tree_add_item(adwin_tree
, hf_adwin_config_pattern
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
159 proto_tree_add_item(adwin_tree
, hf_adwin_config_version
, tvb
, 4, 4, ENC_BIG_ENDIAN
);
161 proto_tree_add_bitmask(adwin_tree
, tvb
, 8, hf_adwin_config_status
, ett_adwin_config_status
, status_flags
, ENC_BIG_ENDIAN
);
163 proto_tree_add_item(adwin_tree
, hf_adwin_config_server_version_beta
, tvb
, 12, 2, ENC_BIG_ENDIAN
);
164 proto_tree_add_item(adwin_tree
, hf_adwin_config_server_version
, tvb
, 14, 2, ENC_BIG_ENDIAN
);
165 proto_tree_add_item(adwin_tree
, hf_adwin_config_xilinx_version
, tvb
, 16, 4, ENC_BIG_ENDIAN
);
166 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 20, 6, ENC_NA
);
167 proto_tree_add_item(debug_tree
, hf_adwin_config_unused
, tvb
, 26, 2, ENC_NA
);
168 proto_tree_add_item(adwin_tree
, hf_adwin_config_port16
, tvb
, 28, 2, ENC_BIG_ENDIAN
);
169 proto_tree_add_item(adwin_tree
, hf_adwin_config_dhcp
, tvb
, 30, 1, ENC_LITTLE_ENDIAN
);
170 proto_tree_add_item(adwin_tree
, hf_adwin_config_netmask_count
, tvb
, 31, 1, ENC_LITTLE_ENDIAN
);
171 proto_tree_add_item(adwin_tree
, hf_adwin_config_gateway
, tvb
, 32, 4, ENC_BIG_ENDIAN
);
172 proto_tree_add_item(debug_tree
, hf_adwin_config_unused
, tvb
, 36, 11, ENC_NA
);
173 proto_tree_add_item(adwin_tree
, hf_adwin_config_reply_broadcast
, tvb
, 47, 1, ENC_LITTLE_ENDIAN
);
174 proto_tree_add_item(adwin_tree
, hf_adwin_config_scan_id
, tvb
, 48, 4, ENC_LITTLE_ENDIAN
);
178 dissect_UDPExtStatus(packet_info
*pinfo
, tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
180 const char *processor_type
, *system_type
;
185 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 0, 6, ENC_NA
);
186 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 6, 2, ENC_NA
);
187 proto_tree_add_item(adwin_tree
, hf_adwin_config_pattern
, tvb
, 8, 4, ENC_BIG_ENDIAN
);
188 proto_tree_add_item(adwin_tree
, hf_adwin_config_version
, tvb
, 12, 4, ENC_BIG_ENDIAN
);
189 proto_tree_add_item(adwin_tree
, hf_adwin_config_description
, tvb
, 16, 16, ENC_ASCII
);
190 proto_tree_add_item(adwin_tree
, hf_adwin_config_timerresets
, tvb
, 32, 4, ENC_BIG_ENDIAN
);
191 proto_tree_add_item(adwin_tree
, hf_adwin_config_socketshutdowns
, tvb
, 36, 4, ENC_BIG_ENDIAN
);
192 proto_tree_add_item(adwin_tree
, hf_adwin_config_disk_free
, tvb
, 40, 4, ENC_BIG_ENDIAN
);
193 proto_tree_add_item(adwin_tree
, hf_adwin_config_disk_size
, tvb
, 44, 4, ENC_BIG_ENDIAN
);
194 proto_tree_add_item(adwin_tree
, hf_adwin_config_date
, tvb
, 48, 8, ENC_ASCII
);
195 proto_tree_add_item(adwin_tree
, hf_adwin_config_revision
, tvb
, 56, 8, ENC_ASCII
);
197 /* add the processor type raw values to the tree, to allow filtering */
198 proto_tree_add_item(adwin_tree
, hf_adwin_config_processor_type_raw
, tvb
, 64, 2, ENC_ASCII
);
199 /* add the processor type as a pretty printed string */
200 processor_type
= tvb_get_string_enc(pinfo
->pool
, tvb
, 64, 2, ENC_ASCII
|ENC_NA
);
201 processor_type
= str_to_str(processor_type
, processor_type_mapping
, "Unknown (%s)");
202 proto_tree_add_string(adwin_tree
, hf_adwin_config_processor_type
, tvb
, 64, 2, processor_type
);
204 /* add system type as raw value and pretty printed string */
205 proto_tree_add_item(adwin_tree
, hf_adwin_config_system_type_raw
, tvb
, 66, 2, ENC_ASCII
);
206 system_type
= tvb_get_string_enc(pinfo
->pool
, tvb
, 66, 2, ENC_ASCII
|ENC_NA
);
207 system_type
= str_to_str(system_type
, system_type_mapping
, "Unknown (%s)");
208 proto_tree_add_string(adwin_tree
, hf_adwin_config_system_type
, tvb
, 66, 2, system_type
);
210 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 68, 364, ENC_NA
);
214 dissect_UDPMessage(packet_info
*pinfo
, tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
216 const char *processor_type
, *system_type
;
221 proto_tree_add_item(adwin_tree
, hf_adwin_config_command
, tvb
, 0, 4, ENC_LITTLE_ENDIAN
);
222 proto_tree_add_item(adwin_tree
, hf_adwin_config_version
, tvb
, 4, 4, ENC_LITTLE_ENDIAN
);
223 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 8, 6, ENC_NA
);
224 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 14, 2, ENC_NA
);
225 proto_tree_add_item(adwin_tree
, hf_adwin_config_server_ip
, tvb
, 16, 4, ENC_LITTLE_ENDIAN
);
226 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 20, 4, ENC_NA
);
227 proto_tree_add_item(adwin_tree
, hf_adwin_config_netmask
, tvb
, 24, 4, ENC_LITTLE_ENDIAN
);
228 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 28, 4, ENC_NA
);
229 proto_tree_add_item(adwin_tree
, hf_adwin_config_gateway
, tvb
, 32, 4, ENC_LITTLE_ENDIAN
);
230 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 36, 4, ENC_NA
);
231 proto_tree_add_item(adwin_tree
, hf_adwin_config_dhcp
, tvb
, 40, 4, ENC_LITTLE_ENDIAN
);
232 proto_tree_add_item(adwin_tree
, hf_adwin_config_port32
, tvb
, 44, 4, ENC_LITTLE_ENDIAN
);
233 proto_tree_add_item(adwin_tree
, hf_adwin_config_password
, tvb
, 48, 10, ENC_ASCII
);
234 proto_tree_add_item(adwin_tree
, hf_adwin_config_bootloader
, tvb
, 58, 1, ENC_LITTLE_ENDIAN
);
235 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 59, 5, ENC_NA
);
236 proto_tree_add_item(adwin_tree
, hf_adwin_config_description
, tvb
, 64, 16, ENC_ASCII
);
237 proto_tree_add_item(adwin_tree
, hf_adwin_config_date
, tvb
, 80, 8, ENC_ASCII
);
238 proto_tree_add_item(adwin_tree
, hf_adwin_config_revision
, tvb
, 88, 8, ENC_ASCII
);
240 /* add the processor type raw values to the tree, to allow filtering */
241 proto_tree_add_item(adwin_tree
, hf_adwin_config_processor_type_raw
, tvb
, 96, 2, ENC_ASCII
);
242 /* add the processor type as a pretty printed string */
243 processor_type
= tvb_get_string_enc(pinfo
->pool
, tvb
, 96, 2, ENC_ASCII
|ENC_NA
);
244 processor_type
= str_to_str(processor_type
, processor_type_mapping
, "Unknown");
245 proto_tree_add_string(adwin_tree
, hf_adwin_config_processor_type
, tvb
, 96, 2, processor_type
);
247 /* add system type as raw value and pretty printed string */
248 proto_tree_add_item(adwin_tree
, hf_adwin_config_system_type_raw
, tvb
, 98, 2, ENC_ASCII
);
249 system_type
= tvb_get_string_enc(pinfo
->pool
, tvb
, 98, 2, ENC_ASCII
|ENC_NA
);
250 system_type
= str_to_str(system_type
, system_type_mapping
, "Unknown");
251 proto_tree_add_string(adwin_tree
, hf_adwin_config_system_type
, tvb
, 98, 2, system_type
);
255 dissect_UDPInitAck(tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
261 proto_tree_add_item(adwin_tree
, hf_adwin_config_pattern
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
262 proto_tree_add_item(adwin_tree
, hf_adwin_config_reboot
, tvb
, 4, 4, ENC_LITTLE_ENDIAN
);
263 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 8, 6, ENC_NA
);
264 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 14, 2, ENC_NA
);
265 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 16, 80, ENC_NA
);
269 dissect_UDPIXP425FlashUpdate(tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
275 proto_tree_add_item(adwin_tree
, hf_adwin_config_pattern
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
276 proto_tree_add_item(adwin_tree
, hf_adwin_config_version
, tvb
, 4, 4, ENC_BIG_ENDIAN
);
277 proto_tree_add_item(adwin_tree
, hf_adwin_config_scan_id
, tvb
, 8, 4, ENC_BIG_ENDIAN
);
278 proto_tree_add_item(adwin_tree
, hf_adwin_config_status
, tvb
, 12, 4, ENC_BIG_ENDIAN
);
279 proto_tree_add_item(adwin_tree
, hf_adwin_config_timeout
, tvb
, 16, 4, ENC_BIG_ENDIAN
);
280 proto_tree_add_item(adwin_tree
, hf_adwin_config_filename
, tvb
, 20, 24, ENC_ASCII
);
281 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 44, 6, ENC_NA
);
282 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, 50, 42, ENC_NA
);
286 dissect_UDPOut(tvbuff_t
*tvb
, proto_tree
*adwin_tree
)
292 proto_tree_add_item(adwin_tree
, hf_adwin_config_status
, tvb
, 0, 4, ENC_LITTLE_ENDIAN
);
293 proto_tree_add_item(adwin_tree
, hf_adwin_config_mac
, tvb
, 4, 6, ENC_NA
);
294 proto_tree_add_item(adwin_tree
, hf_adwin_config_netmask
, tvb
, 10, 4, ENC_LITTLE_ENDIAN
);
295 proto_tree_add_item(adwin_tree
, hf_adwin_config_gateway
, tvb
, 14, 4, ENC_BIG_ENDIAN
);
296 proto_tree_add_item(adwin_tree
, hf_adwin_config_dhcp
, tvb
, 18, 2, ENC_LITTLE_ENDIAN
);
297 proto_tree_add_item(adwin_tree
, hf_adwin_config_port16
, tvb
, 20, 2, ENC_BIG_ENDIAN
);
301 get_adwin_TCPUpdate_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
,
302 int offset
, void *data _U_
)
305 * Return the length of the packet. (Doesn't include the length field itself)
307 return tvb_get_ntohl(tvb
, offset
);
311 dissect_TCPFlashUpdate(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
313 proto_tree
*adwin_tree
;
318 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ADwin Config");
319 col_set_str(pinfo
->cinfo
, COL_INFO
, "TCPFlashUpdate");
321 ti
= proto_tree_add_item(tree
, proto_adwin_config
, tvb
, 0, -1, ENC_NA
);
322 adwin_tree
= proto_item_add_subtree(ti
, ett_adwin_config
);
324 proto_tree_add_item(adwin_tree
, hf_adwin_config_stream_length
, tvb
, 0, 4, ENC_BIG_ENDIAN
);
326 length
= tvb_strnlen(tvb
, offset
, -1) + 1;
327 filename
= tvb_get_string_enc(pinfo
->pool
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
328 if (strncmp(filename
, "eeprom_on", length
) == 0) {
329 proto_tree_add_boolean(adwin_tree
, hf_adwin_config_eeprom_support
, tvb
, offset
, length
, true);
330 return offset
+length
;
332 if (strncmp(filename
, "eeprom_off", length
) == 0) {
333 proto_tree_add_boolean(adwin_tree
, hf_adwin_config_eeprom_support
, tvb
, offset
, length
, false);
334 return offset
+length
;
336 proto_tree_add_item(adwin_tree
, hf_adwin_config_filename
, tvb
, 4, length
, ENC_ASCII
);
338 length
= tvb_strnlen(tvb
, 4 + length
, -1) + 1;
339 proto_tree_add_item(adwin_tree
, hf_adwin_config_path
, tvb
, offset
, length
, ENC_ASCII
);
341 proto_tree_add_item(adwin_tree
, hf_adwin_config_filesize
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
343 proto_tree_add_item(adwin_tree
, hf_adwin_config_filetime
, tvb
, offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
345 proto_tree_add_item(adwin_tree
, hf_adwin_config_updatetime
, tvb
, offset
, 4, ENC_TIME_SECS
|ENC_BIG_ENDIAN
);
347 proto_tree_add_item(adwin_tree
, hf_adwin_config_unused
, tvb
, offset
, 128, ENC_NA
);
349 length
= tvb_captured_length_remaining(tvb
, offset
);
350 proto_tree_add_item(adwin_tree
, hf_adwin_config_data
, tvb
, offset
, length
, ENC_NA
);
352 return tvb_captured_length(tvb
);
355 /* 00:50:c2:0a:2*:** */
356 static const unsigned char mac_iab_start
[] = { 0x00, 0x50, 0xc2, 0x0a, 0x20, 0x00 };
357 static const unsigned char mac_iab_end
[] = { 0x00, 0x50, 0xc2, 0x0a, 0x2f, 0xff };
359 /* 00:22:71:**:**:** */
360 static const unsigned char mac_oui_start
[] = { 0x00, 0x22, 0x71, 0x00, 0x00, 0x00 };
361 static const unsigned char mac_oui_end
[] = { 0x00, 0x22, 0x71, 0xff, 0xff, 0xff };
363 /* ff:ff:ff:ff:ff:ff */
364 static const unsigned char mac_broadcast
[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
366 /* return true if mac is in mac address range assigned to ADwin or if
367 * mac is broadcast */
369 is_adwin_mac_or_broadcast(address mac
)
371 if (mac
.type
!= AT_ETHER
)
374 if (mac
.len
!= 6) /* length of MAC address */
377 if ((memcmp(mac
.data
, mac_iab_start
, mac
.len
) >= 0) &&
378 (memcmp(mac
.data
, mac_iab_end
, mac
.len
) <= 0))
381 if ((memcmp(mac
.data
, mac_oui_start
, mac
.len
) >= 0) &&
382 (memcmp(mac
.data
, mac_oui_end
, mac
.len
) <= 0))
385 /* adwin configuration protocol uses MAC broadcasts for
387 if (memcmp(mac
.data
, mac_broadcast
, mac
.len
) == 0)
394 /* Here we determine which type of packet is sent by looking at its
395 size. Let's hope that future ADwin packets always differ in size.
396 They probably will, since the server classifies the packets
397 according to their sizes, too. */
399 static const value_string length_mapping
[] = {
400 { UDPStatusLENGTH
, "UDPStatus" },
401 { UDPExtStatusLENGTH
, "UDPExtStatus" },
402 { UDPMessageLENGTH
, "UDPMessage" },
403 { UDPMessageLENGTH_wrong
, "UDPMessage (broken - upgrade ADConfig!)" },
404 { UDPInitAckLENGTH
, "UDPInitAck" },
405 { UDPIXP425FlashUpdateLENGTH
, "UDPIXP425FlashUpdate" },
406 { UDPOutLENGTH
, "UDPOut" },
411 dissect_adwin_config_udp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
414 proto_tree
*adwin_config_tree
;
417 length
= tvb_reported_length(tvb
);
419 if(!(pinfo
->srcport
== ADWIN_CONFIGURATION_PORT
420 || pinfo
->destport
== ADWIN_CONFIGURATION_PORT
))
423 if (!(length
== UDPStatusLENGTH
424 || length
== UDPExtStatusLENGTH
425 || length
== UDPMessageLENGTH
426 || length
== UDPMessageLENGTH_wrong
427 || length
== UDPInitAckLENGTH
428 || length
== UDPIXP425FlashUpdateLENGTH
429 || length
== UDPOutLENGTH
))
432 if (! (is_adwin_mac_or_broadcast(pinfo
->dl_src
) || is_adwin_mac_or_broadcast(pinfo
->dl_dst
)))
435 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ADwin Config");
436 col_clear(pinfo
->cinfo
, COL_INFO
);
438 ti
= proto_tree_add_item(tree
, proto_adwin_config
, tvb
, 0, -1, ENC_NA
);
439 adwin_config_tree
= proto_item_add_subtree(ti
, ett_adwin_config
);
442 case UDPStatusLENGTH
:
443 dissect_UDPStatus(tvb
, adwin_config_tree
);
445 case UDPExtStatusLENGTH
:
446 dissect_UDPExtStatus(pinfo
, tvb
, adwin_config_tree
);
448 case UDPMessageLENGTH
:
449 dissect_UDPMessage(pinfo
, tvb
, adwin_config_tree
);
451 case UDPMessageLENGTH_wrong
: /* incorrect packet length */
452 /* formerly used by adconfig */
453 dissect_UDPMessage(pinfo
, tvb
, adwin_config_tree
);
455 case UDPInitAckLENGTH
:
456 dissect_UDPInitAck(tvb
, adwin_config_tree
);
458 case UDPIXP425FlashUpdateLENGTH
:
459 dissect_UDPIXP425FlashUpdate(tvb
, adwin_config_tree
);
462 dissect_UDPOut(tvb
, adwin_config_tree
);
465 /* Heuristics above should mean we never get here */
466 col_add_str(pinfo
->cinfo
, COL_INFO
,
467 val_to_str(length
, length_mapping
,
468 "Unknown ADwin Configuration packet, length: %d"));
475 dissect_adwin_config_tcp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
477 if(!(pinfo
->srcport
== ADWIN_CONFIGURATION_PORT
478 || pinfo
->destport
== ADWIN_CONFIGURATION_PORT
))
481 /* XXX - Is this possible for TCP? */
482 if (! (is_adwin_mac_or_broadcast(pinfo
->dl_src
) || is_adwin_mac_or_broadcast(pinfo
->dl_dst
)))
485 tcp_dissect_pdus(tvb
, pinfo
, tree
, 1, 4, get_adwin_TCPUpdate_len
, dissect_TCPFlashUpdate
, NULL
);
491 proto_register_adwin_config(void)
493 static hf_register_info hf
[] = {
494 { &hf_adwin_config_bootloader
,
495 { "Enable Bootloader", "adwin_config.bootloader",
496 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
499 { &hf_adwin_config_command
,
500 { "Command", "adwin_config.command",
501 FT_UINT32
, BASE_DEC
, VALS(config_command_mapping
), 0x0,
504 { &hf_adwin_config_data
,
505 { "Data", "adwin_config.data",
506 FT_NONE
, BASE_NONE
, NULL
, 0x0,
509 { &hf_adwin_config_date
,
510 { "Date", "adwin_config.date",
511 FT_STRING
, BASE_NONE
, NULL
, 0x0,
514 { &hf_adwin_config_description
,
515 { "Description", "adwin_config.description",
516 FT_STRING
, BASE_NONE
, NULL
, 0x0,
519 { &hf_adwin_config_dhcp
,
520 { "DHCP enabled", "adwin_config.dhcp",
521 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
524 { &hf_adwin_config_filename
,
525 { "File name", "adwin_config.filename",
526 FT_STRING
, BASE_NONE
, NULL
, 0x0,
529 { &hf_adwin_config_filesize
,
530 { "File size", "adwin_config.filesize",
531 FT_INT32
, BASE_DEC
, NULL
, 0x0,
534 { &hf_adwin_config_filetime
,
535 { "File time", "adwin_config.filetime",
536 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
539 { &hf_adwin_config_updatetime
,
540 { "Update time", "adwin_config.updatetime",
541 FT_ABSOLUTE_TIME
, ABSOLUTE_TIME_LOCAL
, NULL
, 0x0,
544 { &hf_adwin_config_gateway
,
545 { "Gateway IP", "adwin_config.gateway",
546 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
549 { &hf_adwin_config_mac
,
550 { "MAC address", "adwin_config.mac",
551 FT_ETHER
, BASE_NONE
, NULL
, 0x0,
554 { &hf_adwin_config_netmask
,
555 { "Netmask", "adwin_config.netmask",
556 FT_IPv4
, BASE_NETMASK
, NULL
, 0x0,
559 { &hf_adwin_config_netmask_count
,
560 { "Netmask count", "adwin_config.netmask_count",
561 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
562 "The number of binary ones in the netmask.", HFILL
}
564 { &hf_adwin_config_password
,
565 { "Password", "adwin_config.password",
566 FT_STRING
, BASE_NONE
, NULL
, 0x0,
567 "Password to set for ADwin system.", HFILL
}
569 { &hf_adwin_config_pattern
,
570 { "Pattern", "adwin_config.pattern",
571 FT_UINT32
, BASE_HEX
, VALS(pattern_mapping
), 0x0,
574 { &hf_adwin_config_path
,
575 { "Path", "adwin_config.path",
576 FT_STRING
, BASE_NONE
, NULL
, 0x0,
579 { &hf_adwin_config_port16
,
580 { "Port (16bit)", "adwin_config.port",
581 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
582 "The server port on which the ADwin system is listening on (16bit).", HFILL
}
584 { &hf_adwin_config_port32
,
585 { "Port (32bit)", "adwin_config.port",
586 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
587 "The server port on which the ADwin system is listening on (32bit).", HFILL
}
589 { &hf_adwin_config_reboot
,
590 { "Reboot", "adwin_config.reboot",
591 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
592 "Number of system reboots.", HFILL
}
594 { &hf_adwin_config_scan_id
,
595 { "Scan ID", "adwin_config.scan_id",
596 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
599 { &hf_adwin_config_reply_broadcast
, /* send_normal in UDPStatus */
600 { "Reply with broadcast", "adwin_config.reply_broadcast",
601 FT_BOOLEAN
, BASE_NONE
, NULL
, 0x0,
602 "If this bit is set, the scanned system should reply with a broadcast.", HFILL
}
604 { &hf_adwin_config_revision
,
605 { "Revision", "adwin_config.revision",
606 FT_STRING
, BASE_NONE
, NULL
, 0x0,
609 { &hf_adwin_config_processor_type_raw
,
610 { "Processor Type (Raw value)", "adwin_config.processor_type_raw",
611 FT_STRING
, BASE_NONE
, NULL
, 0x0,
612 "The DSP processor type of the ADwin system, e.g. T9, T10 or T11.", HFILL
}
614 { &hf_adwin_config_system_type_raw
,
615 { "System Type (Raw value)", "adwin_config.system_type_raw",
616 FT_STRING
, BASE_NONE
, NULL
, 0x0,
617 "The system type of the ADwin system, e.g. Gold, Pro or Light.", HFILL
}
619 { &hf_adwin_config_processor_type
,
620 { "Processor Type", "adwin_config.processor_type",
621 FT_STRING
, BASE_NONE
, NULL
, 0x0,
624 { &hf_adwin_config_system_type
,
625 { "System Type", "adwin_config.system_type",
626 FT_STRING
, BASE_NONE
, NULL
, 0x0,
629 { &hf_adwin_config_server_ip
,
630 { "Server IP", "adwin_config.server_ip",
631 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
632 "In scan replies, this is the current IP address of the ADwin system. In configuration packets, this is the new IP to be used by the ADwin system.", HFILL
}
634 { &hf_adwin_config_server_version
,
635 { "Server version", "adwin_config.server_version",
636 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
637 "The version number of the server program. This number represents the complete firmware version, e.g. 2.74.", HFILL
}
639 { &hf_adwin_config_server_version_beta
,
640 { "server version (beta part)", "adwin_config.server_version_beta",
641 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
642 "A non-zero value of this field indicates a beta firmware version, where this number represents the current revision.", HFILL
}
644 { &hf_adwin_config_socketshutdowns
,
645 { "Socket shutdowns", "adwin_config.socketshutdowns",
646 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
647 "Number of socket errors that lead to a recreation of the socket (ethernet interface version 1 only).", HFILL
}
649 { &hf_adwin_config_status
,
650 { "Status", "adwin_config.status",
651 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
654 { &hf_adwin_config_status_bootloader
,
655 { "Status Bootloader", "adwin_config.status_bootloader",
656 FT_BOOLEAN
, 32, NULL
, STATUS_WITH_BOOTLOADER
,
657 "Indicates if the ADwin system has bootloader capabilities.", HFILL
}
659 { &hf_adwin_config_status_reprogrammable
,
660 { "Status Reprogrammable",
661 "adwin_config.status_reprogrammable",
662 FT_BOOLEAN
, 32, NULL
, STATUS_REPROGRAMMABLE
,
665 { &hf_adwin_config_status_configurable
,
666 { "Status Configurable", "adwin_config.status_configurable",
667 FT_BOOLEAN
, 32, NULL
, STATUS_CONFIGURABLE
,
670 { &hf_adwin_config_status_bootloader_boots
,
671 { "Status Bootloader boots",
672 "adwin_config.status_bootloader_boots",
673 FT_BOOLEAN
, 32, NULL
, STATUS_BOOTLOADER_BOOTS
,
676 { &hf_adwin_config_status_bootloader_reprogrammable
,
677 { "Status Bootloader reprogrammable",
678 "adwin_config.status_bootloader_reprogrammable",
679 FT_BOOLEAN
, 32, NULL
, STATUS_BOOTLOADER_REPROGRAMMABLE
,
682 { &hf_adwin_config_status_bootloader_receive
,
683 { "Status Bootloader receive",
684 "adwin_config.status_bootloader_receive",
685 FT_BOOLEAN
, 32, NULL
, STATUS_BOOTLOADER_RECEIVES_DATA
,
688 { &hf_adwin_config_status_bootloader_reprogramming_done
,
689 { "Status Bootloader reprogramming done",
690 "adwin_config.status_bootloader_reprogramming_done",
691 FT_BOOLEAN
, 32, NULL
, STATUS_BOOTLOADER_REPROGRAMMING_DONE
,
694 { &hf_adwin_config_status_eeprom_support
,
695 { "Status EEPROM Support",
696 "adwin_config.status_eeprom_support",
697 FT_BOOLEAN
, 32, NULL
, STATUS_WITH_EEPROM_SUPPORT
,
700 { &hf_adwin_config_stream_length
,
701 { "Stream length", "adwin_config.stream_length",
702 FT_INT32
, BASE_DEC
, NULL
, 0x0,
705 { &hf_adwin_config_eeprom_support
,
706 { "EEPROM Support", "adwin_config.eeprom_support",
707 FT_BOOLEAN
, BASE_NONE
, TFS(&tfs_enabled_disabled
), 0x0,
710 { &hf_adwin_config_timeout
,
711 { "Timeout", "adwin_config.timeout",
712 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
715 { &hf_adwin_config_timerresets
,
716 { "Timer resets", "adwin_config.timerresets",
717 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
718 "Counter for resets of the timer (ethernet interface version 1 only).", HFILL
}
720 { &hf_adwin_config_disk_free
,
721 { "Free disk space (kb)", "adwin_config.disk_free",
722 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
723 "Free disk space in kb on flash (ethernet interface version 2 only).", HFILL
}
725 { &hf_adwin_config_disk_size
,
726 { "Disk size (kb)", "adwin_config.disk_size",
727 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
728 "Flash disk size in kb (ethernet interface version 2 only).", HFILL
}
730 { &hf_adwin_config_unused
,
731 { "Unused", "adwin_config.unused",
732 FT_NONE
, BASE_NONE
, NULL
, 0x0,
735 { &hf_adwin_config_version
,
736 { "Version", "adwin_config.version",
737 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
740 { &hf_adwin_config_xilinx_version
,
741 { "XILINX Version", "adwin_config.xilinx_version",
742 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
743 "Version of XILINX program", HFILL
}
747 /* Setup protocol subtree array */
748 static int *ett
[] = {
750 &ett_adwin_config_status
,
751 &ett_adwin_config_debug
,
754 /* Register the protocol name and description */
756 proto_register_protocol("ADwin configuration protocol",
757 "ADwin-Config", "adwin_config");
759 /* Required function calls to register the header fields and
761 proto_register_field_array(proto_adwin_config
, hf
, array_length(hf
));
762 proto_register_subtree_array(ett
, array_length(ett
));
766 proto_reg_handoff_adwin_config(void)
768 heur_dissector_add("udp", dissect_adwin_config_udp
, "ADwin-Config over UDP", "adwin_config_udp", proto_adwin_config
, HEURISTIC_ENABLE
);
769 heur_dissector_add("tcp", dissect_adwin_config_tcp
, "ADwin-Config over TCP", "adwin_config_tcp", proto_adwin_config
, HEURISTIC_ENABLE
);
774 * Editor modelines - https://www.wireshark.org/tools/modelines.html
779 * indent-tabs-mode: t
782 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
783 * :indentSize=8:tabSize=8:noTabs=false: