10#ifndef __PACKET_USB_H__
11#define __PACKET_USB_H__
25#define USB_ADDR_LEN (sizeof(usb_address_t))
30#define INTERFACE_PORT 0x80000000
48 USB_HEADER_LINUX_48_BYTES,
49 USB_HEADER_LINUX_64_BYTES,
54 USB_HEADER_PSEUDO_URB,
58#define USB_HEADER_IS_LINUX(type) \
59 ((type) == USB_HEADER_LINUX_48_BYTES || (type) == USB_HEADER_LINUX_64_BYTES)
63 uint8_t transfer_type;
64 uint8_t device_address;
75 usb_header_t header_type;
102 uint8_t interface_endpoint;
108enum usb_conv_class_data_type {
109 USB_CONV_UNKNOWN = 0,
113 USB_CONV_MASS_STORAGE_BOT,
114 USB_CONV_MASS_STORAGE_UASP,
121 uint8_t descriptor_transfer_type;
122 uint16_t max_packet_size;
124 uint16_t interfaceClass;
125 uint16_t interfaceSubclass;
126 uint16_t interfaceProtocol;
127 uint8_t interfaceNum;
129 uint16_t deviceVendor;
130 uint32_t deviceProduct;
131 uint16_t deviceVersion;
132 uint8_t iSerialNumber;
136 enum usb_conv_class_data_type class_data_type;
144 uint16_t device_address;
147 uint8_t transfer_type;
148 uint32_t device_protocol;
151 uint8_t setup_requesttype;
162 uint8_t transfer_type;
169#define NO_ENDPOINT 0xffffffff
172#define NO_ENDPOINT8 ((uint8_t)(NO_ENDPOINT& UINT8_MAX))
181#define URB_SUBMIT 'S'
182#define URB_COMPLETE 'C'
188#define URB_ISOCHRONOUS 0x0
189#define URB_INTERRUPT 0x1
190#define URB_CONTROL 0x2
192#define URB_UNKNOWN 0xFF
194#define URB_TRANSFER_IN 0x80
198#define IF_CLASS_DEVICE 0x00
199#define IF_CLASS_AUDIO 0x01
200#define IF_CLASS_COMMUNICATIONS 0x02
201#define IF_CLASS_HID 0x03
202#define IF_CLASS_PHYSICAL 0x05
203#define IF_CLASS_IMAGE 0x06
204#define IF_CLASS_PRINTER 0x07
205#define IF_CLASS_MASS_STORAGE 0x08
206#define IF_CLASS_HUB 0x09
207#define IF_CLASS_CDC_DATA 0x0a
208#define IF_CLASS_SMART_CARD 0x0b
209#define IF_CLASS_CONTENT_SECURITY 0x0d
210#define IF_CLASS_VIDEO 0x0e
211#define IF_CLASS_PERSONAL_HEALTHCARE 0x0f
212#define IF_CLASS_AUDIO_VIDEO 0x10
213#define IF_CLASS_BILLBOARD 0x11
214#define IF_CLASS_USB_C_BRIDGE 0x12
215#define IF_CLASS_BULK_DISPLAY_PROTO 0x13
216#define IF_CLASS_MCTP_USB_EP 0x14
217#define IF_CLASS_I3C 0x3c
218#define IF_CLASS_DIAGNOSTIC_DEVICE 0xdc
219#define IF_CLASS_WIRELESS_CONTROLLER 0xe0
220#define IF_CLASS_MISCELLANEOUS 0xef
221#define IF_CLASS_APPLICATION_SPECIFIC 0xfe
222#define IF_CLASS_VENDOR_SPECIFIC 0xff
224#define IF_CLASS_UNKNOWN 0xffff
225#define IF_SUBCLASS_UNKNOWN 0xffff
226#define IF_PROTOCOL_UNKNOWN 0xffff
227#define DEV_VENDOR_UNKNOWN 0x0000
228#define DEV_PRODUCT_UNKNOWN 0xfffffff
229#define DEV_VERSION_UNKNOWN 0xffff
231#define IF_SUBCLASS_MISC_U3V 0x05
233#define IF_SUBCLASS_APP_DFU 0x01
235#define IF_PROTOCOL_DFU_RUNTIME 0x01
236#define IF_PROTOCOL_DFU_MODE 0x02
245#define USB_PROTOCOL_KEY(class, subclass, protocol) \
246 (1u << 31 | (class & 0xff) << 16 | (subclass & 0xff) << 8 | (protocol & 0xff))
250#define USB_DIR_IN 0x80
252#define USB_TYPE_MASK (0x03 << 5)
253#define USB_TYPE(type) (((type) & USB_TYPE_MASK) >> 5)
254#define RQT_SETUP_TYPE_STANDARD 0
255#define RQT_SETUP_TYPE_CLASS 1
256#define RQT_SETUP_TYPE_VENDOR 2
258#define USB_RECIPIENT_MASK 0x1F
259#define USB_RECIPIENT(type) ((type) & USB_RECIPIENT_MASK)
260#define RQT_SETUP_RECIPIENT_DEVICE 0
261#define RQT_SETUP_RECIPIENT_INTERFACE 1
262#define RQT_SETUP_RECIPIENT_ENDPOINT 2
263#define RQT_SETUP_RECIPIENT_OTHER 3
266#define ENDPOINT_TYPE(ep_attrib) ((ep_attrib) & 0x03)
267#define ENDPOINT_TYPE_CONTROL 0
268#define ENDPOINT_TYPE_ISOCHRONOUS 1
269#define ENDPOINT_TYPE_BULK 2
270#define ENDPOINT_TYPE_INTERRUPT 3
271#define ENDPOINT_TYPE_NOT_SET 255
274#define USB_MPS_EP_SIZE(max_packet_size) ((max_packet_size) & 0x07FF)
275#define USB_MPS_ADDNL(max_packet_size) (((max_packet_size) & 0x1800) >> 11)
276#define USB_MPS(ep_size, addnl) (((addnl) << 11) | (ep_size))
277#define USB_MPS_TPL(max_packet_size) \
278 ((USB_MPS_ADDNL(max_packet_size) + 1) * USB_MPS_EP_SIZE(max_packet_size))
280#define USB_SETUP_GET_STATUS 0
281#define USB_SETUP_CLEAR_FEATURE 1
282#define USB_SETUP_SET_FEATURE 3
283#define USB_SETUP_SET_ADDRESS 5
284#define USB_SETUP_GET_DESCRIPTOR 6
285#define USB_SETUP_SET_DESCRIPTOR 7
286#define USB_SETUP_GET_CONFIGURATION 8
287#define USB_SETUP_SET_CONFIGURATION 9
288#define USB_SETUP_GET_INTERFACE 10
289#define USB_SETUP_SET_INTERFACE 11
290#define USB_SETUP_SYNCH_FRAME 12
291#define USB_SETUP_SET_SEL 48
292#define USB_SETUP_SET_ISOCH_DELAY 49
295#define URB_SHORT_NOT_OK 0x00000001
296#define URB_ISO_ASAP 0x00000002
298#define URB_NO_TRANSFER_DMA_MAP 0x00000004
299#define URB_NO_FSBR 0x00000020
300#define URB_ZERO_PACKET 0x00000040
301#define URB_NO_INTERRUPT 0x00000080
303#define URB_FREE_BUFFER 0x00000100
306#define URB_DIR_IN 0x00000200
308#define URB_DIR_MASK URB_DIR_IN
310#define URB_DMA_MAP_SINGLE 0x00010000
311#define URB_DMA_MAP_PAGE 0x00020000
312#define URB_DMA_MAP_SG 0x00040000
313#define URB_MAP_LOCAL 0x00080000
314#define URB_SETUP_MAP_SINGLE 0x00100000
315#define URB_SETUP_MAP_LOCAL 0x00200000
316#define URB_DMA_SG_COMBINED 0x00400000
317#define URB_ALIGNED_TEMP_BUFFER 0x00800000
333 uint16_t device_address,
int endpoint);
342sanitize_usb_max_packet_size(uint8_t ep_type, usb_speed_t speed,
343 unsigned int max_packet_size);
349 uint8_t *out_ep_type, usb_speed_t speed);
357dissect_urb_transfer_flags(
tvbuff_t *tvb,
int offset,
proto_tree* tree,
int hf,
int endian);
363 usb_header_t header_type,
void *extra_data);
365void usb_lpm_besl_str(
char *buf, uint32_t value);
Represents the metadata and indexing information for a single captured frame.
Definition packet_info.h:43
Definition packet-usb.h:142
Definition packet-usb.h:20
Definition packet-usb.h:120
Definition packet-usb.h:61
Definition packet-usb.h:160
Definition packet-usb.h:78
Definition packet-usb.h:71
Extended metadata for a value_string array.
Definition value_string.h:325
Definition wmem_array.c:29
Internal representation of a wmem balanced tree.
Definition wmem_tree-int.h:81
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95