Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-tzsp.c
Line
Count
Source
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
16
#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
718
#define TZSP_NULL       4   /* Null frame, used as a keepalive */
51
716
#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
16
#define TZSP_ENCAP_ETHERNET                1
68
16
#define TZSP_ENCAP_TOKEN_RING              2
69
#define TZSP_ENCAP_SLIP                    3
70
16
#define TZSP_ENCAP_PPP                     4
71
16
#define TZSP_ENCAP_FDDI                    5
72
16
#define TZSP_ENCAP_RAW                     7   /* "Raw UO", presumably meaning "Raw IP" */
73
16
#define TZSP_ENCAP_IEEE_802_11             18
74
16
#define TZSP_ENCAP_IEEE_802_11_PRISM       119
75
16
#define TZSP_ENCAP_IEEE_802_11_RADIOTAP    126
76
16
#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
11.5k
#define TZSP_HDR_PAD               0  /* Pad. */
134
3.78k
#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
12
#define TZSP_PACKET_ID            40  /* Unique ID of the packet */
138
18
#define TZSP_HDR_ORIGINAL_LENGTH  41  /* Length of the packet before slicing. 2 bytes. */
139
7
#define TZSP_HDR_SENSOR           60  /* Sensor MAC address packet was received on, 6 byte ethernet address.*/
140
141
13
#define TZSP_DEVICE_NAME          80
142
10
#define TZSP_CAPTURE_LOCATION     81
143
11
#define TZSP_TIME_STAMP           82
144
10
#define TZSP_INFO                 83  /* Addition TZSP Information; String type*/
145
19
#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
52
#define WLAN_RADIO_HDR_SIGNAL     10  /* Signal strength in dBm, signed byte. */
155
21
#define WLAN_RADIO_HDR_NOISE      11  /* Noise level in dBm, signed byte. */
156
42
#define WLAN_RADIO_HDR_RATE       12  /* Data rate, unsigned byte. */
157
79
#define WLAN_RADIO_HDR_TIMESTAMP  13  /* Timestamp in us, unsigned 32-bits network byte order. */
158
45
#define WLAN_RADIO_HDR_MSG_TYPE   14  /* Packet type, unsigned byte. */
159
22
#define WLAN_RADIO_HDR_CF         15  /* Whether packet arrived during CF period, unsigned byte. */
160
27
#define WLAN_RADIO_HDR_UN_DECR    16  /* Whether packet could not be decrypted by MAC, unsigned byte. */
161
47
#define WLAN_RADIO_HDR_FCS_ERR    17  /* Whether packet contains an FCS error, unsigned byte. */
162
37
#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
715
{
195
715
    uint8_t     tag, length, fcs_err = 0, encr = 0, seen_fcs_err = 0;
196
715
    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
4.37k
    while (true) {
203
4.37k
        tag = tvb_get_uint8(tvb, pos);
204
4.37k
        if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) {
205
958
            length = tvb_get_uint8(tvb, pos+1);
206
958
            tag_tree = proto_tree_add_subtree(tree, tvb, pos, 2+length, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown"));
207
3.41k
        } else {
208
3.41k
            tag_tree = proto_tree_add_subtree(tree, tvb, pos, 1, ett_tag, NULL, val_to_str_const(tag, option_tag_vals, "Unknown"));
209
3.41k
            length = 0;
210
3.41k
        }
211
212
4.37k
        proto_tree_add_item(tag_tree, hf_option_tag, tvb, pos, 1, ENC_BIG_ENDIAN);
213
4.37k
        pos++;
214
4.37k
        if ((tag != TZSP_HDR_PAD) && (tag != TZSP_HDR_END)) {
215
955
            proto_tree_add_item(tag_tree, hf_option_length, tvb, pos, 1, ENC_BIG_ENDIAN);
216
955
            pos++;
217
955
        }
218
219
4.37k
        switch (tag) {
220
2.77k
        case TZSP_HDR_PAD:
221
2.77k
            break;
222
223
624
        case TZSP_HDR_END:
224
            /* Fill in header with information from other tags. */
225
624
            if (seen_fcs_err) {
226
5
                proto_item_append_text(ti,"%s", fcs_err?"FCS Error":(encr?"Encrypted":"Good"));
227
5
            }
228
624
            return pos;
229
230
12
        case TZSP_PACKET_ID:
231
12
            proto_tree_add_item(tag_tree, hf_packet_id, tvb, pos, 4, ENC_BIG_ENDIAN);
232
12
            break;
233
234
18
        case TZSP_HDR_ORIGINAL_LENGTH:
235
18
            proto_tree_add_item(tag_tree, hf_original_length, tvb, pos, 2, ENC_BIG_ENDIAN);
236
18
            break;
237
238
13
        case TZSP_DEVICE_NAME:
239
13
            proto_tree_add_item(tag_tree, hf_device_name, tvb, pos, length, ENC_ASCII);
240
13
            break;
241
242
10
        case TZSP_CAPTURE_LOCATION:
243
10
            proto_tree_add_item(tag_tree, hf_capture_location, tvb, pos, length, ENC_ASCII);
244
10
            break;
245
246
10
        case TZSP_INFO:
247
10
            proto_tree_add_item(tag_tree, hf_capture_info, tvb, pos, length, ENC_ASCII);
248
10
            break;
249
250
19
        case TZSP_CAPTURE_ID:
251
19
            proto_tree_add_item(tag_tree, hf_capture_id, tvb, pos, 4, ENC_BIG_ENDIAN);
252
19
            break;
253
254
11
        case TZSP_TIME_STAMP:
255
11
            proto_tree_add_item(tag_tree, hf_time_stamp, tvb, pos, length, ENC_TIME_SECS_NSECS|ENC_BIG_ENDIAN);
256
11
            break;
257
258
259
52
        case WLAN_RADIO_HDR_SIGNAL:
260
52
            proto_tree_add_item(tag_tree, hf_signal, tvb, pos, 1, ENC_BIG_ENDIAN);
261
52
            break;
262
263
21
        case WLAN_RADIO_HDR_NOISE:
264
21
            proto_tree_add_item(tag_tree, hf_silence, tvb, pos, 1, ENC_BIG_ENDIAN);
265
21
            break;
266
267
42
        case WLAN_RADIO_HDR_RATE:
268
42
            proto_tree_add_item(tag_tree, hf_rate, tvb, pos, 1, ENC_BIG_ENDIAN);
269
42
            break;
270
271
79
        case WLAN_RADIO_HDR_TIMESTAMP:
272
79
            proto_tree_add_item(tag_tree, hf_time, tvb, pos, 4, ENC_BIG_ENDIAN);
273
79
            break;
274
275
45
        case WLAN_RADIO_HDR_MSG_TYPE:
276
45
            proto_tree_add_item(tag_tree, hf_status_msg_type, tvb, pos, 1, ENC_BIG_ENDIAN);
277
45
            break;
278
279
22
        case WLAN_RADIO_HDR_CF:
280
22
            proto_tree_add_item(tag_tree, hf_status_pcf, tvb, pos, 1, ENC_NA);
281
22
            break;
282
283
27
        case WLAN_RADIO_HDR_UN_DECR:
284
27
            proto_tree_add_item(tag_tree, hf_status_undecrypted, tvb, pos, 1, ENC_NA);
285
27
            encr = tvb_get_uint8(tvb, pos);
286
27
            break;
287
288
47
        case WLAN_RADIO_HDR_FCS_ERR:
289
47
            seen_fcs_err = 1;
290
47
            proto_tree_add_item(tag_tree, hf_status_fcs_error, tvb, pos, 1, ENC_NA);
291
47
            fcs_err = tvb_get_uint8(tvb, pos);
292
47
            break;
293
294
37
        case WLAN_RADIO_HDR_CHANNEL:
295
37
            proto_tree_add_item(tag_tree, hf_channel, tvb, pos, length, ENC_BIG_ENDIAN);
296
37
            break;
297
298
7
        case TZSP_HDR_SENSOR:
299
7
            proto_tree_add_item(tag_tree, hf_sensormac, tvb, pos, 6, ENC_NA);
300
7
            break;
301
302
483
        default:
303
483
            proto_tree_add_item(tag_tree, hf_unknown, tvb, pos, length, ENC_NA);
304
483
            break;
305
4.37k
        }
306
307
3.66k
        pos += length;
308
3.66k
    }
309
715
}
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
718
{
318
718
    proto_tree         *tzsp_tree     = NULL;
319
718
    proto_item         *ti            = NULL;
320
718
    int                 pos           = 0;
321
718
    tvbuff_t           *next_tvb;
322
718
    uint32_t            encapsulation = 0;
323
718
    const char         *info;
324
718
    uint32_t             type;
325
326
718
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "TZSP");
327
718
    col_clear(pinfo->cinfo, COL_INFO);
328
329
    /* Adding TZSP item and subtree */
330
718
    ti = proto_tree_add_item(tree, proto_tzsp, tvb, 0, -1, ENC_NA);
331
718
    tzsp_tree = proto_item_add_subtree(ti, ett_tzsp);
332
333
718
    proto_tree_add_item (tzsp_tree, hf_tzsp_version, tvb, 0, 1, ENC_BIG_ENDIAN);
334
718
    proto_tree_add_item_ret_uint(tzsp_tree, hf_tzsp_type, tvb, 1, 1, ENC_BIG_ENDIAN, &type);
335
718
    proto_tree_add_item_ret_uint(tzsp_tree, hf_tzsp_encap, tvb, 2, 2, ENC_BIG_ENDIAN, &encapsulation);
336
718
    info = val_to_str(pinfo->pool, encapsulation, tzsp_encapsulation, "Unknown (%u)");
337
718
    proto_item_append_text(ti, ": %s", info);
338
339
718
    col_add_str(pinfo->cinfo, COL_INFO, info);
340
341
    /*
342
     * XXX - what about TZSP_CONFIG frames?
343
     *
344
     * The MIB at
345
     *
346
     *  http://web.archive.org/web/20021221195733/http://www.networkchemistry.com/support/appnotes/SENSOR-MIB
347
     *
348
     * seems to indicate that you can configure the probe using SNMP;
349
     * does TZSP_CONFIG also support that?  An old version of Kismet
350
     * included code to control a Network Chemistry WSP100 sensor:
351
     *
352
     *  https://www.kismetwireless.net/code-old/svn/tags/kismet-2004-02-R1/wsp100source.cc
353
     *
354
     * and it used SNMP to configure the probe.
355
     */
356
718
    if ((type != TZSP_NULL) && (type != TZSP_PORT)) {
357
715
        pos = add_option_info(tvb, 4, tzsp_tree, ti);
358
359
715
        if (tree)
360
624
            proto_item_set_end(ti, tvb, pos);
361
715
        next_tvb = tvb_new_subset_remaining(tvb, pos);
362
715
        if (dissector_try_uint(tzsp_encap_table, encapsulation, next_tvb, pinfo, tree) == 0) {
363
7
            col_set_str(pinfo->cinfo, COL_PROTOCOL, "UNKNOWN");
364
7
            col_add_fstr(pinfo->cinfo, COL_INFO, "TZSP_ENCAP = %u",
365
7
                    encapsulation);
366
7
            call_data_dissector(next_tvb, pinfo, tree);
367
7
        }
368
715
    }
369
370
718
    return tvb_captured_length(tvb);
371
718
}
372
373
/* ************************************************************************* */
374
/*                Register the TZSP dissector                                */
375
/* ************************************************************************* */
376
377
void
378
proto_register_tzsp(void)
379
16
{
380
16
    static const value_string msg_type[] = {
381
16
        {0, "Normal"},
382
16
        {1, "RFC1042 encoded"},
383
16
        {2, "Bridge-tunnel encoded"},
384
16
        {4, "802.11 management frame"},
385
16
        {0, NULL}
386
16
    };
387
388
16
    static const true_false_string pcf_flag = {
389
16
        "CF: Frame received during CF period",
390
16
        "Not CF"
391
16
    };
392
393
16
    static const true_false_string undecr_flag = {
394
16
        "Encrypted frame could not be decrypted",
395
16
        "Unencrypted"
396
16
    };
397
398
16
    static const true_false_string fcs_err_flag = {
399
16
        "FCS error, frame is corrupted",
400
16
        "Frame is valid"
401
16
    };
402
403
16
    static const value_string channels[] = {
404
        /* 802.11b/g */
405
16
        {  1, "1 (2.412 GHz)"},
406
16
        {  2, "2 (2.417 GHz)"},
407
16
        {  3, "3 (2.422 GHz)"},
408
16
        {  4, "4 (2.427 GHz)"},
409
16
        {  5, "5 (2.432 GHz)"},
410
16
        {  6, "6 (2.437 GHz)"},
411
16
        {  7, "7 (2.442 GHz)"},
412
16
        {  8, "8 (2.447 GHz)"},
413
16
        {  9, "9 (2.452 GHz)"},
414
16
        { 10, "10 (2.457 GHz)"},
415
16
        { 11, "11 (2.462 GHz)"},
416
16
        { 12, "12 (2.467 GHz)"},
417
16
        { 13, "13 (2.472 GHz)"},
418
16
        { 14, "14 (2.484 GHz)"},
419
        /* 802.11a */
420
16
        { 36, "36 (5.180 GHz)"},
421
16
        { 40, "40 (5.200 GHz)"},
422
16
        { 44, "44 (5.220 GHz)"},
423
16
        { 48, "48 (5.240 GHz)"},
424
16
        { 52, "52 (5.260 GHz)"},
425
16
        { 56, "56 (5.280 GHz)"},
426
16
        { 60, "60 (5.300 GHz)"},
427
16
        { 64, "64 (5.320 GHz)"},
428
16
        {149, "149 (5.745 GHz)"},
429
16
        {153, "153 (5.765 GHz)"},
430
16
        {157, "157 (5.785 GHz)"},
431
16
        {161, "161 (5.805 GHz)"},
432
        /* 802.11ax */
433
16
        {191, "191 (5.955 GHz)"},
434
16
        {195, "195 (5.975 GHz)"},
435
16
        {199, "199 (5.995 GHz)"},
436
16
        {203, "203 (6.015 GHz)"},
437
16
        {207, "207 (6.035 GHz)"},
438
16
        {211, "211 (6.055 GHz)"},
439
16
        {215, "215 (6.075 GHz)"},
440
16
        {219, "219 (6.095 GHz)"},
441
16
        {223, "223 (6.115 GHz)"},
442
16
        {227, "227 (6.135 GHz)"},
443
16
        {231, "231 (6.155 GHz)"},
444
16
        {235, "235 (6.175 GHz)"},
445
16
        {239, "239 (6.195 GHz)"},
446
16
        {243, "243 (6.215 GHz)"},
447
16
        {247, "247 (6.235 GHz)"},
448
16
        {251, "251 (6.255 GHz)"},
449
16
        {255, "255 (6.275 GHz)"},
450
16
        {259, "259 (6.295 GHz)"},
451
16
        {263, "263 (6.315 GHz)"},
452
16
        {267, "267 (6.335 GHz)"},
453
16
        {271, "271 (6.355 GHz)"},
454
16
        {275, "275 (6.375 GHz)"},
455
16
        {279, "279 (6.395 GHz)"},
456
16
        {283, "283 (6.415 GHz)"},
457
16
        {287, "287 (6.435 GHz)"},
458
16
        {291, "291 (6.455 GHz)"},
459
16
        {295, "295 (6.475 GHz)"},
460
16
        {299, "299 (6.495 GHz)"},
461
16
        {303, "303 (6.515 GHz)"},
462
16
        {307, "307 (6.535 GHz)"},
463
16
        {311, "311 (6.555 GHz)"},
464
16
        {315, "315 (6.575 GHz)"},
465
16
        {319, "319 (6.595 GHz)"},
466
16
        {323, "323 (6.615 GHz)"},
467
16
        {327, "327 (6.635 GHz)"},
468
16
        {331, "331 (6.655 GHz)"},
469
16
        {335, "335 (6.675 GHz)"},
470
16
        {339, "339 (6.695 GHz)"},
471
16
        {343, "343 (6.715 GHz)"},
472
16
        {347, "347 (6.735 GHz)"},
473
16
        {351, "351 (6.755 GHz)"},
474
16
        {355, "355 (6.775 GHz)"},
475
16
        {359, "359 (6.795 GHz)"},
476
16
        {363, "363 (6.815 GHz)"},
477
16
        {367, "367 (6.835 GHz)"},
478
16
        {371, "371 (6.855 GHz)"},
479
16
        {375, "375 (6.875 GHz)"},
480
16
        {379, "379 (6.895 GHz)"},
481
16
        {383, "383 (6.915 GHz)"},
482
16
        {387, "387 (6.935 GHz)"},
483
16
        {391, "391 (6.955 GHz)"},
484
16
        {395, "395 (6.975 GHz)"},
485
16
        {399, "399 (6.995 GHz)"},
486
16
        {403, "403 (7.015 GHz)"},
487
16
        {407, "407 (7.035 GHz)"},
488
16
        {411, "411 (7.055 GHz)"},
489
16
        {415, "415 (7.075 GHz)"},
490
16
        {419, "419 (7.095 GHz)"},
491
16
        {423, "423 (7.115 GHz)"},
492
16
        {0, NULL}
493
16
    };
494
495
16
    static const value_string rates[] = {
496
        /* Old PRISM rates */
497
16
        {0x0A, "1 Mbit/s"},
498
16
        {0x14, "2 Mbit/s"},
499
16
        {0x37, "5.5 Mbit/s"},
500
16
        {0x6E, "11 Mbit/s"},
501
        /* MicroAP rates */
502
16
        {  2,  "1 Mbit/s"},
503
16
        {  4,  "2 Mbit/s"},
504
16
        { 11,  "5.5 Mbit/s"},
505
16
        { 12,  "6 Mbit/s"},
506
16
        { 18,  "9 Mbit/s"},
507
16
        { 22,  "11 Mbit/s"},
508
16
        { 24,  "12 Mbit/s"},
509
16
        { 36,  "18 Mbit/s"},
510
16
        { 48,  "24 Mbit/s"},
511
16
        { 72,  "36 Mbit/s"},
512
16
        { 96,  "48 Mbit/s"},
513
16
        {108,  "54 Mbit/s"},
514
16
        {0, NULL}
515
16
    };
516
517
16
    static hf_register_info hf[] = {
518
16
        { &hf_tzsp_version, {
519
16
            "Version", "tzsp.version", FT_UINT8, BASE_DEC,
520
16
            NULL, 0, NULL, HFILL }},
521
16
        { &hf_tzsp_type, {
522
16
            "Type", "tzsp.type", FT_UINT8, BASE_DEC,
523
16
            VALS(tzsp_type), 0, NULL, HFILL }},
524
16
        { &hf_tzsp_encap, {
525
16
            "Encapsulation", "tzsp.encap", FT_UINT16, BASE_DEC,
526
16
            VALS(tzsp_encapsulation), 0, NULL, HFILL }},
527
528
16
        { &hf_option_tag, {
529
16
            "Option Tag", "tzsp.option_tag", FT_UINT8, BASE_DEC,
530
16
            VALS(option_tag_vals), 0, NULL, HFILL }},
531
16
        { &hf_option_length, {
532
16
            "Option Length", "tzsp.option_length", FT_UINT8, BASE_DEC,
533
16
            NULL, 0, NULL, HFILL }},
534
#if 0
535
        { &hf_status_field, {
536
            "Status", "tzsp.wlan.status", FT_UINT16, BASE_HEX,
537
                NULL, 0, NULL, HFILL }},
538
#endif
539
16
        { &hf_status_msg_type, {
540
16
            "Type", "tzsp.wlan.status.msg_type", FT_UINT8, BASE_HEX,
541
16
            VALS(msg_type), 0, "Message type", HFILL }},
542
#if 0
543
        { &hf_status_mac_port, {
544
            "Port", "tzsp.wlan.status.mac_port", FT_UINT8, BASE_DEC,
545
            NULL, 0, "MAC port", HFILL }},
546
#endif
547
16
        { &hf_status_pcf, {
548
16
            "PCF", "tzsp.wlan.status.pcf", FT_BOOLEAN, BASE_NONE,
549
16
            TFS (&pcf_flag), 0x0, "Point Coordination Function", HFILL }},
550
16
        { &hf_status_undecrypted, {
551
16
            "Undecrypted", "tzsp.wlan.status.undecrypted", FT_BOOLEAN, BASE_NONE,
552
16
            TFS (&undecr_flag), 0x0, NULL, HFILL }},
553
16
        { &hf_status_fcs_error, {
554
16
            "FCS", "tzsp.wlan.status.fcs_err", FT_BOOLEAN, BASE_NONE,
555
16
            TFS (&fcs_err_flag), 0x0, "Frame check sequence", HFILL }},
556
16
        { &hf_time, {
557
16
            "Time", "tzsp.wlan.time", FT_UINT32, BASE_HEX,
558
16
            NULL, 0, NULL, HFILL }},
559
16
        { &hf_silence, {
560
16
            "Silence", "tzsp.wlan.silence", FT_INT8, BASE_DEC,
561
16
            NULL, 0, NULL, HFILL }},
562
16
        { &hf_original_length, {
563
16
            "Original Length", "tzsp.original_length", FT_INT16, BASE_DEC,
564
16
            NULL, 0, "OrigLength", HFILL }},
565
16
        { &hf_signal, {
566
16
            "Signal", "tzsp.wlan.signal", FT_INT8, BASE_DEC,
567
16
            NULL, 0, NULL, HFILL }},
568
16
        { &hf_rate, {
569
16
            "Rate", "tzsp.wlan.rate", FT_UINT8, BASE_DEC,
570
16
            VALS(rates), 0, NULL, HFILL }},
571
16
        { &hf_channel, {
572
16
            "Channel", "tzsp.wlan.channel", FT_UINT16, BASE_DEC,
573
16
            VALS(channels), 0, NULL, HFILL }},
574
16
        { &hf_unknown, {
575
16
            "Unknown tag", "tzsp.unknown", FT_BYTES, BASE_NONE,
576
16
            NULL, 0, NULL, HFILL }},
577
16
        { &hf_sensormac, {
578
16
            "Sensor Address", "tzsp.sensormac", FT_ETHER, BASE_NONE,
579
16
            NULL, 0, "Sensor MAC", HFILL }},
580
581
16
        { &hf_device_name, {
582
16
            "Device Name", "tzsp.device_name", FT_STRING, BASE_NONE,
583
16
            NULL, 0, "DeviceName", HFILL }},
584
585
16
        { &hf_capture_location, {
586
16
            "Capture Location", "tzsp.capture_location", FT_STRING, BASE_NONE,
587
16
            NULL, 0, "CaptureLocation", HFILL }},
588
589
16
        { &hf_capture_info, {
590
16
            "Capture Information", "tzsp.device_info", FT_STRING, BASE_NONE,
591
16
            NULL, 0, "CaptureInformation", HFILL }},
592
593
16
        { &hf_capture_id, {
594
16
            "Capture Id", "tzsp.device_id", FT_UINT32, BASE_DEC,
595
16
            NULL, 0, "CaptureID", HFILL }},
596
597
16
        {&hf_time_stamp, {
598
16
            "Time Stamp", "tzsp.time_stamp",
599
16
            FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
600
16
            "TimeStamp", HFILL}},
601
602
16
        { &hf_packet_id, {
603
16
            "Packet Id", "tzsp.packet_id", FT_UINT32, BASE_DEC,
604
16
            NULL, 0, "PacketId", HFILL }}
605
16
    };
606
607
16
    static int *ett[] = {
608
16
        &ett_tzsp,
609
16
        &ett_tag
610
16
    };
611
612
16
    proto_tzsp = proto_register_protocol("Tazmen Sniffer Protocol", "TZSP", "tzsp");
613
16
    proto_register_field_array(proto_tzsp, hf, array_length(hf));
614
16
    proto_register_subtree_array(ett, array_length(ett));
615
616
16
    tzsp_handle = register_dissector("tzsp", dissect_tzsp, proto_tzsp);
617
618
16
    tzsp_encap_table = register_dissector_table("tzsp.encap", "TZSP Encapsulation Type",
619
16
            proto_tzsp, FT_UINT16, BASE_DEC);
620
16
}
621
622
void
623
proto_reg_handoff_tzsp(void)
624
16
{
625
16
    dissector_add_uint_with_preference("udp.port", UDP_PORT_TZSP, tzsp_handle);
626
627
    /* Get the data dissector for handling various encapsulation types. */
628
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_ETHERNET,           find_dissector("eth_maybefcs"));
629
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_TOKEN_RING,         find_dissector("tr"));
630
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_PPP,                find_dissector("ppp_hdlc"));
631
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_FDDI,               find_dissector("fddi"));
632
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_RAW,                find_dissector("raw_ip"));
633
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11,        find_dissector("wlan"));
634
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_PRISM,  find_dissector("prism"));
635
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_AVS,    find_dissector("wlancap"));
636
16
    dissector_add_uint("tzsp.encap", TZSP_ENCAP_IEEE_802_11_RADIOTAP, find_dissector("radiotap"));
637
638
    /* Register this protocol as an encapsulation type. */
639
16
    dissector_add_uint("wtap_encap", WTAP_ENCAP_TZSP, tzsp_handle);
640
16
}
641
642
/*
643
* Editor modelines - https://www.wireshark.org/tools/modelines.html
644
*
645
* Local variables:
646
* c-basic-offset: 4
647
* tab-width: 8
648
* indent-tabs-mode: nil
649
* End:
650
*
651
* vi: set shiftwidth=4 tabstop=8 expandtab:
652
* :indentSize=4:tabSize=8:noTabs=true:
653
*/