/src/wireshark/epan/dissectors/packet-tzsp.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* packet-tzsp.c |
2 | | * |
3 | | * Copyright 2002, Tazmen Technologies Inc |
4 | | * |
5 | | * Tazmen Sniffer Protocol for encapsulating the packets across a network |
6 | | * from a remote packet sniffer. TZSP can encapsulate any other protocol. |
7 | | * |
8 | | * Wireshark - Network traffic analyzer |
9 | | * By Gerald Combs <gerald@wireshark.org> |
10 | | * Copyright 1998 Gerald Combs |
11 | | * |
12 | | * SPDX-License-Identifier: GPL-2.0-or-later |
13 | | */ |
14 | | |
15 | | #include "config.h" |
16 | | |
17 | | #include <epan/packet.h> |
18 | | #include <epan/tfs.h> |
19 | | #include <wsutil/array.h> |
20 | | #include <wiretap/wtap.h> |
21 | | |
22 | | /* |
23 | | * See |
24 | | * |
25 | | * http://web.archive.org/web/20050404125022/http://www.networkchemistry.com/support/appnotes/an001_tzsp.html |
26 | | * |
27 | | * for a description of the protocol. |
28 | | */ |
29 | | |
30 | 14 | #define UDP_PORT_TZSP 0x9090 /* Not IANA registered */ |
31 | | |
32 | | void proto_register_tzsp(void); |
33 | | void proto_reg_handoff_tzsp(void); |
34 | | |
35 | | static int proto_tzsp; |
36 | | static int hf_tzsp_version; |
37 | | static int hf_tzsp_type; |
38 | | static int hf_tzsp_encap; |
39 | | |
40 | | static dissector_table_t tzsp_encap_table; |
41 | | |
42 | | static dissector_handle_t tzsp_handle; |
43 | | |
44 | | /* |
45 | | * Packet types. |
46 | | */ |
47 | | #define TZSP_RX_PACKET 0 /* Packet received from the sensor */ |
48 | | #define TZSP_TX_PACKET 1 /* Packet for the sensor to transmit */ |
49 | | #define TZSP_CONFIG 3 /* Configuration information for the sensor */ |
50 | 712 | #define TZSP_NULL 4 /* Null frame, used as a keepalive */ |
51 | 711 | #define TZSP_PORT 5 /* Port opener - opens a NAT tunnel */ |
52 | | |
53 | | static const value_string tzsp_type[] = { |
54 | | {TZSP_RX_PACKET, "Received packet"}, |
55 | | {TZSP_TX_PACKET, "Packet for transmit"}, |
56 | | {TZSP_CONFIG, "Configuration"}, |
57 | | {TZSP_NULL, "Keepalive"}, |
58 | | {TZSP_PORT, "Port opener"}, |
59 | | {0, NULL} |
60 | | }; |
61 | | |
62 | | /* ************************************************************************* */ |
63 | | /* Encapsulation type values */ |
64 | | /* Note that these are not all the same as DLT_ values */ |
65 | | /* ************************************************************************* */ |
66 | | |
67 | 14 | #define TZSP_ENCAP_ETHERNET 1 |
68 | 14 | #define TZSP_ENCAP_TOKEN_RING 2 |
69 | | #define TZSP_ENCAP_SLIP 3 |
70 | 14 | #define TZSP_ENCAP_PPP 4 |
71 | 14 | #define TZSP_ENCAP_FDDI 5 |
72 | 14 | #define TZSP_ENCAP_RAW 7 /* "Raw UO", presumably meaning "Raw IP" */ |
73 | 14 | #define TZSP_ENCAP_IEEE_802_11 18 |
74 | 14 | #define TZSP_ENCAP_IEEE_802_11_PRISM 119 |
75 | 14 | #define TZSP_ENCAP_IEEE_802_11_RADIOTAP 126 |
76 | 14 | #define TZSP_ENCAP_IEEE_802_11_AVS 127 |
77 | | |
78 | | /* |
79 | | * Packet encapsulations. |
80 | | */ |
81 | | static const value_string tzsp_encapsulation[] = { |
82 | | {TZSP_ENCAP_ETHERNET, "Ethernet"}, |
83 | | {TZSP_ENCAP_TOKEN_RING, "Token Ring"}, |
84 | | {TZSP_ENCAP_SLIP, "SLIP"}, |
85 | | {TZSP_ENCAP_PPP, "PPP"}, |
86 | | {TZSP_ENCAP_FDDI, "FDDI"}, |
87 | | {TZSP_ENCAP_RAW, "Raw IP"}, |
88 | | {TZSP_ENCAP_IEEE_802_11, "IEEE 802.11"}, |
89 | | {TZSP_ENCAP_IEEE_802_11_PRISM, "IEEE 802.11 with Prism headers"}, |
90 | | {TZSP_ENCAP_IEEE_802_11_RADIOTAP, "IEEE 802.11 with radiotap headers"}, |
91 | | {TZSP_ENCAP_IEEE_802_11_AVS, "IEEE 802.11 with AVS headers"}, |
92 | | {0, NULL} |
93 | | }; |
94 | | |
95 | | static int ett_tzsp; |
96 | | static int ett_tag; |
97 | | |
98 | | /* ************************************************************************* */ |
99 | | /* WLAN radio header fields */ |
100 | | /* ************************************************************************* */ |
101 | | |
102 | | static int hf_option_tag; |
103 | | static int hf_option_length; |
104 | | /* static int hf_status_field; */ |
105 | | static int hf_status_msg_type; |
106 | | static int hf_status_pcf; |
107 | | /* static int hf_status_mac_port; */ |
108 | | static int hf_status_undecrypted; |
109 | | static int hf_status_fcs_error; |
110 | | |
111 | | static int hf_time; |
112 | | static int hf_silence; |
113 | | static int hf_signal; |
114 | | static int hf_rate; |
115 | | static int hf_channel; |
116 | | static int hf_unknown; |
117 | | static int hf_original_length; |
118 | | static int hf_sensormac; |
119 | | |
120 | | static int hf_device_name; |
121 | | static int hf_capture_location; |
122 | | static int hf_capture_info; |
123 | | static int hf_capture_id; |
124 | | static int hf_time_stamp; |
125 | | static int hf_packet_id; |
126 | | |
127 | | |
128 | | |
129 | | /* ************************************************************************* */ |
130 | | /* Generic header options */ |
131 | | /* ************************************************************************* */ |
132 | | |
133 | 7.91k | #define TZSP_HDR_PAD 0 /* Pad. */ |
134 | 3.44k | #define TZSP_HDR_END 1 /* End of the list. */ |
135 | | #define TZSP_WLAN_STA 30 /* Station statistics */ |
136 | | #define TZSP_WLAN_PKT 31 /* Packet statistics */ |
137 | 18 | #define TZSP_PACKET_ID 40 /* Unique ID of the packet */ |
138 | 15 | #define TZSP_HDR_ORIGINAL_LENGTH 41 /* Length of the packet before slicing. 2 bytes. */ |
139 | 11 | #define TZSP_HDR_SENSOR 60 /* Sensor MAC address packet was received on, 6 byte ethernet address.*/ |
140 | | |
141 | 12 | #define TZSP_DEVICE_NAME 80 |
142 | 11 | #define TZSP_CAPTURE_LOCATION 81 |
143 | 9 | #define TZSP_TIME_STAMP 82 |
144 | 16 | #define TZSP_INFO 83 /* Addition TZSP Information; String type*/ |
145 | 7 | #define TZSP_CAPTURE_ID 84 /* Capture Instance ID; 32 bits unsigned integer */ |
146 | | |
147 | | |
148 | | |
149 | | |
150 | | /* ************************************************************************* */ |
151 | | /* Options for 802.11 radios */ |
152 | | /* ************************************************************************* */ |
153 | | |
154 | 61 | #define WLAN_RADIO_HDR_SIGNAL 10 /* Signal strength in dBm, signed byte. */ |
155 | 85 | #define WLAN_RADIO_HDR_NOISE 11 /* Noise level in dBm, signed byte. */ |
156 | 38 | #define WLAN_RADIO_HDR_RATE 12 /* Data rate, unsigned byte. */ |
157 | 28 | #define WLAN_RADIO_HDR_TIMESTAMP 13 /* Timestamp in us, unsigned 32-bits network byte order. */ |
158 | 37 | #define WLAN_RADIO_HDR_MSG_TYPE 14 /* Packet type, unsigned byte. */ |
159 | 19 | #define WLAN_RADIO_HDR_CF 15 /* Whether packet arrived during CF period, unsigned byte. */ |
160 | 25 | #define WLAN_RADIO_HDR_UN_DECR 16 /* Whether packet could not be decrypted by MAC, unsigned byte. */ |
161 | 22 | #define WLAN_RADIO_HDR_FCS_ERR 17 /* Whether packet contains an FCS error, unsigned byte. */ |
162 | 21 | #define WLAN_RADIO_HDR_CHANNEL 18 /* Channel number packet was received on, unsigned byte.*/ |
163 | | |
164 | | static const value_string option_tag_vals[] = { |
165 | | {TZSP_HDR_PAD, "Pad"}, |
166 | | {TZSP_HDR_END, "End"}, |
167 | | {TZSP_PACKET_ID, "packet ID"}, |
168 | | {TZSP_HDR_ORIGINAL_LENGTH, "Original Length"}, |
169 | | {TZSP_DEVICE_NAME, "Device Name"}, |
170 | | {TZSP_CAPTURE_LOCATION, "Capture Location"}, |
171 | | {TZSP_TIME_STAMP, "Time Stamp"}, |
172 | | {TZSP_INFO, "Information"}, |
173 | | {TZSP_CAPTURE_ID, "Capture ID"}, |
174 | | {WLAN_RADIO_HDR_SIGNAL, "Signal"}, |
175 | | {WLAN_RADIO_HDR_NOISE, "Silence"}, |
176 | | {WLAN_RADIO_HDR_RATE, "Rate"}, |
177 | | {WLAN_RADIO_HDR_TIMESTAMP, "Time"}, |
178 | | {WLAN_RADIO_HDR_MSG_TYPE, "Message Type"}, |
179 | | {WLAN_RADIO_HDR_CF, "Point Coordination Function"}, |
180 | | {WLAN_RADIO_HDR_UN_DECR, "Undecrypted"}, |
181 | | {WLAN_RADIO_HDR_FCS_ERR, "Frame check sequence"}, |
182 | | {WLAN_RADIO_HDR_CHANNEL, "Channel"}, |
183 | | {TZSP_HDR_SENSOR, "Sensor MAC"}, |
184 | | {0, NULL} |
185 | | }; |
186 | | |
187 | | |
188 | | /* ************************************************************************* */ |
189 | | /* Add option information to the display */ |
190 | | /* ************************************************************************* */ |
191 | | |
192 | | static int |
193 | | add_option_info(tvbuff_t *tvb, int pos, proto_tree *tree, proto_item *ti) |
194 | 710 | { |
195 | 710 | uint8_t tag, length, fcs_err = 0, encr = 0, seen_fcs_err = 0; |
196 | 710 | proto_tree *tag_tree; |
197 | | |
198 | | /* |
199 | | * Read all option tags in an endless loop. If the packet is malformed this |
200 | | * loop might be a problem. |
201 | | */ |
202 | 3.12k | while (true) { |
203 | 3.12k | tag = tvb_get_uint8(tvb, pos); |
204 | 3.12k | if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) { |
205 | 797 | length = tvb_get_uint8(tvb, pos+1); |
206 | 797 | tag_tree = proto_tree_add_subtree(tree, tvb, pos, 2+length, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown")); |
207 | 2.32k | } else { |
208 | 2.32k | tag_tree = proto_tree_add_subtree(tree, tvb, pos, 1, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown")); |
209 | 2.32k | length = 0; |
210 | 2.32k | } |
211 | | |
212 | 3.12k | proto_tree_add_item(tag_tree, hf_option_tag, tvb, pos, 1, ENC_BIG_ENDIAN); |
213 | 3.12k | pos++; |
214 | 3.12k | if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) { |
215 | 791 | proto_tree_add_item(tag_tree, hf_option_length, tvb, pos, 1, ENC_BIG_ENDIAN); |
216 | 791 | pos++; |
217 | 791 | } |
218 | | |
219 | 3.12k | switch (tag) { |
220 | 1.67k | case TZSP_HDR_PAD: |
221 | 1.67k | break; |
222 | | |
223 | 620 | case TZSP_HDR_END: |
224 | | /* Fill in header with information from other tags. */ |
225 | 620 | if (seen_fcs_err) { |
226 | 2 | proto_item_append_text(ti,"%s", fcs_err?"FCS Error":(encr?"Encrypted":"Good")); |
227 | 2 | } |
228 | 620 | return pos; |
229 | | |
230 | 18 | case TZSP_PACKET_ID: |
231 | 18 | proto_tree_add_item(tag_tree, hf_packet_id, tvb, pos, 4, ENC_BIG_ENDIAN); |
232 | 18 | break; |
233 | | |
234 | 15 | case TZSP_HDR_ORIGINAL_LENGTH: |
235 | 15 | proto_tree_add_item(tag_tree, hf_original_length, tvb, pos, 2, ENC_BIG_ENDIAN); |
236 | 15 | break; |
237 | | |
238 | 12 | case TZSP_DEVICE_NAME: |
239 | 12 | proto_tree_add_item(tag_tree, hf_device_name, tvb, pos, length, ENC_ASCII); |
240 | 12 | break; |
241 | | |
242 | 11 | case TZSP_CAPTURE_LOCATION: |
243 | 11 | proto_tree_add_item(tag_tree, hf_capture_location, tvb, pos, length, ENC_ASCII); |
244 | 11 | break; |
245 | | |
246 | 16 | case TZSP_INFO: |
247 | 16 | proto_tree_add_item(tag_tree, hf_capture_info, tvb, pos, length, ENC_ASCII); |
248 | 16 | break; |
249 | | |
250 | 7 | case TZSP_CAPTURE_ID: |
251 | 7 | proto_tree_add_item(tag_tree, hf_capture_id, tvb, pos, 4, ENC_BIG_ENDIAN); |
252 | 7 | break; |
253 | | |
254 | 9 | case TZSP_TIME_STAMP: |
255 | 9 | proto_tree_add_item(tag_tree, hf_time_stamp, tvb, pos, length, ENC_TIME_SECS_NSECS|ENC_BIG_ENDIAN); |
256 | 9 | break; |
257 | | |
258 | | |
259 | 61 | case WLAN_RADIO_HDR_SIGNAL: |
260 | 61 | proto_tree_add_item(tag_tree, hf_signal, tvb, pos, 1, ENC_BIG_ENDIAN); |
261 | 61 | break; |
262 | | |
263 | 85 | case WLAN_RADIO_HDR_NOISE: |
264 | 85 | proto_tree_add_item(tag_tree, hf_silence, tvb, pos, 1, ENC_BIG_ENDIAN); |
265 | 85 | break; |
266 | | |
267 | 38 | case WLAN_RADIO_HDR_RATE: |
268 | 38 | proto_tree_add_item(tag_tree, hf_rate, tvb, pos, 1, ENC_BIG_ENDIAN); |
269 | 38 | break; |
270 | | |
271 | 28 | case WLAN_RADIO_HDR_TIMESTAMP: |
272 | 28 | proto_tree_add_item(tag_tree, hf_time, tvb, pos, 4, ENC_BIG_ENDIAN); |
273 | 28 | break; |
274 | | |
275 | 37 | case WLAN_RADIO_HDR_MSG_TYPE: |
276 | 37 | proto_tree_add_item(tag_tree, hf_status_msg_type, tvb, pos, 1, ENC_BIG_ENDIAN); |
277 | 37 | break; |
278 | | |
279 | 19 | case WLAN_RADIO_HDR_CF: |
280 | 19 | proto_tree_add_item(tag_tree, hf_status_pcf, tvb, pos, 1, ENC_NA); |
281 | 19 | break; |
282 | | |
283 | 25 | case WLAN_RADIO_HDR_UN_DECR: |
284 | 25 | proto_tree_add_item(tag_tree, hf_status_undecrypted, tvb, pos, 1, ENC_NA); |
285 | 25 | encr = tvb_get_uint8(tvb, pos); |
286 | 25 | break; |
287 | | |
288 | 22 | case WLAN_RADIO_HDR_FCS_ERR: |
289 | 22 | seen_fcs_err = 1; |
290 | 22 | proto_tree_add_item(tag_tree, hf_status_fcs_error, tvb, pos, 1, ENC_NA); |
291 | 22 | fcs_err = tvb_get_uint8(tvb, pos); |
292 | 22 | break; |
293 | | |
294 | 21 | case WLAN_RADIO_HDR_CHANNEL: |
295 | 21 | proto_tree_add_item(tag_tree, hf_channel, tvb, pos, length, ENC_BIG_ENDIAN); |
296 | 21 | break; |
297 | | |
298 | 11 | case TZSP_HDR_SENSOR: |
299 | 11 | proto_tree_add_item(tag_tree, hf_sensormac, tvb, pos, 6, ENC_NA); |
300 | 11 | break; |
301 | | |
302 | 356 | default: |
303 | 356 | proto_tree_add_item(tag_tree, hf_unknown, tvb, pos, length, ENC_NA); |
304 | 356 | break; |
305 | 3.12k | } |
306 | | |
307 | 2.41k | pos += length; |
308 | 2.41k | } |
309 | 710 | } |
310 | | |
311 | | /* ************************************************************************* */ |
312 | | /* Dissect a TZSP packet */ |
313 | | /* ************************************************************************* */ |
314 | | |
315 | | static int |
316 | | dissect_tzsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
317 | 712 | { |
318 | 712 | proto_tree *tzsp_tree = NULL; |
319 | 712 | proto_item *ti = NULL; |
320 | 712 | int pos = 0; |
321 | 712 | tvbuff_t *next_tvb; |
322 | 712 | uint16_t encapsulation = 0; |
323 | 712 | const char *info; |
324 | 712 | uint8_t type; |
325 | | |
326 | 712 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "TZSP"); |
327 | 712 | col_clear(pinfo->cinfo, COL_INFO); |
328 | | |
329 | 712 | type = tvb_get_uint8(tvb, 1); |
330 | | |
331 | | /* Find the encapsulation. */ |
332 | 712 | encapsulation = tvb_get_ntohs(tvb, 2); |
333 | 712 | info = val_to_str(encapsulation, tzsp_encapsulation, "Unknown (%u)"); |
334 | | |
335 | 712 | col_add_str(pinfo->cinfo, COL_INFO, info); |
336 | | |
337 | 712 | if (tree) { |
338 | | /* Adding TZSP item and subtree */ |
339 | 712 | ti = proto_tree_add_protocol_format(tree, proto_tzsp, tvb, 0, |
340 | 712 | -1, "TZSP: %s ", info); |
341 | 712 | tzsp_tree = proto_item_add_subtree(ti, ett_tzsp); |
342 | | |
343 | 712 | proto_tree_add_item (tzsp_tree, hf_tzsp_version, tvb, 0, 1, |
344 | 712 | ENC_BIG_ENDIAN); |
345 | 712 | proto_tree_add_uint (tzsp_tree, hf_tzsp_type, tvb, 1, 1, |
346 | 712 | type); |
347 | 712 | proto_tree_add_uint (tzsp_tree, hf_tzsp_encap, tvb, 2, 2, |
348 | 712 | encapsulation); |
349 | 712 | } |
350 | | |
351 | | /* |
352 | | * XXX - what about TZSP_CONFIG frames? |
353 | | * |
354 | | * The MIB at |
355 | | * |
356 | | * http://web.archive.org/web/20021221195733/http://www.networkchemistry.com/support/appnotes/SENSOR-MIB |
357 | | * |
358 | | * seems to indicate that you can configure the probe using SNMP; |
359 | | * does TZSP_CONFIG also support that? An old version of Kismet |
360 | | * included code to control a Network Chemistry WSP100 sensor: |
361 | | * |
362 | | * https://www.kismetwireless.net/code-old/svn/tags/kismet-2004-02-R1/wsp100source.cc |
363 | | * |
364 | | * and it used SNMP to configure the probe. |
365 | | */ |
366 | 712 | if ((type != TZSP_NULL) && (type != TZSP_PORT)) { |
367 | 710 | pos = add_option_info(tvb, 4, tzsp_tree, ti); |
368 | | |
369 | 710 | if (tree) |
370 | 620 | proto_item_set_end(ti, tvb, pos); |
371 | 710 | next_tvb = tvb_new_subset_remaining(tvb, pos); |
372 | 710 | if (dissector_try_uint(tzsp_encap_table, encapsulation, next_tvb, pinfo, tree) == 0) { |
373 | 6 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN"); |
374 | 6 | col_add_fstr(pinfo->cinfo, COL_INFO, "TZSP_ENCAP = %u", |
375 | 6 | encapsulation); |
376 | 6 | call_data_dissector(next_tvb, pinfo, tree); |
377 | 6 | } |
378 | 710 | } |
379 | | |
380 | 712 | return tvb_captured_length(tvb); |
381 | 712 | } |
382 | | |
383 | | /* ************************************************************************* */ |
384 | | /* Register the TZSP dissector */ |
385 | | /* ************************************************************************* */ |
386 | | |
387 | | void |
388 | | proto_register_tzsp(void) |
389 | 14 | { |
390 | 14 | static const value_string msg_type[] = { |
391 | 14 | {0, "Normal"}, |
392 | 14 | {1, "RFC1042 encoded"}, |
393 | 14 | {2, "Bridge-tunnel encoded"}, |
394 | 14 | {4, "802.11 management frame"}, |
395 | 14 | {0, NULL} |
396 | 14 | }; |
397 | | |
398 | 14 | static const true_false_string pcf_flag = { |
399 | 14 | "CF: Frame received during CF period", |
400 | 14 | "Not CF" |
401 | 14 | }; |
402 | | |
403 | 14 | static const true_false_string undecr_flag = { |
404 | 14 | "Encrypted frame could not be decrypted", |
405 | 14 | "Unencrypted" |
406 | 14 | }; |
407 | | |
408 | 14 | static const true_false_string fcs_err_flag = { |
409 | 14 | "FCS error, frame is corrupted", |
410 | 14 | "Frame is valid" |
411 | 14 | }; |
412 | | |
413 | 14 | static const value_string channels[] = { |
414 | | /* 802.11b/g */ |
415 | 14 | { 1, "1 (2.412 GHz)"}, |
416 | 14 | { 2, "2 (2.417 GHz)"}, |
417 | 14 | { 3, "3 (2.422 GHz)"}, |
418 | 14 | { 4, "4 (2.427 GHz)"}, |
419 | 14 | { 5, "5 (2.432 GHz)"}, |
420 | 14 | { 6, "6 (2.437 GHz)"}, |
421 | 14 | { 7, "7 (2.442 GHz)"}, |
422 | 14 | { 8, "8 (2.447 GHz)"}, |
423 | 14 | { 9, "9 (2.452 GHz)"}, |
424 | 14 | { 10, "10 (2.457 GHz)"}, |
425 | 14 | { 11, "11 (2.462 GHz)"}, |
426 | 14 | { 12, "12 (2.467 GHz)"}, |
427 | 14 | { 13, "13 (2.472 GHz)"}, |
428 | 14 | { 14, "14 (2.484 GHz)"}, |
429 | | /* 802.11a */ |
430 | 14 | { 36, "36 (5.180 GHz)"}, |
431 | 14 | { 40, "40 (5.200 GHz)"}, |
432 | 14 | { 44, "44 (5.220 GHz)"}, |
433 | 14 | { 48, "48 (5.240 GHz)"}, |
434 | 14 | { 52, "52 (5.260 GHz)"}, |
435 | 14 | { 56, "56 (5.280 GHz)"}, |
436 | 14 | { 60, "60 (5.300 GHz)"}, |
437 | 14 | { 64, "64 (5.320 GHz)"}, |
438 | 14 | {149, "149 (5.745 GHz)"}, |
439 | 14 | {153, "153 (5.765 GHz)"}, |
440 | 14 | {157, "157 (5.785 GHz)"}, |
441 | 14 | {161, "161 (5.805 GHz)"}, |
442 | | /* 802.11ax */ |
443 | 14 | {191, "191 (5.955 GHz)"}, |
444 | 14 | {195, "195 (5.975 GHz)"}, |
445 | 14 | {199, "199 (5.995 GHz)"}, |
446 | 14 | {203, "203 (6.015 GHz)"}, |
447 | 14 | {207, "207 (6.035 GHz)"}, |
448 | 14 | {211, "211 (6.055 GHz)"}, |
449 | 14 | {215, "215 (6.075 GHz)"}, |
450 | 14 | {219, "219 (6.095 GHz)"}, |
451 | 14 | {223, "223 (6.115 GHz)"}, |
452 | 14 | {227, "227 (6.135 GHz)"}, |
453 | 14 | {231, "231 (6.155 GHz)"}, |
454 | 14 | {235, "235 (6.175 GHz)"}, |
455 | 14 | {239, "239 (6.195 GHz)"}, |
456 | 14 | {243, "243 (6.215 GHz)"}, |
457 | 14 | {247, "247 (6.235 GHz)"}, |
458 | 14 | {251, "251 (6.255 GHz)"}, |
459 | 14 | {255, "255 (6.275 GHz)"}, |
460 | 14 | {259, "259 (6.295 GHz)"}, |
461 | 14 | {263, "263 (6.315 GHz)"}, |
462 | 14 | {267, "267 (6.335 GHz)"}, |
463 | 14 | {271, "271 (6.355 GHz)"}, |
464 | 14 | {275, "275 (6.375 GHz)"}, |
465 | 14 | {279, "279 (6.395 GHz)"}, |
466 | 14 | {283, "283 (6.415 GHz)"}, |
467 | 14 | {287, "287 (6.435 GHz)"}, |
468 | 14 | {291, "291 (6.455 GHz)"}, |
469 | 14 | {295, "295 (6.475 GHz)"}, |
470 | 14 | {299, "299 (6.495 GHz)"}, |
471 | 14 | {303, "303 (6.515 GHz)"}, |
472 | 14 | {307, "307 (6.535 GHz)"}, |
473 | 14 | {311, "311 (6.555 GHz)"}, |
474 | 14 | {315, "315 (6.575 GHz)"}, |
475 | 14 | {319, "319 (6.595 GHz)"}, |
476 | 14 | {323, "323 (6.615 GHz)"}, |
477 | 14 | {327, "327 (6.635 GHz)"}, |
478 | 14 | {331, "331 (6.655 GHz)"}, |
479 | 14 | {335, "335 (6.675 GHz)"}, |
480 | 14 | {339, "339 (6.695 GHz)"}, |
481 | 14 | {343, "343 (6.715 GHz)"}, |
482 | 14 | {347, "347 (6.735 GHz)"}, |
483 | 14 | {351, "351 (6.755 GHz)"}, |
484 | 14 | {355, "355 (6.775 GHz)"}, |
485 | 14 | {359, "359 (6.795 GHz)"}, |
486 | 14 | {363, "363 (6.815 GHz)"}, |
487 | 14 | {367, "367 (6.835 GHz)"}, |
488 | 14 | {371, "371 (6.855 GHz)"}, |
489 | 14 | {375, "375 (6.875 GHz)"}, |
490 | 14 | {379, "379 (6.895 GHz)"}, |
491 | 14 | {383, "383 (6.915 GHz)"}, |
492 | 14 | {387, "387 (6.935 GHz)"}, |
493 | 14 | {391, "391 (6.955 GHz)"}, |
494 | 14 | {395, "395 (6.975 GHz)"}, |
495 | 14 | {399, "399 (6.995 GHz)"}, |
496 | 14 | {403, "403 (7.015 GHz)"}, |
497 | 14 | {407, "407 (7.035 GHz)"}, |
498 | 14 | {411, "411 (7.055 GHz)"}, |
499 | 14 | {415, "415 (7.075 GHz)"}, |
500 | 14 | {419, "419 (7.095 GHz)"}, |
501 | 14 | {423, "423 (7.115 GHz)"}, |
502 | 14 | {0, NULL} |
503 | 14 | }; |
504 | | |
505 | 14 | static const value_string rates[] = { |
506 | | /* Old PRISM rates */ |
507 | 14 | {0x0A, "1 Mbit/s"}, |
508 | 14 | {0x14, "2 Mbit/s"}, |
509 | 14 | {0x37, "5.5 Mbit/s"}, |
510 | 14 | {0x6E, "11 Mbit/s"}, |
511 | | /* MicroAP rates */ |
512 | 14 | { 2, "1 Mbit/s"}, |
513 | 14 | { 4, "2 Mbit/s"}, |
514 | 14 | { 11, "5.5 Mbit/s"}, |
515 | 14 | { 12, "6 Mbit/s"}, |
516 | 14 | { 18, "9 Mbit/s"}, |
517 | 14 | { 22, "11 Mbit/s"}, |
518 | 14 | { 24, "12 Mbit/s"}, |
519 | 14 | { 36, "18 Mbit/s"}, |
520 | 14 | { 48, "24 Mbit/s"}, |
521 | 14 | { 72, "36 Mbit/s"}, |
522 | 14 | { 96, "48 Mbit/s"}, |
523 | 14 | {108, "54 Mbit/s"}, |
524 | 14 | {0, NULL} |
525 | 14 | }; |
526 | | |
527 | 14 | static hf_register_info hf[] = { |
528 | 14 | { &hf_tzsp_version, { |
529 | 14 | "Version", "tzsp.version", FT_UINT8, BASE_DEC, |
530 | 14 | NULL, 0, NULL, HFILL }}, |
531 | 14 | { &hf_tzsp_type, { |
532 | 14 | "Type", "tzsp.type", FT_UINT8, BASE_DEC, |
533 | 14 | VALS(tzsp_type), 0, NULL, HFILL }}, |
534 | 14 | { &hf_tzsp_encap, { |
535 | 14 | "Encapsulation", "tzsp.encap", FT_UINT16, BASE_DEC, |
536 | 14 | VALS(tzsp_encapsulation), 0, NULL, HFILL }}, |
537 | | |
538 | 14 | { &hf_option_tag, { |
539 | 14 | "Option Tag", "tzsp.option_tag", FT_UINT8, BASE_DEC, |
540 | 14 | VALS(option_tag_vals), 0, NULL, HFILL }}, |
541 | 14 | { &hf_option_length, { |
542 | 14 | "Option Length", "tzsp.option_length", FT_UINT8, BASE_DEC, |
543 | 14 | NULL, 0, NULL, HFILL }}, |
544 | | #if 0 |
545 | | { &hf_status_field, { |
546 | | "Status", "tzsp.wlan.status", FT_UINT16, BASE_HEX, |
547 | | NULL, 0, NULL, HFILL }}, |
548 | | #endif |
549 | 14 | { &hf_status_msg_type, { |
550 | 14 | "Type", "tzsp.wlan.status.msg_type", FT_UINT8, BASE_HEX, |
551 | 14 | VALS(msg_type), 0, "Message type", HFILL }}, |
552 | | #if 0 |
553 | | { &hf_status_mac_port, { |
554 | | "Port", "tzsp.wlan.status.mac_port", FT_UINT8, BASE_DEC, |
555 | | NULL, 0, "MAC port", HFILL }}, |
556 | | #endif |
557 | 14 | { &hf_status_pcf, { |
558 | 14 | "PCF", "tzsp.wlan.status.pcf", FT_BOOLEAN, BASE_NONE, |
559 | 14 | TFS (&pcf_flag), 0x0, "Point Coordination Function", HFILL }}, |
560 | 14 | { &hf_status_undecrypted, { |
561 | 14 | "Undecrypted", "tzsp.wlan.status.undecrypted", FT_BOOLEAN, BASE_NONE, |
562 | 14 | TFS (&undecr_flag), 0x0, NULL, HFILL }}, |
563 | 14 | { &hf_status_fcs_error, { |
564 | 14 | "FCS", "tzsp.wlan.status.fcs_err", FT_BOOLEAN, BASE_NONE, |
565 | 14 | TFS (&fcs_err_flag), 0x0, "Frame check sequence", HFILL }}, |
566 | 14 | { &hf_time, { |
567 | 14 | "Time", "tzsp.wlan.time", FT_UINT32, BASE_HEX, |
568 | 14 | NULL, 0, NULL, HFILL }}, |
569 | 14 | { &hf_silence, { |
570 | 14 | "Silence", "tzsp.wlan.silence", FT_INT8, BASE_DEC, |
571 | 14 | NULL, 0, NULL, HFILL }}, |
572 | 14 | { &hf_original_length, { |
573 | 14 | "Original Length", "tzsp.original_length", FT_INT16, BASE_DEC, |
574 | 14 | NULL, 0, "OrigLength", HFILL }}, |
575 | 14 | { &hf_signal, { |
576 | 14 | "Signal", "tzsp.wlan.signal", FT_INT8, BASE_DEC, |
577 | 14 | NULL, 0, NULL, HFILL }}, |
578 | 14 | { &hf_rate, { |
579 | 14 | "Rate", "tzsp.wlan.rate", FT_UINT8, BASE_DEC, |
580 | 14 | VALS(rates), 0, NULL, HFILL }}, |
581 | 14 | { &hf_channel, { |
582 | 14 | "Channel", "tzsp.wlan.channel", FT_UINT16, BASE_DEC, |
583 | 14 | VALS(channels), 0, NULL, HFILL }}, |
584 | 14 | { &hf_unknown, { |
585 | 14 | "Unknown tag", "tzsp.unknown", FT_BYTES, BASE_NONE, |
586 | 14 | NULL, 0, NULL, HFILL }}, |
587 | 14 | { &hf_sensormac, { |
588 | 14 | "Sensor Address", "tzsp.sensormac", FT_ETHER, BASE_NONE, |
589 | 14 | NULL, 0, "Sensor MAC", HFILL }}, |
590 | | |
591 | 14 | { &hf_device_name, { |
592 | 14 | "Device Name", "tzsp.device_name", FT_STRING, BASE_NONE, |
593 | 14 | NULL, 0, "DeviceName", HFILL }}, |
594 | | |
595 | 14 | { &hf_capture_location, { |
596 | 14 | "Capture Location", "tzsp.capture_location", FT_STRING, BASE_NONE, |
597 | 14 | NULL, 0, "CaptureLocation", HFILL }}, |
598 | | |
599 | 14 | { &hf_capture_info, { |
600 | 14 | "Capture Information", "tzsp.device_info", FT_STRING, BASE_NONE, |
601 | 14 | NULL, 0, "CaptureInformation", HFILL }}, |
602 | | |
603 | 14 | { &hf_capture_id, { |
604 | 14 | "Capture Id", "tzsp.device_id", FT_UINT32, BASE_DEC, |
605 | 14 | NULL, 0, "CaptureID", HFILL }}, |
606 | | |
607 | 14 | {&hf_time_stamp, { |
608 | 14 | "Time Stamp", "tzsp.time_stamp", |
609 | 14 | FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, |
610 | 14 | "TimeStamp", HFILL}}, |
611 | | |
612 | 14 | { &hf_packet_id, { |
613 | 14 | "Packet Id", "tzsp.packet_id", FT_UINT32, BASE_DEC, |
614 | 14 | NULL, 0, "PacketId", HFILL }} |
615 | 14 | }; |
616 | | |
617 | 14 | static int *ett[] = { |
618 | 14 | &ett_tzsp, |
619 | 14 | &ett_tag |
620 | 14 | }; |
621 | | |
622 | 14 | proto_tzsp = proto_register_protocol("Tazmen Sniffer Protocol", "TZSP", "tzsp"); |
623 | 14 | proto_register_field_array(proto_tzsp, hf, array_length(hf)); |
624 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
625 | | |
626 | 14 | tzsp_handle = register_dissector("tzsp", dissect_tzsp, proto_tzsp); |
627 | | |
628 | 14 | tzsp_encap_table = register_dissector_table("tzsp.encap", "TZSP Encapsulation Type", |
629 | 14 | proto_tzsp, FT_UINT16, BASE_DEC); |
630 | 14 | } |
631 | | |
632 | | void |
633 | | proto_reg_handoff_tzsp(void) |
634 | 14 | { |
635 | 14 | dissector_add_uint_with_preference("udp.port", UDP_PORT_TZSP, tzsp_handle); |
636 | | |
637 | | /* Get the data dissector for handling various encapsulation types. */ |
638 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_ETHERNET, find_dissector("eth_maybefcs")); |
639 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_TOKEN_RING, find_dissector("tr")); |
640 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_PPP, find_dissector("ppp_hdlc")); |
641 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_FDDI, find_dissector("fddi")); |
642 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_RAW, find_dissector("raw_ip")); |
643 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11, find_dissector("wlan")); |
644 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_PRISM, find_dissector("prism")); |
645 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_AVS, find_dissector("wlancap")); |
646 | 14 | dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_RADIOTAP, find_dissector("radiotap")); |
647 | | |
648 | | /* Register this protocol as an encapsulation type. */ |
649 | 14 | dissector_add_uint("wtap_encap", WTAP_ENCAP_TZSP, tzsp_handle); |
650 | 14 | } |
651 | | |
652 | | /* |
653 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
654 | | * |
655 | | * Local variables: |
656 | | * c-basic-offset: 4 |
657 | | * tab-width: 8 |
658 | | * indent-tabs-mode: nil |
659 | | * End: |
660 | | * |
661 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
662 | | * :indentSize=4:tabSize=8:noTabs=true: |
663 | | */ |