diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-04-22 04:38:48 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-04-22 04:38:48 +0000 |
commit | 53850f189a9d6ae361e884b7f5d44833e5e8b756 (patch) | |
tree | a0158104d26d11f3607f5aa4423e0b42c983c6c8 /wiretap | |
parent | c6e453d090fdba2a8cd7254a53fd0e7968acc638 (diff) |
More updates to reflect all the hairy details of Linux USB capture.
svn path=/trunk/; revision=32536
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/wtap.h | 100 |
1 files changed, 70 insertions, 30 deletions
diff --git a/wiretap/wtap.h b/wiretap/wtap.h index ab562b5698..0f17d9ea11 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -614,14 +614,69 @@ struct catapult_dct2000_phdr }; /* - * possible event type + * When not using the memory-mapped interface to capture USB events, + * code that reads those events can use the MON_IOCX_GET ioctl to + * read a 48-byte header consisting of a "struct linux_usb_phdr", as + * defined below, followed immediately by one of: + * + * 8 bytes of a "struct usb_device_setup_hdr", if "setup_flag" + * in the preceding "struct linux_usb_phdr" is 0; + * + * in Linux 2.6.30 or later, 8 bytes of a "struct iso_rec", if + * this is an isochronous transfer; + * + * 8 bytes of junk, otherwise. + * + * In Linux 2.6.31 and later, it can also use the MON_IOCX_GETX ioctl + * to read a 64-byte header; that header consists of the 48 bytes + * above, followed immediately by 16 bytes of a "struct linux_usb_phdr_ext", + * as defined below. + * + * In Linux 2.6.21 and later, there's a memory-mapped interface to + * capture USB events. In that interface, the events in the memory-mapped + * buffer have a 64-byte header, followed immediately by the data. + * In Linux 2.6.21 through 2.6.30.x, the 64-byte header is the 48-byte + * header described above, followed by 16 bytes of zeroes; in Linux + * 2.6.31 and later, the 64-byte header is the 64-byte header described + * above. + * + * See linux/Documentation/usb/usbmon.txt and libpcap/pcap/usb.h for details. + */ + +/* + * Header prepended by Linux kernel to each USB event. + * + * (Setup flag is '-', 'D', 'Z', or 0. Data flag is '<', '>', 'Z', or 0.) + * + * The values are in *host* byte order. + * + * This structure is 40 bytes long. + */ +struct linux_usb_phdr { + guint64 id; /* urb id, to link submission and completion events */ + guint8 event_type; /* Submit ('S'), Completed ('C'), Error ('E') */ + guint8 transfer_type; /* ISO (0), Intr, Control, Bulk (3) */ + guint8 endpoint_number; /* Endpoint number (0-15) and transfer direction */ + guint8 device_address; /* 0-127 */ + guint16 bus_id; + gint8 setup_flag; /* 0, if the urb setup header is meaningful */ + gint8 data_flag; /* 0, if urb data is present */ + gint64 ts_sec; + gint32 ts_usec; + gint32 status; + guint32 urb_len; /* whole len of urb this event refers to */ + guint32 data_len; /* amount of urb data really present in this event */ +}; + +/* + * event_type values */ #define URB_SUBMIT 'S' #define URB_COMPLETE 'C' #define URB_ERROR 'E' /* - * possible transfer mode + * transfer_type values */ #define URB_ISOCHRONOUS 0x0 #define URB_INTERRUPT 0x1 @@ -634,6 +689,8 @@ struct catapult_dct2000_phdr * USB setup header as defined in USB specification * See usb_20.pdf, Chapter 9.3 'USB Device Requests' for details. * http://www.usb.org/developers/docs/usb_20_122909-2.zip + * + * This structure is 8 bytes long. */ struct usb_device_setup_hdr { gint8 bmRequestType; @@ -645,41 +702,24 @@ struct usb_device_setup_hdr { /* * Information from the URB for Isochronous transfers. + * + * This structure is 8 bytes long. */ struct iso_rec { - guint32 error_count; - guint32 numdesc; + gint32 error_count; + gint32 numdesc; }; /* - * Header prepended by Linux kernel to each USB event. - * Always followed either by: - * - * a struct usb_device_setup_hdr, if "setup_flag" is 0; - * - * a struct iso_rec, if this is an isochronous transfer; - * - * 8 bytes of junk, otherwise. - * - * (Setup flag is '-', 'D', 'Z', or 0. Data flag is '<', '>', 'Z', or 0.) - * See linux/Documentation/usb/usbmon.txt and libpcap/pcap/usb.h for details. + * Additional data provided by Linux 2.6.31 and later kernels. * - * The values are in *host* byte order. + * This structure is 16 bytes long. */ -struct linux_usb_phdr { - guint64 id; /* urb id, to link submission and completion events */ - guint8 event_type; /* Submit ('S'), Completed ('C'), Error ('E') */ - guint8 transfer_type; /* ISO (0), Intr, Control, Bulk (3) */ - guint8 endpoint_number; /* Endpoint number (0-15) and transfer direction */ - guint8 device_address; /* 0-127 */ - guint16 bus_id; - gint8 setup_flag; /* 0, if the urb setup header is meaningful */ - gint8 data_flag; /* 0, if urb data is present */ - gint64 ts_sec; - gint32 ts_usec; - gint32 status; - guint32 urb_len; /* whole len of urb this event refers to */ - guint32 data_len; /* amount of urb data really present in this event */ +struct linux_usb_phdr_ext { + gint32 interval; /* only for Interrupt and Isochronous events */ + gint32 start_frame; /* for Isochronous */ + guint32 xfer_flags; /* copy of URB's transfer_flags */ + guint32 ndesc; /* actual number of isochronous descriptors */ }; #define LIBPCAP_BT_PHDR_SENT 0 |