-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconst_cgo.go
84 lines (74 loc) · 3.14 KB
/
const_cgo.go
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//go:build windows && divert_cgo
// +build windows,divert_cgo
package divert
// #cgo CFLAGS: -I${SRCDIR}/divert -Wno-incompatible-pointer-types
// #include "windivert.h"
import "C"
const (
LayerNetwork = Layer(C.WINDIVERT_LAYER_NETWORK)
LayerNetworkForward = Layer(C.WINDIVERT_LAYER_NETWORK_FORWARD)
LayerFlow = Layer(C.WINDIVERT_LAYER_FLOW)
LayerSocket = Layer(C.WINDIVERT_LAYER_SOCKET)
LayerReflect = Layer(C.WINDIVERT_LAYER_REFLECT)
//LayerEthernet = Layer(C.WINDIVERT_LAYER_ETHERNET)
)
const (
EventNetworkPacket = Event(C.WINDIVERT_EVENT_NETWORK_PACKET)
EventFlowEstablished = Event(C.WINDIVERT_EVENT_FLOW_ESTABLISHED)
EventFlowDeleted = Event(C.WINDIVERT_EVENT_FLOW_DELETED)
EventSocketBind = Event(C.WINDIVERT_EVENT_SOCKET_BIND)
EventSocketConnect = Event(C.WINDIVERT_EVENT_SOCKET_CONNECT)
EventSocketListen = Event(C.WINDIVERT_EVENT_SOCKET_LISTEN)
EventSocketAccept = Event(C.WINDIVERT_EVENT_SOCKET_ACCEPT)
EventSocketClose = Event(C.WINDIVERT_EVENT_SOCKET_CLOSE)
EventReflectOpen = Event(C.WINDIVERT_EVENT_REFLECT_OPEN)
EventReflectClose = Event(C.WINDIVERT_EVENT_REFLECT_CLOSE)
//EventEthernetFrame = Event(C.WINDIVERT_EVENT_ETHERNET_FRAME)
)
const (
ShutdownRecv = Shutdown(C.WINDIVERT_SHUTDOWN_RECV)
ShutdownSend = Shutdown(C.WINDIVERT_SHUTDOWN_SEND)
ShutdownBoth = Shutdown(C.WINDIVERT_SHUTDOWN_BOTH)
)
const (
QueueLength = Param(C.WINDIVERT_PARAM_QUEUE_LENGTH)
QueueTime = Param(C.WINDIVERT_PARAM_QUEUE_TIME)
QueueSize = Param(C.WINDIVERT_PARAM_QUEUE_SIZE)
VersionMajor = Param(C.WINDIVERT_PARAM_VERSION_MAJOR)
VersionMinor = Param(C.WINDIVERT_PARAM_VERSION_MINOR)
)
const (
FlagDefault = uint64(0)
FlagSniff = uint64(C.WINDIVERT_FLAG_SNIFF)
FlagDrop = uint64(C.WINDIVERT_FLAG_DROP)
FlagRecvOnly = uint64(C.WINDIVERT_FLAG_RECV_ONLY)
FlagSendOnly = uint64(C.WINDIVERT_FLAG_SEND_ONLY)
FlagNoInstall = uint64(C.WINDIVERT_FLAG_NO_INSTALL)
FlagFragments = uint64(C.WINDIVERT_FLAG_FRAGMENTS)
)
const (
PriorityDefault = int16(0)
PriorityHighest = int16(C.WINDIVERT_PRIORITY_HIGHEST)
PriorityLowest = int16(C.WINDIVERT_PRIORITY_LOWEST)
QueueLengthDefault = uint64(C.WINDIVERT_PARAM_QUEUE_LENGTH_DEFAULT)
QueueLengthMin = uint64(C.WINDIVERT_PARAM_QUEUE_LENGTH_MIN)
QueueLengthMax = uint64(C.WINDIVERT_PARAM_QUEUE_LENGTH_MAX)
QueueTimeDefault = uint64(C.WINDIVERT_PARAM_QUEUE_TIME_DEFAULT)
QueueTimeMin = uint64(C.WINDIVERT_PARAM_QUEUE_TIME_MIN)
QueueTimeMax = uint64(C.WINDIVERT_PARAM_QUEUE_TIME_MAX)
QueueSizeDefault = uint64(C.WINDIVERT_PARAM_QUEUE_SIZE_DEFAULT)
QueueSizeMin = uint64(C.WINDIVERT_PARAM_QUEUE_SIZE_MIN)
QueueSizeMax = uint64(C.WINDIVERT_PARAM_QUEUE_SIZE_MAX)
)
const (
ChecksumDefault = uint64(0)
NoIPChecksum = uint64(C.WINDIVERT_HELPER_NO_IP_CHECKSUM)
NoICMPChecksum = uint64(C.WINDIVERT_HELPER_NO_ICMP_CHECKSUM)
NoICMPV6Checksum = uint64(C.WINDIVERT_HELPER_NO_ICMPV6_CHECKSUM)
NoTCPChecksum = uint64(C.WINDIVERT_HELPER_NO_TCP_CHECKSUM)
NoUDPChecksum = uint64(C.WINDIVERT_HELPER_NO_UDP_CHECKSUM)
)
const (
BatchMax = int(C.WINDIVERT_BATCH_MAX)
MTUMax = int(C.WINDIVERT_MTU_MAX)
)