wireshark/epan/dissectors/packet-wsmp.c

610 lines
25 KiB
C

/* packet-wsmp.c
* Routines for WAVE Short Message dissection (WSMP)
* Copyright 2013, Savari Networks (http://www.savarinetworks.com) (email: smooney@savarinetworks.com)
* Based on packet-wsmp.c implemented by
* Arada Systems (http://www.aradasystems.com) (email: siva@aradasystems.com)
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
* Ref IEEE 1609.3
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/etypes.h>
#include <epan/expert.h>
/* elemenID Types */
#define TRANSMITPW 0x04
#define CHANNUM 0x0F
#define DATARATE 0x10
#define WSMP 0x80
#define WSMP_S 0x81
#define WSMP_I 0x82
void proto_register_wsmp(void);
void proto_reg_handoff_wsmp(void);
static const value_string wsmp_elemenid_names[] = {
{ 0x80, "WSMP" },
{ 0x81, "WSMP-S" },
{ 0x82, "WSMP-I" },
{ 0, NULL }
};
/* Initialize the protocol and registered fields */
static int proto_wsmp = -1;
static int hf_wsmp_version = -1;
static int hf_wsmp_psid = -1;
static int hf_wsmp_rate = -1;
static int hf_wsmp_channel = -1;
static int hf_wsmp_txpower = -1;
static int hf_wsmp_WAVEid = -1;
static int hf_wsmp_wsmlength = -1;
static int hf_wsmp_WSMP_S_data = -1;
static int hf_wsmp_subtype = -1;
static int hf_wsmp_N_header_opt_ind = -1;
static int hf_wsmp_version_v3 = -1;
static int hf_wsmp_no_elements = -1;
static int hf_wsmp_wave_ie = -1;
static int hf_wsmp_wave_ie_len = -1;
static int hf_wsmp_wave_ie_data = -1;
static int hf_wsmp_tpid = -1;
/* Initialize the subtree pointers */
static int ett_wsmp = -1;
static int ett_wsmdata = -1;
static int ett_wsmp_n_hdr = -1;
static int ett_wsmp_t_hdr = -1;
static int ett_wsmp_ie_ext = -1;
static int ett_wsmp_ie = -1;
static expert_field ei_wsmp_length_field_err = EI_INIT;
dissector_handle_t IEEE1609dot2_handle;
static const value_string wsmp_subtype_vals[] = {
{ 0x0, "Null-networking protocol" },
{ 0x1, "ITS station-internal forwarding" },
{ 0x2, "N-hop forwarding" },
{ 0x3, "Enables the features of GeoNetworking" },
{ 0, NULL }
};
static const value_string wsmp_wave_information_elements_vals[] = {
{ 0, "Reserved" },
{ 1, "Reserved" },
{ 2, "Reserved" },
{ 3, "Reserved" },
{ 4, "Transmit Power Used" }, /* WSMP - N - Header 8.3.4.4 */
{ 5, "2D Location" }, /* WSA header 8.2.2.6 */
{ 6, "3D Location" }, /* WSA header 8.2.2.6 */
{ 7, "Advertiser Identifier" }, /* WSA header 8.2.2.6 */
{ 8, "Provider Service Context" }, /* WSA Service Info 8.2.3.5 */
{ 9, "IPv6 Address" }, /* WSA Service Info 8.2.3.5 */
{ 10, "Service Por" }, /* WSA Service Info 8.2.3.5 */
{ 11, "Provider MAC Address" }, /* WSA Service Info 8.2.3.5 */
{ 12, "EDCA Parameter Set" }, /* WSA Channel Info 8.2.4.8 */
{ 13, "Secondary DNS" }, /* WSA WRA 8.2.5.7 */
{ 14, "Gateway MAC Address" }, /* WSA WRA 8.2.5.7 */
{ 15, "Channel Number" }, /* WSMP - N - Header 8.3.4.2 */
{ 16, "Data Rate" }, /* WSMP - N - Header 8.3.4.3 */
{ 17, "Repeat Rate" }, /* WSA header 8.2.2.6 */
{ 18, "Reserved" },
{ 19, "RCPI Threshold" }, /* WSA Service Info 8.2.3.5 */
{ 20, "WSA Count Threshold" }, /* WSA Service Info 8.2.3.5 */
{ 21, "Channel Access" }, /* WSA Channel Info 8.2.4.8 */
{ 22, "WSA Count Threshold Interval" }, /* WSA Service Info 8.2.3.5 */
{ 23, "Channel Load" }, /* WSMP-N-Header 8.3.4.5 */
{ 0, NULL }
};
static const value_string wsmp_tpid_vals[] = {
{ 0, "The Address Info field contains a PSID and a WAVE Information Element Extension field is not present" },
{ 1, "The Address Info field contains a PSID and a WAVE Information Element Extension field is present" },
{ 2, "The Address Info field contains source and destination ITS port numbers and a WAVE Information Element Extension field is not present" },
{ 3, "The Address Info field contains source and destination ITS port numbers and a WAVE Information Element Extension field is present" },
{ 4, "LPP mode and a WAVE Information Element Extension field is not present" },
{ 5, "LPP mode and a WAVE Information Element Extension field is present" },
{ 0, NULL }
};
/* IEEE std 1609.12
* 4.1.3 PSID allocations
* Using P-encoded PSID values (hex)
*/
static const value_string wsmp_psid_vals[] = {
{ 0x0, "Null-networking protocol" },
/* 0x00 */ { 0x00, "system" }, /* ISO 15628a */
/* 0x01 */ { 0x01, "electronic-fee-collection" }, /* ISO 14906 */
/* 0x02 */ { 0x02, "freight-fl eet-management" }, /* ISO 15628 */
/* 0x03 */ { 0x03, "public-transport" }, /* ISO 15628 */
/* 0x04 */ { 0x04, "traffi c-traveller-information" }, /* ISO 15628 */
/* 0x05 */ { 0x05, "traffi c-control" }, /* ISO 15628 */
/* 0x06 */ { 0x06, "parking management" }, /* ISO 15628 */
/* 0x07 */ { 0x07, "geographic-road-database" }, /* ISO 15628 */
/* 0x08 */ { 0x08, "medium-range-preinformation" }, /* ISO 15628 */
/* 0x09 */ { 0x09, "man-machine-interface" }, /* ISO 15628 */
/* 0x0A */ { 0x0A, "intersystem-interface" }, /* ISO 15628 */
/* 0x0B */ { 0x0B, "automatic-vehicle-identifi cation" }, /* ISO 17264 */
/* 0x0C */ { 0x0C, "emergency-warning" }, /* ISO 15628 */
/* 0x0D */ { 0x0D, "private" }, /* ISO 15628 */
/* 0x0E */ { 0x0E, "multi-purpose-payment" }, /* ISO 15628 */
/* 0x0F */ { 0x0F, "dsrc-resource manager" }, /* ISO 15628 */
/* 0x10 */ { 0x10, "after-theft-systems" }, /* ISO 15628 */
/* 0x11 */ { 0x11, "cruise-assist-highway-system" }, /* ISO 15628 */
/* 0x12 */ { 0x12, "multi-purpose-information-system" }, /* ISO 15628 */
/* 0x13 */ { 0x13, "multi-mobile-information-system" }, /* ISO 15628 */
/* 0x14 */ { 0x14, "efc-compliance-check-communication-applications " }, /* ISO TS 12813 */
/* 0x15 */ { 0x15, "efc-localisation-augmentation-communication-applications" }, /* ISO TS 13141 */
/* 0x16 */ { 0x16, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x17 */ { 0x17, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x18 */ { 0x18, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x19 */ { 0x19, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x10 */ { 0x1a, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x1b */ { 0x1b, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x1c */ { 0x1c, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x1d */ { 0x1d, "Private use" }, /* IISO 15628 */
/* 0x1e */ { 0x1e, "Private use" }, /* IISO 15628 */
/* 0x1f */ { 0x1f, "reserved for ISO/CEN-dsrc-applications" }, /* IISO 15628 */
/* 0x20 */ { 0x20, "vehicle to vehicle safety and awarenesss" }, /* SAE J2735 */
/* 0x21 */ { 0x21, "limited sensor vehicle to vehicle safety and awarenesss" }, /* SAE J2735 */
/* 0x22 */ { 0x22, "tracked vehicle safety and awarenesss" }, /* SAE J2735 */
/* 0x23 */ { 0x23, "WAVE security managements" }, /* IEEE Std 1609.2 */
/* 0x24 */ { 0x24, "CA Basic Services" }, /* ETSI EN 302 637-2 */
/* 0x25 */ { 0x25, "DEN Basic Services" }, /* ETSI EN 302 637-3 */
/* 0x26 */ { 0x26, "Misbehavior reporting for common applicationss" }, /* CAMP */
/* 0x27 */ { 0x27, "Vulnerable Road Users Safety Applications" }, /* SAE DSRC TC */
/* 0x28 to 0x7E 0p28 to 0p7E Not allocated */
/* 0x7F */ { 0x7F, "Testings" }, /* IEEE P1609 WG */
/* 0x80 */ { 0x8000, "differential GPS corrections, uncompressed" }, /* SAE J2735 */
/* 0x81 */ { 0x8001, "differential GPS corrections, compressed" }, /* SAE J2735 */
/* 0x82 */ { 0x8002, "intersection safety and awareness" }, /* SAE J2735 */
/* 0x83 */ { 0x8003, "traveller information and roadside signage" }, /* SAE J2735 */
/* 0x84 */ { 0x8004, "mobile probe exchanges" }, /* SAE J2735 */
/* 0x85 */ { 0x8005, "emergency and erratic vehicles present in roadway" }, /* SAE J2735 */
/* 0x86 */ { 0x8006, "Remote ITS station management protocol-Remote Management Protocol Execution(RMPE)" }, /* ISO 24102-2 */
/* 0x87 */ { 0x8007, "WAVE Service Advertisement" }, /* IEEE Std 1609.3 */
/* 0x88 */ { 0x8008, "Peer-to-peer distribution of Security Management Information" }, /* CAMP */
/* 0x89 to 0xFF 0p80-09 to 0p80-7F Not allocated */
/* 0x01-00 */ { 0x8080, "Certificate Revocation List Application" }, /* CAMP */
/*0x01-01 to 0x3E-7F 0p80-81 to 0pBD-FF Not allocated*/
/*0x3E-80 to 0x40-1F 0pBE-00 to 0pBF-9F Reserved IEEE P1609 WG 416*/
/*0x40-20 to 0x40-5F 0pBF-A0 to 0pBF-DF Private used IEEE P1609 WG 64*/
/*0x40-60 to 0x40-7F 0pBF-E0 to 0pBF-FF Testing IEEE P1609 WG 32*/
/*16 384 total 2-octet p-encoded values*/
/*0x40-80 0pC0-00-00 Cooperative Awareness Message (CAM) processor(deprecated) ETSI */
/*0x40-81 0pC0-00-01 Decentralized Environmental Notification Message(DENM) processor(deprecated) ETSI */
/*0x40-82 to 0x20-40-7F 0pC0-00-02 to 0pDF-FF-FF Not allocated*/
/* 2 097 152 total 3-octet p-encoded values*/
/* 0x20-40-81 */{ 0xE0000001, "ITS-station Internal management Communications Protocol(IICP)" }, /* ISO 24102-4 */
/*0x20-40-82 to 0x10-20-40-7D 0pE0-00-00 - 02 to 0pEF-FFFF - FD Not allocated*/
/* 0x10-20-40-7E */{ 0xEFFFFFFE, "IPv6 routing" }, /* IEEE Std 1609.3 */
/* 0x10-20-40-7F */{ 0xEFFFFFFF, "Not allocated" }, /* */
{ 0, NULL }
};
/*
4.1.2 P-encoding of PSIDs
This standard defines a compact encoding for PSID referred to as p-encoding. Octets are numbered from the
left starting at zero (Octet 0). The length of the PSID is indicated by Octet 0, where the position of the first
zero-value bit in descending order of bit significance in the octet indicates the length in octets of the p?encoded
PSID. Using p-encoding, a binary "0" in the most-significant bit indicates a one-octet PSID; a binary "10"
in the two most-significant bits indicates a two-octet PSID; a binary "110" in the three most-significant bits
indicates a three-octet PSID; and a binary "1110" in the four most-significant bits indicates a four-octet PSID.
*/
static int
dissect_wsmp_psid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint32 *psid)
{
guint8 oct;
guint32 psidLen = 0;
oct = tvb_get_guint8(tvb, offset);
if ((oct & 0xF0) == 0xF0) {
psidLen = 255;
} else if ((oct & 0xF0) == 0xE0) {
psidLen = 4;
} else if ((oct & 0xE0) == 0xC0) {
psidLen = 3;
} else if ((oct & 0xC0) == 0x80) {
psidLen = 2;
} else if ((oct & 0x80) == 0x00) {
psidLen = 1;
}
if (psidLen == 1)
*psid = oct;
else if (psidLen == 2)
*psid = tvb_get_ntohs(tvb, offset);
else if (psidLen == 3)
*psid = tvb_get_ntoh24(tvb, offset);
else if (psidLen == 4)
*psid = tvb_get_ntohl(tvb, offset);
proto_tree_add_item(tree, hf_wsmp_psid, tvb, offset, psidLen, ENC_BIG_ENDIAN);
offset += psidLen;
return offset;
}
/* 8.1.3 Length and Count field encoding*/
static int
dissect_wsmp_length_and_count(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int hf_id, guint16* value)
{
guint8 oct, len;
guint16 val;
/* For values in the range of 0 through 127, Length and Count values
* are represented in a single-octet encoded as an unsigned integer. For values in the range 128 through 16
* 383, values are represented as two octets encoded as follows. If the most significant bit of the field is 0b0,
* then this indicates a one-octet Length or Count field. If the two most significant bits of the field are 0b10,
* the Length or Count field is a two-octet field, with the remaining 14 bits representing the value encoded as
* an unsigned integer.*/
oct = tvb_get_guint8(tvb, offset);
if ((oct & 0x80) == 0x80) {
if ((oct & 0xc0) == 0x80) {
/* Two bytes */
val = tvb_get_ntohs(tvb, offset) & 0x3fff;
len = 2;
} else {
/* Error */
proto_tree_add_expert(tree, pinfo, &ei_wsmp_length_field_err, tvb, offset, 1);
val = tvb_get_ntohs(tvb, offset) & 0x3fff;
len = 2;
}
}else{
/* One byte */
val = oct;
len = 1;
}
proto_tree_add_uint(tree, hf_id, tvb, offset, len, val);
offset += len;
if (value){
*value = val;
}
return offset;
}
static int
dissect_wsmp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 oct)
{
proto_tree *sub_tree, *n_tree, *t_tree, *data_tree;
proto_item *item;
int offset = 0, ie_start, len_to_set;
guint8 header_opt_ind = oct & 0x08 >> 3;
guint8 ie;
guint16 count, ie_len, wsm_len;
guint32 tpid, psid = 0;
static const int * flags[] = {
&hf_wsmp_subtype,
&hf_wsmp_N_header_opt_ind,
&hf_wsmp_version_v3,
NULL
};
/* 8.3.2 WSMP Network Header (WSMP-N-Header) */
n_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_wsmp_n_hdr, &item, "WSMP-N-Header");
/* In Version 3
* B7 B4 B3 B2 B0 | Variable | 1 octet
* Subtype |WSMP-NHeader | WSMP Version | WAVE Information Element Extension | TPID
* | Option Indicator | | |
*/
proto_tree_add_bitmask_list(n_tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
offset++;
/* WAVE Information Element Extension */
if (header_opt_ind) {
sub_tree = proto_tree_add_subtree(n_tree, tvb, offset, -1, ett_wsmp_ie_ext, &item, "WAVE Information Element Extension");
/* Figure 14 WAVE Information Element Extension */
/* 8.1.3 Length and Count field encoding*/
/* Count( Number of WAVE Information Elements )*/
offset = dissect_wsmp_length_and_count(tvb, pinfo, sub_tree, offset, hf_wsmp_no_elements, &count);
while (count) {
proto_tree* ie_tree;
ie_start = offset;
/* WAVE Element ID 1 octet*/
ie = tvb_get_guint8(tvb, offset);
ie_tree = proto_tree_add_subtree_format(sub_tree, tvb, offset, -1, ett_wsmp_ie, &item, "%s",
val_to_str_const(ie, wsmp_wave_information_elements_vals, "Unknown"));
proto_tree_add_item(ie_tree, hf_wsmp_wave_ie, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Length */
offset = dissect_wsmp_length_and_count(tvb, pinfo, ie_tree, offset, hf_wsmp_wave_ie_len, &ie_len);
proto_tree_add_item(ie_tree, hf_wsmp_wave_ie_data, tvb, offset, ie_len, ENC_NA);
offset += ie_len;
len_to_set = offset - ie_start;
proto_item_set_len(item, len_to_set);
count--;
}
}
/* TPID */
proto_tree_add_item_ret_uint(n_tree, hf_wsmp_tpid, tvb, offset, 1, ENC_BIG_ENDIAN, &tpid);
offset++;
/* WSMP-T-Header */
t_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_wsmp_t_hdr, &item, "WSMP-T-Header");
switch (tpid) {
case 0:
/* The Address Info field contains a PSID and a WAVE Information Element Extension field is not present.*/
offset = dissect_wsmp_psid(tvb, pinfo, t_tree, offset, &psid);
break;
default:
break;
}
/* WSM Length */
offset = dissect_wsmp_length_and_count(tvb, pinfo, t_tree, offset, hf_wsmp_wave_ie_len, &wsm_len);
/* WSM Data */
data_tree = proto_tree_add_subtree(tree, tvb, offset, wsm_len, ett_wsmdata, NULL, "Wave Short Message");
if((psid == 0x20) && (IEEE1609dot2_handle)){
tvbuff_t * tvb_new = tvb_new_subset_remaining(tvb, offset);
call_dissector(IEEE1609dot2_handle, tvb_new, pinfo, data_tree);
} else if ((psid == 0x8002) && (IEEE1609dot2_handle)) {
tvbuff_t * tvb_new = tvb_new_subset_remaining(tvb, offset);
call_dissector(IEEE1609dot2_handle, tvb_new, pinfo, data_tree);
}
return tvb_captured_length(tvb);
}
static int
dissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti;
proto_tree *wsmp_tree, *wsmdata_tree;
tvbuff_t *wsmdata_tvb;
guint16 wsmlength, offset = 0;
guint32 psid, supLen;
guint8 elemenId, elemenLen, msb, oct, version;
/* Make entries in Protocol column and Info column on summary display */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WSMP");
col_set_str(pinfo->cinfo, COL_INFO, "WAVE Short Message Protocol IEEE P1609.3");
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_wsmp, tvb, 0, -1, ENC_NA);
wsmp_tree = proto_item_add_subtree(ti, ett_wsmp);
/* In Version 3
* B7 B4 B3 B2 B0
* Subtype |WSMP-NHeader | WSMP Version
* | Option Indicator
*/
oct = tvb_get_guint8(tvb, offset);
version = oct & 0x07;
if (version == 3) {
/* Version 3 */
return dissect_wsmp_v3(tvb, pinfo, wsmp_tree, oct);
}
proto_tree_add_item(wsmp_tree, hf_wsmp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
offset = dissect_wsmp_psid(tvb, pinfo, wsmp_tree, offset, &psid);
/* TLV decoder that does not display the T and L elements */
elemenId = tvb_get_guint8(tvb, offset);
while ((elemenId != WSMP) && (elemenId != WSMP_S) && (elemenId != WSMP_I))
{
offset++;
if (elemenId == CHANNUM)
{
elemenLen = tvb_get_guint8(tvb, offset);
offset++;
proto_tree_add_item(wsmp_tree,
hf_wsmp_channel, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
offset += elemenLen;
}
else if (elemenId == DATARATE)
{
elemenLen = tvb_get_guint8(tvb, offset);
offset++;
proto_tree_add_item(wsmp_tree,
hf_wsmp_rate, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
offset += elemenLen;
}
else if (elemenId == TRANSMITPW)
{
elemenLen = tvb_get_guint8(tvb, offset);
offset++;
proto_tree_add_item(wsmp_tree,
hf_wsmp_txpower, tvb, offset, elemenLen, ENC_BIG_ENDIAN);
offset += elemenLen;
}
elemenId = tvb_get_guint8(tvb, offset);
}
proto_tree_add_item(wsmp_tree,
hf_wsmp_WAVEid, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
wsmlength = tvb_get_ntohs( tvb, offset);
proto_tree_add_item(wsmp_tree,
hf_wsmp_wsmlength, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
if (elemenId == WSMP_S)
{
msb = 1;
supLen = 0;
while (msb)
{
msb = tvb_get_guint8(tvb, offset + supLen);
msb = msb & 0x80;
supLen++;
}
proto_tree_add_item(wsmp_tree,
hf_wsmp_WSMP_S_data, tvb, offset, supLen, ENC_BIG_ENDIAN);
wsmlength -= supLen;
offset += supLen;
}
wsmdata_tree = proto_tree_add_subtree(wsmp_tree, tvb, offset, wsmlength,
ett_wsmdata, NULL, "Wave Short Message");
wsmdata_tvb = tvb_new_subset_length_caplen(tvb, offset, -1, wsmlength);
/* TODO: Branch on the application context and display accordingly
* Default: call the data dissector
*/
if (psid == 0xbff0)
{
call_data_dissector(wsmdata_tvb, pinfo, wsmdata_tree);
}
return tvb_captured_length(tvb);
}
void
proto_register_wsmp(void)
{
static hf_register_info hf[] = {
{ &hf_wsmp_version,
{ "Version", "wsmp.version", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_psid,
{ "PSID", "wsmp.psid", FT_UINT32, BASE_HEX, VALS(wsmp_psid_vals), 0x0,
NULL, HFILL }},
{ &hf_wsmp_channel,
{ "Channel", "wsmp.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_rate,
{ "Data Rate", "wsmp.rate", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_txpower,
{ "Transmit Power", "wsmp.txpower", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_WAVEid,
{ "WAVE element id", "wsmp.WAVEid", FT_UINT8, BASE_DEC, VALS(wsmp_elemenid_names), 0x0,
NULL, HFILL }},
{ &hf_wsmp_wsmlength,
{ "WSM Length", "wsmp.wsmlength", FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_WSMP_S_data,
{ "WAVE Supplement Data", "wsmp.supplement", FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_subtype,
{ "Subtype", "wsmp.subtype", FT_UINT8, BASE_DEC, VALS(wsmp_subtype_vals), 0xF0,
NULL, HFILL }},
{ &hf_wsmp_N_header_opt_ind,
{ "WSMP-NHeader Option Indicator(WAVE Information Element Extension)", "wsmp.N_header_opt_ind", FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
NULL, HFILL }},
{ &hf_wsmp_version_v3,
{ "Version", "wsmp.version_v3", FT_UINT8, BASE_DEC, NULL, 0x07,
NULL, HFILL }},
{ &hf_wsmp_no_elements,
{ "Count", "wsmp.no_elements", FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_wave_ie,
{ "WAVE IE", "wsmp.wave_ie", FT_UINT8, BASE_DEC, VALS(wsmp_wave_information_elements_vals), 0x0,
NULL, HFILL }},
{ &hf_wsmp_wave_ie_len,
{ "Length", "wsmp.wave_ie_len", FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_wave_ie_data,
{ "Data", "wsmp.wave_ie_data", FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_wsmp_tpid,
{ "TPID", "wsmp.wave_ie", FT_UINT8, BASE_DEC, VALS(wsmp_tpid_vals), 0x0,
NULL, HFILL }},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_wsmp,
&ett_wsmdata,
&ett_wsmp_n_hdr,
&ett_wsmp_t_hdr,
&ett_wsmp_ie_ext,
&ett_wsmp_ie,
};
static ei_register_info ei[] = {
{ &ei_wsmp_length_field_err, { "wsmp.length_field_err", PI_PROTOCOL, PI_ERROR,
"Length field wrongly encoded, b6 not 0. The rest of the dissection is suspect", EXPFILL }},
};
expert_module_t* expert_wsmp;
/* Register the protocol name and description */
proto_wsmp = proto_register_protocol("Wave Short Message Protocol(IEEE P1609.3)",
"WSMP", "wsmp");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_wsmp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_wsmp = expert_register_protocol(proto_wsmp);
expert_register_field_array(expert_wsmp, ei, array_length(ei));
}
void
proto_reg_handoff_wsmp(void)
{
dissector_handle_t wsmp_handle;
wsmp_handle = create_dissector_handle(dissect_wsmp, proto_wsmp);
dissector_add_uint("ethertype", ETHERTYPE_WSMP, wsmp_handle);
IEEE1609dot2_handle = find_dissector_add_dependency("ieee1609dot2.data", proto_wsmp);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/