unix: add tpacket types and constants on Linux

Change-Id: I4f2fd8a7c899403f545d8dc73fec2ebbb0b322c0
Reviewed-on: https://go-review.googlesource.com/113035
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser
2018-05-14 14:36:08 +00:00
committed by Tobias Klauser
parent d0faeb5398
commit 7c87d13f8e
25 changed files with 1332 additions and 3 deletions
+35 -1
View File
@@ -22,7 +22,6 @@ package unix
#include <dirent.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netpacket/packet.h>
#include <poll.h>
#include <sched.h>
#include <signal.h>
@@ -62,6 +61,7 @@ package unix
#include <utime.h>
#include <linux/can.h>
#include <linux/if_alg.h>
#include <linux/if_packet.h>
#include <linux/fs.h>
#include <linux/vm_sockets.h>
#include <linux/random.h>
@@ -987,3 +987,37 @@ const (
ST_RELATIME = C.ST_RELATIME
ST_SYNCHRONOUS = C.ST_SYNCHRONOUS
)
// TPacket
type TpacketHdr C.struct_tpacket_hdr
type Tpacket2Hdr C.struct_tpacket2_hdr
type Tpacket3Hdr C.struct_tpacket3_hdr
type TpacketHdrVariant1 C.struct_tpacket_hdr_variant1
type TpacketBlockDesc C.struct_tpacket_block_desc
type TpacketReq C.struct_tpacket_req
type TpacketReq3 C.struct_tpacket_req3
type TpacketStats C.struct_tpacket_stats
type TpacketStatsV3 C.struct_tpacket_stats_v3
type TpacketAuxdata C.struct_tpacket_auxdata
const (
TPACKET_V1 = C.TPACKET_V1
TPACKET_V2 = C.TPACKET_V2
TPACKET_V3 = C.TPACKET_V3
)
const (
SizeofTpacketHdr = C.sizeof_struct_tpacket_hdr
SizeofTpacket2Hdr = C.sizeof_struct_tpacket2_hdr
SizeofTpacket3Hdr = C.sizeof_struct_tpacket3_hdr
)