Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-wsmp.c
Line
Count
Source
1
/* packet-wsmp.c
2
 * Routines for WAVE Short Message  dissection (WSMP)
3
 * Copyright 2013, Savari Networks (http://www.savarinetworks.com) (email: smooney@savarinetworks.com)
4
 *  Based on packet-wsmp.c implemented by
5
 *  Arada Systems (http://www.aradasystems.com) (email: siva@aradasystems.com)
6
 *
7
 * Wireshark - Network traffic analyzer
8
 * By Gerald Combs <gerald@wireshark.org>
9
 * Copyright 1998 Gerald Combs
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
12
 * Ref IEEE 1609.3
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/etypes.h>
19
#include <epan/expert.h>
20
#include <epan/tfs.h>
21
#include <wsutil/array.h>
22
23
#include "packet-ieee1609dot2.h"
24
25
/* elemenID Types */
26
3.92k
#define TRANSMITPW 0x04
27
3.96k
#define CHANNUM    0x0F
28
3.94k
#define DATARATE   0x10
29
4.01k
#define WSMP       0x80
30
4.03k
#define WSMP_S     0x81
31
3.97k
#define WSMP_I     0x82
32
33
void proto_register_wsmp(void);
34
void proto_reg_handoff_wsmp(void);
35
36
static dissector_handle_t wsmp_handle;
37
38
static const value_string wsmp_elemenid_names[] = {
39
    { 0x80, "WSMP" },
40
    { 0x81, "WSMP-S" },
41
    { 0x82, "WSMP-I" },
42
    { 0, NULL }
43
};
44
45
/* Dissector table to be passed to IEEE 1609.2 dissector */
46
static dissector_table_t ieee1609dot2_psid_table;
47
48
/* Initialize the protocol and registered fields */
49
static int proto_wsmp;
50
static int hf_wsmp_version;
51
static int hf_wsmp_var_len_det;
52
static int hf_wsmp_psid;
53
static int hf_wsmp_rate;
54
static int hf_wsmp_channel;
55
static int hf_wsmp_txpower;
56
static int hf_wsmp_WAVEid;
57
static int hf_wsmp_wsmlength;
58
static int hf_wsmp_WSMP_S_data;
59
60
static int hf_wsmp_subtype;
61
static int hf_wsmp_N_header_opt_ind;
62
static int hf_wsmp_version_v3;
63
static int hf_wsmp_no_elements;
64
static int hf_wsmp_wave_ie;
65
static int hf_wsmp_wave_ie_len;
66
static int hf_wsmp_wave_ie_data;
67
static int hf_wsmp_tpid;
68
69
/* Initialize the subtree pointers */
70
static int ett_wsmp;
71
static int ett_wsmdata;
72
static int ett_wsmp_n_hdr;
73
static int ett_wsmp_t_hdr;
74
static int ett_wsmp_ie_ext;
75
static int ett_wsmp_ie;
76
77
static expert_field ei_wsmp_length_field_err;
78
static expert_field ei_wsmp_psid_invalid;
79
80
81
static const value_string wsmp_subtype_vals[] = {
82
    { 0x0, "Null-networking protocol" },
83
    { 0x1, "ITS station-internal forwarding" },
84
    { 0x2, "N-hop forwarding" },
85
    { 0x3, "Enables the features of GeoNetworking" },
86
    { 0, NULL }
87
};
88
89
static const value_string wsmp_wave_information_elements_vals[] = {
90
    { 0, "Reserved" },
91
    { 1, "Reserved" },
92
    { 2, "Reserved" },
93
    { 3, "Reserved" },
94
    { 4, "Transmit Power Used" },                   /* WSMP - N - Header 8.3.4.4 */
95
    { 5, "2D Location" },                           /* WSA header 8.2.2.6 */
96
    { 6, "3D Location" },                           /* WSA header 8.2.2.6 */
97
    { 7, "Advertiser Identifier" },                 /* WSA header 8.2.2.6 */
98
    { 8, "Provider Service Context" },              /* WSA Service Info 8.2.3.5 */
99
    { 9, "IPv6 Address" },                          /* WSA Service Info 8.2.3.5 */
100
    { 10, "Service Por" },                          /* WSA Service Info 8.2.3.5 */
101
    { 11, "Provider MAC Address" },                 /* WSA Service Info 8.2.3.5 */
102
    { 12, "EDCA Parameter Set" },                   /* WSA Channel Info 8.2.4.8 */
103
    { 13, "Secondary DNS" },                        /* WSA WRA 8.2.5.7 */
104
    { 14, "Gateway MAC Address" },                  /* WSA WRA 8.2.5.7 */
105
    { 15, "Channel Number" },                       /* WSMP - N - Header 8.3.4.2 */
106
    { 16, "Data Rate" },                            /* WSMP - N - Header 8.3.4.3 */
107
    { 17, "Repeat Rate" },                          /* WSA header 8.2.2.6 */
108
    { 18, "Reserved" },
109
    { 19, "RCPI Threshold" },                       /* WSA Service Info 8.2.3.5 */
110
    { 20, "WSA Count Threshold" },                  /* WSA Service Info 8.2.3.5 */
111
    { 21, "Channel Access" },                       /* WSA Channel Info 8.2.4.8 */
112
    { 22, "WSA Count Threshold Interval" },         /* WSA Service Info 8.2.3.5 */
113
    { 23, "Channel Load" },                         /* WSMP-N-Header 8.3.4.5 */
114
    { 0, NULL }
115
};
116
117
static const value_string wsmp_tpid_vals[] = {
118
    { 0, "The Address Info field contains a PSID and a WAVE Information Element Extension field is not present" },
119
    { 1, "The Address Info field contains a PSID and a WAVE Information Element Extension field is present" },
120
    { 2, "The Address Info field contains source and destination ITS port numbers and a WAVE Information Element Extension field is not present" },
121
    { 3, "The Address Info field contains source and destination ITS port numbers and a WAVE Information Element Extension field is present" },
122
    { 4, "LPP mode and a WAVE Information Element Extension field is not present" },
123
    { 5, "LPP mode and a WAVE Information Element Extension field is present" },
124
    { 0, NULL }
125
};
126
127
/*
128
4.1.2 P-encoding of PSIDs
129
    This standard defines a compact encoding for PSID referred to as p-encoding. Octets are numbered from the
130
    left starting at zero (Octet 0). The length of the PSID is indicated by Octet 0, where the position of the first
131
    zero-value bit in descending order of bit significance in the octet indicates the length in octets of the p?encoded
132
    PSID. Using p-encoding, a binary "0" in the most-significant bit indicates a one-octet PSID; a binary "10"
133
    in the two most-significant bits indicates a two-octet PSID; a binary "110" in the three most-significant bits
134
    indicates a three-octet PSID; and a binary "1110" in the four most-significant bits indicates a four-octet PSID.
135
*/
136
static int
137
dissect_wsmp_psid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, uint32_t *psid)
138
52
{
139
52
    uint8_t oct;
140
52
    uint32_t psidLen = 0;
141
142
52
    oct = tvb_get_uint8(tvb, offset);
143
52
    *psid = 0;
144
145
52
    if ((oct & 0xF0) == 0xF0) {
146
2
        proto_tree_add_expert(tree, pinfo, &ei_wsmp_psid_invalid, tvb, offset, 1);
147
2
        return offset + 1;
148
50
    } else if ((oct & 0xF0) == 0xE0) {
149
3
        psidLen = 4;
150
47
    } else if ((oct & 0xE0) == 0xC0) {
151
13
        psidLen = 3;
152
34
    } else if ((oct & 0xC0) == 0x80) {
153
8
        psidLen = 2;
154
26
    } else if ((oct & 0x80) == 0x00) {
155
25
        psidLen = 1;
156
25
    }
157
158
50
    if (psidLen == 1)
159
25
        *psid = oct;
160
25
    else if (psidLen == 2)
161
8
        *psid = (tvb_get_ntohs(tvb, offset) & ~0x8000) + 0x80;
162
17
    else if (psidLen == 3)
163
13
        *psid = (tvb_get_ntoh24(tvb, offset) & ~0xc00000) + 0x4080;
164
4
    else if (psidLen == 4)
165
3
        *psid = (tvb_get_ntohl(tvb, offset) & ~0xe0000000) + 0x204080;
166
167
50
    proto_tree_add_bits_item(tree, hf_wsmp_var_len_det, tvb, offset << 3, psidLen, ENC_NA);
168
50
    proto_tree_add_uint_bits_format_value(tree, hf_wsmp_psid, tvb, (offset << 3) + psidLen,
169
50
            (psidLen << 3) - psidLen,*psid,ENC_BIG_ENDIAN,"%s(%u)", val64_to_str_const(*psid, ieee1609dot2_Psid_vals, "Unknown"), *psid);
170
50
    offset += psidLen;
171
172
50
    return offset;
173
52
}
174
175
/* 8.1.3 Length and Count field encoding*/
176
static int
177
dissect_wsmp_length_and_count(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int hf_id, uint16_t* value)
178
289
{
179
289
    uint8_t oct, len;
180
289
    uint16_t val;
181
    /* For values in the range of 0 through 127, Length and Count values
182
     * are represented in a single-octet encoded as an unsigned integer. For values in the range 128 through 16
183
     * 383, values are represented as two octets encoded as follows. If the most significant bit of the field is 0b0,
184
     * then this indicates a one-octet Length or Count field. If the two most significant bits of the field are 0b10,
185
     * the Length or Count field is a two-octet field, with the remaining 14 bits representing the value encoded as
186
     * an unsigned integer.*/
187
188
289
    oct = tvb_get_uint8(tvb, offset);
189
289
    if ((oct & 0x80) == 0x80) {
190
35
        if ((oct & 0xc0) == 0x80) {
191
            /* Two bytes */
192
28
            val = tvb_get_ntohs(tvb, offset) & 0x3fff;
193
28
            len = 2;
194
28
        } else {
195
            /* Error */
196
7
            proto_tree_add_expert(tree, pinfo, &ei_wsmp_length_field_err, tvb, offset, 1);
197
7
            val = tvb_get_ntohs(tvb, offset) & 0x3fff;
198
7
            len = 2;
199
7
        }
200
254
    }else{
201
        /* One byte */
202
254
        val = oct;
203
254
        len = 1;
204
254
    }
205
206
289
    proto_tree_add_uint(tree, hf_id, tvb, offset, len, val);
207
289
    offset += len;
208
209
289
    if (value){
210
287
        *value = val;
211
287
    }
212
213
289
    return offset;
214
289
}
215
216
static int
217
dissect_wsmp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t oct)
218
30
{
219
30
    proto_tree *sub_tree, *n_tree, *t_tree, *data_tree;
220
30
    proto_item *item, *n_tree_item, *t_tree_item;
221
30
    int offset = 0, ie_start, len_to_set;
222
30
    uint8_t header_opt_ind = (oct & 0x08) >> 3;
223
30
    uint8_t ie;
224
30
    uint16_t count, ie_len, wsm_len;
225
30
    uint32_t tpid, psid = 0;
226
227
30
    static int * const flags[] = {
228
30
        &hf_wsmp_subtype,
229
30
        &hf_wsmp_N_header_opt_ind,
230
30
        &hf_wsmp_version_v3,
231
30
        NULL
232
30
    };
233
234
    /* 8.3.2 WSMP Network Header (WSMP-N-Header) */
235
236
30
    n_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_wsmp_n_hdr, &n_tree_item, "WSMP-N-Header");
237
    /* In Version 3
238
    * B7     B4          B3            B2   B0     | Variable                            | 1 octet
239
    * Subtype    |WSMP-NHeader      | WSMP Version |  WAVE Information Element Extension | TPID
240
    *            | Option Indicator |              |                                     |
241
    */
242
243
30
    proto_tree_add_bitmask_list(n_tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
244
30
    offset++;
245
246
    /* WAVE Information Element Extension */
247
30
    if (header_opt_ind) {
248
29
        sub_tree = proto_tree_add_subtree(n_tree, tvb, offset, -1, ett_wsmp_ie_ext, &item, "WAVE Information Element Extension");
249
        /* Figure 14 WAVE Information Element Extension */
250
        /* 8.1.3 Length and Count field encoding*/
251
        /* Count( Number of WAVE Information Elements )*/
252
29
        offset = dissect_wsmp_length_and_count(tvb, pinfo, sub_tree, offset, hf_wsmp_no_elements, &count);
253
254
288
        while (count) {
255
259
            proto_tree* ie_tree;
256
259
            ie_start = offset;
257
            /* WAVE Element ID 1 octet*/
258
259
            ie = tvb_get_uint8(tvb, offset);
259
259
            ie_tree = proto_tree_add_subtree_format(sub_tree, tvb, offset, -1, ett_wsmp_ie, &item, "%s",
260
259
                val_to_str_const(ie, wsmp_wave_information_elements_vals, "Unknown"));
261
262
259
            proto_tree_add_item(ie_tree, hf_wsmp_wave_ie, tvb, offset, 1, ENC_BIG_ENDIAN);
263
259
            offset++;
264
265
            /* Length */
266
259
            offset = dissect_wsmp_length_and_count(tvb, pinfo, ie_tree, offset, hf_wsmp_wave_ie_len, &ie_len);
267
268
259
            proto_tree_add_item(ie_tree, hf_wsmp_wave_ie_data, tvb, offset, ie_len, ENC_NA);
269
259
            offset += ie_len;
270
271
259
            len_to_set = offset - ie_start;
272
259
            proto_item_set_len(item, len_to_set);
273
274
259
            count--;
275
259
        }
276
29
    }
277
278
    /* TPID */
279
30
    proto_tree_add_item_ret_uint(n_tree, hf_wsmp_tpid, tvb, offset, 1, ENC_BIG_ENDIAN, &tpid);
280
30
    offset++;
281
282
30
    proto_item_set_end(n_tree_item, tvb, offset);
283
284
285
    /* WSMP-T-Header */
286
30
    t_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_wsmp_t_hdr, &t_tree_item, "WSMP-T-Header");
287
30
    switch (tpid) {
288
2
        case 0:
289
            /* The Address Info field contains a PSID and a WAVE Information Element Extension field is not present.*/
290
2
            offset = dissect_wsmp_psid(tvb, pinfo, t_tree, offset, &psid);
291
2
            break;
292
2
        default:
293
2
            break;
294
30
    }
295
296
    /* WSM Length */
297
3
    offset = dissect_wsmp_length_and_count(tvb, pinfo, t_tree, offset, hf_wsmp_wave_ie_len, &wsm_len);
298
299
3
    proto_item_set_end(t_tree_item, tvb, offset);
300
301
302
    /* WSM Data */
303
3
    data_tree = proto_tree_add_subtree(tree, tvb, offset, wsm_len, ett_wsmdata, NULL, "Wave Short Message");
304
305
3
    if(NULL != ieee1609dot2_psid_table){
306
3
        ieee1609dot2_set_next_default_psid(pinfo, psid);
307
3
        tvbuff_t* tvb_new = tvb_new_subset_remaining(tvb, offset);
308
3
        dissector_try_uint(ieee1609dot2_psid_table,
309
3
                           psid,
310
3
                           tvb_new,
311
3
                           pinfo,
312
3
                           data_tree);
313
3
    }
314
315
3
    return tvb_captured_length(tvb);
316
30
}
317
static int
318
dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
319
80
{
320
    /* Set up structures needed to add the protocol subtree and manage it */
321
80
    proto_item *ti;
322
80
    proto_tree *wsmp_tree, *wsmdata_tree;
323
80
    tvbuff_t   *wsmdata_tvb;
324
80
    uint16_t    wsmlength, offset = 0;
325
80
    uint32_t    psid, supLen;
326
80
    uint8_t     elemenId, elemenLen, msb, oct, version;
327
328
    /* Make entries in Protocol column and Info column on summary display */
329
80
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "WSMP");
330
331
80
    col_set_str(pinfo->cinfo, COL_INFO, "WAVE Short Message Protocol IEEE P1609.3");
332
333
    /* create display subtree for the protocol */
334
80
    ti = proto_tree_add_item(tree, proto_wsmp, tvb, 0, -1, ENC_NA);
335
80
    wsmp_tree = proto_item_add_subtree(ti, ett_wsmp);
336
337
    /* In Version 3
338
     * B7     B4          B3            B2   B0
339
     * Subtype    |WSMP-NHeader      | WSMP Version
340
     *            | Option Indicator
341
     */
342
80
    oct = tvb_get_uint8(tvb, offset);
343
80
    version = oct & 0x07;
344
80
    if (version == 3) {
345
        /* Version 3 */
346
30
        return dissect_wsmp_v3(tvb, pinfo, wsmp_tree, oct);
347
30
    }
348
349
50
    proto_tree_add_item(wsmp_tree, hf_wsmp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
350
50
    offset++;
351
352
50
    offset = dissect_wsmp_psid(tvb, pinfo, wsmp_tree, offset, &psid);
353
354
    /* TLV decoder that does not display the T and L elements */
355
50
    elemenId = tvb_get_uint8(tvb, offset);
356
4.01k
    while ((elemenId != WSMP) && (elemenId != WSMP_S) && (elemenId != WSMP_I))
357
3.96k
    {
358
3.96k
        offset++;
359
3.96k
        if (elemenId == CHANNUM)
360
23
        {
361
23
            elemenLen = tvb_get_uint8(tvb, offset);
362
23
            offset++;
363
23
            proto_tree_add_item(wsmp_tree,
364
23
                                hf_wsmp_channel, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
365
23
            offset += elemenLen;
366
23
        }
367
3.94k
        else if (elemenId == DATARATE)
368
21
        {
369
21
            elemenLen = tvb_get_uint8(tvb, offset);
370
21
            offset++;
371
21
            proto_tree_add_item(wsmp_tree,
372
21
                                hf_wsmp_rate, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
373
21
            offset += elemenLen;
374
21
        }
375
3.92k
        else if (elemenId == TRANSMITPW)
376
40
        {
377
40
            elemenLen = tvb_get_uint8(tvb, offset);
378
40
            offset++;
379
40
            proto_tree_add_item(wsmp_tree,
380
40
                                hf_wsmp_txpower, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
381
40
            offset += elemenLen;
382
40
        }
383
3.96k
        elemenId  = tvb_get_uint8(tvb, offset);
384
3.96k
    }
385
386
50
    proto_tree_add_item(wsmp_tree,
387
50
                        hf_wsmp_WAVEid, tvb, offset, 1, ENC_BIG_ENDIAN);
388
50
    offset++;
389
390
50
    wsmlength = tvb_get_ntohs( tvb, offset);
391
50
    proto_tree_add_item(wsmp_tree,
392
50
                        hf_wsmp_wsmlength, tvb, offset, 2, ENC_BIG_ENDIAN);
393
50
    offset += 2;
394
395
50
    if (elemenId == WSMP_S)
396
7
    {
397
7
        msb    = 1;
398
7
        supLen = 0;
399
21
        while (msb)
400
14
        {
401
14
            msb = tvb_get_uint8(tvb, offset + supLen);
402
14
            msb = msb & 0x80;
403
14
            supLen++;
404
14
        }
405
7
        proto_tree_add_item(wsmp_tree,
406
7
                            hf_wsmp_WSMP_S_data, tvb, offset, supLen, ENC_BIG_ENDIAN);
407
7
        wsmlength -= supLen;
408
7
        offset    += supLen;
409
7
    }
410
411
50
    wsmdata_tree = proto_tree_add_subtree(wsmp_tree, tvb, offset, wsmlength,
412
50
                                        ett_wsmdata, NULL, "Wave Short Message");
413
414
50
    wsmdata_tvb  = tvb_new_subset_length(tvb, offset, wsmlength);
415
416
    /* TODO: Branch on the application context and display accordingly
417
     * Default: call the data dissector
418
     */
419
50
    if (psid == 0x4070)
420
0
    {
421
0
        call_data_dissector(wsmdata_tvb, pinfo, wsmdata_tree);
422
0
    }
423
50
    return tvb_captured_length(tvb);
424
80
}
425
426
void
427
proto_register_wsmp(void)
428
14
{
429
14
    static hf_register_info hf[] = {
430
14
        { &hf_wsmp_version,
431
14
          { "Version", "wsmp.version", FT_UINT8, BASE_DEC, NULL, 0x0,
432
14
            NULL, HFILL }},
433
434
14
        { &hf_wsmp_var_len_det,
435
14
          { "Length", "wsmp.len.det",
436
14
            FT_UINT8, BASE_HEX, NULL, 0x0,
437
14
            NULL, HFILL }},
438
439
14
        { &hf_wsmp_psid,
440
14
          { "PSID", "wsmp.psid", FT_UINT32, BASE_HEX, NULL, 0x0,
441
14
            NULL, HFILL }},
442
443
14
        { &hf_wsmp_channel,
444
14
          { "Channel", "wsmp.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
445
14
            NULL, HFILL }},
446
447
14
        { &hf_wsmp_rate,
448
14
          { "Data Rate", "wsmp.rate", FT_UINT8, BASE_DEC, NULL, 0x0,
449
14
            NULL, HFILL }},
450
451
14
        { &hf_wsmp_txpower,
452
14
          { "Transmit Power", "wsmp.txpower", FT_UINT8, BASE_DEC, NULL, 0x0,
453
14
            NULL, HFILL }},
454
455
14
        { &hf_wsmp_WAVEid,
456
14
          { "WAVE element id", "wsmp.WAVEid", FT_UINT8, BASE_DEC, VALS(wsmp_elemenid_names), 0x0,
457
14
            NULL, HFILL }},
458
459
14
        { &hf_wsmp_wsmlength,
460
14
          { "WSM Length", "wsmp.wsmlength", FT_UINT16, BASE_DEC, NULL, 0x0,
461
14
            NULL, HFILL }},
462
463
14
        { &hf_wsmp_WSMP_S_data,
464
14
          { "WAVE Supplement Data", "wsmp.supplement", FT_UINT8, BASE_HEX, NULL, 0x0,
465
14
            NULL, HFILL }},
466
467
14
        { &hf_wsmp_subtype,
468
14
          { "Subtype", "wsmp.subtype", FT_UINT8, BASE_DEC, VALS(wsmp_subtype_vals), 0xF0,
469
14
            NULL, HFILL }},
470
471
14
        { &hf_wsmp_N_header_opt_ind,
472
14
          { "WSMP-NHeader Option Indicator(WAVE Information Element Extension)", "wsmp.N_header_opt_ind", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
473
14
            NULL, HFILL }},
474
475
14
        { &hf_wsmp_version_v3,
476
14
          { "Version", "wsmp.version_v3", FT_UINT8, BASE_DEC, NULL, 0x07,
477
14
            NULL, HFILL }},
478
479
14
        { &hf_wsmp_no_elements,
480
14
          { "Count", "wsmp.no_elements", FT_UINT16, BASE_DEC, NULL, 0x0,
481
14
            NULL, HFILL }},
482
483
14
        { &hf_wsmp_wave_ie,
484
14
          { "WAVE IE", "wsmp.wave_ie", FT_UINT8, BASE_DEC, VALS(wsmp_wave_information_elements_vals), 0x0,
485
14
            NULL, HFILL }},
486
487
14
        { &hf_wsmp_wave_ie_len,
488
14
          { "Length", "wsmp.wave_ie_len", FT_UINT16, BASE_DEC, NULL, 0x0,
489
14
            NULL, HFILL }},
490
491
14
        { &hf_wsmp_wave_ie_data,
492
14
          { "Data", "wsmp.wave_ie_data", FT_BYTES, BASE_NONE, NULL, 0x0,
493
14
            NULL, HFILL }},
494
495
14
        { &hf_wsmp_tpid,
496
14
          { "TPID", "wsmp.tpid", FT_UINT8, BASE_DEC, VALS(wsmp_tpid_vals), 0x0,
497
14
            NULL, HFILL }},
498
499
14
    };
500
501
    /* Setup protocol subtree array */
502
14
    static int *ett[] = {
503
14
        &ett_wsmp,
504
14
        &ett_wsmdata,
505
14
        &ett_wsmp_n_hdr,
506
14
        &ett_wsmp_t_hdr,
507
14
        &ett_wsmp_ie_ext,
508
14
        &ett_wsmp_ie,
509
14
    };
510
511
14
    static ei_register_info ei[] = {
512
14
    { &ei_wsmp_length_field_err, { "wsmp.length_field_err", PI_PROTOCOL, PI_ERROR,
513
14
        "Length field wrongly encoded, b6 not 0. The rest of the dissection is suspect", EXPFILL }},
514
14
    { &ei_wsmp_psid_invalid, { "wsmp.psid.invalid", PI_PROTOCOL, PI_ERROR, "Invalid PSID", EXPFILL }},
515
14
    };
516
517
14
    expert_module_t* expert_wsmp;
518
519
    /* Register the protocol name and description */
520
14
    proto_wsmp = proto_register_protocol("Wave Short Message Protocol(IEEE P1609.3)",
521
14
                                         "WSMP", "wsmp");
522
523
    /* Required function calls to register the header fields and subtrees used */
524
14
    proto_register_field_array(proto_wsmp, hf, array_length(hf));
525
14
    proto_register_subtree_array(ett, array_length(ett));
526
14
    expert_wsmp = expert_register_protocol(proto_wsmp);
527
14
    expert_register_field_array(expert_wsmp, ei, array_length(ei));
528
529
    /* Register the dissector handle */
530
14
    wsmp_handle = register_dissector("wsmp", dissect_wsmp, proto_wsmp);
531
532
    /* Register IEEE 1609.2 PSIDs dissector table */
533
14
    ieee1609dot2_psid_table = register_dissector_table("wsmp.psid",
534
14
                                                       "WSMP known PSIDs",
535
14
                                                       proto_wsmp,
536
14
                                                       FT_UINT32,
537
14
                                                       BASE_DEC);
538
14
}
539
540
void
541
proto_reg_handoff_wsmp(void)
542
14
{
543
14
    dissector_add_uint("ethertype", ETHERTYPE_WSMP, wsmp_handle);
544
14
}
545
546
/*
547
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
548
 *
549
 * Local variables:
550
 * c-basic-offset: 4
551
 * tab-width: 8
552
 * indent-tabs-mode: nil
553
 * End:
554
 *
555
 * vi: set shiftwidth=4 tabstop=8 expandtab:
556
 * :indentSize=4:tabSize=8:noTabs=true:
557
 */