]> The Tcpdump Group git mirrors - libpcap/blob - pcap/usb.h
Indicate which headers go with which DLT_ values.
[libpcap] / pcap / usb.h
1 /*
2 * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
3 * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the Politecnico di Torino, CACE Technologies
16 * nor the names of its contributors may be used to endorse or promote
17 * products derived from this software without specific prior written
18 * permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * Basic USB data struct
33 * By Paolo Abeni <paolo.abeni@email.it>
34 *
35 */
36
37 #ifndef _PCAP_USB_STRUCTS_H__
38 #define _PCAP_USB_STRUCTS_H__
39
40 /*
41 * possible transfer mode
42 */
43 #define URB_TRANSFER_IN 0x80
44 #define URB_ISOCHRONOUS 0x0
45 #define URB_INTERRUPT 0x1
46 #define URB_CONTROL 0x2
47 #define URB_BULK 0x3
48
49 /*
50 * possible event type
51 */
52 #define URB_SUBMIT 'S'
53 #define URB_COMPLETE 'C'
54 #define URB_ERROR 'E'
55
56 /*
57 * USB setup header as defined in USB specification.
58 * Appears at the front of each packet in DLT_USB captures.
59 */
60 typedef struct _usb_setup {
61 u_int8_t bmRequestType;
62 u_int8_t bRequest;
63 u_int16_t wValue;
64 u_int16_t wIndex;
65 u_int16_t wLength;
66 } pcap_usb_setup;
67
68
69 /*
70 * Header prepended by linux kernel to each event.
71 * Appears at the front of each packet in DLT_USB_LINUX captures.
72 */
73 typedef struct _usb_header {
74 u_int64_t id;
75 u_int8_t event_type;
76 u_int8_t transfer_type;
77 u_int8_t endpoint_number;
78 u_int8_t device_address;
79 u_int16_t bus_id;
80 char setup_flag;/*if !=0 the urb setup header is not present*/
81 char data_flag; /*if !=0 no urb data is present*/
82 int64_t ts_sec;
83 int32_t ts_usec;
84 int32_t status;
85 u_int32_t urb_len;
86 u_int32_t data_len; /* amount of urb data really present in this event*/
87 pcap_usb_setup setup;
88 } pcap_usb_header;
89
90
91 #endif