-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.go
executable file
·89 lines (75 loc) · 1.97 KB
/
types.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
85
86
87
88
89
package nfqueue
import (
"syscall"
"go.aporeto.io/netlink-go/common/syscallwrappers"
)
//Types for various enums needed by the nfqueue subsys in linux
type nfqaAttr int
type nfqConfigCommands uint8
type nfqConfigMode int
//We will write a method to serialize these messages into a byte slice. So so need to be packed
//NfqMsgPacketHdr PacketHdr
//packetID -- unique ID of packet in queue
//hwProtocol -- hw protocol (network order)
//hook -- netfilter hook
//lint complains -- uncomment when needed
// type NfqMsgPacketHdr struct {
// packetID uint32
// hwProtocol uint16
// hook uint8
// }
//Not needed for our usecase
//NfqMsgPacketHwAddress -- HwAddress
//lint complains -- uncomment when needed
// type NfqMsgPacketHwAddress struct { //nolint: structcheck
// hwAddrLen uint16
// _pad uint16 //nolint
// hwaddr [8]uint8
// }
//NfqMsgVerdictHdr -- Verdict Hdr struct
//verdict -- accept/drop
//id -- packetid
type NfqMsgVerdictHdr struct {
verdict uint32
id uint32
}
//NfqMsgMarkHdr -- Mark Payload
//mark -- markval
type NfqMsgMarkHdr struct {
mark uint32
}
//NfqMsgVerdictPayload -- unused
// type NfqMsgVerdictPayload struct { //nolint: structcheck
// iovecs []syscall.Iovec
// }
//NfqMsgConfigCommand -- config command
//Command -- the config command
//pf -- family
type NfqMsgConfigCommand struct {
Command nfqConfigCommands
_pad uint8 //nolint
pf uint16
}
//NfqMsgConfigParams -- Config params
//copyRange -- Range of bytes to copy
//copyMode -- copyMode meta/none/packet
type NfqMsgConfigParams struct {
copyRange uint32
copyMode uint8
}
//NfqMsgConfigQueueLen -- Queue length
//queueLen -- The length of queue
type NfqMsgConfigQueueLen struct {
queueLen uint32
}
//NfqSockHandle -- Sock handle of netlink socket
//fd -- fd of socket
//rcvbufSize -- rcv buffer Size
//lsa -- local address
type NfqSockHandle struct {
Syscalls syscallwrappers.Syscalls
fd int
rcvbufSize uint32
buf []byte
lsa syscall.SockaddrNetlink
}