2014-02-06 00:03:15 +00:00
|
|
|
/* packet-mausb.c
|
|
|
|
* Routines for Media Agnostic USB dissection
|
|
|
|
* Copyright 2014, Intel Corporation
|
|
|
|
* Author: Sean O. Stalley <sean.stalley@intel.com>
|
|
|
|
*
|
|
|
|
* Dedicated to Robert & Dorothy Stalley
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-02-06 00:03:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/expert.h>
|
2014-10-13 23:09:09 +00:00
|
|
|
#include <epan/oui.h>
|
2014-12-20 21:23:59 +00:00
|
|
|
#include "packet-tcp.h"
|
2014-02-06 00:03:15 +00:00
|
|
|
#include "packet-llc.h"
|
|
|
|
#include "packet-usb.h"
|
2016-01-11 20:39:12 +00:00
|
|
|
#include "packet-mausb.h"
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
void proto_reg_handoff_mausb(void);
|
|
|
|
void proto_register_mausb(void);
|
|
|
|
|
|
|
|
/* For SNAP Packets */
|
|
|
|
static int hf_llc_mausb_pid = -1;
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_mausb = -1;
|
|
|
|
static int hf_mausb_version = -1;
|
|
|
|
static int hf_mausb_flags = -1;
|
|
|
|
static int hf_mausb_flag_host = -1;
|
|
|
|
static int hf_mausb_flag_retry = -1;
|
|
|
|
static int hf_mausb_flag_timestamp = -1;
|
|
|
|
static int hf_mausb_flag_reserved = -1;
|
2016-01-11 20:39:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
static const int *mausb_flag_fields[] = {
|
|
|
|
&hf_mausb_flag_host,
|
|
|
|
&hf_mausb_flag_retry,
|
|
|
|
&hf_mausb_flag_timestamp,
|
|
|
|
&hf_mausb_flag_reserved,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
static int hf_mausb_type = -1;
|
|
|
|
static int hf_mausb_length = -1;
|
|
|
|
static int hf_mausb_dev_handle = -1;
|
|
|
|
static int hf_mausb_ep_handle = -1;
|
|
|
|
static int hf_mausb_ep_handle_d = -1;
|
|
|
|
static int hf_mausb_ep_handle_ep_num = -1;
|
|
|
|
static int hf_mausb_ep_handle_dev_addr = -1;
|
|
|
|
static int hf_mausb_ep_handle_bus_num = -1;
|
|
|
|
static int hf_mausb_ma_dev_addr = -1;
|
|
|
|
static int hf_mausb_ssid = -1;
|
|
|
|
static int hf_mausb_status = -1;
|
|
|
|
|
2015-11-15 20:06:10 +00:00
|
|
|
/* management packet specific */
|
2014-02-06 00:03:15 +00:00
|
|
|
static int hf_mausb_token = -1;
|
|
|
|
static int hf_mausb_mgmt_pad = -1;
|
|
|
|
static int hf_mausb_mgmt_ep_handle_num = -1;
|
|
|
|
static int hf_mausb_mgmt_ep_handle_pad = -1;
|
|
|
|
static int hf_mausb_mgmt_ep_des_num = -1;
|
|
|
|
static int hf_mausb_mgmt_ep_des_size = -1;
|
|
|
|
static int hf_mausb_mgmt_ep_des_pad = -1;
|
|
|
|
static int hf_mausb_mgmt_type_spec = -1;
|
|
|
|
static int hf_mausb_mgmt_type_spec_generic = -1;
|
|
|
|
|
2014-07-31 22:54:24 +00:00
|
|
|
/* CapResp packet specific */
|
|
|
|
static int hf_mausb_cap_resp_num_ep = -1;
|
|
|
|
static int hf_mausb_cap_resp_num_dev = -1;
|
|
|
|
static int hf_mausb_cap_resp_num_stream = -1;
|
|
|
|
static int hf_mausb_cap_resp_dev_type = -1;
|
|
|
|
static int hf_mausb_cap_resp_desc_count = -1;
|
|
|
|
static int hf_mausb_cap_resp_desc_len = -1;
|
|
|
|
static int hf_mausb_cap_resp_transfer_req = -1;
|
|
|
|
static int hf_mausb_cap_resp_mgmt_req = -1;
|
|
|
|
static int hf_mausb_cap_resp_rsvd = -1;
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
static int hf_mausb_dev_cap_len = -1;
|
|
|
|
static int hf_mausb_dev_cap_type = -1;
|
|
|
|
static int hf_mausb_dev_cap_generic = -1;
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* EPHandleReq & Resp packet specific */
|
|
|
|
static int hf_mausb_ep_handle_req_pad = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_dir = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_iso = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_lman = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_valid = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_ccu = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_buf_size = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_iso_prog_dly = -1;
|
|
|
|
static int hf_mausb_ep_handle_resp_iso_resp_dly = -1;
|
|
|
|
|
2016-01-05 22:47:20 +00:00
|
|
|
/* (Clear/Cancel)TransferReq & Resp packet specific */
|
|
|
|
static int hf_mausb_clear_transfers_info_block = -1;
|
|
|
|
static int hf_mausb_clear_transfers_status_block = -1;
|
2014-11-14 01:15:31 +00:00
|
|
|
static int hf_mausb_cancel_transfer_rsvd = -1;
|
2016-01-05 22:47:20 +00:00
|
|
|
static int hf_mausb_clear_transfers_req_num = -1;
|
|
|
|
static int hf_mausb_clear_transfers_req_rsvd = -1;
|
|
|
|
static int hf_mausb_clear_transfers_resp_num = -1;
|
|
|
|
static int hf_mausb_clear_transfers_resp_rsvd = -1;
|
2014-11-14 01:15:31 +00:00
|
|
|
static int hf_mausb_cancel_transfer_status = -1;
|
|
|
|
static int hf_mausb_cancel_transfer_rsvd_2 = -1;
|
2016-01-05 22:47:20 +00:00
|
|
|
static int hf_mausb_clear_transfers_status = -1;
|
|
|
|
static int hf_mausb_clear_transfers_partial = -1;
|
|
|
|
static int hf_mausb_clear_transfers_start_req_id = -1;
|
|
|
|
static int hf_mausb_clear_transfers_last_req_id = -1;
|
|
|
|
static int hf_mausb_clear_transfers_req_block_rsvd = -1;
|
|
|
|
static int hf_mausb_clear_transfers_resp_block_rsvd = -1;
|
2014-11-14 01:15:31 +00:00
|
|
|
static int hf_mausb_cancel_transfer_seq_num = -1;
|
|
|
|
static int hf_mausb_cancel_transfer_byte_offset = -1;
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* data packet specific */
|
|
|
|
static int hf_mausb_eps = -1;
|
|
|
|
static int hf_mausb_eps_rsvd = -1;
|
|
|
|
static int hf_mausb_tflags = -1;
|
|
|
|
static int hf_mausb_tflag_arq = -1;
|
|
|
|
static int hf_mausb_tflag_neg = -1;
|
|
|
|
static int hf_mausb_tflag_eot = -1;
|
|
|
|
static int hf_mausb_tflag_type = -1;
|
|
|
|
static int hf_mausb_tflag_rsvd = -1;
|
2016-01-11 20:39:12 +00:00
|
|
|
|
|
|
|
static const int *mausb_tflag_fields[] = {
|
|
|
|
&hf_mausb_tflag_arq,
|
|
|
|
&hf_mausb_tflag_neg,
|
|
|
|
&hf_mausb_tflag_eot,
|
|
|
|
&hf_mausb_tflag_type,
|
|
|
|
&hf_mausb_tflag_rsvd,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2015-02-19 21:20:56 +00:00
|
|
|
static int hf_mausb_num_iso_hdr = -1;
|
|
|
|
static int hf_mausb_iflags = -1;
|
|
|
|
static int hf_mausb_iflag_mtd = -1;
|
|
|
|
static int hf_mausb_iflag_hdr_format = -1;
|
|
|
|
static int hf_mausb_iflag_asap = -1;
|
2016-01-11 20:39:12 +00:00
|
|
|
|
|
|
|
static const int *mausb_iflag_fields[] = {
|
|
|
|
&hf_mausb_iflag_mtd,
|
|
|
|
&hf_mausb_iflag_hdr_format,
|
|
|
|
&hf_mausb_iflag_asap,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
static int hf_mausb_stream_id = -1;
|
|
|
|
static int hf_mausb_seq_num = -1;
|
|
|
|
static int hf_mausb_req_id = -1;
|
2015-02-19 21:20:56 +00:00
|
|
|
static int hf_mausb_present_time = -1;
|
|
|
|
static int hf_mausb_uframe = -1;
|
|
|
|
static int hf_mausb_frame = -1;
|
|
|
|
static int hf_mausb_num_segs = -1;
|
|
|
|
|
|
|
|
static int hf_mausb_timestamp = -1;
|
|
|
|
static int hf_mausb_delta = -1;
|
|
|
|
static int hf_mausb_nom_interval = -1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hf_mausb_mtd = -1;
|
2014-02-06 00:03:15 +00:00
|
|
|
static int hf_mausb_rem_size_credit = -1;
|
|
|
|
|
|
|
|
/* expert info fields */
|
|
|
|
static expert_field ei_ep_handle_len = EI_INIT;
|
|
|
|
static expert_field ei_len = EI_INIT;
|
|
|
|
static expert_field ei_mgmt_type_undef = EI_INIT;
|
|
|
|
static expert_field ei_mgmt_type_spec_len_long = EI_INIT;
|
|
|
|
static expert_field ei_mgmt_type_spec_len_short = EI_INIT;
|
2014-08-01 17:23:28 +00:00
|
|
|
static expert_field ei_dev_cap_len = EI_INIT;
|
|
|
|
static expert_field ei_dev_cap_resp_desc_len = EI_INIT;
|
2014-07-31 22:54:24 +00:00
|
|
|
static expert_field ei_cap_resp_desc_len = EI_INIT;
|
2014-08-01 17:23:28 +00:00
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* MAUSB Version, per 6.2.1.1 */
|
|
|
|
#define MAUSB_VERSION_1_0 0x0
|
|
|
|
#define MAUSB_VERSION_MASK 0x0F
|
|
|
|
|
|
|
|
/* for dissecting snap packets */
|
|
|
|
/*
|
2014-10-13 23:09:09 +00:00
|
|
|
* TODO: determine assigned PID value
|
2014-02-06 00:03:15 +00:00
|
|
|
* (yet to be assigned as of Earth Day 2014)
|
|
|
|
*/
|
2014-10-13 23:09:09 +00:00
|
|
|
#define PID_MAUSB 0x1500
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
static const value_string mausb_pid_string[] = {
|
|
|
|
{ PID_MAUSB, "MAUSB" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string mausb_version_string[] = {
|
|
|
|
{ MAUSB_VERSION_1_0, "MAUSB protocol version 1.0" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Packet flags, per 6.2.1.2 */
|
|
|
|
#define MAUSB_FLAG_MASK 0xF0
|
|
|
|
#define MAUSB_FLAG_HOST (1 << 0)
|
|
|
|
#define MAUSB_FLAG_RETRY (1 << 1)
|
|
|
|
#define MAUSB_FLAG_TIMESTAMP (1 << 2)
|
|
|
|
#define MAUSB_FLAG_RESERVED (1 << 3)
|
|
|
|
#define MAUSB_FLAG_OFFSET 4
|
|
|
|
|
|
|
|
/* Packet Types, per 6.2.1.3 */
|
|
|
|
#define MAUSB_PKT_TYPE_MASK 0xC0
|
|
|
|
#define MAUSB_PKT_TYPE_MGMT (0 << 6)
|
|
|
|
#define MAUSB_PKT_TYPE_CTRL (1 << 6)
|
|
|
|
#define MAUSB_PKT_TYPE_DATA (2 << 6)
|
|
|
|
|
|
|
|
/* Packet Subtypes, per 6.2.1.3 */
|
|
|
|
#define MAUSB_SUBTYPE_MASK 0x3F
|
|
|
|
|
|
|
|
enum mausb_pkt_type {
|
|
|
|
/* Management packets */
|
|
|
|
CapReq = 0x00 | MAUSB_PKT_TYPE_MGMT,
|
|
|
|
CapResp ,
|
|
|
|
USBDevHandleReq ,
|
|
|
|
USBDevHandleResp ,
|
|
|
|
EPHandleReq ,
|
|
|
|
EPHandleResp ,
|
|
|
|
EPActivateReq ,
|
|
|
|
EPActivateResp ,
|
|
|
|
EPInactivateReq ,
|
|
|
|
EPInactivateResp ,
|
2014-11-12 01:52:31 +00:00
|
|
|
EPResetReq ,
|
|
|
|
EPResetResp ,
|
2016-01-05 22:47:20 +00:00
|
|
|
ClearTransfersReq ,
|
|
|
|
ClearTransfersResp ,
|
2014-02-06 00:03:15 +00:00
|
|
|
EPHandleDeleteReq ,
|
|
|
|
EPHandleDeleteResp ,
|
|
|
|
|
2014-11-12 01:52:31 +00:00
|
|
|
DevResetReq ,
|
|
|
|
DevResetResp ,
|
2014-02-06 00:03:15 +00:00
|
|
|
ModifyEP0Req ,
|
|
|
|
ModifyEP0Resp ,
|
2014-11-12 01:52:31 +00:00
|
|
|
SetUSBDevAddrReq ,
|
|
|
|
SetUSBDevAddrResp ,
|
2014-02-06 00:03:15 +00:00
|
|
|
UpdateDevReq ,
|
|
|
|
UpdateDevResp ,
|
2014-11-12 01:52:31 +00:00
|
|
|
USBDevDisconnectReq ,
|
|
|
|
USBDevDisconnectResp ,
|
|
|
|
USBSuspendReq ,
|
|
|
|
USBSuspendResp ,
|
|
|
|
USBResumeReq ,
|
|
|
|
USBResumeResp ,
|
|
|
|
RemoteWakeReq ,
|
|
|
|
RemoteWakeResp ,
|
|
|
|
|
|
|
|
PingReq ,
|
|
|
|
PingResp ,
|
|
|
|
DevDisconnectReq ,
|
|
|
|
DevDisconnectResp ,
|
|
|
|
DevInitDisconnectReq ,
|
|
|
|
DevInitDisconnectResp ,
|
|
|
|
SynchReq ,
|
|
|
|
SynchResp ,
|
2014-02-06 00:03:15 +00:00
|
|
|
CancelTransferReq ,
|
|
|
|
CancelTransferResp ,
|
|
|
|
EPOpenStreamReq ,
|
|
|
|
EPOpenStreamResp ,
|
|
|
|
EPCloseStreamReq ,
|
|
|
|
EPCloseStreamResp ,
|
|
|
|
USBDevResetReq ,
|
|
|
|
USBDevResetResp ,
|
|
|
|
|
2014-11-12 01:52:31 +00:00
|
|
|
DevNotificationReq ,
|
|
|
|
DevNotificationResp ,
|
|
|
|
EPSetKeepAliveReq ,
|
|
|
|
EPSetKeepAliveResp ,
|
|
|
|
GetPortBWReq ,
|
|
|
|
GetPortBWResp ,
|
|
|
|
SleepReq ,
|
|
|
|
SleepResp ,
|
|
|
|
WakeReq ,
|
|
|
|
WakeResp ,
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* Vendor-Specific Management Packets */
|
|
|
|
VendorSpecificReq = 0x3E | MAUSB_PKT_TYPE_MGMT,
|
|
|
|
VendorSpecificResp ,
|
|
|
|
|
2014-11-12 01:52:31 +00:00
|
|
|
/* Control Packets */
|
2014-02-06 00:03:15 +00:00
|
|
|
TransferSetupReq = 0x00 | MAUSB_PKT_TYPE_CTRL,
|
|
|
|
TransferSetupResp ,
|
|
|
|
TransferTearDownConf ,
|
|
|
|
|
|
|
|
/* Data Packets */
|
|
|
|
TransferReq = 0x00 | MAUSB_PKT_TYPE_DATA,
|
2014-11-12 01:52:31 +00:00
|
|
|
TransferResp ,
|
|
|
|
TransferAck ,
|
|
|
|
IsochTransferReq ,
|
|
|
|
IsochTransferResp
|
2014-02-06 00:03:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type & Subtype values for MAUSB packet variants, per 6.2.1.3, Table 5
|
|
|
|
*/
|
|
|
|
static const value_string mausb_type_string[] = {
|
|
|
|
/* Management packets */
|
2014-11-12 01:52:31 +00:00
|
|
|
{ CapReq , "CapReq" },
|
|
|
|
{ CapResp , "CapResp" },
|
|
|
|
{ USBDevHandleReq , "USBDevHandleReq" },
|
|
|
|
{ USBDevHandleResp , "USBDevHandleResp" },
|
|
|
|
{ EPHandleReq , "EPHandleReq" },
|
|
|
|
{ EPHandleResp , "EPHandleResp" },
|
|
|
|
{ EPActivateReq , "EPActivateReq" },
|
|
|
|
{ EPActivateResp , "EPActivateResp" },
|
|
|
|
{ EPInactivateReq , "EPInactivateReq" },
|
|
|
|
{ EPInactivateResp , "EPInactivateResp" },
|
|
|
|
{ EPResetReq , "EPResetReq" },
|
|
|
|
{ EPResetResp , "EPResetResp" },
|
2016-01-05 22:47:20 +00:00
|
|
|
{ ClearTransfersReq , "ClearTransfersReq" },
|
|
|
|
{ ClearTransfersResp , "ClearTransfersResp" },
|
2014-11-12 01:52:31 +00:00
|
|
|
{ EPHandleDeleteReq , "EPHandleDeleteReq" },
|
|
|
|
{ EPHandleDeleteResp , "EPHandleDeleteResp" },
|
|
|
|
|
|
|
|
{ DevResetReq , "DevResetReq" },
|
|
|
|
{ DevResetResp , "DevResetResp" },
|
|
|
|
{ ModifyEP0Req , "ModifyEP0Req" },
|
|
|
|
{ ModifyEP0Resp , "ModifyEP0Resp" },
|
|
|
|
{ SetUSBDevAddrReq , "SetUSBDevAddrReq" },
|
|
|
|
{ SetUSBDevAddrResp , "SetUSBDevAddrResp" },
|
|
|
|
{ UpdateDevReq , "UpdateDevReq" },
|
|
|
|
{ UpdateDevResp , "UpdateDevResp" },
|
|
|
|
{ USBDevDisconnectReq , "USBDevDisconnectReq" },
|
|
|
|
{ USBDevDisconnectResp , "USBDevDisconnectResp" },
|
|
|
|
{ USBSuspendReq , "USBSuspendReq" },
|
|
|
|
{ USBSuspendResp , "USBSuspendResp" },
|
|
|
|
{ USBResumeReq , "USBResumeReq" },
|
|
|
|
{ USBResumeResp , "USBResumeResp" },
|
|
|
|
{ RemoteWakeReq , "RemoteWakeReq" },
|
|
|
|
{ RemoteWakeResp , "RemoteWakeResp" },
|
|
|
|
|
|
|
|
{ PingReq , "PingReq" },
|
|
|
|
{ PingResp , "PingResp" },
|
|
|
|
{ DevDisconnectReq , "DevDisconnectReq " },
|
|
|
|
{ DevDisconnectResp , "DevDisconnectResp" },
|
|
|
|
{ DevInitDisconnectReq , "DevInitDisconnectReq" },
|
|
|
|
{ DevInitDisconnectResp, "DevInitDisconnectResp" },
|
|
|
|
{ SynchReq , "SynchReq" },
|
|
|
|
{ SynchResp , "SynchResp" },
|
|
|
|
{ CancelTransferReq , "CancelTransferReq" },
|
|
|
|
{ CancelTransferResp , "CancelTransferResp" },
|
|
|
|
{ EPOpenStreamReq , "EPOpenStreamReq" },
|
|
|
|
{ EPOpenStreamResp , "EPOpenStreamResp" },
|
|
|
|
{ EPCloseStreamReq , "EPCloseStreamReq" },
|
|
|
|
{ EPCloseStreamResp , "EPCloseStreamResp" },
|
|
|
|
{ USBDevResetReq , "USBDevResetReq" },
|
|
|
|
{ USBDevResetResp , "USBDevResetResp" },
|
|
|
|
|
|
|
|
{ DevNotificationReq , "DevNotificationReq" },
|
|
|
|
{ DevNotificationResp , "DevNotificationResp" },
|
|
|
|
{ EPSetKeepAliveReq , "EPSetKeepAliveReq" },
|
|
|
|
{ EPSetKeepAliveResp , "EPSetKeepAliveResp" },
|
|
|
|
{ GetPortBWReq , "GetPortBWReq" },
|
|
|
|
{ GetPortBWResp , "GetPortBWResp" },
|
|
|
|
{ SleepReq , "SleepReq" },
|
|
|
|
{ SleepResp , "SleepResp" },
|
|
|
|
{ WakeReq , "WakeReq" },
|
|
|
|
{ WakeResp , "WakeResp" },
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Vendor-Specific Management Packets */
|
2014-11-12 01:52:31 +00:00
|
|
|
{ VendorSpecificReq , "VendorSpecificReq" },
|
|
|
|
{ VendorSpecificResp , "VendorSpecificResp" },
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Control Packets */
|
2014-11-12 01:52:31 +00:00
|
|
|
{ TransferSetupReq , "TransferSetupReq" },
|
|
|
|
{ TransferSetupResp , "TransferSetupResp" },
|
|
|
|
{ TransferTearDownConf , "TransferTearDownConf" },
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Data Packets */
|
2014-11-12 01:52:31 +00:00
|
|
|
{ TransferReq , "TransferReq" },
|
|
|
|
{ TransferResp , "TransferResp" },
|
|
|
|
{ TransferAck , "TransferAck" },
|
|
|
|
{ IsochTransferReq , "IsochTransferReq" },
|
|
|
|
{ IsochTransferResp , "IsochTransferResp" },
|
2014-02-06 00:03:15 +00:00
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAUSB_EP_HANDLE_D 0x0001
|
|
|
|
#define MAUSB_EP_HANDLE_EP_NUM 0x001e
|
|
|
|
#define MAUSB_EP_HANDLE_DEV_ADDR 0x0fe0
|
|
|
|
#define MAUSB_EP_HANDLE_BUS_NUM 0xf000
|
|
|
|
|
2014-06-03 23:22:43 +00:00
|
|
|
#define MAUSB_EP_HANDLE_D_OFFSET 0
|
|
|
|
#define MAUSB_EP_HANDLE_EP_NUM_OFFSET 1
|
|
|
|
#define MAUSB_EP_HANDLE_DEV_ADDR_OFFSET 5
|
|
|
|
#define MAUSB_EP_HANDLE_BUS_NUM_OFFSET 12
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
static const value_string mausb_status_string[] = {
|
|
|
|
{ 0, "SUCCESS (NO_ERROR)" },
|
|
|
|
{ 128, "UNSUCCESSFUL" },
|
|
|
|
{ 129, "INVALID_MA_USB_SESSION_STATE" },
|
|
|
|
{ 130, "INVALID_DEVICE_HANDLE" },
|
|
|
|
{ 131, "INVALID_EP_HANDLE" },
|
|
|
|
{ 132, "INVALID_EP_HANDLE_STATE" },
|
|
|
|
{ 133, "INVALID_REQUEST" },
|
|
|
|
{ 134, "MISSING_SEQUENCE_NUMBER" },
|
|
|
|
{ 135, "TRANSFER_PENDING" },
|
|
|
|
{ 136, "TRANSFER_EP_STALL" },
|
|
|
|
{ 137, "TRANSFER_SIZE_ERROR" },
|
|
|
|
{ 138, "TRANSFER_DATA_BUFFER_ERROR" },
|
|
|
|
{ 139, "TRANSFER_BABBLE_DETECTED" },
|
|
|
|
{ 140, "TRANSFER_TRANSACTION_ERROR" },
|
|
|
|
{ 141, "TRANSFER_SHORT_TRANSFER" },
|
|
|
|
{ 142, "TRANSFER_CANCELLED" },
|
|
|
|
{ 143, "INSUFFICENT_RESOURCES" },
|
|
|
|
{ 144, "NOT_SUFFICENT_BANDWIDTH" },
|
|
|
|
{ 145, "INTERNAL_ERROR" },
|
|
|
|
{ 146, "DATA_OVERRUN" },
|
|
|
|
{ 147, "DEVICE_NOT_ACCESSED" },
|
|
|
|
{ 148, "BUFFER_OVERRUN" },
|
|
|
|
{ 149, "BUSY" },
|
|
|
|
{ 150, "DROPPED_PACKET" },
|
|
|
|
{ 151, "ISOC_TIME_EXPIRED" },
|
|
|
|
{ 152, "ISOCH_TIME_INVALID" },
|
|
|
|
{ 153, "NO_USB_PING_RESPONSE" },
|
|
|
|
{ 154, "NOT_SUPPORTED" },
|
|
|
|
{ 155, "REQUEST_DENIED" },
|
2016-08-26 21:40:58 +00:00
|
|
|
{ 156, "MISSING_REQUEST_ID" },
|
2014-02-06 00:03:15 +00:00
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2015-02-19 21:20:56 +00:00
|
|
|
|
|
|
|
/* Nuber of Isochronous Headers, per 6.5.1.7 */
|
|
|
|
#define MAUSB_NUM_ISO_HDR_MASK 0x0fff
|
|
|
|
|
|
|
|
/* I-Flags, per 6.5.1.8 */
|
|
|
|
#define MAUSB_IFLAG_ASAP (1 << 0)
|
|
|
|
#define MAUSB_IFLAG_HDR_FORMAT (3 << 1)
|
|
|
|
#define MAUSB_IFLAG_MTD (1 << 3)
|
|
|
|
#define MAUSB_IFLAG_OFFSET 12
|
|
|
|
#define MAUSB_IFLAG_MASK (0xF << MAUSB_IFLAG_OFFSET)
|
|
|
|
|
|
|
|
/* Presentation Time, per 6.5.1.9 */
|
|
|
|
#define MAUSB_PRESENT_TIME_MASK 0x000fffff
|
|
|
|
#define MAUSB_UFRAME_MASK 0x00000007
|
|
|
|
#define MAUSB_FRAME_MASK 0x000ffff8
|
|
|
|
|
|
|
|
/* Number of Segments, per 6.5.1.10 */
|
|
|
|
#define MAUSB_NUM_SEGS_MASK 0xfff00000
|
|
|
|
|
|
|
|
/* MA USB Global Time fields, per 6.6.1 */
|
|
|
|
#define MAUSB_DELTA_MASK 0x00000fff
|
|
|
|
#define MAUSB_INTERVAL_MASK 0xfffff000
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
#define MAUSB_TOKEN_MASK 0x03ff
|
|
|
|
#define MAUSB_MGMT_PAD_MASK 0xfffc
|
|
|
|
#define MAUSB_MGMT_NUM_EP_DES_MASK 0x001f
|
|
|
|
#define MAUSB_MGMT_SIZE_EP_DES_OFFSET 5
|
|
|
|
#define MAUSB_MGMT_SIZE_EP_DES_MASK (0x003f << MAUSB_MGMT_SIZE_EP_DES_OFFSET)
|
|
|
|
|
2016-01-05 22:47:20 +00:00
|
|
|
#define MAUSB_MGMT_CLEAR_TRANSFER_RESP_NUM_MASK 0x1f
|
|
|
|
|
2014-07-31 22:54:24 +00:00
|
|
|
/* CapResp Bitfield Masks */
|
|
|
|
#define MAUSB_CAP_RESP_NUM_STREAM_MASK 0x1f
|
|
|
|
#define MAUSB_CAP_RESP_DEV_TYPE_OFFSET 5
|
|
|
|
#define MAUSB_CAP_RESP_DEV_TYPE_MASK (0x07 << MAUSB_CAP_RESP_DEV_TYPE_OFFSET)
|
|
|
|
#define MAUSB_CAP_RESP_MGMT_REQ_MASK 0x0fff
|
|
|
|
#define MAUSB_CAP_RESP_RSVD_MASK 0xf000
|
|
|
|
|
|
|
|
static const value_string mausb_cap_resp_dev_type[] = {
|
|
|
|
{ 0, "Integrated Device" },
|
|
|
|
{ 1, "MAUSB 2.0 hub" },
|
|
|
|
{ 2, "MAUSB 3.1 hub" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
static const value_string mausb_dev_cap_string[] = {
|
|
|
|
{ 0, "Speed Capability" },
|
|
|
|
{ 1, "P-managed OUT Capabilities" },
|
|
|
|
{ 2, "Isochronous Capabilities" },
|
|
|
|
{ 3, "Synchronization Capabilities" },
|
|
|
|
{ 4, "Container ID Capability" },
|
|
|
|
{ 5, "Link Sleep Capability" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mausb_dev_cap_type {
|
|
|
|
SpeedCap = 0,
|
|
|
|
PmanCap,
|
|
|
|
IsoCap,
|
|
|
|
SyncCap,
|
|
|
|
ContainerIDCap,
|
|
|
|
LinkSleepCap
|
|
|
|
};
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
#define DWORD_MASK 0xffffffff
|
|
|
|
#define MAUSB_MGMT_NUM_EP_HANDLE_PAD_MASK \
|
2014-05-06 16:03:22 +00:00
|
|
|
(DWORD_MASK & !(MAUSB_MGMT_NUM_EP_DES_MASK))
|
2014-02-06 00:03:15 +00:00
|
|
|
#define MAUSB_MGMT_EP_DES_PAD_MASK \
|
2014-05-07 18:08:31 +00:00
|
|
|
((DWORD_MASK & !(MAUSB_MGMT_NUM_EP_DES_MASK | \
|
|
|
|
MAUSB_MGMT_SIZE_EP_DES_MASK)) >> 8)
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* EPHandleResp Bitfield Masks */
|
|
|
|
#define MAUSB_EP_HANDLE_RESP_DIR_MASK (1 << 0)
|
|
|
|
#define MAUSB_EP_HANDLE_RESP_ISO_MASK (1 << 1)
|
|
|
|
#define MAUSB_EP_HANDLE_RESP_LMAN_MASK (1 << 2)
|
|
|
|
#define MAUSB_EP_HANDLE_RESP_VALID_MASK (1 << 3)
|
|
|
|
|
|
|
|
static const value_string mausb_eps_string[] = {
|
|
|
|
{ 0, "Unassigned" },
|
|
|
|
{ 1, "Active" },
|
|
|
|
{ 2, "Inactive" },
|
|
|
|
{ 3, "Halted" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAUSB_EPS_MASK 0x03
|
|
|
|
|
|
|
|
#define MAUSB_TFLAG_MASK 0xfc
|
|
|
|
|
|
|
|
#define MAUSB_TX_TYPE_CTRL (0 << 3)
|
|
|
|
#define MAUSB_TX_TYPE_ISOC (1 << 3)
|
|
|
|
#define MAUSB_TX_TYPE_BULK (2 << 3)
|
|
|
|
#define MAUSB_TX_TYPE_INTR (3 << 3)
|
|
|
|
|
|
|
|
#define MAUSB_TFLAG_OFFSET 2
|
|
|
|
#define MAUSB_TFLAG_ARQ (1 << 0)
|
|
|
|
#define MAUSB_TFLAG_NEG (1 << 1)
|
|
|
|
#define MAUSB_TFLAG_EOT (1 << 2)
|
|
|
|
#define MAUSB_TFLAG_TRANSFER_TYPE (3 << 3)
|
|
|
|
#define MAUSB_TFLAG_RSVD (1 << 5)
|
|
|
|
|
|
|
|
static const value_string mausb_transfer_type_string[] = {
|
|
|
|
{ 0, "Control" },
|
|
|
|
{ 1, "Isochronous" },
|
|
|
|
{ 2, "Bulk" },
|
|
|
|
{ 3, "Interrupt" },
|
2014-11-12 01:52:31 +00:00
|
|
|
{ 0, NULL}
|
2014-02-06 00:03:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const true_false_string tfs_ep_handle_resp_dir = { "IN", "OUT or Control" };
|
|
|
|
|
|
|
|
#define MAUSB_TRANSFER_TYPE_OFFSET 3 /* Offset from start of TFlags Field */
|
|
|
|
/* (EPS not included) */
|
|
|
|
#define MAUSB_TRANSFER_TYPE_CTRL (0 << MAUSB_TRANSFER_TYPE_OFFSET)
|
|
|
|
#define MAUSB_TRANSFER_TYPE_ISO (1 << MAUSB_TRANSFER_TYPE_OFFSET)
|
|
|
|
#define MAUSB_TRANSFER_TYPE_BULK (2 << MAUSB_TRANSFER_TYPE_OFFSET)
|
|
|
|
#define MAUSB_TRANSFER_TYPE_INTERRUPT (3 << MAUSB_TRANSFER_TYPE_OFFSET)
|
|
|
|
|
2014-11-14 01:15:31 +00:00
|
|
|
static const value_string mausb_cancel_transfer_status_string[] = {
|
|
|
|
{ 0, "Cancel Unsuccessful"},
|
|
|
|
{ 1, "Canceled before any data was moved"},
|
|
|
|
{ 2, "Canceled after some data was moved"},
|
2016-08-26 21:36:57 +00:00
|
|
|
{ 3, "Transfer completed"},
|
2016-10-27 15:57:17 +00:00
|
|
|
{ 4, "Transfer not yet received"},
|
2016-08-26 21:36:57 +00:00
|
|
|
{ 5, "Transfer cleared without any data moved"},
|
2014-11-14 01:15:31 +00:00
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
2016-11-01 21:55:35 +00:00
|
|
|
#define MAUSB_CANCEL_TRANSFER_STATUS_MASK 0x07
|
2014-11-14 01:15:31 +00:00
|
|
|
|
2016-01-05 22:47:20 +00:00
|
|
|
#define MAUSB_CLEAR_TRANSFERS_RESP_NUM_MASK 0x1f
|
|
|
|
#define MAUSB_CLEAR_TRANSFERS_STATUS_MASK 0x01
|
|
|
|
#define MAUSB_CLEAR_TRANSFERS_PARTIAL_MASK 0x02
|
|
|
|
#define MAUSB_CLEAR_TRANSFERS_RESP_BLOCK_RSVD_MASK 0xfffffffc
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* We need at least the first DWORD to determine the packet length (for TCP) */
|
|
|
|
#define MAUSB_MIN_LENGTH 4
|
|
|
|
|
|
|
|
#define MAUSB_MIN_MGMT_LENGTH 12
|
|
|
|
#define MAUSB_MIN_DATA_LENGTH 20
|
|
|
|
#define MAUSB_COMMON_LEN 9
|
|
|
|
|
|
|
|
|
|
|
|
/*** Packet parsing helper functions ***/
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
gboolean mausb_is_from_host(struct mausb_header *header)
|
2014-02-06 00:03:15 +00:00
|
|
|
{
|
|
|
|
return (MAUSB_FLAG_HOST << MAUSB_FLAG_OFFSET) & header->ver_flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean mausb_is_mgmt_pkt(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return MAUSB_PKT_TYPE_MGMT == (header->type & MAUSB_PKT_TYPE_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean mausb_is_data_pkt(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return MAUSB_PKT_TYPE_DATA == (header->type & MAUSB_PKT_TYPE_MASK);
|
|
|
|
}
|
|
|
|
|
2014-06-06 00:01:46 +00:00
|
|
|
static gboolean mausb_is_transfer_req(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return TransferReq == header->type;
|
|
|
|
}
|
|
|
|
|
2014-08-26 17:16:58 +00:00
|
|
|
static gboolean mausb_is_transfer_ack(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return TransferAck == header->type;
|
|
|
|
}
|
|
|
|
|
2014-06-06 00:01:46 +00:00
|
|
|
static gint8 mausb_tx_type(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return (header->u.s.eps_tflags >> MAUSB_TFLAG_OFFSET) & MAUSB_TFLAG_TRANSFER_TYPE;
|
|
|
|
}
|
|
|
|
|
2015-02-19 21:20:56 +00:00
|
|
|
static gboolean mausb_is_iso_pkt(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return MAUSB_TX_TYPE_ISOC == mausb_tx_type(header);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean mausb_has_timestamp(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return (MAUSB_FLAG_TIMESTAMP << MAUSB_FLAG_OFFSET) & header->ver_flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean mausb_has_mtd(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
return (MAUSB_IFLAG_MTD << MAUSB_IFLAG_OFFSET) & header->u.s.u1.num_headers_iflags;
|
|
|
|
}
|
|
|
|
|
2014-06-06 00:01:46 +00:00
|
|
|
static gboolean mausb_has_setup_data(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
if ((TransferReq == header->type ) &&
|
|
|
|
(mausb_is_from_host(header)) &&
|
|
|
|
(0 == header->u.s.seq_num) &&
|
|
|
|
(MAUSB_TX_TYPE_CTRL == mausb_tx_type(header))) {
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-07-07 18:38:45 +00:00
|
|
|
static gboolean mausb_is_setup_response(struct mausb_header *header)
|
|
|
|
{
|
|
|
|
if ((TransferResp == header->type) &&
|
|
|
|
(!mausb_is_from_host(header)) &&
|
|
|
|
(MAUSB_TX_TYPE_CTRL == mausb_tx_type(header))) {
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-06-03 23:22:43 +00:00
|
|
|
/*** EP Handle parsing helper functions */
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
guint8 mausb_ep_handle_ep_num(guint16 handle) {
|
2014-06-03 23:22:43 +00:00
|
|
|
return (handle & MAUSB_EP_HANDLE_EP_NUM) >> MAUSB_EP_HANDLE_EP_NUM_OFFSET;
|
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
guint8 mausb_ep_handle_dev_addr(guint16 handle) {
|
2014-06-03 23:22:43 +00:00
|
|
|
return (handle & MAUSB_EP_HANDLE_DEV_ADDR) >> MAUSB_EP_HANDLE_DEV_ADDR_OFFSET;
|
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
guint8 mausb_ep_handle_bus_num(guint16 handle) {
|
2014-07-03 21:05:24 +00:00
|
|
|
return (handle & MAUSB_EP_HANDLE_BUS_NUM) >> MAUSB_EP_HANDLE_BUS_NUM_OFFSET;
|
|
|
|
}
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* returns the length field of the MAUSB packet */
|
2015-01-25 19:30:13 +00:00
|
|
|
static guint mausb_get_pkt_len(packet_info *pinfo _U_, tvbuff_t *tvb,
|
|
|
|
int offset, void *data _U_)
|
2014-02-06 00:03:15 +00:00
|
|
|
{
|
|
|
|
return tvb_get_letohs(tvb, offset + 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_mausb = -1;
|
|
|
|
static gint ett_mausb_flags = -1;
|
|
|
|
static gint ett_mausb_ep_handle = -1;
|
|
|
|
static gint ett_mausb_tflags = -1;
|
2015-02-19 21:20:56 +00:00
|
|
|
static gint ett_mausb_iflags = -1;
|
|
|
|
static gint ett_mausb_present_time = -1;
|
|
|
|
static gint ett_mausb_timestamp = -1;
|
2014-02-06 00:03:15 +00:00
|
|
|
static gint ett_mgmt = -1;
|
2014-08-01 17:23:28 +00:00
|
|
|
static gint ett_dev_cap = -1;
|
2016-01-05 22:47:20 +00:00
|
|
|
static gint ett_clear_transfers_block = -1;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define USB_DT_EP_SIZE 7
|
|
|
|
#define USB_DT_SS_EP_COMP_SIZE 6
|
|
|
|
#define USB_DT_ISO_SSP_EP_COMP_SIZE 8
|
|
|
|
|
|
|
|
/* Size of EPHandleReq Descriptors */
|
|
|
|
#define MAUSB_EP_DES_SIZE 8
|
|
|
|
#define MAUSB_SS_EP_DES_SIZE 16
|
|
|
|
#define MAUSB_ISO_SSP_EP_DES_SIZE 24
|
|
|
|
|
|
|
|
/* EPHandleReq Descriptor Padding */
|
|
|
|
#define MAUSB_EP_DES_PAD (MAUSB_EP_DES_SIZE - USB_DT_EP_SIZE)
|
|
|
|
|
|
|
|
#define MAUSB_SS_EP_DES_PAD (MAUSB_SS_EP_DES_SIZE - \
|
|
|
|
(USB_DT_EP_SIZE + USB_DT_SS_EP_COMP_SIZE))
|
|
|
|
|
|
|
|
#define MAUSB_ISO_SSP_EP_DES_PAD (MAUSB_ISO_SSP_EP_DES_SIZE - \
|
|
|
|
(USB_DT_EP_SIZE + USB_DT_SS_EP_COMP_SIZE + USB_DT_ISO_SSP_EP_COMP_SIZE))
|
|
|
|
|
|
|
|
|
|
|
|
/* Size of EPHandleResp Descriptor */
|
|
|
|
#define MAUSB_SIZE_MAUSB_EP_DES 16
|
|
|
|
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
/* Size of EPHandleResp Descriptor */
|
|
|
|
#define MAUSB_SIZE_EP_HANDLE 2
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
|
|
|
|
/* Dissects an individual Device Capability Descriptor */
|
|
|
|
static guint16 dissect_mausb_dev_cap_desc(proto_tree *tree, tvbuff_t *tvb,
|
|
|
|
packet_info *pinfo, gint16 offset)
|
|
|
|
{
|
|
|
|
guint8 desc_len;
|
|
|
|
guint8 cap_type;
|
|
|
|
gint16 desc_offset;
|
|
|
|
proto_item *len_field;
|
|
|
|
proto_tree *dev_cap_tree;
|
|
|
|
|
|
|
|
desc_offset = offset;
|
|
|
|
desc_len = tvb_get_guint8(tvb, desc_offset);
|
|
|
|
cap_type = tvb_get_guint8(tvb, desc_offset + 1);
|
|
|
|
|
|
|
|
dev_cap_tree = proto_tree_add_subtree(tree, tvb, desc_offset, desc_len,
|
|
|
|
ett_dev_cap, NULL,
|
|
|
|
val_to_str_const(cap_type, mausb_dev_cap_string, "Unknown Capability"));
|
|
|
|
|
|
|
|
len_field = proto_tree_add_item(dev_cap_tree, hf_mausb_dev_cap_len,
|
|
|
|
tvb, desc_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
desc_offset += 1;
|
|
|
|
|
|
|
|
proto_tree_add_item(dev_cap_tree, hf_mausb_dev_cap_type,
|
|
|
|
tvb, desc_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
desc_offset += 1;
|
|
|
|
|
|
|
|
if (desc_len > 2) {
|
|
|
|
|
|
|
|
/* TODO: dissect individual capabilities */
|
|
|
|
switch (cap_type) {
|
|
|
|
case SpeedCap:
|
|
|
|
case PmanCap:
|
|
|
|
case IsoCap:
|
|
|
|
case SyncCap:
|
|
|
|
case ContainerIDCap:
|
|
|
|
case LinkSleepCap:
|
|
|
|
default:
|
|
|
|
proto_tree_add_item(dev_cap_tree, hf_mausb_dev_cap_generic,
|
|
|
|
tvb, desc_offset, (desc_len - 2), ENC_NA);
|
|
|
|
desc_offset += (desc_len - 2);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Was this descriptor a different length than expected */
|
|
|
|
if (desc_offset != offset + desc_len) {
|
|
|
|
expert_add_info(pinfo, len_field, &ei_dev_cap_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset + desc_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Dissects a MAUSB capability response packet
|
2014-07-31 22:54:24 +00:00
|
|
|
* also dissects Capability Descriptors
|
|
|
|
*/
|
|
|
|
static guint16 dissect_mausb_mgmt_pkt_cap_resp(struct mausb_header *header,
|
|
|
|
proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint16 offset)
|
|
|
|
{
|
|
|
|
|
|
|
|
guint desc_len;
|
2014-08-01 17:23:28 +00:00
|
|
|
guint8 desc_count;
|
|
|
|
proto_item *len_field;
|
|
|
|
guint16 loop_offset;
|
|
|
|
int i;
|
2014-07-31 22:54:24 +00:00
|
|
|
|
|
|
|
/* Fields present in all CapResp packets */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_num_ep,
|
|
|
|
tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_num_dev,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_num_stream,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN); /* really 5 bits */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_dev_type,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN); /* really 3 bits */
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_desc_count,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
2014-08-01 17:23:28 +00:00
|
|
|
desc_count = tvb_get_guint8(tvb, offset);
|
2014-07-31 22:54:24 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
len_field = proto_tree_add_item(tree, hf_mausb_cap_resp_desc_len,
|
2014-07-31 22:54:24 +00:00
|
|
|
tvb, offset, 3, ENC_LITTLE_ENDIAN);
|
|
|
|
desc_len = tvb_get_letoh24(tvb, offset);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_transfer_req,
|
|
|
|
tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_mgmt_req,
|
|
|
|
tvb, offset, 2, ENC_LITTLE_ENDIAN); /* really 12 bits */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cap_resp_rsvd,
|
|
|
|
tvb, offset, 2, ENC_LITTLE_ENDIAN); /* really 4 bits */
|
|
|
|
offset += 2;
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
/* Descriptors length longer than remainder of packet */
|
2014-07-31 22:54:24 +00:00
|
|
|
if (offset + desc_len > header->length) {
|
2014-08-01 17:23:28 +00:00
|
|
|
expert_add_info(pinfo, len_field, &ei_cap_resp_desc_len);
|
2014-07-31 22:54:24 +00:00
|
|
|
desc_len = header->length - offset; /* to avoid overflows */
|
|
|
|
}
|
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
loop_offset = offset;
|
2014-07-31 22:54:24 +00:00
|
|
|
|
2014-08-01 17:23:28 +00:00
|
|
|
/* dissect capability descriptors */
|
|
|
|
for (i = 0; i < desc_count; i++) {
|
|
|
|
loop_offset = dissect_mausb_dev_cap_desc(tree, tvb, pinfo, loop_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* were the descriptors a different length than expected */
|
|
|
|
if (loop_offset != offset + desc_len) {
|
|
|
|
expert_add_info(pinfo, len_field, &ei_dev_cap_resp_desc_len);
|
|
|
|
desc_len = header->length - offset; /* to avoid overflows */
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset + desc_len;
|
2014-07-31 22:54:24 +00:00
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Dissects a MAUSB endpoint handle */
|
|
|
|
static gint dissect_ep_handle(proto_tree *tree, tvbuff_t *tvb, gint offset)
|
|
|
|
{
|
|
|
|
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *ep_handle_tree;
|
|
|
|
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_ep_handle, tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, MAUSB_SIZE_EP_HANDLE, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
ep_handle_tree = proto_item_add_subtree(ti, ett_mausb_ep_handle);
|
|
|
|
proto_tree_add_item(ep_handle_tree, hf_mausb_ep_handle_d, tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, MAUSB_SIZE_EP_HANDLE, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(ep_handle_tree, hf_mausb_ep_handle_ep_num, tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, MAUSB_SIZE_EP_HANDLE, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(ep_handle_tree, hf_mausb_ep_handle_dev_addr, tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, MAUSB_SIZE_EP_HANDLE, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(ep_handle_tree, hf_mausb_ep_handle_bus_num, tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, MAUSB_SIZE_EP_HANDLE, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
return MAUSB_SIZE_EP_HANDLE;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-02-19 21:20:56 +00:00
|
|
|
/* dissects presentation time & subfields */
|
|
|
|
static void dissect_mausb_present_time(proto_tree *tree, tvbuff_t *tvb,
|
|
|
|
gint offset)
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *present_time_tree;
|
|
|
|
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_present_time, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
present_time_tree = proto_item_add_subtree(ti, ett_mausb_present_time);
|
|
|
|
proto_tree_add_item(present_time_tree, hf_mausb_uframe, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(present_time_tree, hf_mausb_frame, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_mausb_timestamp(proto_tree *tree, tvbuff_t *tvb,
|
|
|
|
gint offset)
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *timestamp_tree;
|
|
|
|
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_timestamp, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
timestamp_tree = proto_item_add_subtree(ti, ett_mausb_timestamp);
|
|
|
|
proto_tree_add_item(timestamp_tree, hf_mausb_delta, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
proto_tree_add_item(timestamp_tree, hf_mausb_nom_interval, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* gets the size of the endpoint descriptors in a EPHandleReq packet */
|
|
|
|
static guint8 mausb_get_size_ep_des(tvbuff_t *tvb, gint offset)
|
|
|
|
{
|
|
|
|
guint8 size_ep_des = 0;
|
|
|
|
guint16 temp_buffer = 0; /* for storing the offset data */
|
|
|
|
|
|
|
|
/* grab the 2 bytes with the size field */
|
|
|
|
temp_buffer = tvb_get_letohs(tvb, offset);
|
|
|
|
|
|
|
|
/* mask & shift the size field */
|
|
|
|
temp_buffer = temp_buffer & MAUSB_MGMT_SIZE_EP_DES_MASK;
|
|
|
|
size_ep_des = (temp_buffer >> MAUSB_MGMT_SIZE_EP_DES_OFFSET);
|
|
|
|
|
|
|
|
return size_ep_des;
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:47:20 +00:00
|
|
|
/* dissect an individual block for ClearTransfers */
|
|
|
|
static guint16 dissect_clear_transfers_block(proto_tree *tree,
|
|
|
|
tvbuff_t *tvb, gint16 offset, gboolean req)
|
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *block_tree;
|
|
|
|
|
|
|
|
if (req) {
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_clear_transfers_info_block,
|
|
|
|
tvb, offset, 8, ENC_NA);
|
|
|
|
} else {
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_clear_transfers_status_block,
|
|
|
|
tvb, offset, 16, ENC_NA);
|
|
|
|
}
|
|
|
|
|
|
|
|
block_tree = proto_item_add_subtree(ti, ett_clear_transfers_block);
|
|
|
|
|
|
|
|
|
|
|
|
/* EP Handle */
|
|
|
|
offset += dissect_ep_handle(block_tree, tvb, offset);
|
|
|
|
|
|
|
|
/* Stream ID */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_stream_id, tvb, offset, 2,
|
|
|
|
ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
if (req) {
|
|
|
|
/* Start Request ID */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_start_req_id,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Rsvd */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_req_block_rsvd,
|
|
|
|
tvb, offset, 3, ENC_NA);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Cancel Status */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_status,
|
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
/* Partial Delivery */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_partial,
|
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
/* Rsvd */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_resp_block_rsvd,
|
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* Last Request ID */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_clear_transfers_last_req_id,
|
|
|
|
tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Delivered Sequence Number */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_cancel_transfer_seq_num, tvb,
|
|
|
|
offset, 3, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 3;
|
|
|
|
/* Delivered Byte Offset */
|
|
|
|
proto_tree_add_item(block_tree, hf_mausb_cancel_transfer_byte_offset,
|
|
|
|
tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dissects portions of a MA USB packet specific to ClearTransfers packets */
|
|
|
|
static guint16 dissect_mausb_mgmt_pkt_clear_transfers(proto_tree *tree,
|
|
|
|
tvbuff_t *tvb, gint16 offset, gboolean req)
|
|
|
|
{
|
|
|
|
guint8 num_block;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
num_block = tvb_get_guint8(tvb, offset);
|
|
|
|
if (req) {
|
|
|
|
/* Number of entries */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_clear_transfers_req_num, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Rsvd */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_clear_transfers_req_rsvd, tvb,
|
|
|
|
offset, 3, ENC_NA);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
num_block &= MAUSB_MGMT_CLEAR_TRANSFER_RESP_NUM_MASK;
|
|
|
|
|
|
|
|
/* Number of entries */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_clear_transfers_resp_num, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
/* Rsvd */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_clear_transfers_resp_rsvd, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < num_block; i++) {
|
|
|
|
offset = dissect_clear_transfers_block(tree, tvb, offset, req);
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* dissects portions of a MA USB packet specific to Endpoint Handle Request packets */
|
|
|
|
static guint16 dissect_mausb_mgmt_pkt_ep_handle( proto_tree *tree, tvbuff_t *tvb,
|
2014-05-07 18:08:31 +00:00
|
|
|
packet_info *pinfo, gint16 start, gboolean req, gboolean del)
|
2014-02-06 00:03:15 +00:00
|
|
|
{
|
2014-05-05 14:49:03 +00:00
|
|
|
usb_conv_info_t usb_conv_info;
|
2014-05-07 18:08:31 +00:00
|
|
|
proto_item *size_field = NULL;
|
2014-02-06 00:03:15 +00:00
|
|
|
guint16 offset = start;
|
|
|
|
guint16 loop_offset;
|
|
|
|
guint8 num_ep;
|
|
|
|
guint8 size_ep_des;
|
|
|
|
int i;
|
|
|
|
|
2014-05-05 14:49:03 +00:00
|
|
|
memset(&usb_conv_info, 0, sizeof(usb_conv_info_t));
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
num_ep = tvb_get_guint8(tvb, offset) & MAUSB_MGMT_NUM_EP_DES_MASK;
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
if (!del) {
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(tree, hf_mausb_mgmt_ep_des_num, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN); /* really 5 bits */
|
2014-05-07 18:08:31 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_item(tree, hf_mausb_mgmt_ep_handle_num, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN); /* really 5 bits */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (req && !del) {
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
size_ep_des = mausb_get_size_ep_des(tvb, offset);
|
|
|
|
size_field = proto_tree_add_item(tree, hf_mausb_mgmt_ep_des_size, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN); /* really 6 bits over a byte boundry */
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Padding to DWORD */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_mgmt_ep_des_pad, tvb,
|
|
|
|
offset, 3, ENC_NA);
|
|
|
|
offset += 3;
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
} else if (!req && !del) {
|
|
|
|
size_ep_des = MAUSB_SIZE_MAUSB_EP_DES;
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(tree, hf_mausb_mgmt_ep_handle_pad, tvb,
|
|
|
|
offset, 4, ENC_NA); /* really 5 bits */
|
|
|
|
/* Padding to DWORD */
|
|
|
|
offset += 4;
|
2014-05-07 18:08:31 +00:00
|
|
|
|
|
|
|
} else { /* If it is an EPHandleDelete Req or Resp */
|
|
|
|
size_ep_des = MAUSB_SIZE_EP_HANDLE;
|
|
|
|
/* Padding to DWORD */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_mgmt_ep_handle_pad, tvb,
|
|
|
|
offset, 4, ENC_NA);
|
|
|
|
offset += 4; /* Padding to DWORD */
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
/* For every entry */
|
2014-02-06 00:03:15 +00:00
|
|
|
for (i = 0; i < num_ep; ++i) {
|
|
|
|
loop_offset = offset;
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
/* If it is an EPHandleDelete Req or Resp */
|
|
|
|
if (del) {
|
|
|
|
loop_offset += dissect_ep_handle(tree, tvb, loop_offset);
|
|
|
|
|
2015-11-30 19:58:23 +00:00
|
|
|
} else if (req) {
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Standard USB Endpoint Descriptor */
|
|
|
|
dissect_usb_endpoint_descriptor(pinfo, tree, tvb, loop_offset,
|
2014-08-20 12:32:40 +00:00
|
|
|
&usb_conv_info);
|
2014-02-06 00:03:15 +00:00
|
|
|
loop_offset += USB_DT_EP_SIZE;
|
|
|
|
|
|
|
|
/* If there are more descriptors to read */
|
|
|
|
if (MAUSB_EP_DES_SIZE < size_ep_des) {
|
|
|
|
/* TODO: Dissector for SS EP Companion Descriptors */
|
|
|
|
dissect_usb_unknown_descriptor(pinfo, tree,
|
2014-08-20 12:41:26 +00:00
|
|
|
tvb, loop_offset, &usb_conv_info);
|
2014-02-06 00:03:15 +00:00
|
|
|
loop_offset += USB_DT_SS_EP_COMP_SIZE;
|
|
|
|
|
|
|
|
if (MAUSB_SS_EP_DES_SIZE < size_ep_des) {
|
|
|
|
/* TODO: Dissector for SSP ISO EP Companion Descriptors */
|
|
|
|
loop_offset += dissect_usb_unknown_descriptor(pinfo, tree,
|
2014-08-20 12:41:26 +00:00
|
|
|
tvb, loop_offset, &usb_conv_info);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Pad to a DWORD */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_req_pad, tvb,
|
|
|
|
loop_offset, MAUSB_ISO_SSP_EP_DES_PAD, ENC_NA);
|
|
|
|
loop_offset += MAUSB_ISO_SSP_EP_DES_PAD;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Pad to a DWORD */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_req_pad, tvb,
|
|
|
|
loop_offset, MAUSB_SS_EP_DES_PAD, ENC_NA);
|
|
|
|
loop_offset += MAUSB_SS_EP_DES_PAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Pad to a DWORD */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_req_pad, tvb,
|
|
|
|
loop_offset, MAUSB_EP_DES_PAD, ENC_NA);
|
|
|
|
loop_offset += MAUSB_EP_DES_PAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else { /* IE: it's a EPHandleResp */
|
|
|
|
/* EP Handle */
|
|
|
|
loop_offset += dissect_ep_handle(tree, tvb, loop_offset);
|
|
|
|
|
|
|
|
/* direction */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_dir, tvb,
|
|
|
|
loop_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
/* isochronous */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_iso, tvb,
|
|
|
|
loop_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
/* L-managed transfers */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_lman, tvb,
|
|
|
|
loop_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
/* valid handle bit */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_valid, tvb,
|
|
|
|
loop_offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
loop_offset += 2; /* 4 bit flags + 12 reserved bits */
|
|
|
|
|
|
|
|
/* credit consumption unit */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_ccu, tvb,
|
|
|
|
loop_offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
loop_offset += 2;
|
|
|
|
|
|
|
|
loop_offset += 2; /* 2 bytes reserved */
|
|
|
|
|
|
|
|
/* buffer size (in bytes) */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_buf_size, tvb,
|
|
|
|
loop_offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
loop_offset += 4;
|
|
|
|
|
|
|
|
|
|
|
|
/* max iso programming delay (in uSec) */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_iso_prog_dly, tvb,
|
|
|
|
loop_offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
loop_offset += 2;
|
|
|
|
|
|
|
|
/* max iso response delay (in uSec) */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_ep_handle_resp_iso_resp_dly, tvb,
|
|
|
|
loop_offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
loop_offset += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
offset += size_ep_des;
|
|
|
|
|
2014-05-07 18:08:31 +00:00
|
|
|
if (req && !del && loop_offset != offset){
|
2014-02-06 00:03:15 +00:00
|
|
|
expert_add_info(pinfo, size_field, &ei_ep_handle_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-14 01:15:31 +00:00
|
|
|
/* dissects portions of a MA USB packet specific to CancelTransfer packets */
|
|
|
|
static guint16 dissect_mausb_mgmt_pkt_cancel_transfer( proto_tree *tree,
|
|
|
|
tvbuff_t *tvb, gint offset, gboolean req)
|
|
|
|
{
|
|
|
|
|
|
|
|
guint8 status;
|
|
|
|
|
|
|
|
offset += dissect_ep_handle(tree, tvb, offset);
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_stream_id, tvb, offset, 2,
|
|
|
|
ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_req_id, tvb, offset, 1,
|
|
|
|
ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
if (req) {
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_rsvd, tvb, offset, 3,
|
|
|
|
ENC_NA);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
} /* else resp */
|
|
|
|
|
|
|
|
status = tvb_get_guint8(tvb, offset) |
|
|
|
|
MAUSB_CANCEL_TRANSFER_STATUS_MASK;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_status, tvb, offset, 3,
|
|
|
|
ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_rsvd_2, tvb, offset, 3,
|
|
|
|
ENC_LITTLE_ENDIAN);
|
|
|
|
/* Reserved */
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
/* if some data was moved */
|
|
|
|
if (2 == status) {
|
|
|
|
/* TODO: sequence number reserved for INs */
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_seq_num, tvb, offset,
|
|
|
|
3, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_rsvd, tvb, offset, 1,
|
|
|
|
ENC_NA);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_byte_offset, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
proto_tree_add_item(tree, hf_mausb_cancel_transfer_rsvd, tvb, offset, 8,
|
|
|
|
ENC_NA);
|
|
|
|
offset += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-01-06 00:58:42 +00:00
|
|
|
/* dissects portions of a MA USB packet specific to particular management packets */
|
2014-02-06 00:03:15 +00:00
|
|
|
static guint16 dissect_mausb_mgmt_pkt_flds(struct mausb_header *header,
|
|
|
|
proto_tree *tree, tvbuff_t *tvb,
|
|
|
|
packet_info *pinfo, gint16 start)
|
|
|
|
{
|
|
|
|
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *mgmt_tree;
|
|
|
|
guint16 offset = start;
|
|
|
|
gint type_spec_len = tvb_reported_length(tvb) - start;
|
|
|
|
|
|
|
|
if (0 > type_spec_len) {
|
|
|
|
expert_add_info(pinfo, tree, &ei_mgmt_type_spec_len_short);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
ti = proto_tree_add_item(tree, hf_mausb_mgmt_type_spec, tvb,
|
|
|
|
offset, type_spec_len, ENC_NA);
|
|
|
|
|
|
|
|
mgmt_tree = proto_item_add_subtree(ti, ett_mgmt);
|
|
|
|
|
|
|
|
switch (header->type) {
|
|
|
|
|
|
|
|
/* subtypes with variable length additional data */
|
2014-07-31 22:54:24 +00:00
|
|
|
case CapResp:
|
|
|
|
offset = dissect_mausb_mgmt_pkt_cap_resp(header, mgmt_tree, tvb, pinfo, offset);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPHandleReq:
|
|
|
|
offset = dissect_mausb_mgmt_pkt_ep_handle(mgmt_tree, tvb, pinfo,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, TRUE, FALSE);
|
2014-02-06 00:03:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EPHandleResp:
|
|
|
|
offset = dissect_mausb_mgmt_pkt_ep_handle(mgmt_tree, tvb, pinfo,
|
2014-05-07 18:08:31 +00:00
|
|
|
offset, FALSE, FALSE);
|
2014-02-06 00:03:15 +00:00
|
|
|
break;
|
|
|
|
|
2015-11-15 20:06:10 +00:00
|
|
|
/* TODO: Dissect type-specific management packet fields */
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPActivateReq:
|
|
|
|
case EPActivateResp:
|
|
|
|
case EPInactivateReq:
|
|
|
|
case EPInactivateResp:
|
2014-11-12 01:52:31 +00:00
|
|
|
case EPResetReq:
|
|
|
|
case EPResetResp:
|
2014-07-31 19:23:51 +00:00
|
|
|
proto_tree_add_item(mgmt_tree, hf_mausb_mgmt_type_spec_generic,
|
|
|
|
tvb, offset, type_spec_len, ENC_NA);
|
|
|
|
offset += type_spec_len;
|
|
|
|
break;
|
2016-01-05 22:47:20 +00:00
|
|
|
case ClearTransfersReq:
|
|
|
|
offset = dissect_mausb_mgmt_pkt_clear_transfers(mgmt_tree, tvb, offset, TRUE);
|
|
|
|
break;
|
|
|
|
case ClearTransfersResp:
|
|
|
|
offset = dissect_mausb_mgmt_pkt_clear_transfers(mgmt_tree, tvb, offset, FALSE);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPHandleDeleteReq:
|
2014-05-07 18:08:31 +00:00
|
|
|
offset = dissect_mausb_mgmt_pkt_ep_handle(mgmt_tree, tvb, pinfo,
|
|
|
|
offset, TRUE, TRUE);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPHandleDeleteResp:
|
2014-05-07 18:08:31 +00:00
|
|
|
offset = dissect_mausb_mgmt_pkt_ep_handle(mgmt_tree, tvb, pinfo,
|
|
|
|
offset, FALSE, TRUE);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case ModifyEP0Resp:
|
|
|
|
case EPCloseStreamResp:
|
|
|
|
case USBDevResetReq:
|
|
|
|
case USBDevResetResp:
|
|
|
|
case EPOpenStreamResp:
|
|
|
|
case VendorSpecificReq:
|
|
|
|
case VendorSpecificResp:
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
/* subtypes with constant length additional data */
|
|
|
|
case CapReq:
|
|
|
|
case USBDevHandleReq:
|
|
|
|
case USBDevHandleResp:
|
|
|
|
case ModifyEP0Req:
|
2014-11-12 01:52:31 +00:00
|
|
|
case SetUSBDevAddrReq:
|
|
|
|
case SetUSBDevAddrResp:
|
2014-02-06 00:03:15 +00:00
|
|
|
case UpdateDevReq:
|
2014-11-12 01:52:31 +00:00
|
|
|
case SynchReq:
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPCloseStreamReq:
|
2014-11-14 01:15:31 +00:00
|
|
|
proto_tree_add_item(mgmt_tree, hf_mausb_mgmt_type_spec_generic,
|
|
|
|
tvb, offset, type_spec_len, ENC_NA);
|
|
|
|
offset += type_spec_len;
|
|
|
|
break;
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
case CancelTransferReq:
|
2014-11-14 01:15:31 +00:00
|
|
|
offset = dissect_mausb_mgmt_pkt_cancel_transfer(mgmt_tree, tvb, offset,
|
|
|
|
TRUE);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case CancelTransferResp:
|
2014-11-14 01:15:31 +00:00
|
|
|
offset = dissect_mausb_mgmt_pkt_cancel_transfer(mgmt_tree, tvb, offset,
|
|
|
|
FALSE);
|
|
|
|
break;
|
2014-02-06 00:03:15 +00:00
|
|
|
case EPOpenStreamReq:
|
|
|
|
|
|
|
|
proto_tree_add_item(mgmt_tree, hf_mausb_mgmt_type_spec_generic,
|
|
|
|
tvb, offset, type_spec_len, ENC_NA);
|
|
|
|
offset += type_spec_len;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
/* Managment packets with no additional data */
|
2014-11-12 01:52:31 +00:00
|
|
|
case DevResetReq:
|
|
|
|
case DevResetResp:
|
2014-02-06 00:03:15 +00:00
|
|
|
case UpdateDevResp:
|
2014-11-12 01:52:31 +00:00
|
|
|
case USBDevDisconnectReq:
|
|
|
|
case USBDevDisconnectResp:
|
|
|
|
case SleepReq:
|
|
|
|
case SleepResp:
|
|
|
|
case WakeReq:
|
|
|
|
case WakeResp:
|
2014-02-06 00:03:15 +00:00
|
|
|
case PingReq:
|
|
|
|
case PingResp:
|
2014-11-12 01:52:31 +00:00
|
|
|
case DevDisconnectReq:
|
|
|
|
case DevDisconnectResp:
|
|
|
|
case DevInitDisconnectReq:
|
|
|
|
case DevInitDisconnectResp:
|
|
|
|
case SynchResp:
|
2014-02-06 00:03:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
expert_add_info(pinfo, mgmt_tree, &ei_mgmt_type_undef);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (offset < tvb_reported_length(tvb)) {
|
|
|
|
expert_add_info(pinfo, mgmt_tree, &ei_mgmt_type_spec_len_long);
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
void mausb_set_usb_conv_info(usb_conv_info_t *usb_conv_info,
|
|
|
|
struct mausb_header *header)
|
2014-06-03 23:22:43 +00:00
|
|
|
{
|
2016-01-11 20:39:12 +00:00
|
|
|
usb_conv_info->is_request = mausb_is_transfer_req(header);
|
|
|
|
usb_conv_info->bus_id = mausb_ep_handle_bus_num(header->handle);
|
|
|
|
usb_conv_info->device_address = mausb_ep_handle_dev_addr(header->handle);
|
|
|
|
usb_conv_info->direction = mausb_is_from_host(header);
|
|
|
|
usb_conv_info->endpoint = mausb_ep_handle_ep_num(header->handle);
|
|
|
|
usb_conv_info->is_setup = mausb_has_setup_data(header) ||
|
|
|
|
mausb_is_setup_response(header);
|
|
|
|
switch (mausb_tx_type(header)) {
|
|
|
|
case MAUSB_TX_TYPE_CTRL:
|
|
|
|
usb_conv_info->transfer_type = URB_CONTROL;
|
|
|
|
break;
|
|
|
|
case MAUSB_TX_TYPE_ISOC:
|
|
|
|
usb_conv_info->transfer_type = URB_ISOCHRONOUS;
|
|
|
|
break;
|
|
|
|
case MAUSB_TX_TYPE_BULK:
|
|
|
|
usb_conv_info->transfer_type = URB_BULK;
|
|
|
|
break;
|
|
|
|
case MAUSB_TX_TYPE_INTR:
|
|
|
|
usb_conv_info->transfer_type = URB_INTERRUPT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
usb_conv_info->transfer_type = URB_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
2014-06-03 23:22:43 +00:00
|
|
|
}
|
|
|
|
|
2014-05-16 00:23:47 +00:00
|
|
|
/* Used to detect multiple MA Packets in a single TCP packet */
|
|
|
|
/* Not used for MA Packets in SNAP Packets */
|
|
|
|
static gint mausb_num_pdus = 0;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
|
|
|
|
/* dissect fields common to all MAUSB packet types */
|
2014-02-06 00:03:15 +00:00
|
|
|
static int
|
2016-01-11 20:39:12 +00:00
|
|
|
dissect_mausb_pkt_common(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|
|
|
proto_tree *mausb_tree, struct mausb_header *header)
|
2014-02-06 00:03:15 +00:00
|
|
|
{
|
|
|
|
proto_item *len_field;
|
|
|
|
|
|
|
|
/* MAUSB Protocol Version */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->ver_flags = tvb_get_guint8(tvb, offset);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_version, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
|
|
|
|
/* Flags */
|
2016-01-11 20:39:12 +00:00
|
|
|
proto_tree_add_bitmask(mausb_tree, tvb, offset, hf_mausb_flags,
|
|
|
|
ett_mausb_flags, mausb_flag_fields, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Packet Type */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->type = tvb_get_guint8(tvb, offset);
|
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, val_to_str(header->type, mausb_type_string, "%d"));
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_type, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Packet Length */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->length = tvb_get_letohs(tvb, offset);
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Length=%u", header->length);
|
2014-02-06 00:03:15 +00:00
|
|
|
len_field = proto_tree_add_item(mausb_tree, hf_mausb_length, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* Check to see if length field is valid */
|
2016-01-11 20:39:12 +00:00
|
|
|
if (tvb_reported_length(tvb) != header->length) {
|
2014-02-06 00:03:15 +00:00
|
|
|
expert_add_info(pinfo, len_field, &ei_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Is the next field a device handle or an endpoint handle */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->handle = tvb_get_letohs(tvb, offset);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
if (mausb_is_mgmt_pkt(header)) {
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_dev_handle, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
} else {
|
|
|
|
offset += dissect_ep_handle(mausb_tree, tvb, offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MA Device Address */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->ma_dev_addr = tvb_get_guint8(tvb, offset);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_ma_dev_addr, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* SSID */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->mass_id = tvb_get_guint8(tvb, offset);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_ssid, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
/* Status */
|
2016-01-11 20:39:12 +00:00
|
|
|
header->status = tvb_get_guint8(tvb, offset);
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_status, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* dissect datapacket specific values */
|
|
|
|
static int
|
|
|
|
dissect_mausb_pkt_data(tvbuff_t *tvb, gint offset, packet_info *pinfo,
|
|
|
|
proto_tree *mausb_tree, struct mausb_header *header)
|
|
|
|
{
|
|
|
|
/* EPS */
|
|
|
|
header->u.s.eps_tflags = tvb_get_guint8(tvb, offset);
|
|
|
|
if (mausb_is_from_host(header)) {
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_eps_rsvd, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
} else {
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_eps, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* T-Flags */
|
|
|
|
proto_tree_add_bitmask(mausb_tree, tvb, offset, hf_mausb_tflags,
|
|
|
|
ett_mausb_tflags, mausb_tflag_fields, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
if (mausb_is_iso_pkt(header)) {
|
|
|
|
/* Number of Headers */
|
|
|
|
header->u.s.u1.num_headers_iflags = tvb_get_letohs(tvb, offset);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_num_iso_hdr, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* I-Flags */
|
|
|
|
proto_tree_add_bitmask(mausb_tree, tvb, offset, hf_mausb_iflags,
|
|
|
|
ett_mausb_iflags, mausb_iflag_fields, ENC_LITTLE_ENDIAN);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
} else {
|
|
|
|
/* Stream ID */
|
|
|
|
header->u.s.u1.stream_id = tvb_get_letohs(tvb, offset);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_stream_id, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN);
|
|
|
|
}
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* Sequence Number */
|
|
|
|
header->u.s.seq_num = tvb_get_letoh24(tvb, offset);
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " SeqNum=%u", header->u.s.seq_num);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_seq_num, tvb,
|
|
|
|
offset, 3, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
/* Request ID */
|
|
|
|
header->u.s.req_id = tvb_get_guint8(tvb, offset);
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " ReqID=%u", header->u.s.req_id);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_req_id, tvb,
|
|
|
|
offset, 1, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
if (mausb_is_iso_pkt(header)) {
|
|
|
|
/* Presentation Time */
|
|
|
|
header->u.s.u2.present_time_num_seg = tvb_get_letohl(tvb, offset);
|
|
|
|
dissect_mausb_present_time(mausb_tree, tvb, offset);
|
|
|
|
|
|
|
|
/* Number of Segments */
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_num_segs, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* MA USB Timestamp */
|
|
|
|
if (mausb_has_timestamp(header)) {
|
|
|
|
header->u.s.timestamp = tvb_get_letohl(tvb, offset);
|
|
|
|
dissect_mausb_timestamp(mausb_tree, tvb, offset);
|
|
|
|
offset += 4;
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Media Time/Transmission Delay */
|
|
|
|
if (mausb_has_mtd(header)) {
|
|
|
|
header->u.s.tx_dly = tvb_get_letohl(tvb, offset);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_mtd, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Not Iso */
|
|
|
|
} else {
|
|
|
|
/* Remaining Size/Credit */
|
|
|
|
header->u.s.u2.credit = tvb_get_letohl(tvb, offset);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_rem_size_credit, tvb,
|
|
|
|
offset, 4, ENC_LITTLE_ENDIAN);
|
|
|
|
offset += 4;
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Code to actually dissect the packets */
|
|
|
|
static int
|
|
|
|
dissect_mausb_pkt(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 *mausb_tree;
|
|
|
|
/* Other misc. local variables. */
|
|
|
|
struct mausb_header header;
|
|
|
|
gint offset = 0;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
memset(&header, 0, sizeof(struct mausb_header));
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Set the Protocol column to the constant string of mausb */
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MAUSB");
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
mausb_num_pdus++;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO, "[");
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/*** PROTOCOL TREE ***/
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* create display subtree for the protocol */
|
|
|
|
ti = proto_tree_add_item(tree, proto_mausb, tvb, 0,
|
|
|
|
mausb_get_pkt_len(pinfo, tvb, offset, NULL), ENC_NA);
|
2015-02-19 21:20:56 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
mausb_tree = proto_item_add_subtree(ti, ett_mausb);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Add an item to the subtree, see section 1.5 of README.dissector for more
|
|
|
|
* information. */
|
2015-02-19 21:20:56 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
offset = dissect_mausb_pkt_common(tvb, offset, pinfo, mausb_tree, &header);
|
2015-02-19 21:20:56 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
if (mausb_is_mgmt_pkt(&header)) {
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Dialog Token */
|
|
|
|
header.u.token = tvb_get_letohs(tvb, 9) & MAUSB_TOKEN_MASK;
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Token=%u", header.u.token);
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_token, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN); /* Really 10 bits */
|
|
|
|
offset += 1; /* token */
|
2015-03-21 15:42:08 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Padding to a DWORD */
|
|
|
|
proto_tree_add_item(mausb_tree, hf_mausb_mgmt_pad, tvb,
|
|
|
|
offset, 2, ENC_LITTLE_ENDIAN); /* Really 14 bits */
|
2015-03-21 15:42:08 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
offset += 2; /* DWORD*/
|
2015-03-21 15:42:08 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
/* Dissect additional management fields (when applicable) */
|
|
|
|
if (offset < header.length) {
|
2016-01-16 11:05:11 +00:00
|
|
|
dissect_mausb_mgmt_pkt_flds(&header, mausb_tree, tvb, pinfo, offset);
|
2015-03-21 15:42:08 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
}
|
|
|
|
else if (mausb_is_data_pkt(&header)) {
|
|
|
|
dissect_mausb_pkt_data(tvb, offset, pinfo, mausb_tree, &header);
|
2014-06-06 00:01:46 +00:00
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
if (!mausb_is_transfer_ack(&header)) {
|
|
|
|
dissect_usb_common(tvb, pinfo, tree, USB_HEADER_MAUSB, &header);
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-04 19:07:26 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, "]");
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
|
|
|
|
2016-01-11 20:39:12 +00:00
|
|
|
return header.length;
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Code to dissect the stream */
|
|
|
|
static int
|
2014-05-19 20:03:28 +00:00
|
|
|
dissect_mausb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
2014-02-06 00:03:15 +00:00
|
|
|
{
|
|
|
|
|
2014-05-16 00:23:47 +00:00
|
|
|
mausb_num_pdus = 0;
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MAUSB_MIN_LENGTH,
|
|
|
|
mausb_get_pkt_len, dissect_mausb_pkt, data);
|
2014-05-16 00:23:47 +00:00
|
|
|
|
|
|
|
if (1 < mausb_num_pdus) {
|
2014-06-04 19:07:26 +00:00
|
|
|
col_clear_fence(pinfo->cinfo, COL_INFO);
|
2014-05-16 00:23:47 +00:00
|
|
|
col_prepend_fstr(pinfo->cinfo, COL_INFO, "[%i packets] ", mausb_num_pdus);
|
|
|
|
}
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
return tvb_reported_length(tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Register the protocol with Wireshark.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
proto_register_mausb(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_mausb_version,
|
|
|
|
{ "Version", "mausb.version", FT_UINT8, BASE_DEC,
|
2014-05-06 19:51:57 +00:00
|
|
|
VALS(mausb_version_string), MAUSB_VERSION_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_flags,
|
|
|
|
{ "Flags", "mausb.flags", FT_UINT8, BASE_HEX,
|
2016-01-11 20:39:12 +00:00
|
|
|
NULL, MAUSB_FLAG_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Flag Subfields */
|
|
|
|
{ &hf_mausb_flag_host,
|
2015-02-19 21:31:46 +00:00
|
|
|
{ "Host", "mausb.flags.host", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), (MAUSB_FLAG_HOST << MAUSB_FLAG_OFFSET),
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_flag_retry,
|
2015-02-19 21:31:46 +00:00
|
|
|
{ "Retry", "mausb.flags.retry", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_yes_no), (MAUSB_FLAG_RETRY << MAUSB_FLAG_OFFSET),
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_flag_timestamp,
|
2015-02-19 21:31:46 +00:00
|
|
|
{ "Timestamp", "mausb.flags.timestamp", FT_BOOLEAN, 8,
|
2014-02-06 00:03:15 +00:00
|
|
|
TFS(&tfs_present_not_present),
|
2015-02-19 21:31:46 +00:00
|
|
|
(MAUSB_FLAG_TIMESTAMP << MAUSB_FLAG_OFFSET),
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_flag_reserved,
|
2015-02-19 21:31:46 +00:00
|
|
|
{ "Reserved", "mausb.flags.reserved", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), (MAUSB_FLAG_RESERVED << MAUSB_FLAG_OFFSET),
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ &hf_mausb_type,
|
|
|
|
{ "Type", "mausb.type", FT_UINT8, BASE_HEX,
|
2014-05-06 19:51:57 +00:00
|
|
|
VALS(mausb_type_string), 0, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_length,
|
|
|
|
{ "Length", "mausb.length", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_dev_handle,
|
|
|
|
{ "Device Handle", "mausb.dev_handle", FT_UINT16, BASE_HEX,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle,
|
|
|
|
{ "Endpoint Handle", "mausb.ep_handle", FT_UINT16, BASE_HEX,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* EP Handle Subfields */
|
|
|
|
{ &hf_mausb_ep_handle_d,
|
|
|
|
{ "Direction", "mausb.ep_handle.d", FT_BOOLEAN, 16,
|
2014-09-15 21:26:05 +00:00
|
|
|
TFS(&tfs_endpoint_direction), MAUSB_EP_HANDLE_D, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_ep_num,
|
|
|
|
{ "Endpoint Number", "mausb.ep_handle.ep_num", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_EP_HANDLE_EP_NUM, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_dev_addr,
|
|
|
|
{ "USB Device Address", "mausb.ep_handle.dev_addr", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_EP_HANDLE_DEV_ADDR, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_bus_num,
|
|
|
|
{ "USB Bus Number", "mausb.ep_handle.bus_num", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_EP_HANDLE_BUS_NUM, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{ &hf_mausb_ma_dev_addr,
|
|
|
|
{ "MA Device Address", "mausb.ma_dev_addr", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ssid,
|
|
|
|
{ "Service Set ID", "mausb.ssid", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_status,
|
|
|
|
{ "Status", "mausb.status", FT_UINT8, BASE_DEC,
|
2014-05-06 19:51:57 +00:00
|
|
|
VALS(mausb_status_string), 0, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Managment Packets Only */
|
|
|
|
{ &hf_mausb_token,
|
|
|
|
{ "Token", "mausb.token", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_TOKEN_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_pad,
|
|
|
|
{ "Padding to a DWORD", "mausb.mgmt_pad",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, MAUSB_MGMT_PAD_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_type_spec,
|
2015-11-15 20:06:10 +00:00
|
|
|
{ "Type-specific management packet fields", "mausb.mgmt_flds",
|
2014-02-06 00:03:15 +00:00
|
|
|
FT_NONE, 0, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_type_spec_generic,
|
2015-11-15 20:06:10 +00:00
|
|
|
{ "Type-specific management packet fields", "mausb.mgmt_flds.generic",
|
2014-02-06 00:03:15 +00:00
|
|
|
FT_NONE, 0, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* Data Packets Only */
|
|
|
|
{ &hf_mausb_eps,
|
|
|
|
{ "EP Status", "mausb.eps", FT_UINT8, BASE_HEX,
|
2014-05-06 19:51:57 +00:00
|
|
|
VALS(mausb_eps_string), MAUSB_EPS_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_eps_rsvd,
|
2014-05-06 21:53:28 +00:00
|
|
|
{ "EP Status", "mausb.eps.reserved", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, MAUSB_EPS_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_tflags,
|
|
|
|
{ "Transfer Flags", "mausb.tflag", FT_UINT8, BASE_HEX,
|
2016-01-11 20:39:12 +00:00
|
|
|
NULL, MAUSB_TFLAG_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* T-Flag Subfields */
|
|
|
|
{ &hf_mausb_tflag_arq,
|
|
|
|
{ "ARQ", "mausb.tflag.arq", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_TFLAG_ARQ << MAUSB_TFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_tflag_neg,
|
|
|
|
{ "NEG", "mausb.tflag.neg", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_TFLAG_NEG << MAUSB_TFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_tflag_eot,
|
|
|
|
{ "EoT", "mausb.tflag.eot", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_TFLAG_EOT << MAUSB_TFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_tflag_type,
|
|
|
|
{ "Transfer Type", "mausb.tflag.type", FT_UINT8, BASE_HEX,
|
2014-05-06 19:51:57 +00:00
|
|
|
VALS(mausb_transfer_type_string),
|
2014-02-06 00:03:15 +00:00
|
|
|
MAUSB_TFLAG_TRANSFER_TYPE << MAUSB_TFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_tflag_rsvd,
|
|
|
|
{ "Reserved", "mausb.tflag.rsvd", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_TFLAG_RSVD << MAUSB_TFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
2015-02-19 21:20:56 +00:00
|
|
|
{ &hf_mausb_num_iso_hdr,
|
|
|
|
{ "Number of Iso Headers", "mausb.numisohdr", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_NUM_ISO_HDR_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_iflags,
|
|
|
|
{ "Isochronous Flags", "mausb.iflag", FT_UINT16, BASE_HEX,
|
2016-01-11 20:39:12 +00:00
|
|
|
NULL, MAUSB_IFLAG_MASK, NULL, HFILL
|
2015-02-19 21:20:56 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/* I-Flag Subfields */
|
|
|
|
{ &hf_mausb_iflag_mtd,
|
|
|
|
{ "MTD Valid", "mausb.iflag.mtd", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_IFLAG_MTD << MAUSB_IFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_iflag_hdr_format,
|
|
|
|
{ "Isochronous Header Format", "mausb.iflag.ihf", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, MAUSB_IFLAG_HDR_FORMAT << MAUSB_IFLAG_OFFSET, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_iflag_asap,
|
|
|
|
{ "ASAP", "mausb.iflag.asap", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_set_notset), MAUSB_IFLAG_ASAP << MAUSB_IFLAG_OFFSET,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
{ &hf_mausb_stream_id,
|
|
|
|
{ "Stream ID", "mausb.streamid", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_seq_num,
|
|
|
|
{ "Sequence Number", "mausb.seqnum", FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_req_id,
|
|
|
|
{ "Request ID", "mausb.reqid", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2015-02-19 21:20:56 +00:00
|
|
|
{ &hf_mausb_present_time,
|
|
|
|
{ "Presentation Time", "mausb.presenttime", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_PRESENT_TIME_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_uframe,
|
|
|
|
{ "Microframe Number", "mausb.uframe", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_UFRAME_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_frame,
|
|
|
|
{ "Frame Number", "mausb.frame", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_FRAME_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_num_segs,
|
|
|
|
{ "Number of Segments", "mausb.numseg", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_NUM_SEGS_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_timestamp,
|
|
|
|
{ "Timestamp", "mausb.timestamp", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_delta,
|
|
|
|
{ "Delta", "mausb.delta", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_DELTA_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_nom_interval,
|
|
|
|
{ "Nominal Bus Interval", "mausb.nomitvl", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_INTERVAL_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mtd,
|
|
|
|
{ "Media Time/Transmission Delay", "mausb.mtd", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2014-02-06 00:03:15 +00:00
|
|
|
{ &hf_mausb_rem_size_credit,
|
|
|
|
{ "Remaining Size/Credit", "mausb.remsize_credit", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-07-31 22:54:24 +00:00
|
|
|
/* Register info for CapReq/Resp specific fields */
|
|
|
|
static hf_register_info hf_cap[] = {
|
|
|
|
|
|
|
|
{ &hf_mausb_cap_resp_num_ep,
|
|
|
|
{ "Number of Endpoints", "mausb.cap_resp.num_ep",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0,
|
|
|
|
"the maximum number of endpoints for this device",
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_num_dev,
|
|
|
|
{ "Number of Devices", "mausb.cap_resp.num_dev",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0,
|
|
|
|
"the maximum number of USB devices the MA USB device can manage",
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_num_stream,
|
|
|
|
{ "Number of Streams", "mausb.cap_resp.num_stream",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, MAUSB_CAP_RESP_NUM_STREAM_MASK,
|
|
|
|
"2 to the power of this value is the max number of streams supported",
|
|
|
|
/* TODO: have dissector print the actual number of streams supported */
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_dev_type,
|
|
|
|
{ "Device Type", "mausb.cap_resp.dev_type", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(mausb_cap_resp_dev_type), MAUSB_CAP_RESP_DEV_TYPE_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_desc_count,
|
|
|
|
{ "Descriptors Count", "mausb.cap_resp.desc_count",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, "The total number of MA Device Capabilities descriptors",
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_desc_len,
|
|
|
|
{ "Descriptors Length", "mausb.cap_resp.desc_len",
|
|
|
|
FT_UINT24, BASE_DEC,
|
|
|
|
NULL, 0, "The total size of MA Device Capabilities descriptors",
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_transfer_req,
|
|
|
|
{ "Number of Outstanding Transfer Requests",
|
|
|
|
"mausb.cap_resp.transfer_req",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0,
|
|
|
|
"The maximum number of total outstanding transfer requests", HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_mgmt_req,
|
|
|
|
{ "Number of Outstanding Management Requests", "mausb.cap_resp.mgmt_req",
|
|
|
|
FT_UINT16, BASE_DEC, NULL,
|
|
|
|
MAUSB_CAP_RESP_MGMT_REQ_MASK,
|
|
|
|
"The maximum number of host initiated outstanding management requests",
|
|
|
|
HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cap_resp_rsvd,
|
|
|
|
{ "Reserved", "mausb.cap_resp.rsvd", FT_UINT16, BASE_HEX,
|
|
|
|
NULL, MAUSB_CAP_RESP_RSVD_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2014-08-01 17:23:28 +00:00
|
|
|
|
|
|
|
/* Device Capability Descriptors */
|
|
|
|
{ &hf_mausb_dev_cap_len,
|
|
|
|
{ "Length", "mausb.cap_resp.dev_cap.length",
|
|
|
|
FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_dev_cap_type,
|
|
|
|
{ "Type", "mausb.cap_resp.dev_cap.type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(mausb_dev_cap_string),
|
|
|
|
0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_dev_cap_generic,
|
|
|
|
{ "Type-specific device capability descriptor fields",
|
|
|
|
"mausb.cap_resp.dev_cap.generic",
|
|
|
|
FT_NONE, 0, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
}
|
2014-07-31 22:54:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* register info for ep_handle_* specific fields */
|
|
|
|
static hf_register_info hf_ep_handle[] = {
|
|
|
|
{ &hf_mausb_mgmt_ep_handle_num,
|
|
|
|
{ "Number of Endpoint Handles", "mausb.ep_handle_num",
|
|
|
|
FT_UINT8, BASE_DEC,
|
|
|
|
NULL, MAUSB_MGMT_NUM_EP_DES_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_ep_handle_pad,
|
|
|
|
{ "Padding to a DWORD", "mausb.ep_handle_pad",
|
|
|
|
FT_NONE, 0,
|
2015-11-30 20:00:24 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_ep_des_num,
|
|
|
|
{ "Number of Endpoint Descriptors", "mausb.ep_des_num",
|
|
|
|
FT_UINT8, BASE_DEC,
|
2014-05-07 18:08:31 +00:00
|
|
|
NULL, MAUSB_MGMT_NUM_EP_DES_MASK, NULL, HFILL
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_ep_des_size,
|
|
|
|
{ "Size of Endpoint Descriptors", "mausb.ep_des_size",
|
|
|
|
FT_UINT16, BASE_DEC,
|
|
|
|
NULL, MAUSB_MGMT_SIZE_EP_DES_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_mgmt_ep_des_pad,
|
|
|
|
{ "Padding to a DWORD", "mausb.ep_des_pad",
|
|
|
|
FT_NONE, 0, NULL,
|
2015-11-30 20:00:24 +00:00
|
|
|
0x0,
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_mausb_ep_handle_req_pad,
|
|
|
|
{ "Padding to a DWORD", "mausb.ep_handle_req.pad",
|
|
|
|
FT_NONE, 0, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_dir,
|
|
|
|
{ "Direction", "mausb.ep_dir", FT_BOOLEAN, 6,
|
|
|
|
TFS(&tfs_ep_handle_resp_dir), MAUSB_EP_HANDLE_RESP_DIR_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_iso,
|
|
|
|
{ "Isochronous", "mausb.ep_iso", FT_BOOLEAN, 6,
|
|
|
|
TFS(&tfs_yes_no), MAUSB_EP_HANDLE_RESP_ISO_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_lman,
|
|
|
|
{ "L-Managed", "mausb.ep_lman", FT_BOOLEAN, 6,
|
|
|
|
TFS(&tfs_supported_not_supported), MAUSB_EP_HANDLE_RESP_LMAN_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_valid,
|
|
|
|
{ "Valid", "mausb.ep_valid", FT_BOOLEAN, 6,
|
2014-05-23 22:40:08 +00:00
|
|
|
TFS(&tfs_invalid_valid), MAUSB_EP_HANDLE_RESP_VALID_MASK,
|
2014-02-06 00:03:15 +00:00
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_ccu,
|
|
|
|
{ "CCU", "mausb.ep_ccu", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_buf_size,
|
|
|
|
{ "Buffer Size", "mausb.ep_buf_size", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_iso_prog_dly,
|
|
|
|
{ "Iso Programming Delay", "mausb.ep_iso_prog_dly", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_ep_handle_resp_iso_resp_dly,
|
|
|
|
{ "Iso Response Delay", "mausb.ep_iso_resp_dly", FT_UINT16, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-01-05 22:47:20 +00:00
|
|
|
/* (Cancel/Clear)Transfer(Req/Resp) specific fields */
|
2014-11-14 01:15:31 +00:00
|
|
|
static hf_register_info hf_cancel_transfer[] = {
|
2016-01-05 22:47:20 +00:00
|
|
|
{ &hf_mausb_clear_transfers_info_block,
|
|
|
|
{ "Clear Transfers Information Block", "mausb.clear_transfers.info", FT_NONE, 0,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_status_block,
|
2016-02-22 01:19:02 +00:00
|
|
|
{ "Cancel Transfers Status Block", "mausb.clear_transfers.status_block", FT_NONE, 0,
|
2016-01-05 22:47:20 +00:00
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2014-11-14 01:15:31 +00:00
|
|
|
{ &hf_mausb_cancel_transfer_rsvd,
|
|
|
|
{ "Reserved", "mausb.cancel_transfer.rsvd", FT_NONE, 0,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2016-01-05 22:47:20 +00:00
|
|
|
{ &hf_mausb_clear_transfers_req_num,
|
|
|
|
{ "Number of Blocks", "mausb.clear_transfers_req.num", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_req_rsvd,
|
|
|
|
{ "Reserved", "mausb.clear_transfers_req.rsvd", FT_NONE, 0,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_resp_num,
|
|
|
|
{ "Number of Blocks", "mausb.clear_transfers_resp.num", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, MAUSB_CLEAR_TRANSFERS_RESP_NUM_MASK , NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_resp_rsvd,
|
|
|
|
{ "Reserved", "mausb.clear_transfers_resp.rsvd", FT_UINT32, BASE_HEX,
|
|
|
|
NULL, ~MAUSB_CLEAR_TRANSFERS_RESP_NUM_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2014-11-14 01:15:31 +00:00
|
|
|
{ &hf_mausb_cancel_transfer_status,
|
|
|
|
{ "Status", "mausb.cancel_transfer.status", FT_UINT24, BASE_HEX,
|
|
|
|
VALS(mausb_cancel_transfer_status_string),
|
|
|
|
MAUSB_CANCEL_TRANSFER_STATUS_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cancel_transfer_rsvd_2,
|
|
|
|
{ "Reserved", "mausb.cancel_transfer.rsvd_2", FT_UINT24, BASE_HEX,
|
|
|
|
NULL, ~MAUSB_CANCEL_TRANSFER_STATUS_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2016-01-05 22:47:20 +00:00
|
|
|
{ &hf_mausb_clear_transfers_status,
|
|
|
|
{ "Cancellation Status", "mausb.clear_transfers.status", FT_BOOLEAN, 6,
|
|
|
|
TFS(&tfs_success_fail), MAUSB_CLEAR_TRANSFERS_STATUS_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_partial,
|
|
|
|
{ "Partial Delivery", "mausb.clear_transfers.partial", FT_BOOLEAN, 6,
|
|
|
|
TFS(&tfs_true_false), MAUSB_CLEAR_TRANSFERS_PARTIAL_MASK,
|
|
|
|
NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_start_req_id,
|
|
|
|
{ "Start Request ID", "mausb.clear_transfers.start_reqid", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_last_req_id,
|
|
|
|
{ "Last Request ID", "mausb.clear_transfers.last_reqid", FT_UINT8, BASE_DEC,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_req_block_rsvd,
|
|
|
|
{ "Reserved", "mausb.clear_transfers_req.block_rsvd", FT_NONE, 0,
|
|
|
|
NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_clear_transfers_resp_block_rsvd,
|
|
|
|
{ "Reserved", "mausb.clear_transfers_resp.block_rsvd", FT_UINT32, BASE_HEX,
|
|
|
|
NULL, MAUSB_CLEAR_TRANSFERS_RESP_BLOCK_RSVD_MASK, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
{ &hf_mausb_cancel_transfer_seq_num,
|
2014-11-14 01:15:31 +00:00
|
|
|
{ "Delivered Sequence Number", "mausb.cancel_transfer.seqnum",
|
|
|
|
FT_UINT24, BASE_DEC, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_mausb_cancel_transfer_byte_offset,
|
|
|
|
{ "Delivered Byte Offset", "mausb.cancel_transfer.byte_offset",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-03-13 11:51:45 +00:00
|
|
|
static hf_register_info oui_hf[] = {
|
|
|
|
{ &hf_llc_mausb_pid,
|
|
|
|
{ "PID", "mausb.pid", FT_UINT16, BASE_HEX,
|
|
|
|
VALS(mausb_pid_string), 0x0, NULL, HFILL }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-06 00:03:15 +00:00
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_mausb,
|
|
|
|
&ett_mausb_flags,
|
|
|
|
&ett_mausb_ep_handle,
|
|
|
|
&ett_mausb_tflags,
|
2015-02-19 21:20:56 +00:00
|
|
|
&ett_mausb_iflags,
|
|
|
|
&ett_mausb_present_time,
|
|
|
|
&ett_mausb_timestamp,
|
2014-08-01 17:23:28 +00:00
|
|
|
&ett_mgmt,
|
2016-01-05 22:47:20 +00:00
|
|
|
&ett_dev_cap,
|
|
|
|
&ett_clear_transfers_block
|
2014-02-06 00:03:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static ei_register_info ei[] = {
|
|
|
|
{ &ei_ep_handle_len,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.ep_handle.length", PI_PROTOCOL, PI_WARN,
|
2014-02-06 00:03:15 +00:00
|
|
|
"Invalid Endpoint handle length field", EXPFILL }
|
|
|
|
},
|
|
|
|
{ &ei_len,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.length", PI_MALFORMED, PI_ERROR,
|
2014-02-06 00:03:15 +00:00
|
|
|
"Packet length field does not match size of packet", EXPFILL }
|
|
|
|
},
|
|
|
|
{ &ei_mgmt_type_undef,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.type", PI_PROTOCOL, PI_WARN,
|
2015-11-15 20:06:10 +00:00
|
|
|
"Undefined management packet type", EXPFILL }
|
2014-02-06 00:03:15 +00:00
|
|
|
},
|
|
|
|
{ &ei_mgmt_type_spec_len_long,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.type_spec.len", PI_PROTOCOL, PI_WARN,
|
2015-11-15 20:06:10 +00:00
|
|
|
"Data exists after type-specific management packet field", EXPFILL }
|
2014-02-06 00:03:15 +00:00
|
|
|
},
|
|
|
|
{ &ei_mgmt_type_spec_len_short,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.type_spec.len", PI_PROTOCOL, PI_WARN,
|
2015-11-15 20:06:10 +00:00
|
|
|
"Expected type-specific management packet data", EXPFILL }
|
2014-02-06 00:03:15 +00:00
|
|
|
},
|
2014-08-01 17:23:28 +00:00
|
|
|
{ &ei_dev_cap_len,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.cap_resp.dev_cap.length", PI_PROTOCOL, PI_WARN,
|
2014-08-01 17:23:28 +00:00
|
|
|
"Incorrect length value for this device capability descriptor",
|
|
|
|
EXPFILL }
|
|
|
|
},
|
|
|
|
{ &ei_dev_cap_resp_desc_len,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.dev_cap_resp.desc_len", PI_PROTOCOL, PI_WARN,
|
2014-08-01 17:23:28 +00:00
|
|
|
"Incorrect value in Device Descriptors Length field", EXPFILL }
|
|
|
|
},
|
2014-07-31 22:54:24 +00:00
|
|
|
{ &ei_cap_resp_desc_len,
|
2014-12-03 19:14:53 +00:00
|
|
|
{ "mausb.ei.cap_resp.desc_len", PI_PROTOCOL, PI_WARN,
|
2014-07-31 22:54:24 +00:00
|
|
|
"Value in Descriptors Length field exceeds actual space in packet", EXPFILL }
|
|
|
|
},
|
2014-02-06 00:03:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
expert_module_t* expert_mausb;
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
2016-10-05 20:33:54 +00:00
|
|
|
proto_mausb = proto_register_protocol("Media Agnostic USB", "MAUSB", "mausb");
|
2014-02-06 00:03:15 +00:00
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees */
|
|
|
|
proto_register_field_array(proto_mausb, hf, array_length(hf));
|
2014-07-31 22:54:24 +00:00
|
|
|
proto_register_field_array(proto_mausb, hf_cap, array_length(hf_cap));
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_register_field_array(proto_mausb, hf_ep_handle, array_length(hf_ep_handle));
|
2014-11-14 01:15:31 +00:00
|
|
|
proto_register_field_array(proto_mausb, hf_cancel_transfer, array_length(hf_cancel_transfer));
|
2014-02-06 00:03:15 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
/* for Expert info */
|
|
|
|
expert_mausb = expert_register_protocol(proto_mausb);
|
|
|
|
expert_register_field_array(expert_mausb, ei, array_length(ei));
|
|
|
|
|
2016-03-13 11:51:45 +00:00
|
|
|
llc_add_oui(OUI_WFA, "llc.wfa_pid", "LLC WFA OUI PID", oui_hf, proto_mausb);
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_mausb(void)
|
|
|
|
{
|
2016-10-05 20:33:54 +00:00
|
|
|
dissector_handle_t mausb_tcp_handle;
|
|
|
|
dissector_handle_t mausb_pkt_handle;
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
mausb_tcp_handle = create_dissector_handle(dissect_mausb, proto_mausb);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
mausb_pkt_handle = create_dissector_handle(dissect_mausb_pkt, proto_mausb);
|
2014-02-06 00:03:15 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
dissector_add_uint("llc.wfa_pid", PID_MAUSB, mausb_pkt_handle);
|
2014-10-09 18:27:17 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
dissector_add_uint_range_with_preference("tcp.port", "", mausb_tcp_handle);
|
|
|
|
dissector_add_for_decode_as_with_preference("udp.port", mausb_pkt_handle);
|
2014-02-06 00:03:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
2015-08-09 16:14:39 +00:00
|
|
|
* tab-width: 8
|
2014-02-06 00:03:15 +00:00
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
2015-08-09 16:14:39 +00:00
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
2014-02-06 00:03:15 +00:00
|
|
|
*/
|