-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtpacket_v3.h
59 lines (46 loc) · 1.91 KB
/
tpacket_v3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* License: MIT
*
* Copyright (c) 2017-2020 James Bensley.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _TPACKET_V3_H_
#define _TPACKET_V3_H_
// Worker thread entry function
void *tpacket_v3_init(void* thd_opt_p);
// TX/RX_RING ring/block alignment
void tpacket_v3_ring_align(struct thd_opt *thd_opt);
// TX/RX_RING init
void tpacket_v3_ring_init(struct thd_opt *thd_opt);
// PACKET_MMAP Rx thread loop
void tpacket_v3_rx(struct thd_opt *thd_opt);
// Return PACKET_MMAP socket FD
int32_t tpacket_v3_sock(struct thd_opt *thd_opt);
// TPACKET V3 Rx socket stats
void tpacket_v3_stats(struct thd_opt *thd_opt, uint64_t *rx_drops, uint64_t *rx_qfrz);
// PACKET_MMAP Tx thread loop
void tpacket_v3_tx(struct thd_opt *thd_opt);
struct block_desc {
uint32_t version;
uint32_t offset_to_priv;
struct tpacket_hdr_v1 h1;
}; ///// Can this be removed or renamed?
#endif // _TPACKET_V3_H_