2006-10-18 09:10:14 +00:00
|
|
|
/* packet-usb.h
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PACKET_USB_H__
|
|
|
|
#define __PACKET_USB_H__
|
|
|
|
|
2007-01-08 14:32:10 +00:00
|
|
|
typedef struct _usb_address_t {
|
|
|
|
guint32 device;
|
|
|
|
guint32 endpoint;
|
|
|
|
} usb_address_t;
|
2007-03-25 11:15:09 +00:00
|
|
|
#define USB_ADDR_LEN (sizeof(usb_address_t))
|
2007-01-08 14:32:10 +00:00
|
|
|
|
|
|
|
|
2006-10-22 11:49:23 +00:00
|
|
|
typedef struct _usb_conv_info_t usb_conv_info_t;
|
2006-10-18 09:10:14 +00:00
|
|
|
|
|
|
|
/* there is one such structure for each request/response */
|
|
|
|
typedef struct _usb_trans_info_t {
|
|
|
|
guint32 request_in;
|
|
|
|
guint32 response_in;
|
2007-03-25 05:20:56 +00:00
|
|
|
nstime_t req_time;
|
2006-10-18 09:10:14 +00:00
|
|
|
guint8 requesttype;
|
|
|
|
guint8 request;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
guint8 type;
|
|
|
|
guint8 index;
|
|
|
|
} get_descriptor;
|
2006-11-07 08:33:24 +00:00
|
|
|
} u;
|
2006-10-18 09:10:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* used to pass the interface class from the
|
|
|
|
* interface descriptor onto the endpoint
|
|
|
|
* descriptors so that we can create a
|
|
|
|
* conversation with the appropriate class
|
|
|
|
* once we know the endpoint.
|
|
|
|
*/
|
|
|
|
usb_conv_info_t *interface_info;
|
|
|
|
} usb_trans_info_t;
|
|
|
|
|
2006-10-22 11:49:23 +00:00
|
|
|
/* there is one such structure for each device/endpoint conversation */
|
|
|
|
struct _usb_conv_info_t {
|
2007-03-25 23:51:40 +00:00
|
|
|
guint16 interfaceClass; /* class for this conversation */
|
2006-10-22 11:49:23 +00:00
|
|
|
emem_tree_t *transactions;
|
|
|
|
usb_trans_info_t *usb_trans_info; /* pointer to the current transaction */
|
2007-03-25 22:53:35 +00:00
|
|
|
void *class_data; /* private class/id decode data */
|
2006-10-22 11:49:23 +00:00
|
|
|
};
|
|
|
|
|
2007-03-25 09:55:49 +00:00
|
|
|
/* This is what a tap will tap */
|
|
|
|
typedef struct _usb_tap_data_t {
|
|
|
|
guint8 urb_type;
|
|
|
|
guint8 transfer_type;
|
|
|
|
usb_conv_info_t *conv_info;
|
|
|
|
usb_trans_info_t *trans_info;
|
|
|
|
} usb_tap_data_t;
|
2006-10-18 11:24:03 +00:00
|
|
|
|
|
|
|
/* This is the endpoint number user for "no endpoint" or the fake endpoint
|
|
|
|
* for the host side since we need two endpoints to manage conversations
|
|
|
|
* properly.
|
|
|
|
*/
|
|
|
|
#define NO_ENDPOINT 0xffff
|
|
|
|
|
|
|
|
|
2006-10-18 09:10:14 +00:00
|
|
|
#define IF_CLASS_UNKNOWN 0xffff
|
2006-11-01 09:54:48 +00:00
|
|
|
#define IF_CLASS_FROM_INTERFACE_DESC 0x00
|
|
|
|
#define IF_CLASS_AUDIO 0x01
|
|
|
|
#define IF_CLASS_COMMUNICATIONS 0x02
|
|
|
|
#define IF_CLASS_HID 0x03
|
|
|
|
#define IF_CLASS_PHYSICAL 0x05
|
|
|
|
#define IF_CLASS_IMAGE 0x06
|
|
|
|
#define IF_CLASS_PRINTER 0x07
|
2006-10-18 09:10:14 +00:00
|
|
|
#define IF_CLASS_MASSTORAGE 0x08
|
2006-11-01 09:54:48 +00:00
|
|
|
#define IF_CLASS_HUB 0x09
|
|
|
|
#define IF_CLASS_CDC_DATA 0x0a
|
|
|
|
#define IF_CLASS_SMART_CARD 0x0b
|
|
|
|
#define IF_CLASS_CONTENT_SECURITY 0x0d
|
|
|
|
#define IF_CLASS_VIDEO 0x0e
|
|
|
|
#define IF_CLASS_DIAGNOSTIC_DEVICE 0xdc
|
|
|
|
#define IF_CLASS_WIRELESS_CONTROLLER 0xe0
|
|
|
|
#define IF_CLASS_MISCELLANEOUS 0xef
|
|
|
|
#define IF_CLASS_APPLICATION_SPECIFIC 0xfe
|
|
|
|
#define IF_CLASS_VENDOR_SPECIFIC 0xff
|
2006-10-18 09:10:14 +00:00
|
|
|
|
2009-10-29 21:32:21 +00:00
|
|
|
|
|
|
|
/* bmRequestType values */
|
|
|
|
#define USB_DIR_OUT 0 /* to device */
|
|
|
|
#define USB_DIR_IN 0x80 /* to host */
|
|
|
|
|
|
|
|
#define USB_TYPE_MASK (0x03 << 5)
|
2010-04-21 20:51:22 +00:00
|
|
|
#define USB_TYPE(type) (((type) & USB_TYPE_MASK) >> 5)
|
2009-10-29 21:32:21 +00:00
|
|
|
#define RQT_SETUP_TYPE_STANDARD 0
|
|
|
|
#define RQT_SETUP_TYPE_CLASS 1
|
|
|
|
#define RQT_SETUP_TYPE_VENDOR 2
|
|
|
|
|
|
|
|
#define RQT_SETUP_RECIPIENT_DEVICE 0
|
|
|
|
#define RQT_SETUP_RECIPIENT_INTERFACE 1
|
|
|
|
#define RQT_SETUP_RECIPIENT_ENDPOINT 2
|
|
|
|
#define RQT_SETUP_RECIPIENT_OTHER 3
|
|
|
|
|
2006-10-18 09:10:14 +00:00
|
|
|
#endif
|