libpcap
1.10.1
About:
libpcap
is a packet filter library used by tools like tcpdump.
Fossies
Dox
:
libpcap-1.10.1.tar.gz
("unofficial" and yet experimental doxygen-generated source code documentation)
usb.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 Paolo Abeni (Italy)
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* 3. The name of the author may not be used to endorse or promote
15
* products derived from this software without specific prior written
16
* permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*
30
* Basic USB data struct
31
* By Paolo Abeni <paolo.abeni@email.it>
32
*/
33
34
#ifndef lib_pcap_usb_h
35
#define lib_pcap_usb_h
36
37
#include <
pcap/pcap-inttypes.h
>
38
39
/*
40
* possible transfer mode
41
*/
42
#define URB_TRANSFER_IN 0x80
43
#define URB_ISOCHRONOUS 0x0
44
#define URB_INTERRUPT 0x1
45
#define URB_CONTROL 0x2
46
#define URB_BULK 0x3
47
48
/*
49
* possible event type
50
*/
51
#define URB_SUBMIT 'S'
52
#define URB_COMPLETE 'C'
53
#define URB_ERROR 'E'
54
55
/*
56
* USB setup header as defined in USB specification.
57
* Appears at the front of each Control S-type packet in DLT_USB captures.
58
*/
59
typedef
struct
_usb_setup
{
60
uint8_t
bmRequestType
;
61
uint8_t
bRequest
;
62
uint16_t
wValue
;
63
uint16_t
wIndex
;
64
uint16_t
wLength
;
65
}
pcap_usb_setup
;
66
67
/*
68
* Information from the URB for Isochronous transfers.
69
*/
70
typedef
struct
_iso_rec
{
71
int32_t
error_count
;
72
int32_t
numdesc
;
73
}
iso_rec
;
74
75
/*
76
* Header prepended by linux kernel to each event.
77
* Appears at the front of each packet in DLT_USB_LINUX captures.
78
*/
79
typedef
struct
_usb_header
{
80
uint64_t
id
;
81
uint8_t
event_type
;
82
uint8_t
transfer_type
;
83
uint8_t
endpoint_number
;
84
uint8_t
device_address
;
85
uint16_t
bus_id
;
86
char
setup_flag
;
/*if !=0 the urb setup header is not present*/
87
char
data_flag
;
/*if !=0 no urb data is present*/
88
int64_t
ts_sec
;
89
int32_t
ts_usec
;
90
int32_t
status
;
91
uint32_t
urb_len
;
92
uint32_t
data_len
;
/* amount of urb data really present in this event*/
93
pcap_usb_setup
setup
;
94
}
pcap_usb_header
;
95
96
/*
97
* Header prepended by linux kernel to each event for the 2.6.31
98
* and later kernels; for the 2.6.21 through 2.6.30 kernels, the
99
* "iso_rec" information, and the fields starting with "interval"
100
* are zeroed-out padding fields.
101
*
102
* Appears at the front of each packet in DLT_USB_LINUX_MMAPPED captures.
103
*/
104
typedef
struct
_usb_header_mmapped
{
105
uint64_t
id
;
106
uint8_t
event_type
;
107
uint8_t
transfer_type
;
108
uint8_t
endpoint_number
;
109
uint8_t
device_address
;
110
uint16_t
bus_id
;
111
char
setup_flag
;
/*if !=0 the urb setup header is not present*/
112
char
data_flag
;
/*if !=0 no urb data is present*/
113
int64_t
ts_sec
;
114
int32_t
ts_usec
;
115
int32_t
status
;
116
uint32_t
urb_len
;
117
uint32_t
data_len
;
/* amount of urb data really present in this event*/
118
union
{
119
pcap_usb_setup
setup
;
120
iso_rec
iso
;
121
}
s
;
122
int32_t
interval
;
/* for Interrupt and Isochronous events */
123
int32_t
start_frame
;
/* for Isochronous events */
124
uint32_t
xfer_flags
;
/* copy of URB's transfer flags */
125
uint32_t
ndesc
;
/* number of isochronous descriptors */
126
}
pcap_usb_header_mmapped
;
127
128
/*
129
* Isochronous descriptors; for isochronous transfers there might be
130
* one or more of these at the beginning of the packet data. The
131
* number of descriptors is given by the "ndesc" field in the header;
132
* as indicated, in older kernels that don't put the descriptors at
133
* the beginning of the packet, that field is zeroed out, so that field
134
* can be trusted even in captures from older kernels.
135
*/
136
typedef
struct
_usb_isodesc
{
137
int32_t
status
;
138
uint32_t
offset
;
139
uint32_t
len
;
140
uint8_t
pad
[4];
141
}
usb_isodesc
;
142
143
#endif
pcap-inttypes.h
_iso_rec
Definition:
usb.h:70
_iso_rec::error_count
int32_t error_count
Definition:
usb.h:71
_iso_rec::numdesc
int32_t numdesc
Definition:
usb.h:72
_usb_header_mmapped
Definition:
usb.h:104
_usb_header_mmapped::bus_id
uint16_t bus_id
Definition:
usb.h:110
_usb_header_mmapped::interval
int32_t interval
Definition:
usb.h:122
_usb_header_mmapped::ndesc
uint32_t ndesc
Definition:
usb.h:125
_usb_header_mmapped::data_flag
char data_flag
Definition:
usb.h:112
_usb_header_mmapped::event_type
uint8_t event_type
Definition:
usb.h:106
_usb_header_mmapped::ts_usec
int32_t ts_usec
Definition:
usb.h:114
_usb_header_mmapped::ts_sec
int64_t ts_sec
Definition:
usb.h:113
_usb_header_mmapped::setup
pcap_usb_setup setup
Definition:
usb.h:119
_usb_header_mmapped::data_len
uint32_t data_len
Definition:
usb.h:117
_usb_header_mmapped::xfer_flags
uint32_t xfer_flags
Definition:
usb.h:124
_usb_header_mmapped::setup_flag
char setup_flag
Definition:
usb.h:111
_usb_header_mmapped::iso
iso_rec iso
Definition:
usb.h:120
_usb_header_mmapped::transfer_type
uint8_t transfer_type
Definition:
usb.h:107
_usb_header_mmapped::device_address
uint8_t device_address
Definition:
usb.h:109
_usb_header_mmapped::endpoint_number
uint8_t endpoint_number
Definition:
usb.h:108
_usb_header_mmapped::urb_len
uint32_t urb_len
Definition:
usb.h:116
_usb_header_mmapped::status
int32_t status
Definition:
usb.h:115
_usb_header_mmapped::id
uint64_t id
Definition:
usb.h:105
_usb_header_mmapped::s
union _usb_header_mmapped::@3 s
_usb_header_mmapped::start_frame
int32_t start_frame
Definition:
usb.h:123
_usb_header
Definition:
usb.h:79
_usb_header::ts_sec
int64_t ts_sec
Definition:
usb.h:88
_usb_header::data_len
uint32_t data_len
Definition:
usb.h:92
_usb_header::id
uint64_t id
Definition:
usb.h:80
_usb_header::setup
pcap_usb_setup setup
Definition:
usb.h:93
_usb_header::urb_len
uint32_t urb_len
Definition:
usb.h:91
_usb_header::setup_flag
char setup_flag
Definition:
usb.h:86
_usb_header::bus_id
uint16_t bus_id
Definition:
usb.h:85
_usb_header::device_address
uint8_t device_address
Definition:
usb.h:84
_usb_header::transfer_type
uint8_t transfer_type
Definition:
usb.h:82
_usb_header::data_flag
char data_flag
Definition:
usb.h:87
_usb_header::event_type
uint8_t event_type
Definition:
usb.h:81
_usb_header::endpoint_number
uint8_t endpoint_number
Definition:
usb.h:83
_usb_header::ts_usec
int32_t ts_usec
Definition:
usb.h:89
_usb_header::status
int32_t status
Definition:
usb.h:90
_usb_isodesc
Definition:
usb.h:136
_usb_isodesc::status
int32_t status
Definition:
usb.h:137
_usb_isodesc::offset
uint32_t offset
Definition:
usb.h:138
_usb_isodesc::pad
uint8_t pad[4]
Definition:
usb.h:140
_usb_isodesc::len
uint32_t len
Definition:
usb.h:139
_usb_setup
Definition:
usb.h:59
_usb_setup::bRequest
uint8_t bRequest
Definition:
usb.h:61
_usb_setup::wValue
uint16_t wValue
Definition:
usb.h:62
_usb_setup::wIndex
uint16_t wIndex
Definition:
usb.h:63
_usb_setup::wLength
uint16_t wLength
Definition:
usb.h:64
_usb_setup::bmRequestType
uint8_t bmRequestType
Definition:
usb.h:60
pcap_usb_header_mmapped
struct _usb_header_mmapped pcap_usb_header_mmapped
iso_rec
struct _iso_rec iso_rec
pcap_usb_header
struct _usb_header pcap_usb_header
usb_isodesc
struct _usb_isodesc usb_isodesc
pcap_usb_setup
struct _usb_setup pcap_usb_setup
pcap
usb.h
Generated by
1.9.2