Coverage Report

Created: 2025-08-04 07:15

/src/wireshark/epan/dissectors/packet-waveagent.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-waveagent.c
2
 * Routines for WaveAgent dissection
3
 * Copyright 2009-2011, Tom Cook <tcook@ixiacom.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 * *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "config.h"
13
14
#include <epan/packet.h>
15
14
#define ETHERNET_INTERFACE      1
16
14
#define WLAN_INTERFACE          2
17
18
14
#define IPV4_TYPE               2
19
14
#define IPV6_TYPE               10
20
21
0
#define NUM_STATE_CHANGES       8
22
0
#define NUM_BSS                 8
23
#define SHORT_STR               256
24
25
0
#define WA_V2_PAYLOAD_OFFSET    40
26
0
#define WA_V3_PAYLOAD_OFFSET    44
27
28
void proto_register_waveagent(void);
29
void proto_reg_handoff_waveagent(void);
30
31
/* Initialize the protocol and registered fields */
32
static int proto_waveagent;
33
static int hf_waveagent_controlword;
34
static int hf_waveagent_payloadlen;
35
static int hf_waveagent_transnum;
36
static int hf_waveagent_rtoken;
37
static int hf_waveagent_flowid;
38
static int hf_waveagent_capstatus;
39
static int hf_waveagent_protocolversion;
40
static int hf_waveagent_capimpl;
41
static int hf_waveagent_id;
42
static int hf_waveagent_bindtag;
43
static int hf_waveagent_version;
44
static int hf_waveagent_brokerip;
45
static int hf_waveagent_brokerport;
46
static int hf_waveagent_bindlevel;
47
static int hf_waveagent_bindport;
48
static int hf_waveagent_numinterfaces;
49
static int hf_waveagent_capabilities2;
50
static int hf_waveagent_ifmask;
51
static int hf_waveagent_commandstatus;
52
static int hf_waveagent_syserrno;
53
static int hf_waveagent_statusstring;
54
static int hf_waveagent_rxdatapckts;
55
static int hf_waveagent_rxdatabytes;
56
static int hf_waveagent_rxpcktrate;
57
static int hf_waveagent_rxbyterate;
58
static int hf_waveagent_txdatapckts;
59
static int hf_waveagent_txdatabytes;
60
static int hf_waveagent_txpcktrate;
61
static int hf_waveagent_txbyterate;
62
static int hf_waveagent_looppckts;
63
static int hf_waveagent_loopbytes;
64
static int hf_waveagent_rxctlpckts;
65
static int hf_waveagent_rxctlbytes;
66
static int hf_waveagent_txctlpckts;
67
static int hf_waveagent_txctlbytes;
68
static int hf_waveagent_unknowncmds;
69
static int hf_waveagent_snap;
70
static int hf_waveagent_state;
71
static int hf_waveagent_appstate;
72
static int hf_waveagent_rx1pl;
73
static int hf_waveagent_rx2pl;
74
static int hf_waveagent_rx3pl;
75
static int hf_waveagent_rx4pl;
76
static int hf_waveagent_rx5pl;
77
static int hf_waveagent_rxoospkts;
78
/* static int hf_waveagent_rxmeanlatency; */
79
/* static int hf_waveagent_rxminlatency; */
80
/* static int hf_waveagent_rxmaxlatency; */
81
static int hf_waveagent_latencysum;
82
static int hf_waveagent_latencycount;
83
static int hf_waveagent_txflowstop;
84
static int hf_waveagent_jitter;
85
static int hf_waveagent_remoteport;
86
static int hf_waveagent_remoteaddr;
87
static int hf_waveagent_dscp;
88
static int hf_waveagent_fsflags;
89
static int hf_waveagent_fscbrflag;
90
static int hf_waveagent_fscombinedsetupflag;
91
/* static int hf_waveagent_totalbytes; */
92
static int hf_waveagent_payfill;
93
static int hf_waveagent_paysize;
94
static int hf_waveagent_avgrate;
95
static int hf_waveagent_rxflownum;
96
static int hf_waveagent_mode;
97
static int hf_waveagent_endpointtype;
98
static int hf_waveagent_totalframes;
99
static int hf_waveagent_bssidstartindex;
100
static int hf_waveagent_bssidstopindex;
101
static int hf_waveagent_ifindex;
102
static int hf_waveagent_iftype;
103
static int hf_waveagent_ifdescription;
104
static int hf_waveagent_ifmacaddr;
105
static int hf_waveagent_iflinkspeed;
106
static int hf_waveagent_ifdhcp;
107
static int hf_waveagent_ifwlanbssid;
108
static int hf_waveagent_ifwlanssid;
109
static int hf_waveagent_ifiptype;
110
static int hf_waveagent_ifipv4;
111
static int hf_waveagent_ifipv6;
112
static int hf_waveagent_ifdhcpserver;
113
static int hf_waveagent_ifgateway;
114
static int hf_waveagent_ifdnsserver;
115
static int hf_waveagent_ifethl2status;
116
static int hf_waveagent_ifwlanl2status;
117
static int hf_waveagent_ifl3status;
118
static int hf_waveagent_totalbssid;
119
static int hf_waveagent_returnedbssid;
120
static int hf_waveagent_scanbssid;
121
static int hf_waveagent_scanssid;
122
static int hf_waveagent_ifwlanrssi;
123
static int hf_waveagent_ifwlansupprates;
124
static int hf_waveagent_ifwlancapabilities;
125
static int hf_waveagent_ifwlanchannel;
126
static int hf_waveagent_ifwlanprivacy;
127
static int hf_waveagent_ifwlanbssmode;
128
static int hf_waveagent_ifwlannoise;
129
static int hf_waveagent_ifphytypes;
130
static int hf_waveagent_ifphytypebit0;
131
static int hf_waveagent_ifphytypebit1;
132
static int hf_waveagent_ifphytypebit2;
133
static int hf_waveagent_ifphytypebit3;
134
/* static int hf_waveagent_ifphytypebit4; */
135
static int hf_waveagent_ifwlanauthentication;
136
static int hf_waveagent_ifwlancipher;
137
static int hf_waveagent_delayfactor;
138
static int hf_waveagent_medialossrate;
139
static int hf_waveagent_txstartts;
140
static int hf_waveagent_txendts;
141
static int hf_waveagent_rxstartts;
142
static int hf_waveagent_rxendts;
143
static int hf_waveagent_oidcode;
144
static int hf_waveagent_oidvalue;
145
static int hf_waveagent_destip;
146
static int hf_waveagent_destport;
147
static int hf_waveagent_connectflags;
148
static int hf_waveagent_connecttype;
149
static int hf_waveagent_minrssi;
150
static int hf_waveagent_connecttimeout;
151
static int hf_waveagent_connectattempts;
152
static int hf_waveagent_reason;
153
static int hf_waveagent_sigsequencenum;
154
static int hf_waveagent_relaydestid;
155
static int hf_waveagent_relaysrcid;
156
static int hf_waveagent_relaymessagest;
157
158
/* Initialize the subtree pointers */
159
static int ett_waveagent;
160
static int ett_statechange;
161
static int ett_phytypes;
162
static int ett_fsflags;
163
static int ett_scindex[8];  /* NUM_STATE_CHANGES */
164
static int ett_bss[8];  /* NUM_BSS           */
165
static int ett_relaymessage;
166
167
168
static const value_string control_words[] = {
169
    { 0x01, "Receive, Count, Discard"},
170
    { 0x02, "Receive, Count, Loopback"},
171
    { 0x03, "Receive, Count, Push timestamp, Discard"},
172
    { 0x04, "Receive, Count, Push timestamp, Loopback"},
173
    { 0x08, "Transmit"},
174
    { 0x11, "Start Flow"},
175
    { 0x12, "Stop Flow"},
176
    { 0x20, "Stats Reset"},
177
    { 0x21, "Stats Request"},
178
    { 0x22, "Flow Stats Reset"},
179
    { 0x23, "Scan Results Request"},
180
    { 0x24, "Interface Info Request"},
181
    { 0x25, "Interface Change Info Request"},
182
    { 0x26, "OID Request"},
183
    { 0x2e, "Scan Results Response"},
184
    { 0x2f, "Stats Response"},
185
    { 0x30, "Interface Info Response"},
186
    { 0x31, "Interface Change Info Response"},
187
    { 0x32, "OID Response"},  /* XXX: is this correct ? entry originally located after 0x41 */
188
    { 0x3e, "Relay Message"},
189
    { 0x3f, "Relay Response"},
190
    { 0x40, "Client Connect Request"},
191
    { 0x41, "Client Disconnect Request"},
192
    { 0x80, "Capabilities Request"},
193
    { 0x81, "Capabilities Response"},
194
    { 0x82, "Reserve Request"},
195
    { 0x84, "Release Request"},
196
    { 0x85, "Flow Setup"},
197
    { 0x86, "Flow Destroy"},
198
    { 0x87, "Flow Connect"},
199
    { 0x88, "Flow Disconnect"},
200
    { 0x89, "Flow Listen"},
201
    { 0x8a, "Scan Request"},
202
    { 0x8b, "Learning Message"},
203
    { 0x8f, "Command Response"},
204
    { 0, NULL},
205
};
206
static value_string_ext control_words_ext = VALUE_STRING_EXT_INIT(control_words);
207
208
/* Dissects the WLAN interface stats structure */
209
static void dissect_wlan_if_stats(uint32_t starting_offset, proto_item *parent_tree, tvbuff_t *tvb)
210
0
{
211
0
    proto_item *phy_types;
212
0
    proto_tree *phy_types_tree;
213
0
    uint32_t    phy_types_bitfield, noise_floor;
214
215
0
    proto_tree_add_item(parent_tree,
216
0
        hf_waveagent_ifwlanbssid, tvb, starting_offset, 6, ENC_NA);
217
218
    /* two bytes of pad go here */
219
220
0
    proto_tree_add_item(parent_tree,
221
0
        hf_waveagent_ifwlanssid, tvb, starting_offset + 8, 32, ENC_ASCII);
222
223
    /* 4 byte SSID length field not reported */
224
225
0
    proto_tree_add_item(parent_tree,
226
0
        hf_waveagent_ifwlanrssi, tvb, starting_offset + 44, 4, ENC_BIG_ENDIAN);
227
228
0
    noise_floor = tvb_get_ntohl(tvb, starting_offset + 48);
229
230
0
    if (noise_floor != 0x7fffffff) {
231
0
        proto_tree_add_item(parent_tree,
232
0
            hf_waveagent_ifwlannoise, tvb, starting_offset + 48, 4, ENC_BIG_ENDIAN);
233
0
    }
234
0
    else {
235
0
        proto_tree_add_int_format_value(parent_tree,
236
0
            hf_waveagent_ifwlannoise, tvb, starting_offset + 48, 4, noise_floor,
237
0
            "Not Reported");
238
0
    }
239
240
0
    phy_types_bitfield = tvb_get_ntohl(tvb, starting_offset + 52);
241
242
0
    phy_types = proto_tree_add_uint(parent_tree, hf_waveagent_ifphytypes,
243
0
                                tvb, starting_offset + 52, 4, phy_types_bitfield);
244
245
0
    phy_types_tree = proto_item_add_subtree(phy_types, ett_phytypes);
246
247
0
    proto_tree_add_item(phy_types_tree,
248
0
            hf_waveagent_ifphytypebit0, tvb, starting_offset + 55, 1, ENC_LITTLE_ENDIAN);
249
250
0
    proto_tree_add_item(phy_types_tree,
251
0
            hf_waveagent_ifphytypebit1, tvb, starting_offset + 55, 1, ENC_LITTLE_ENDIAN);
252
253
0
    proto_tree_add_item(phy_types_tree,
254
0
            hf_waveagent_ifphytypebit2, tvb, starting_offset + 55, 1, ENC_LITTLE_ENDIAN);
255
256
0
    proto_tree_add_item(phy_types_tree,
257
0
            hf_waveagent_ifphytypebit3, tvb, starting_offset + 55, 1, ENC_LITTLE_ENDIAN);
258
259
0
    proto_tree_add_item(parent_tree,
260
0
        hf_waveagent_ifwlanauthentication, tvb, starting_offset + 56, 4, ENC_BIG_ENDIAN);
261
262
0
    proto_tree_add_item(parent_tree,
263
0
        hf_waveagent_ifwlancipher, tvb, starting_offset + 60, 4, ENC_BIG_ENDIAN);
264
0
}
265
266
static void dissect_wa_payload(uint32_t starting_offset, proto_item *parent_tree, packet_info* pinfo, tvbuff_t *tvb, uint32_t control_word, uint8_t version)
267
0
{
268
0
    switch (control_word)
269
0
    {
270
0
        case 0x11:   /* Flow start message */
271
0
            proto_tree_add_item(parent_tree,
272
0
                hf_waveagent_payfill, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
273
274
0
            proto_tree_add_item(parent_tree,
275
0
                hf_waveagent_paysize, tvb, starting_offset+4, 4, ENC_BIG_ENDIAN);
276
277
0
            proto_tree_add_item(parent_tree,
278
0
                hf_waveagent_avgrate, tvb, starting_offset+8, 4, ENC_BIG_ENDIAN);
279
280
0
            proto_tree_add_item(parent_tree,
281
0
                hf_waveagent_totalframes, tvb, starting_offset+12, 4, ENC_BIG_ENDIAN);
282
283
0
            break;
284
285
0
        case 0x23:   /* Scan results request */
286
0
            proto_tree_add_item(parent_tree,
287
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
288
289
0
            proto_tree_add_item(parent_tree,
290
0
                hf_waveagent_bssidstartindex, tvb, starting_offset+4, 4, ENC_BIG_ENDIAN);
291
292
0
            proto_tree_add_item(parent_tree,
293
0
                hf_waveagent_bssidstopindex, tvb, starting_offset+8, 4, ENC_BIG_ENDIAN);
294
295
0
            break;
296
297
0
        case 0x24:   /* Interface info request */
298
0
        case 0x25:   /* Interface change info request */
299
0
        case 0x8a:   /* Scan request */
300
0
            proto_tree_add_item(parent_tree,
301
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
302
303
0
            break;
304
305
0
        case 0x26:   /* OID request */
306
0
            proto_tree_add_item(parent_tree,
307
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
308
309
0
            proto_tree_add_item(parent_tree,
310
0
                hf_waveagent_oidcode, tvb, starting_offset+4, 4, ENC_BIG_ENDIAN);
311
312
0
            break;
313
314
0
        case 0x30: {  /* Interface stats response */
315
0
            uint32_t if_type;
316
317
0
            proto_tree_add_item(parent_tree,
318
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
319
320
0
            if_type = tvb_get_ntohl(tvb, starting_offset + 4);
321
322
0
            proto_tree_add_item(parent_tree,
323
0
                hf_waveagent_iftype, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
324
325
0
            proto_tree_add_item(parent_tree,
326
0
                hf_waveagent_ifdhcp, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
327
328
0
            proto_tree_add_item(parent_tree,
329
0
                hf_waveagent_ifmacaddr, tvb, starting_offset + 12, 6, ENC_NA);
330
331
            /* 2 bytes of pad go here */
332
333
0
            proto_tree_add_item(parent_tree,
334
0
                hf_waveagent_iflinkspeed, tvb, starting_offset + 20, 4, ENC_BIG_ENDIAN);
335
336
0
            proto_tree_add_item(parent_tree,
337
0
                hf_waveagent_ifdescription, tvb, starting_offset + 24, 128, ENC_ASCII);
338
339
            /* 4 byte length field goes here - skip it */
340
341
            /* two bytes of pad go here */
342
343
            /* If we have WLAN interface, then report the following */
344
0
            if (if_type == WLAN_INTERFACE)
345
0
                dissect_wlan_if_stats(starting_offset + 156, parent_tree, tvb);
346
347
            /* Next come the BindingAddress fields (for each address):
348
                2 bytes:  IP type (v4 or v6)
349
                2 bytes:  address length
350
                4 bytes:  service number (not used)
351
                16 bytes: IP address     */
352
353
            /* for the bound IP address, report both IP type and address */
354
355
0
            proto_tree_add_item(parent_tree,
356
0
                hf_waveagent_ifiptype, tvb, starting_offset + 252, 2, ENC_BIG_ENDIAN);
357
358
0
            if (tvb_get_ntohs(tvb, starting_offset + 252) == IPV4_TYPE) {
359
0
                proto_tree_add_item(parent_tree,
360
0
                    hf_waveagent_ifipv4, tvb, starting_offset + 260, 4, ENC_BIG_ENDIAN);  /* grab the last 4 bytes of the IP address field */
361
0
            }
362
0
            else {
363
0
                proto_tree_add_item(parent_tree,
364
0
                    hf_waveagent_ifipv6, tvb, starting_offset + 260, 16, ENC_NA);
365
0
            }
366
367
0
            proto_tree_add_item(parent_tree,
368
0
                hf_waveagent_ifdhcpserver, tvb, starting_offset + 284, 4, ENC_BIG_ENDIAN);
369
370
0
            proto_tree_add_item(parent_tree,
371
0
                hf_waveagent_ifgateway,    tvb, starting_offset + 308, 4, ENC_BIG_ENDIAN);
372
373
0
            proto_tree_add_item(parent_tree,
374
0
                hf_waveagent_ifdnsserver,  tvb, starting_offset + 332, 4, ENC_BIG_ENDIAN);
375
376
0
            break;
377
0
        }
378
379
0
        case 0x31:  {  /* Interface change info response */
380
0
            uint32_t offset;
381
0
            uint32_t if_type;
382
0
            uint32_t delta;
383
0
            uint32_t iLoop;
384
385
0
            proto_tree_add_item(parent_tree,
386
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
387
388
0
            if_type = tvb_get_ntohl(tvb, starting_offset + 4);
389
390
0
            proto_tree_add_item(parent_tree,
391
0
                hf_waveagent_iftype, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
392
393
0
            offset = starting_offset + 8;
394
0
            delta = 156;
395
396
0
            for (iLoop = 0; iLoop < NUM_STATE_CHANGES; iLoop++) {
397
0
                proto_item *stIndex;
398
0
                proto_tree *st_change_index_tree;
399
0
                uint32_t    if_status;
400
0
                int         current_offset;
401
402
0
                current_offset = offset + iLoop * delta;
403
404
                /* Check to see if the interface entry is valid */
405
0
                if_status = tvb_get_ntohl(tvb, current_offset);
406
0
                if (if_status == 0) continue;  /* No entry at this index, keep going */
407
408
                /* Add index specific trees to hide the details */
409
0
                stIndex = proto_tree_add_uint_format_value(parent_tree,
410
0
                    hf_waveagent_ifwlanl2status, tvb, current_offset, 4, if_status, "Interface state change %d", iLoop);
411
412
0
                st_change_index_tree = proto_item_add_subtree(stIndex, ett_scindex[iLoop]);
413
414
0
                if (if_type == WLAN_INTERFACE) {
415
0
                    proto_tree_add_item(st_change_index_tree,
416
0
                        hf_waveagent_ifwlanl2status, tvb, current_offset, 4, ENC_BIG_ENDIAN);
417
0
                } else {
418
0
                    proto_tree_add_item(st_change_index_tree,
419
0
                        hf_waveagent_ifethl2status, tvb, current_offset, 4, ENC_BIG_ENDIAN);
420
0
                }
421
422
0
                proto_tree_add_item(st_change_index_tree,
423
0
                    hf_waveagent_ifl3status, tvb, current_offset + 4, 4, ENC_BIG_ENDIAN);
424
425
0
                proto_tree_add_item(st_change_index_tree,
426
0
                    hf_waveagent_iflinkspeed, tvb, current_offset + 8, 4, ENC_BIG_ENDIAN);
427
428
0
                if (if_type == WLAN_INTERFACE) {
429
0
                    dissect_wlan_if_stats(current_offset + 12, st_change_index_tree, tvb);
430
0
                }
431
432
0
                proto_tree_add_item(st_change_index_tree,
433
0
                    hf_waveagent_snap, tvb, current_offset + 108, 8, ENC_BIG_ENDIAN);
434
435
0
                proto_tree_add_item(st_change_index_tree,
436
0
                    hf_waveagent_ifiptype, tvb, current_offset + 116, 2, ENC_BIG_ENDIAN);
437
438
0
                if (tvb_get_ntohs(tvb, current_offset + 116) == IPV4_TYPE) {
439
0
                    proto_tree_add_item(st_change_index_tree,
440
0
                        hf_waveagent_ifipv4, tvb, current_offset + 124, 4, ENC_BIG_ENDIAN);  /* grab the last 4 bytes of the IP address field */
441
0
                }
442
0
                else {
443
0
                    proto_tree_add_item(st_change_index_tree,
444
0
                        hf_waveagent_ifipv6, tvb, current_offset + 124, 16, ENC_NA);
445
0
                }
446
447
                /* 16 bytes of padding */
448
0
            }
449
450
0
            break;
451
0
        }
452
453
0
        case 0x32:   /* OID response */
454
0
            proto_tree_add_item(parent_tree,
455
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
456
457
0
            proto_tree_add_item(parent_tree,
458
0
                hf_waveagent_oidcode, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
459
460
0
            proto_tree_add_item(parent_tree,
461
0
                hf_waveagent_oidvalue, tvb, starting_offset + 12, 1024, ENC_ASCII);
462
463
0
            break;
464
465
0
        case 0x2e: {  /* scan results response message */
466
0
            uint32_t       offset;
467
0
            proto_item    *pi;
468
0
            uint32_t       num_bss_entries;
469
0
            uint32_t       tag_len;
470
0
            uint32_t       delta;
471
0
            uint32_t       iLoop;
472
0
            wmem_strbuf_t *sb;
473
474
0
            proto_tree_add_item(parent_tree,
475
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
476
477
478
0
            proto_tree_add_item(parent_tree,
479
0
                hf_waveagent_totalbssid, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
480
481
0
            pi = proto_tree_add_item(parent_tree,
482
0
                hf_waveagent_returnedbssid, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
483
484
0
            num_bss_entries = tvb_get_ntohl(tvb, starting_offset + 8);
485
486
0
            if (num_bss_entries > NUM_BSS) {
487
0
                proto_item_append_text(pi, " [**Too large: Limiting to " G_STRINGIFY(NUM_BSS) "]");
488
0
                num_bss_entries = NUM_BSS;
489
0
            }
490
            /* Add 4 bytes of pad for the offset */
491
492
0
            offset = starting_offset + 16;
493
0
            delta  = 148;
494
495
0
            sb = wmem_strbuf_new_sized(pinfo->pool, 8);
496
497
0
            for (iLoop = 0; iLoop < num_bss_entries; iLoop++)
498
0
            {
499
0
                proto_item *bssIndex;
500
0
                proto_tree *bss_tree;
501
0
                int         current_offset;
502
503
0
                wmem_strbuf_truncate(sb, 0);
504
505
0
                current_offset = offset + iLoop * delta;
506
507
0
                bssIndex = proto_tree_add_item(parent_tree,
508
0
                    hf_waveagent_scanssid, tvb, current_offset, 32, ENC_ASCII);
509
510
0
                bss_tree = proto_item_add_subtree(bssIndex, ett_bss[iLoop]);
511
512
0
                tag_len = tvb_get_ntohl(tvb, current_offset + 52);
513
514
0
                if (tag_len != 0) {
515
0
                    uint32_t      isr;
516
0
                    uint8_t       isr_value;
517
518
0
                    for (isr = 0; isr < tag_len; isr++) {
519
0
                        isr_value = tvb_get_uint8(tvb, offset + 36 + isr);
520
0
                        if (isr_value == 0xFF){
521
0
                            proto_tree_add_string (bss_tree, hf_waveagent_ifwlansupprates, tvb, offset + 36 + isr,
522
0
                                                   1,
523
0
                                                   "BSS requires support for mandatory features of HT PHY (IEEE 802.11"
524
0
                                                   " - Clause 20)");
525
0
                        } else {
526
0
                            wmem_strbuf_append_printf(sb, "%2.1f%s ",
527
0
                                      (isr_value & 0x7F) * 0.5,
528
0
                                      (isr_value & 0x80) ? "(B)" : "");
529
530
0
                        }
531
0
                    }
532
0
                    wmem_strbuf_append(sb, " [Mbit/sec]");
533
0
                }
534
0
                else {
535
0
                    wmem_strbuf_append(sb, "Not defined");
536
0
                }
537
538
0
                proto_tree_add_string (bss_tree, hf_waveagent_ifwlansupprates, tvb, offset + 36,
539
0
                    tag_len, wmem_strbuf_get_str(sb));
540
541
0
                proto_tree_add_item(bss_tree,
542
0
                    hf_waveagent_scanbssid, tvb, current_offset + 56, 6, ENC_NA);
543
544
0
                proto_tree_add_item(bss_tree,
545
0
                    hf_waveagent_ifwlancapabilities, tvb, current_offset + 62, 2, ENC_BIG_ENDIAN);
546
547
0
                proto_tree_add_item(bss_tree,
548
0
                    hf_waveagent_ifwlanrssi, tvb, current_offset + 64, 4, ENC_BIG_ENDIAN);
549
550
                /*  For now this is just a 4 byte pad, so comment it out...  */
551
#if 0
552
                proto_tree_add_item(bss_tree,
553
                    hf_waveagent_ifwlansigquality, tvb, current_offset + 68, 4, ENC_BIG_ENDIAN);
554
#endif
555
0
                proto_tree_add_item(bss_tree,
556
0
                    hf_waveagent_ifwlanchannel, tvb, current_offset + 72, 4, ENC_BIG_ENDIAN);
557
558
0
                proto_tree_add_item(bss_tree,
559
0
                    hf_waveagent_ifwlanprivacy, tvb, current_offset + 76, 4, ENC_BIG_ENDIAN);
560
561
0
                proto_tree_add_item(bss_tree,
562
0
                    hf_waveagent_ifwlanbssmode, tvb, current_offset + 80, 4, ENC_BIG_ENDIAN);
563
0
            }
564
0
            break;
565
0
        }
566
567
0
        case 0x2f:   /* Stats response message */
568
0
            if (version < 3) {
569
                /* For version 2 WA protocol the capability status is not in the header but in the CAP
570
                   RESPONSE.  Need to read it here and then advance the payload offset.  This is a
571
                   packet that had a structure change in the beginning of the packet when moving
572
                   to v3 */
573
0
                proto_tree_add_item(parent_tree,
574
0
                    hf_waveagent_capstatus, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
575
576
0
                proto_tree_add_item(parent_tree,
577
0
                    hf_waveagent_protocolversion, tvb, starting_offset, 1, ENC_BIG_ENDIAN);
578
579
0
                starting_offset += 4;
580
0
            }
581
582
0
            proto_tree_add_item(parent_tree,
583
0
                hf_waveagent_capimpl, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
584
585
0
            proto_tree_add_item(parent_tree,
586
0
                       hf_waveagent_state, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
587
588
0
            proto_tree_add_item(parent_tree,
589
0
                       hf_waveagent_appstate, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
590
591
0
            proto_tree_add_item(parent_tree,
592
0
                hf_waveagent_rxdatapckts, tvb, starting_offset + 12, 8, ENC_BIG_ENDIAN);
593
594
0
            proto_tree_add_item(parent_tree,
595
0
                hf_waveagent_rxdatabytes, tvb, starting_offset + 20, 8, ENC_BIG_ENDIAN);
596
597
0
            proto_tree_add_item(parent_tree,
598
0
                hf_waveagent_rxpcktrate, tvb, starting_offset + 28, 8, ENC_BIG_ENDIAN);
599
600
0
            proto_tree_add_item(parent_tree,
601
0
                hf_waveagent_rxbyterate, tvb, starting_offset + 36, 8, ENC_BIG_ENDIAN);
602
603
0
            proto_tree_add_item(parent_tree,
604
0
                hf_waveagent_txdatapckts, tvb, starting_offset + 44, 8, ENC_BIG_ENDIAN);
605
606
0
            proto_tree_add_item(parent_tree,
607
0
                hf_waveagent_txdatabytes, tvb, starting_offset + 52, 8, ENC_BIG_ENDIAN);
608
609
0
            proto_tree_add_item(parent_tree,
610
0
                hf_waveagent_txpcktrate, tvb, starting_offset + 60, 8, ENC_BIG_ENDIAN);
611
612
0
            proto_tree_add_item(parent_tree,
613
0
                hf_waveagent_txbyterate, tvb, starting_offset + 68, 8, ENC_BIG_ENDIAN);
614
615
0
            proto_tree_add_item(parent_tree,
616
0
                hf_waveagent_looppckts, tvb, starting_offset + 76, 8, ENC_BIG_ENDIAN);
617
618
0
            proto_tree_add_item(parent_tree,
619
0
                hf_waveagent_loopbytes, tvb, starting_offset + 84, 8, ENC_BIG_ENDIAN);
620
621
0
            proto_tree_add_item(parent_tree,
622
0
                hf_waveagent_rxctlpckts, tvb, starting_offset + 92, 8, ENC_BIG_ENDIAN);
623
624
0
            proto_tree_add_item(parent_tree,
625
0
                hf_waveagent_rxctlbytes, tvb, starting_offset + 100, 8, ENC_BIG_ENDIAN);
626
627
0
            proto_tree_add_item(parent_tree,
628
0
                hf_waveagent_txctlpckts, tvb, starting_offset + 108, 8, ENC_BIG_ENDIAN);
629
630
0
            proto_tree_add_item(parent_tree,
631
0
                hf_waveagent_txctlbytes, tvb, starting_offset + 116, 8, ENC_BIG_ENDIAN);
632
633
0
            proto_tree_add_item(parent_tree,
634
0
                hf_waveagent_unknowncmds, tvb, starting_offset + 124, 8, ENC_BIG_ENDIAN);
635
636
0
            proto_tree_add_item(parent_tree,
637
0
                hf_waveagent_snap, tvb, starting_offset + 132, 8, ENC_BIG_ENDIAN);
638
639
#if 0
640
            proto_tree_add_item(parent_tree,
641
                hf_waveagent_tstamp1, tvb, 140, 4, ENC_BIG_ENDIAN);
642
643
            proto_tree_add_item(parent_tree,
644
                hf_waveagent_tstamp2, tvb, 144, 4, ENC_BIG_ENDIAN);
645
646
            proto_tree_add_item(parent_tree,
647
                hf_waveagent_tstamp3, tvb, 148, 4, ENC_BIG_ENDIAN);
648
649
            proto_tree_add_item(parent_tree,
650
                hf_waveagent_tstamp4, tvb, 152, 4, ENC_BIG_ENDIAN);
651
652
            proto_tree_add_item(parent_tree,
653
                hf_waveagent_tstamp5, tvb, 156, 4, ENC_BIG_ENDIAN);
654
655
            proto_tree_add_item(parent_tree,
656
                hf_waveagent_tstamp6, tvb, 160, 4, ENC_BIG_ENDIAN);
657
658
            proto_tree_add_item(parent_tree,
659
                hf_waveagent_tstamp7, tvb, 164, 4, ENC_BIG_ENDIAN);
660
661
            proto_tree_add_item(parent_tree,
662
                hf_waveagent_tstamp8, tvb, 168, 4, ENC_BIG_ENDIAN);
663
664
            proto_tree_add_item(parent_tree,
665
                hf_waveagent_minlcldelta, tvb, 172, 4, ENC_BIG_ENDIAN);
666
667
            proto_tree_add_item(parent_tree,
668
                hf_waveagent_maxlcldelta, tvb, 176, 4, ENC_BIG_ENDIAN);
669
670
            proto_tree_add_item(parent_tree,
671
                hf_waveagent_avglcldelta, tvb, 180, 4, ENC_BIG_ENDIAN);
672
673
            proto_tree_add_item(parent_tree,
674
                hf_waveagent_minremdelta, tvb, 184, 4, ENC_BIG_ENDIAN);
675
676
            proto_tree_add_item(parent_tree,
677
                hf_waveagent_maxremdelta, tvb, 188, 4, ENC_BIG_ENDIAN);
678
679
            proto_tree_add_item(parent_tree,
680
                hf_waveagent_avgremdelta, tvb, 192, 4, ENC_BIG_ENDIAN);
681
#endif
682
0
            proto_tree_add_item(parent_tree,
683
0
                hf_waveagent_rx1pl, tvb, starting_offset + 284, 8, ENC_BIG_ENDIAN);
684
685
0
            proto_tree_add_item(parent_tree,
686
0
                hf_waveagent_rx2pl, tvb, starting_offset + 292, 8, ENC_BIG_ENDIAN);
687
688
0
            proto_tree_add_item(parent_tree,
689
0
                hf_waveagent_rx3pl, tvb, starting_offset + 300, 8, ENC_BIG_ENDIAN);
690
691
0
            proto_tree_add_item(parent_tree,
692
0
                hf_waveagent_rx4pl, tvb, starting_offset + 308, 8, ENC_BIG_ENDIAN);
693
694
0
            proto_tree_add_item(parent_tree,
695
0
                hf_waveagent_rx5pl, tvb, starting_offset + 316, 8, ENC_BIG_ENDIAN);
696
697
0
            proto_tree_add_item(parent_tree,
698
0
                hf_waveagent_rxoospkts, tvb, starting_offset + 324, 8, ENC_BIG_ENDIAN);
699
700
0
            proto_tree_add_item(parent_tree,
701
0
                hf_waveagent_jitter, tvb, starting_offset + 356, 8, ENC_BIG_ENDIAN);
702
703
0
            if (version >= 3) {
704
0
                proto_tree_add_item(parent_tree,
705
0
                    hf_waveagent_delayfactor, tvb, starting_offset + 364, 8, ENC_BIG_ENDIAN);
706
707
0
                proto_tree_add_item(parent_tree,
708
0
                    hf_waveagent_medialossrate, tvb, starting_offset + 372, 8, ENC_BIG_ENDIAN);
709
710
0
                proto_tree_add_item(parent_tree,
711
0
                    hf_waveagent_txstartts, tvb, starting_offset + 380, 8, ENC_BIG_ENDIAN);
712
713
0
                proto_tree_add_item(parent_tree,
714
0
                    hf_waveagent_txendts, tvb, starting_offset + 388, 8, ENC_BIG_ENDIAN);
715
716
0
                proto_tree_add_item(parent_tree,
717
0
                    hf_waveagent_rxstartts, tvb, starting_offset + 396, 8, ENC_BIG_ENDIAN);
718
719
0
                proto_tree_add_item(parent_tree,
720
0
                    hf_waveagent_rxendts, tvb, starting_offset + 404, 8, ENC_BIG_ENDIAN);
721
722
0
                proto_tree_add_item(parent_tree,
723
0
                    hf_waveagent_latencysum, tvb, starting_offset + 412, 8, ENC_BIG_ENDIAN);
724
725
0
                proto_tree_add_item(parent_tree,
726
0
                    hf_waveagent_latencycount, tvb, starting_offset + 420, 8, ENC_BIG_ENDIAN);
727
728
0
                proto_tree_add_item(parent_tree,
729
0
                    hf_waveagent_txflowstop, tvb, starting_offset + 428, 8, ENC_BIG_ENDIAN);
730
0
            }
731
732
0
            break;
733
734
0
        case 0x40: {
735
0
            uint32_t offset;
736
0
            uint32_t delta;
737
0
            uint32_t iLoop;
738
0
            uint32_t num_bss_entries;
739
740
0
            proto_tree_add_item(parent_tree,
741
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
742
743
0
            proto_tree_add_item(parent_tree,
744
0
                hf_waveagent_connectflags, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
745
746
0
            proto_tree_add_item(parent_tree,
747
0
                hf_waveagent_connecttype, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
748
749
0
            proto_tree_add_item(parent_tree,
750
0
                hf_waveagent_scanssid, tvb, starting_offset + 12, 32, ENC_ASCII);
751
752
0
            num_bss_entries = tvb_get_ntohl(tvb, starting_offset + 142);
753
754
0
            offset = starting_offset + 46;
755
0
            delta = 6;
756
0
            for (iLoop = 0; iLoop < num_bss_entries; iLoop++)
757
0
            {
758
0
                int current_offset;
759
0
                current_offset = offset + iLoop * delta;
760
761
0
                proto_tree_add_item(parent_tree,
762
0
                    hf_waveagent_scanbssid, tvb, current_offset, 6, ENC_NA);
763
0
            }
764
765
0
            proto_tree_add_item(parent_tree,
766
0
                hf_waveagent_minrssi, tvb, starting_offset + 146, 4, ENC_BIG_ENDIAN);
767
768
0
            proto_tree_add_item(parent_tree,
769
0
                hf_waveagent_connecttimeout, tvb, starting_offset + 150, 4, ENC_BIG_ENDIAN);
770
771
0
            proto_tree_add_item(parent_tree,
772
0
                hf_waveagent_connectattempts, tvb, starting_offset + 154, 4, ENC_BIG_ENDIAN);
773
774
0
            break;
775
0
        }
776
777
0
        case 0x41:
778
0
            proto_tree_add_item(parent_tree,
779
0
                hf_waveagent_ifindex, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
780
781
0
            proto_tree_add_item(parent_tree,
782
0
                hf_waveagent_reason, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
783
784
0
            break;
785
786
0
        case 0x81:   /* Capabilities response */
787
0
            if (version < 3) {
788
                /* For version 2 WA protocol the capability status is not in the header but in the CAP
789
                   RESPONSE.  Need to read it here and then advance the payload offset.  This is a
790
                   packet that had a structure change in the beginning of the packet when moving
791
                   to v3 */
792
0
                proto_tree_add_item(parent_tree,
793
0
                    hf_waveagent_capstatus, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
794
795
0
                proto_tree_add_item(parent_tree,
796
0
                    hf_waveagent_protocolversion, tvb, starting_offset, 1, ENC_BIG_ENDIAN);
797
798
0
                starting_offset += 4;
799
0
            }
800
801
0
            proto_tree_add_item(parent_tree,
802
0
                hf_waveagent_capimpl, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
803
804
0
            proto_tree_add_item(parent_tree,
805
0
                hf_waveagent_id, tvb, starting_offset + 4, 128, ENC_ASCII);
806
807
0
            proto_tree_add_item(parent_tree,
808
0
                hf_waveagent_bindtag, tvb, starting_offset + 136, 128, ENC_ASCII);
809
810
0
            proto_tree_add_item(parent_tree,
811
0
                hf_waveagent_version, tvb, starting_offset + 268, 128, ENC_ASCII);
812
813
0
            proto_tree_add_item(parent_tree,
814
0
                hf_waveagent_brokerip, tvb, starting_offset + 400, 4, ENC_BIG_ENDIAN);
815
816
0
            proto_tree_add_item(parent_tree,
817
0
                hf_waveagent_brokerport, tvb, starting_offset + 404, 4, ENC_BIG_ENDIAN);
818
819
0
            proto_tree_add_item(parent_tree,
820
0
                hf_waveagent_bindlevel, tvb, starting_offset + 408, 4, ENC_BIG_ENDIAN);
821
822
0
            proto_tree_add_item(parent_tree,
823
0
                hf_waveagent_bindport, tvb, starting_offset + 412, 4, ENC_BIG_ENDIAN);
824
825
0
            if (version >= 3) {
826
0
                proto_tree_add_item(parent_tree,
827
0
                    hf_waveagent_capabilities2, tvb, starting_offset + 416, 4, ENC_BIG_ENDIAN);
828
829
0
                proto_tree_add_item(parent_tree,
830
0
                    hf_waveagent_numinterfaces, tvb, starting_offset + 420, 4, ENC_BIG_ENDIAN);
831
832
0
                proto_tree_add_item(parent_tree,
833
0
                    hf_waveagent_ifmask, tvb, starting_offset + 424, 4, ENC_BIG_ENDIAN);
834
0
            }
835
836
0
            break;
837
838
0
        case 0x82:    /* Reserve request */
839
0
            proto_tree_add_item(parent_tree,
840
0
                hf_waveagent_bindtag, tvb, starting_offset, 128, ENC_ASCII);
841
842
0
            proto_tree_add_item(parent_tree,
843
0
                hf_waveagent_brokerip, tvb, starting_offset + 132, 4, ENC_BIG_ENDIAN);
844
845
0
            proto_tree_add_item(parent_tree,
846
0
                hf_waveagent_brokerport, tvb, starting_offset + 136, 4, ENC_BIG_ENDIAN);
847
848
0
            break;
849
850
0
        case 0x85: {   /* Flow setup */
851
0
            proto_tree *fs_flags;
852
0
            proto_tree *fs_flags_tree;
853
0
            uint32_t    flags_bitfield;
854
855
0
            if (version < 3) {
856
0
                proto_tree_add_item(parent_tree,
857
0
                    hf_waveagent_rxflownum, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
858
0
            }
859
860
0
            proto_tree_add_item(parent_tree,
861
0
                hf_waveagent_mode, tvb, starting_offset + 7, 1, ENC_BIG_ENDIAN);
862
863
0
            proto_tree_add_item(parent_tree,
864
0
                hf_waveagent_endpointtype, tvb, starting_offset + 7, 1, ENC_BIG_ENDIAN);
865
866
0
            proto_tree_add_item(parent_tree,
867
0
                hf_waveagent_bindport, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
868
869
0
            proto_tree_add_item(parent_tree,
870
0
                hf_waveagent_bindlevel, tvb, starting_offset + 12, 4, ENC_BIG_ENDIAN);
871
872
0
            proto_tree_add_item(parent_tree,
873
0
                hf_waveagent_remoteport, tvb, starting_offset + 16, 4, ENC_BIG_ENDIAN);
874
875
0
            proto_tree_add_item(parent_tree,
876
0
                hf_waveagent_remoteaddr, tvb, starting_offset + 24, 4, ENC_BIG_ENDIAN);
877
878
0
            proto_tree_add_item(parent_tree,
879
0
                hf_waveagent_dscp, tvb, starting_offset + 40, 4, ENC_BIG_ENDIAN);
880
881
0
            flags_bitfield = tvb_get_ntohl(tvb, starting_offset + 44);
882
883
0
            fs_flags = proto_tree_add_uint(parent_tree, hf_waveagent_fsflags,
884
0
                                        tvb, starting_offset + 44, 4, flags_bitfield);
885
886
0
            fs_flags_tree = proto_item_add_subtree(fs_flags, ett_fsflags);
887
888
0
            proto_tree_add_item(fs_flags_tree,
889
0
                    hf_waveagent_fscbrflag, tvb, starting_offset + 47, 1, ENC_LITTLE_ENDIAN);
890
891
0
            proto_tree_add_item(fs_flags_tree,
892
0
                    hf_waveagent_fscombinedsetupflag, tvb, starting_offset + 47, 1, ENC_LITTLE_ENDIAN);
893
894
0
            if (version >= 3) {
895
0
                proto_tree_add_item(parent_tree,
896
0
                    hf_waveagent_ifindex, tvb, starting_offset + 48, 4, ENC_BIG_ENDIAN);
897
898
0
                proto_tree_add_item(parent_tree,
899
0
                    hf_waveagent_payfill, tvb, starting_offset + 52, 4, ENC_BIG_ENDIAN);
900
901
0
                proto_tree_add_item(parent_tree,
902
0
                    hf_waveagent_paysize, tvb, starting_offset + 56, 4, ENC_BIG_ENDIAN);
903
904
0
                proto_tree_add_item(parent_tree,
905
0
                    hf_waveagent_avgrate, tvb, starting_offset + 60, 4, ENC_BIG_ENDIAN);
906
907
0
                proto_tree_add_item(parent_tree,
908
0
                    hf_waveagent_totalframes, tvb, starting_offset + 64, 4, ENC_BIG_ENDIAN);
909
0
            }
910
911
0
            break;
912
0
        }
913
914
0
        case 0x8b:
915
0
            proto_tree_add_item(parent_tree,
916
0
                hf_waveagent_destip, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
917
918
0
            proto_tree_add_item(parent_tree,
919
0
                hf_waveagent_destport, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
920
921
0
            proto_tree_add_item(parent_tree,
922
0
                hf_waveagent_connectflags, tvb, starting_offset + 8, 4, ENC_BIG_ENDIAN);
923
924
0
            break;
925
926
0
        case 0x3f:  /* Relay response */
927
0
        case 0x8f:  /* Command Response */
928
0
            proto_tree_add_item(parent_tree,
929
0
                hf_waveagent_commandstatus, tvb, starting_offset, 4, ENC_BIG_ENDIAN);
930
931
0
            proto_tree_add_item(parent_tree,
932
0
                hf_waveagent_syserrno, tvb, starting_offset + 4, 4, ENC_BIG_ENDIAN);
933
934
0
            proto_tree_add_item(parent_tree,
935
0
                hf_waveagent_statusstring, tvb, starting_offset + 8, 128, ENC_ASCII);
936
937
0
            break;
938
0
    }
939
0
}
940
941
942
943
static uint32_t dissect_wa_header(uint32_t starting_offset, proto_item *parent_tree, tvbuff_t *tvb, uint8_t version)
944
0
{
945
0
    uint32_t wa_payload_offset;
946
947
0
    proto_tree_add_item(parent_tree,
948
0
        hf_waveagent_controlword, tvb, 30+starting_offset, 2, ENC_BIG_ENDIAN);
949
950
0
    proto_tree_add_item(parent_tree,
951
0
        hf_waveagent_payloadlen, tvb, 20+starting_offset, 4, ENC_BIG_ENDIAN);
952
953
0
    proto_tree_add_item(parent_tree,
954
0
        hf_waveagent_transnum, tvb, 24+starting_offset, 4, ENC_BIG_ENDIAN);
955
956
0
    proto_tree_add_item(parent_tree,
957
0
        hf_waveagent_rtoken, tvb, 32+starting_offset, 4, ENC_BIG_ENDIAN);
958
959
0
    proto_tree_add_item(parent_tree,
960
0
        hf_waveagent_flowid, tvb, 36+starting_offset, 4, ENC_BIG_ENDIAN);
961
962
0
    if (version >= 3) {
963
0
        proto_tree_add_item(parent_tree,
964
0
            hf_waveagent_capstatus, tvb, 40+starting_offset, 4, ENC_BIG_ENDIAN);
965
966
0
        proto_tree_add_item(parent_tree,
967
0
            hf_waveagent_protocolversion, tvb, 40+starting_offset, 1, ENC_BIG_ENDIAN);
968
969
0
        wa_payload_offset = WA_V3_PAYLOAD_OFFSET + starting_offset;
970
0
    }
971
0
    else {
972
0
        wa_payload_offset = WA_V2_PAYLOAD_OFFSET + starting_offset;
973
0
    }
974
975
0
    proto_tree_add_item(parent_tree,
976
0
        hf_waveagent_sigsequencenum, tvb, 4+starting_offset, 1, ENC_BIG_ENDIAN);
977
978
0
    return wa_payload_offset;
979
0
}
980
981
/* Dissect the packets */
982
static int dissect_waveagent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
983
1.50k
{
984
1.50k
    proto_item *ti, *rmi;
985
1.50k
    proto_tree *waveagent_tree, *relay_message_tree, *payload_tree;
986
1.50k
    uint8_t     signature_start, signature_end;
987
1.50k
    uint8_t     version;
988
1.50k
    uint32_t    magic_number;
989
1.50k
    uint32_t    control_word, paylen;
990
1.50k
    uint32_t    wa_payload_offset;
991
992
    /* Check that there's enough data */
993
1.50k
    if (tvb_captured_length(tvb) < 52 )
994
1.23k
        return 0;
995
996
277
    magic_number    = tvb_get_ntohl(tvb, 16) & 0x0FFFFFFF;  /* Mask magic number off */
997
277
    if(magic_number != 0x0F87C3A5){
998
277
        return 0;
999
277
    }
1000
1001
0
    signature_start = tvb_get_uint8(tvb, 0);
1002
0
    signature_end   = tvb_get_uint8(tvb, 15);
1003
1004
0
    if ( ((signature_start != 0xcc) && (signature_start !=0xdd)) ||
1005
0
         (signature_end != 0xE2))
1006
        /*  This packet does not appear to belong to WaveAgent.
1007
         *  Return 0 to give another dissector a chance to dissect it.
1008
         */
1009
0
        return 0;
1010
1011
0
    version         = ((tvb_get_ntohl(tvb, 16) & 0xF0000000) >> 28 == 1) ? 3 : 2;       /* Mask version bit off */
1012
1013
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "WA");
1014
0
    col_clear(pinfo->cinfo, COL_INFO);
1015
1016
    /* Grab the control word, parse the WaveAgent payload accordingly */
1017
1018
0
    control_word = tvb_get_ntohl(tvb, 28);
1019
0
    paylen       = tvb_get_ntohl(tvb, 20);
1020
1021
0
    col_add_fstr(pinfo->cinfo, COL_INFO, "%s (0x%x)",
1022
0
        val_to_str_ext_const(control_word, &control_words_ext, "Unknown"), control_word);
1023
1024
0
    if (tree) {
1025
        /* create display subtree for the protocol */
1026
0
        ti = proto_tree_add_protocol_format(tree, proto_waveagent, tvb, 0, -1,
1027
0
                        "WaveAgent, %s (0x%x), Payload Length %u Bytes",
1028
0
                        val_to_str_ext_const(control_word, &control_words_ext, "Unknown"), control_word, paylen);
1029
1030
0
        waveagent_tree = proto_item_add_subtree(ti, ett_waveagent);
1031
1032
0
        wa_payload_offset = dissect_wa_header(0, waveagent_tree, tvb, version);
1033
1034
0
        payload_tree = waveagent_tree;
1035
1036
        /* Need to check for a relay message.  If so, parse the extra fields and then parse the WA packet */
1037
0
        if (control_word == 0x3e)
1038
0
        {
1039
0
            proto_tree_add_item(waveagent_tree,
1040
0
                hf_waveagent_relaydestid, tvb, wa_payload_offset, 4, ENC_BIG_ENDIAN);
1041
0
            proto_tree_add_item(waveagent_tree,
1042
0
                hf_waveagent_relaysrcid, tvb, wa_payload_offset+4, 4, ENC_BIG_ENDIAN);
1043
1044
            /* Parse control_word of the relay message */
1045
0
            control_word = tvb_get_ntohl(tvb, wa_payload_offset+12+28);
1046
0
                rmi = proto_tree_add_none_format(waveagent_tree, hf_waveagent_relaymessagest,
1047
0
                                                 tvb, wa_payload_offset+12+28, 0,
1048
0
                                                 "Relayed WaveAgent Message, %s (0x%x)",
1049
0
                                                 val_to_str_ext_const(control_word, &control_words_ext, "Unknown"),
1050
0
                                                 control_word);
1051
1052
0
            relay_message_tree = proto_item_add_subtree(rmi, ett_relaymessage);
1053
1054
0
            wa_payload_offset = dissect_wa_header(wa_payload_offset+12, relay_message_tree, tvb, version);
1055
0
            payload_tree = relay_message_tree;
1056
0
        }
1057
1058
0
        dissect_wa_payload(wa_payload_offset, payload_tree, pinfo, tvb, control_word, version);
1059
0
    }
1060
1061
    /* Return the amount of data this dissector was able to dissect */
1062
0
    return tvb_captured_length(tvb);
1063
0
}
1064
1065
static bool dissect_waveagent_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1066
1.50k
{
1067
1.50k
    return dissect_waveagent(tvb, pinfo, tree) > 0;
1068
1.50k
}
1069
1070
1071
#if 0
1072
static const value_string status_values[] = {
1073
    { 0, "OK" },
1074
    { 1, "In Use" },
1075
    { 0, NULL }
1076
};
1077
#endif
1078
1079
/* Register the protocol with Wireshark */
1080
1081
void proto_register_waveagent(void)
1082
14
{
1083
14
    static const value_string tcp_states[] = {
1084
14
        {  0, "Closed" },
1085
14
        {  1, "Listen" },
1086
14
        {  2, "SYN Sent" },
1087
14
        {  3, "SYN received" },
1088
14
        {  4, "Established" },
1089
14
        {  5, "FIN Wait 1" },
1090
14
        {  6, "FIN Wait 2" },
1091
14
        {  7, "Close Wait" },
1092
14
        {  8, "Closing" },
1093
14
        {  9, "Last ACK" },
1094
14
        { 10, "Time Wait" },
1095
14
        {  0, NULL },
1096
14
    };
1097
1098
14
    static const value_string app_states[] = {
1099
14
        {  0, "IDLE" },
1100
14
        {  1, "READY" },
1101
14
        {  0, NULL },
1102
14
    };
1103
1104
14
    static const value_string wa_modes[] = {
1105
14
        {  0, "In-band" },
1106
14
        {  1, "Source" },
1107
14
        {  2, "Sink" },
1108
14
        {  3, "Loopback" },
1109
14
        {  0, NULL },
1110
14
    };
1111
1112
14
    static const value_string wa_endpointtypes[] = {
1113
14
        {  0, "Undefined" },
1114
14
        {  1, "Server" },
1115
14
        {  2, "Client" },
1116
14
        {  0, NULL },
1117
14
    };
1118
1119
14
    static const value_string binding_levels[] = {
1120
14
        {  0, "WLAN" },
1121
14
        {  1, "Ethernet" },
1122
14
        {  2, "IP" },
1123
14
        {  3, "UDP" },
1124
14
        {  4, "TCP" },
1125
14
        {  5, "FIN Wait 1" },
1126
14
        {  6, "FIN Wait 2" },
1127
14
        {  7, "Close Wait" },
1128
14
        {  8, "Closing" },
1129
14
        {  9, "Last ACK" },
1130
14
        { 10, "Time Wait" },
1131
14
        {  0, NULL },
1132
14
    };
1133
1134
14
    static const value_string if_types[] = {
1135
14
        {  ETHERNET_INTERFACE, "Ethernet" },
1136
14
        {  WLAN_INTERFACE, "WLAN" },
1137
14
        {  0, NULL },
1138
14
    };
1139
1140
14
    static const value_string no_yes[] = {
1141
14
        {  0, "No" },
1142
14
        {  1, "Yes" },
1143
14
        {  0, NULL },
1144
14
    };
1145
1146
14
    static const value_string ip_types[] = {
1147
14
        {  0,  "Unspecified" },
1148
14
        {  IPV4_TYPE,  "IPv4" },
1149
14
        {  IPV6_TYPE, "IPv6" },
1150
14
        {  0, NULL },
1151
14
    };
1152
1153
14
    static const value_string if_l3_states[] = {
1154
14
        {  0, "Uninitialized" },
1155
14
        {  1, "Disconnected" },
1156
14
        {  2, "Connected" },
1157
14
        {  3, "Error" },
1158
14
        {  0, NULL },
1159
14
    };
1160
1161
14
    static const value_string if_wlan_states[] = {
1162
14
        {  0, "Uninitialized" },
1163
14
        {  1, "Not ready" },
1164
14
        {  2, "Connected" },
1165
14
        {  3, "Ad Hoc network formed" },
1166
14
        {  4, "Disconnecting" },
1167
14
        {  5, "Disconnected" },
1168
14
        {  6, "Associating" },
1169
14
        {  7, "Discovering" },
1170
14
        {  8, "Authenticating" },
1171
14
        {  0, NULL },
1172
14
    };
1173
1174
14
    static const value_string if_eth_states[] = {
1175
14
        {  0, "Uninitialized" },
1176
14
        {  1, "Not Operational" },
1177
14
        {  2, "Unreachable" },
1178
14
        {  3, "Disconnected" },
1179
14
        {  4, "Connecting" },
1180
14
        {  5, "Connected" },
1181
14
        {  6, "Operational" },
1182
14
        {  7, "Error" },
1183
14
        {  0, NULL },
1184
14
    };
1185
1186
14
    static const value_string bss_modes[] = {
1187
14
        {  0, "Infrastructure" },
1188
14
        {  1, "IBSS" },
1189
14
        {  2, "Unknown" },
1190
14
        {  0, NULL },
1191
14
    };
1192
1193
14
    static const value_string auth_algs[] = {
1194
14
        {  0,  "Open" },
1195
14
        {  1,  "Shared Key" },
1196
14
        {  2,  "WPA" },
1197
14
        {  4,  "WPA PSK" },
1198
14
        {  8,  "WPA2" },
1199
14
        { 16, "WPA2 PSK" },
1200
14
        {  0, NULL },
1201
14
    };
1202
1203
14
    static const value_string cipher_algs[] = {
1204
14
        {  0,  "None" },
1205
14
        {  1,  "WEP 40" },
1206
14
        {  2,  "WEP 104" },
1207
14
        {  4,  "WEP" },
1208
14
        {  8,  "TKIP" },
1209
14
        { 16, "CCMP" },
1210
14
        {  0, NULL },
1211
14
    };
1212
1213
    /* Setup list of header fields  See Section 1.6.1 for details*/
1214
14
    static hf_register_info hf[] = {
1215
1216
    /* START: General purpose message fields - used in multiple messages */
1217
14
        { &hf_waveagent_controlword,
1218
14
        { "Control Word", "waveagent.cword",
1219
14
        FT_UINT16, BASE_HEX | BASE_EXT_STRING, &control_words_ext, 0x0,
1220
14
        NULL, HFILL } },
1221
1222
14
        { &hf_waveagent_payloadlen,
1223
14
        { "Payload Length", "waveagent.paylen",
1224
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1225
14
        NULL, HFILL } },
1226
1227
14
        { &hf_waveagent_transnum,
1228
14
        { "Transaction Number", "waveagent.transnum",
1229
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1230
14
        NULL, HFILL } },
1231
1232
14
        { &hf_waveagent_rtoken,
1233
14
        { "Reservation Token", "waveagent.rtoken",
1234
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1235
14
        NULL, HFILL } },
1236
1237
14
        { &hf_waveagent_flowid,
1238
14
        { "Flow ID", "waveagent.flowid",
1239
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1240
14
        NULL, HFILL } },
1241
1242
14
        { &hf_waveagent_capstatus,
1243
14
        { "Capabilities Status", "waveagent.capstatus",
1244
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1245
14
        NULL, HFILL } },
1246
1247
14
        { &hf_waveagent_protocolversion,
1248
14
        { "Protocol Version", "waveagent.protocolversion",
1249
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
1250
14
        NULL, HFILL } },
1251
1252
14
        { &hf_waveagent_capimpl,
1253
14
        { "Capabilities Implementation", "waveagent.capimpl",
1254
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1255
14
        NULL, HFILL } },
1256
1257
14
        { &hf_waveagent_sigsequencenum,
1258
14
        { "Signature Sequence Number", "waveagent.sigsequencenum",
1259
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
1260
14
        NULL, HFILL } },
1261
1262
14
        { &hf_waveagent_id,
1263
14
        { "ID", "waveagent.id",
1264
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1265
14
        NULL, HFILL } },
1266
1267
14
        { &hf_waveagent_bindtag,
1268
14
        { "Binding Tag", "waveagent.bindtag",
1269
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1270
14
        NULL, HFILL } },
1271
1272
14
        { &hf_waveagent_version,
1273
14
        { "Version", "waveagent.version",
1274
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1275
14
        NULL, HFILL } },
1276
1277
14
        { &hf_waveagent_brokerip,
1278
14
        { "Broker IP address", "waveagent.brokerip",
1279
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1280
14
        NULL, HFILL } },
1281
1282
14
        { &hf_waveagent_brokerport,
1283
14
        { "Broker Port", "waveagent.brokerport",
1284
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1285
14
        NULL, HFILL } },
1286
1287
14
        { &hf_waveagent_bindlevel,
1288
14
        { "Binding Level", "waveagent.bindlevel",
1289
14
        FT_UINT32, BASE_DEC, VALS(binding_levels), 0x0,
1290
14
        NULL, HFILL } },
1291
1292
14
        { &hf_waveagent_bindport,
1293
14
        { "Binding Port", "waveagent.bindport",
1294
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1295
14
        NULL, HFILL } },
1296
1297
14
        { &hf_waveagent_ifindex,
1298
14
        { "Interface Index", "waveagent.ifindex",
1299
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1300
14
        NULL, HFILL } },
1301
    /* END: General purpose message fields - used in multiple messages */
1302
1303
    /* START: Capabilities response fields (specific to this message, other general fields are also used) */
1304
14
        { &hf_waveagent_capabilities2,
1305
14
        { "Additional Capabilities", "waveagent.capabilities2",
1306
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1307
14
        NULL, HFILL } },
1308
1309
14
        { &hf_waveagent_numinterfaces,
1310
14
        { "Number of WA Interfaces", "waveagent.numinterfaces",
1311
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1312
14
        NULL, HFILL } },
1313
1314
14
        { &hf_waveagent_ifmask,
1315
14
        { "Mask of Active Interfaces", "waveagent.ifmask",
1316
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1317
14
        NULL, HFILL } },
1318
    /* END: Capabilities response fields (specific to this message, other general fields are also used) */
1319
1320
    /* START: Command response message fields */
1321
14
        { &hf_waveagent_commandstatus,
1322
14
        { "Status of Previous Command", "waveagent.cmdstat",
1323
14
        FT_INT32, BASE_DEC, NULL, 0x0,
1324
14
        NULL, HFILL } },
1325
1326
14
        { &hf_waveagent_syserrno,
1327
14
        { "System Error Number", "waveagent.syserrno",
1328
14
        FT_INT32, BASE_DEC, NULL, 0x0,
1329
14
        NULL, HFILL } },
1330
1331
14
        { &hf_waveagent_statusstring,
1332
14
        { "Status Message", "waveagent.statmsg",
1333
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1334
14
        NULL, HFILL } },
1335
    /* END: Command response message fields */
1336
1337
    /* START: Stats response message fields */
1338
14
        { &hf_waveagent_rxdatapckts,
1339
14
        { "Received Data Packets", "waveagent.rxdpkts",
1340
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1341
14
        NULL, HFILL } },
1342
1343
14
        { &hf_waveagent_rxdatabytes,
1344
14
        { "Received Data Bytes", "waveagent.rxdbytes",
1345
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1346
14
        NULL, HFILL } },
1347
1348
14
        { &hf_waveagent_rxpcktrate,
1349
14
        { "Received Data Packet Rate (pps)", "waveagent.rxpktrate",
1350
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1351
14
        NULL, HFILL } },
1352
1353
14
        { &hf_waveagent_rxbyterate,
1354
14
        { "Received Byte Rate", "waveagent.rxbyterate",
1355
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1356
14
        NULL, HFILL } },
1357
1358
14
        { &hf_waveagent_txdatapckts,
1359
14
        { "Transmitted Data Packets", "waveagent.txdpkts",
1360
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1361
14
        NULL, HFILL } },
1362
1363
14
        { &hf_waveagent_txdatabytes,
1364
14
        { "Transmitted Data Bytes", "waveagent.txdbytes",
1365
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1366
14
        NULL, HFILL } },
1367
1368
14
        { &hf_waveagent_txpcktrate,
1369
14
        { "Transmitted Data Packet Rate (pps)", "waveagent.txpktrate",
1370
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1371
14
        NULL, HFILL } },
1372
1373
14
        { &hf_waveagent_txbyterate,
1374
14
        { "Transmitted Byte Rate", "waveagent.txbyterate",
1375
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1376
14
        NULL, HFILL } },
1377
1378
14
        { &hf_waveagent_looppckts,
1379
14
        { "Loopback Packets", "waveagent.looppckts",
1380
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1381
14
        NULL, HFILL } },
1382
1383
14
        { &hf_waveagent_loopbytes,
1384
14
        { "Loopback Bytes", "waveagent.loopbytes",
1385
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1386
14
        NULL, HFILL } },
1387
1388
14
        { &hf_waveagent_rxctlpckts,
1389
14
        { "Received Control Packets", "waveagent.rxctlpkts",
1390
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1391
14
        NULL, HFILL } },
1392
1393
14
        { &hf_waveagent_rxctlbytes,
1394
14
        { "Received Control Bytes", "waveagent.rxctlbytes",
1395
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1396
14
        NULL, HFILL } },
1397
1398
14
        { &hf_waveagent_txctlpckts,
1399
14
        { "Transmitted Control Packets", "waveagent.txctlpkts",
1400
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1401
14
        NULL, HFILL } },
1402
1403
14
        { &hf_waveagent_txctlbytes,
1404
14
        { "Transmitted Control Bytes", "waveagent.txctlbytes",
1405
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1406
14
        NULL, HFILL } },
1407
1408
14
        { &hf_waveagent_unknowncmds,
1409
14
        { "Unknown Commands", "waveagent.unkcmds",
1410
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1411
14
        NULL, HFILL } },
1412
1413
14
        { &hf_waveagent_snap,
1414
14
        { "Time Snap for Counters", "waveagent.snap",
1415
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1416
14
        NULL, HFILL } },
1417
1418
14
        { &hf_waveagent_appstate,
1419
14
        { "TCP State", "waveagent.state",
1420
14
        FT_UINT32, BASE_DEC, VALS(tcp_states), 0x0,
1421
14
        NULL, HFILL } },
1422
1423
14
        { &hf_waveagent_state,
1424
14
        { "Application State", "waveagent.appstate",
1425
14
        FT_UINT32, BASE_DEC, VALS(app_states), 0x0,
1426
14
        NULL, HFILL } },
1427
1428
14
        { &hf_waveagent_rx1pl,
1429
14
        { "Instances of single packet loss", "waveagent.rx1pl",
1430
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1431
14
        NULL, HFILL } },
1432
1433
14
        { &hf_waveagent_rx2pl,
1434
14
        { "Instances of 2 sequential packets lost", "waveagent.rx2pl",
1435
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1436
14
        NULL, HFILL } },
1437
1438
14
        { &hf_waveagent_rx3pl,
1439
14
        { "Instances of 3 sequential packets lost", "waveagent.rx3pl",
1440
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1441
14
        NULL, HFILL } },
1442
1443
14
        { &hf_waveagent_rx4pl,
1444
14
        { "Instances of 4 sequential packets lost", "waveagent.rx4pl",
1445
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1446
14
        NULL, HFILL } },
1447
1448
14
        { &hf_waveagent_rx5pl,
1449
14
        { "Instances of 5 sequential packets lost", "waveagent.rx5pl",
1450
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1451
14
        NULL, HFILL } },
1452
1453
14
        { &hf_waveagent_rxoospkts,
1454
14
        { "Instances of out-of-sequence packets", "waveagent.rxoospkts",
1455
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1456
14
        NULL, HFILL } },
1457
1458
#if 0
1459
        { &hf_waveagent_rxmeanlatency,
1460
        { "Rx Mean latency", "waveagent.rxmeanlatency",
1461
        FT_UINT64, BASE_DEC, NULL, 0x0,
1462
        NULL, HFILL } },
1463
#endif
1464
1465
#if 0
1466
        { &hf_waveagent_rxminlatency,
1467
        { "Rx Minimum latency", "waveagent.rxminlatency",
1468
        FT_UINT64, BASE_DEC, NULL, 0x0,
1469
        NULL, HFILL } },
1470
#endif
1471
1472
#if 0
1473
        { &hf_waveagent_rxmaxlatency,
1474
        { "Rx Maximum latency", "waveagent.rxmaxlatency",
1475
        FT_UINT64, BASE_DEC, NULL, 0x0,
1476
        NULL, HFILL } },
1477
#endif
1478
1479
14
        { &hf_waveagent_jitter,
1480
14
        { "Jitter (microseconds)", "waveagent.jitter",
1481
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1482
14
        NULL, HFILL } },
1483
1484
14
        { &hf_waveagent_delayfactor,
1485
14
        { "Delay Factor", "waveagent.delayfactor",
1486
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1487
14
        NULL, HFILL } },
1488
1489
14
        { &hf_waveagent_medialossrate,
1490
14
        { "Media Loss Rate", "waveagent.medialossrate",
1491
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1492
14
        NULL, HFILL } },
1493
1494
14
        { &hf_waveagent_txstartts,
1495
14
        { "Timestamp for first Tx flow packet", "waveagent.txstartts",
1496
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1497
14
        NULL, HFILL } },
1498
1499
14
        { &hf_waveagent_txendts,
1500
14
        { "Timestamp for last Tx flow packet", "waveagent.txendts",
1501
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1502
14
        NULL, HFILL } },
1503
1504
14
        { &hf_waveagent_rxstartts,
1505
14
        { "Timestamp for first Rx flow packet", "waveagent.rxstartts",
1506
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1507
14
        NULL, HFILL } },
1508
1509
14
        { &hf_waveagent_rxendts,
1510
14
        { "Timestamp for last Rx flow packet", "waveagent.rxendts",
1511
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1512
14
        NULL, HFILL } },
1513
1514
14
        { &hf_waveagent_latencysum,
1515
14
        { "Sum of latencies across all received packets", "waveagent.latencysum",
1516
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1517
14
        NULL, HFILL } },
1518
1519
14
        { &hf_waveagent_latencycount,
1520
14
        { "Count of packets included in the latency sum", "waveagent.latencycount",
1521
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1522
14
        NULL, HFILL } },
1523
1524
14
        { &hf_waveagent_txflowstop,
1525
14
        { "Timestamp for Tx flow stop message", "waveagent.txflowstop",
1526
14
        FT_UINT64, BASE_DEC, NULL, 0x0,
1527
14
        NULL, HFILL } },
1528
    /* END Stats response message fields */
1529
1530
    /* START: Flow setup message */
1531
14
        { &hf_waveagent_rxflownum,
1532
14
        { "Received Flow Number", "waveagent.rxflownum",
1533
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1534
14
        NULL, HFILL } },
1535
1536
14
        { &hf_waveagent_mode,
1537
14
        { "WaveAgent Mode", "waveagent.trafficmode",
1538
14
        FT_UINT8, BASE_DEC, VALS(wa_modes), 0x03,
1539
14
        NULL, HFILL } },
1540
1541
14
        { &hf_waveagent_endpointtype,
1542
14
        { "WaveAgent Endpoint Type", "waveagent.endpointtype",
1543
14
        FT_UINT8, BASE_DEC, VALS(wa_endpointtypes), 0x0c,
1544
14
        NULL, HFILL } },
1545
1546
14
        { &hf_waveagent_remoteport,
1547
14
        { "Remote port", "waveagent.remoteport",
1548
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1549
14
        NULL, HFILL } },
1550
1551
14
        { &hf_waveagent_remoteaddr,
1552
14
        { "Remote address", "waveagent.remoteaddr",
1553
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1554
14
        NULL, HFILL } },
1555
1556
14
        { &hf_waveagent_dscp,
1557
14
        { "DSCP Setting", "waveagent.dscp",
1558
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1559
14
        NULL, HFILL } },
1560
1561
14
        { &hf_waveagent_fsflags,
1562
14
        { "Flow Setup Flags", "waveagent.fsflags",
1563
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1564
14
        NULL, HFILL } },
1565
1566
14
        { &hf_waveagent_fscbrflag,
1567
14
        { "CBR Transmit Mode", "waveagent.fscbrflag",
1568
14
        FT_BOOLEAN, 4, NULL, 0x1, NULL, HFILL } },
1569
1570
14
        { &hf_waveagent_fscombinedsetupflag,
1571
14
        { "Setup, Connect/Listen, Start Combined", "waveagent.fscombinedsetupflag",
1572
14
        FT_BOOLEAN, 4, NULL, 0x2, NULL, HFILL } },
1573
1574
    /* END: Flow setup message */
1575
1576
    /* START: Flow start message fields */
1577
14
        { &hf_waveagent_payfill,
1578
14
        { "Payload Fill", "waveagent.payfill",
1579
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1580
14
        NULL, HFILL } },
1581
1582
14
        { &hf_waveagent_paysize,
1583
14
        { "WaveAgent Payload Size (bytes)", "waveagent.paysize",
1584
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1585
14
        NULL, HFILL } },
1586
1587
14
        { &hf_waveagent_avgrate,
1588
14
        { "Average Rate (header + payload + trailer bytes/s)", "waveagent.avgrate",
1589
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1590
14
        NULL, HFILL } },
1591
1592
14
        { &hf_waveagent_totalframes,
1593
14
        { "Total Frames", "waveagent.totalframes",
1594
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1595
14
        NULL, HFILL } },
1596
1597
    /* END: Flow start message fields */
1598
1599
    /* START: Scan results request (0x23) fields */
1600
14
        { &hf_waveagent_bssidstartindex,
1601
14
        { "Starting Index of BSSID list for reporting", "waveagent.bssidstartindex",
1602
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1603
14
        NULL, HFILL } },
1604
1605
14
        { &hf_waveagent_bssidstopindex,
1606
14
        { "Ending Index of BSSID list for reporting", "waveagent.bssidstopindex",
1607
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1608
14
        NULL, HFILL } },
1609
1610
    /* END: Scan results request (0x23) fields */
1611
1612
    /* START: WLAN Interface stats fields */
1613
14
        { &hf_waveagent_ifwlanbssid,
1614
14
        { "WLAN Interface Connected to BSSID", "waveagent.ifwlanbssid",
1615
14
        FT_ETHER, 0, NULL, 0x0,
1616
14
        NULL, HFILL } },
1617
1618
14
        { &hf_waveagent_ifwlanssid,
1619
14
        { "WLAN Interface Connected to SSID", "waveagent.ifwlanssid",
1620
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1621
14
        NULL, HFILL } },
1622
1623
14
        { &hf_waveagent_ifwlanrssi,
1624
14
        { "WLAN Interface RSSI", "waveagent.ifwlanrssi",
1625
14
        FT_INT32, BASE_DEC, NULL, 0x0,
1626
14
        NULL, HFILL } },
1627
1628
14
        { &hf_waveagent_ifwlannoise,
1629
14
        { "WLAN Interface Noise Floor (dBm)", "waveagent.ifwlannoise",
1630
14
        FT_INT32, BASE_DEC, NULL, 0x0,
1631
14
        NULL, HFILL } },
1632
1633
14
        { &hf_waveagent_ifphytypes,
1634
14
        { "WLAN Interface Supported PHY Types", "waveagent.ifphytypes",
1635
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1636
14
        NULL, HFILL } },
1637
1638
14
        { &hf_waveagent_ifphytypebit0,
1639
14
        { "11b", "waveagent.ifphytypebit0",
1640
14
        FT_BOOLEAN, 4, NULL, 0x1, NULL, HFILL } },
1641
1642
14
        { &hf_waveagent_ifphytypebit1,
1643
14
        { "11g", "waveagent.ifphytypebit1",
1644
14
        FT_BOOLEAN, 4, NULL, 0x2, NULL, HFILL } },
1645
1646
14
        { &hf_waveagent_ifphytypebit2,
1647
14
        { "11a", "waveagent.ifphytypebit2",
1648
14
        FT_BOOLEAN, 4, NULL, 0x4, NULL, HFILL } },
1649
1650
14
        { &hf_waveagent_ifphytypebit3,
1651
14
        { "11n", "waveagent.ifphytypebit3",
1652
14
        FT_BOOLEAN, 4, NULL, 0x8, NULL, HFILL } },
1653
1654
14
        { &hf_waveagent_ifwlanauthentication,
1655
14
        { "WLAN Interface Authentication Algorithm", "waveagent.ifwlanauthentication",
1656
14
        FT_UINT32, BASE_DEC, VALS(auth_algs), 0x0,
1657
14
        NULL, HFILL } },
1658
1659
14
        { &hf_waveagent_ifwlancipher,
1660
14
        { "WLAN Interface Encryption/Cipher Algorithm", "waveagent.ifwlancipher",
1661
14
        FT_UINT32, BASE_DEC, VALS(cipher_algs), 0x0,
1662
14
        NULL, HFILL } },
1663
    /* END: WLAN Interface stats fields */
1664
1665
    /* START: Interface stats response (0x2d) fields */
1666
14
        { &hf_waveagent_iftype,
1667
14
        { "Interface type", "waveagent.iftype",
1668
14
        FT_UINT32, BASE_DEC, VALS(if_types), 0x0,
1669
14
        NULL, HFILL } },
1670
1671
14
        { &hf_waveagent_ifdescription,
1672
14
        { "Name/Description of the adapter", "waveagent.ifdescription",
1673
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1674
14
        NULL, HFILL } },
1675
1676
14
        { &hf_waveagent_ifmacaddr,
1677
14
        { "Interface MAC Address", "waveagent.ifmacaddr",
1678
14
        FT_ETHER, 0, NULL, 0x0,
1679
14
        NULL, HFILL } },
1680
1681
14
        { &hf_waveagent_iflinkspeed,
1682
14
        { "Interface Link Speed (kbps)", "waveagent.iflinkspeed",
1683
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1684
14
        NULL, HFILL } },
1685
1686
14
        { &hf_waveagent_ifdhcp,
1687
14
        { "Interface DHCP Enabled", "waveagent.ifdhcp",
1688
14
        FT_UINT32, BASE_DEC, VALS(no_yes), 0x0,
1689
14
        NULL, HFILL } },
1690
1691
14
        { &hf_waveagent_ifiptype,
1692
14
        { "Interface IP Type", "waveagent.ifiptype",
1693
14
        FT_UINT32, BASE_DEC, VALS(ip_types), 0x0,
1694
14
        NULL, HFILL } },
1695
1696
14
        { &hf_waveagent_ifipv4,
1697
14
        { "Interface Bound to IP Address", "waveagent.ifipv4",
1698
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1699
14
        NULL, HFILL } },
1700
1701
14
        { &hf_waveagent_ifipv6,
1702
14
        { "Interface Bound to IP Address", "waveagent.ifipv6",
1703
14
        FT_IPv6, BASE_NONE, NULL, 0x0,
1704
14
        NULL, HFILL } },
1705
1706
14
        { &hf_waveagent_ifdhcpserver,
1707
14
        { "Interface DHCP Server Address", "waveagent.ifdhcpserver",
1708
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1709
14
        NULL, HFILL } },
1710
1711
14
        { &hf_waveagent_ifgateway,
1712
14
        { "Interface Gateway", "waveagent.ifgateway",
1713
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1714
14
        NULL, HFILL } },
1715
1716
14
        { &hf_waveagent_ifdnsserver,
1717
14
        { "Interface DNS Server Address", "waveagent.ifdnsserver",
1718
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1719
14
        NULL, HFILL } },
1720
1721
14
        { &hf_waveagent_ifethl2status,
1722
14
        { "Ethernet L2 Interface Status", "waveagent.ifethl2status",
1723
14
        FT_UINT32, BASE_DEC, VALS(if_eth_states), 0x0,
1724
14
        NULL, HFILL } },
1725
1726
14
        { &hf_waveagent_ifwlanl2status,
1727
14
        { "WLAN L2 Interface Status", "waveagent.ifwlanl2status",
1728
14
        FT_UINT32, BASE_DEC, VALS(if_wlan_states), 0x0,
1729
14
        NULL, HFILL } },
1730
1731
14
        { &hf_waveagent_ifl3status,
1732
14
        { "L3 Interface Status", "waveagent.ifl3status",
1733
14
        FT_UINT32, BASE_DEC, VALS(if_l3_states), 0x0,
1734
14
        NULL, HFILL } },
1735
1736
    /* END: Interface stats response (0x2d) fields */
1737
1738
    /* START: Scan results response (0x2e) fields */
1739
14
        { &hf_waveagent_totalbssid,
1740
14
        { "Number of Found BSSID", "waveagent.totalbssid",
1741
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1742
14
        NULL, HFILL } },
1743
1744
14
        { &hf_waveagent_returnedbssid,
1745
14
        { "Number of BSSID Reported in This Response", "waveagent.returnedbssid",
1746
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1747
14
        NULL, HFILL } },
1748
1749
14
        { &hf_waveagent_scanbssid,
1750
14
        { "BSSID", "waveagent.scanbssid",
1751
14
        FT_ETHER, 0, NULL, 0x0,
1752
14
        NULL, HFILL } },
1753
1754
14
        { &hf_waveagent_scanssid,
1755
14
        { "SSID", "waveagent.scanssid",
1756
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1757
14
        NULL, HFILL } },
1758
1759
14
        { &hf_waveagent_ifwlansupprates,
1760
14
        { "Supported Rates", "waveagent.ifwlansupportedrates",
1761
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1762
14
        NULL, HFILL } },
1763
1764
14
        { &hf_waveagent_ifwlancapabilities,
1765
14
        { "Capabilities field", "waveagent.ifwlancapabilities",
1766
14
        FT_UINT16, BASE_HEX, NULL, 0x0,
1767
14
        NULL, HFILL } },
1768
1769
14
        { &hf_waveagent_ifwlanchannel,
1770
14
        { "Channel", "waveagent.ifwlanchannel",
1771
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1772
14
        NULL, HFILL } },
1773
1774
14
        { &hf_waveagent_ifwlanprivacy,
1775
14
        { "Privacy Enabled", "waveagent.ifwlanprivacy",
1776
14
        FT_UINT32, BASE_DEC, VALS(no_yes), 0x0,
1777
14
        NULL, HFILL } },
1778
1779
14
        { &hf_waveagent_ifwlanbssmode,
1780
14
        { "BSS Mode", "waveagent.ifwlanbssmode",
1781
14
        FT_UINT32, BASE_DEC, VALS(bss_modes), 0x0,
1782
14
        NULL, HFILL } },
1783
    /* END: Scan results response (0x2e) fields */
1784
1785
    /* START: OID fields */
1786
14
        { &hf_waveagent_oidcode,
1787
14
        { "OID Code", "waveagent.oidcode",
1788
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1789
14
        NULL, HFILL } },
1790
1791
14
        { &hf_waveagent_oidvalue,
1792
14
        { "OID Value", "waveagent.oidvalue",
1793
14
        FT_STRING, BASE_NONE, NULL, 0x0,
1794
14
        NULL, HFILL } },
1795
    /* END: OID fields */
1796
1797
    /* START: Learning Message fields */
1798
14
        { &hf_waveagent_destip,
1799
14
        { "Destination IP", "waveagent.destip",
1800
14
        FT_IPv4, BASE_NONE, NULL, 0x0,
1801
14
        NULL, HFILL } },
1802
1803
14
        { &hf_waveagent_destport,
1804
14
        { "Destination Port", "waveagent.destport",
1805
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1806
14
        NULL, HFILL } },
1807
1808
14
        { &hf_waveagent_connectflags,
1809
14
        { "Connect Flags", "waveagent.connectflags",
1810
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1811
14
        NULL, HFILL } },
1812
    /* END: Learning Message fields */
1813
1814
    /* START: client connect fields */
1815
14
        { &hf_waveagent_connecttype,
1816
14
        { "Connect Type", "waveagent.connecttype",
1817
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
1818
14
        NULL, HFILL } },
1819
1820
14
        { &hf_waveagent_minrssi,
1821
14
        { "Minimum RSSI", "waveagent.minrssi",
1822
14
        FT_INT32, BASE_DEC, NULL, 0x0,
1823
14
        NULL, HFILL } },
1824
1825
14
        { &hf_waveagent_connecttimeout,
1826
14
        { "Connect timeout (s)", "waveagent.connecttimeout",
1827
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1828
14
        NULL, HFILL } },
1829
1830
14
        { &hf_waveagent_connectattempts,
1831
14
        { "Connect attempts", "waveagent.connectattempt",
1832
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1833
14
        NULL, HFILL } },
1834
1835
14
        { &hf_waveagent_reason,
1836
14
        { "Reason", "waveagent.reason",
1837
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1838
14
        NULL, HFILL } },
1839
    /* END: client connect fields */
1840
1841
    /* START: relay server fields */
1842
14
        { &hf_waveagent_relaydestid,
1843
14
        { "ID of destination client (assigned by relay server)", "waveagent.relaydestid",
1844
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1845
14
        NULL, HFILL } },
1846
1847
14
        { &hf_waveagent_relaysrcid,
1848
14
        { "ID of source client (assigned by relay server)", "waveagent.relaysrcid",
1849
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
1850
14
        NULL, HFILL } },
1851
1852
14
        { &hf_waveagent_relaymessagest,
1853
14
        { "Relayed WaveAgent Message", "waveagent.relaymessagest",
1854
14
        FT_NONE, BASE_NONE, NULL, 0x0,
1855
14
        "This is a relayed WaveAgent message", HFILL } },
1856
1857
/* END: relay server fields */
1858
1859
14
    };
1860
1861
/* Setup protocol subtree array */
1862
14
    static int *ett[] = {
1863
14
        &ett_waveagent,
1864
14
        &ett_statechange,
1865
14
        &ett_phytypes,
1866
14
        &ett_fsflags,
1867
14
        &ett_scindex[0],
1868
14
        &ett_scindex[1],
1869
14
        &ett_scindex[2],
1870
14
        &ett_scindex[3],
1871
14
        &ett_scindex[4],
1872
14
        &ett_scindex[5],
1873
14
        &ett_scindex[6],
1874
14
        &ett_scindex[7],
1875
14
        &ett_bss[0],
1876
14
        &ett_bss[1],
1877
14
        &ett_bss[2],
1878
14
        &ett_bss[3],
1879
14
        &ett_bss[4],
1880
14
        &ett_bss[5],
1881
14
        &ett_bss[6],
1882
14
        &ett_bss[7],
1883
14
        &ett_relaymessage,
1884
14
    };
1885
1886
14
    proto_waveagent = proto_register_protocol("WaveAgent", "waveagent", "waveagent");
1887
1888
14
    proto_register_field_array(proto_waveagent, hf, array_length(hf));
1889
14
    proto_register_subtree_array(ett, array_length(ett));
1890
14
}
1891
1892
1893
void proto_reg_handoff_waveagent(void)
1894
14
{
1895
14
    heur_dissector_add("udp", dissect_waveagent_heur, "WaveAgent over UDP", "waveagent_udp", proto_waveagent, HEURISTIC_ENABLE);
1896
14
}
1897
1898
1899
/*
1900
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1901
 *
1902
 * Local variables:
1903
 * c-basic-offset: 4
1904
 * tab-width: 8
1905
 * indent-tabs-mode: nil
1906
 * End:
1907
 *
1908
 * vi: set shiftwidth=4 tabstop=8 expandtab:
1909
 * :indentSize=4:tabSize=8:noTabs=true:
1910
 */