forked from ti-mo/conntrack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
enum.go
304 lines (258 loc) · 12.4 KB
/
enum.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
package conntrack
import "github.com/ti-mo/netfilter"
// All enums in this file are translated from the Linux kernel source at
// include/uapi/linux/netfilter/nfnetlink_conntrack.h
// messageType is a Conntrack-specific representation of a netfilter.MessageType.
// It is used to specify the type of action to execute on the kernel's state table
// (get, create, delete, etc.).
type messageType netfilter.MessageType
// The first three members are similar to NF_NETLINK_CONNTRACK_*, which is still used
// in libnetfilter_conntrack. They can still be used to subscribe to Netlink groups with bind(),
// but subscribing using setsockopt() (like mdlayher/netlink) requires the NFNLGRP_* enum.
//
// enum cntl_msg_types (upstream typo)
const (
ctNew messageType = iota // IPCTNL_MSG_CT_NEW
ctGet // IPCTNL_MSG_CT_GET
ctDelete // IPCTNL_MSG_CT_DELETE
ctGetCtrZero // IPCTNL_MSG_CT_GET_CTRZERO
ctGetStatsCPU // IPCTNL_MSG_CT_GET_STATS_CPU
ctGetStats // IPCTNL_MSG_CT_GET_STATS
ctGetDying // IPCTNL_MSG_CT_GET_DYING
ctGetUnconfirmed // IPCTNL_MSG_CT_GET_UNCONFIRMED
)
// expMessageType is a Conntrack-specific representation of a netfilter.MessageType.
// It holds information about Conntrack Expect events; state created by Conntrack helpers.
type expMessageType netfilter.MessageType
// enum ctnl_exp_msg_types
const (
ctExpNew expMessageType = iota // IPCTNL_MSG_EXP_NEW
ctExpGet // IPCTNL_MSG_EXP_GET
ctExpDelete // IPCTNL_MSG_EXP_DELETE
ctExpGetStatsCPU // IPCTNL_MSG_EXP_GET_STATS_CPU
)
// attributeType defines the meaning of a root-level Type
// value of a Conntrack-specific Netfilter attribute.
type attributeType uint8
// enum ctattr_type
const (
ctaUnspec attributeType = iota // CTA_UNSPEC
ctaTupleOrig // CTA_TUPLE_ORIG
ctaTupleReply // CTA_TUPLE_REPLY
ctaStatus // CTA_STATUS
ctaProtoInfo // CTA_PROTOINFO
ctaHelp // CTA_HELP
ctaNatSrc // CTA_NAT_SRC, Deprecated
ctaTimeout // CTA_TIMEOUT
ctaMark // CTA_MARK
ctaCountersOrig // CTA_COUNTERS_ORIG
ctaCountersReply // CTA_COUNTERS_REPLY
ctaUse // CTA_USE
ctaID // CTA_ID
ctaNatDst // CTA_NAT_DST, Deprecated
ctaTupleMaster // CTA_TUPLE_MASTER
ctaSeqAdjOrig // CTA_SEQ_ADJ_ORIG
ctaSeqAdjReply // CTA_SEQ_ADJ_REPLY
ctaSecMark // CTA_SECMARK, Deprecated
ctaZone // CTA_ZONE
ctaSecCtx // CTA_SECCTX
ctaTimestamp // CTA_TIMESTAMP
ctaMarkMask // CTA_MARK_MASK
ctaLabels // CTA_LABELS
ctaLabelsMask // CTA_LABELS_MASK
ctaSynProxy // CTA_SYNPROXY
)
// tupleType describes the type of tuple contained in this container.
type tupleType uint8
// enum ctattr_tuple
const (
ctaTupleUnspec tupleType = iota //CTA_TUPLE_UNSPEC
ctaTupleIP // CTA_TUPLE_IP
ctaTupleProto // CTA_TUPLE_PROTO
ctaTupleZone // CTA_TUPLE_ZONE
)
// protoTupleType describes the type of Layer 4 protocol metadata in this container.
type protoTupleType uint8
// enum ctattr_l4proto
const (
ctaProtoUnspec protoTupleType = iota // CTA_PROTO_UNSPEC
ctaProtoNum // CTA_PROTO_NUM
ctaProtoSrcPort // CTA_PROTO_SRC_PORT
ctaProtoDstPort // CTA_PROTO_DST_PORT
ctaProtoICMPID // CTA_PROTO_ICMP_ID
ctaProtoICMPType // CTA_PROTO_ICMP_TYPE
ctaProtoICMPCode // CTA_PROTO_ICMP_CODE
ctaProtoICMPv6ID // CTA_PROTO_ICMPV6_ID
ctaProtoICMPv6Type // CTA_PROTO_ICMPV6_TYPE
ctaProtoICMPv6Code // CTA_PROTO_ICMPV6_CODE
)
// ipTupleType describes the type of IP address in this container.
type ipTupleType uint8
// enum ctattr_ip
const (
ctaIPUnspec ipTupleType = iota // CTA_IP_UNSPEC
ctaIPv4Src // CTA_IP_V4_SRC
ctaIPv4Dst // CTA_IP_V4_DST
ctaIPv6Src // CTA_IP_V6_SRC
ctaIPv6Dst // CTA_IP_V6_DST
)
// helperType describes the kind of helper in this container.
type helperType uint8
// enum ctattr_help
const (
ctaHelpUnspec helperType = iota // CTA_HELP_UNSPEC
ctaHelpName // CTA_HELP_NAME
ctaHelpInfo // CTA_HELP_INFO
)
// counterType describes the kind of counter in this container.
type counterType uint8
// enum ctattr_counters
const (
ctaCountersUnspec counterType = iota // CTA_COUNTERS_UNSPEC
ctaCountersPackets // CTA_COUNTERS_PACKETS
ctaCountersBytes // CTA_COUNTERS_BYTES
_ // CTA_COUNTERS32_PACKETS, old 32bit counters, unused
_ // CTA_COUNTERS32_BYTES, old 32bit counters, unused
ctaCountersPad // CTA_COUNTERS_PAD
)
// timestampType describes the type of timestamp in this container.
type timestampType uint8
// enum ctattr_tstamp
const (
ctaTimestampUnspec timestampType = iota // CTA_TIMESTAMP_UNSPEC
ctaTimestampStart // CTA_TIMESTAMP_START
ctaTimestampStop // CTA_TIMESTAMP_STOP
ctaTimestampPad // CTA_TIMESTAMP_PAD
)
// securityType describes the type of SecCtx value in this container.
type securityType uint8
// enum ctattr_secctx
const (
ctaSecCtxUnspec securityType = iota // CTA_SECCTX_UNSPEC
ctaSecCtxName // CTA_SECCTX_NAME
)
// protoInfoType describes the kind of protocol info in this container.
type protoInfoType uint8
// enum ctattr_protoinfo
const (
ctaProtoInfoUnspec protoInfoType = iota // CTA_PROTOINFO_UNSPEC
ctaProtoInfoTCP // CTA_PROTOINFO_TCP
ctaProtoInfoDCCP // CTA_PROTOINFO_DCCP
ctaProtoInfoSCTP // CTA_PROTOINFO_SCTP
)
// protoInfoTCPType describes the kind of TCP protocol info attribute in this container.
type protoInfoTCPType uint8
// enum ctattr_protoinfo_tcp
const (
ctaProtoInfoTCPUnspec protoInfoTCPType = iota // CTA_PROTOINFO_TCP_UNSPEC
ctaProtoInfoTCPState // CTA_PROTOINFO_TCP_STATE
ctaProtoInfoTCPWScaleOriginal // CTA_PROTOINFO_TCP_WSCALE_ORIGINAL
ctaProtoInfoTCPWScaleReply // CTA_PROTOINFO_TCP_WSCALE_REPLY
ctaProtoInfoTCPFlagsOriginal // CTA_PROTOINFO_TCP_FLAGS_ORIGINAL
ctaProtoInfoTCPFlagsReply // CTA_PROTOINFO_TCP_FLAGS_REPLY
)
// protoInfoDCCPType describes the kind of DCCP protocol info attribute in this container.
type protoInfoDCCPType uint8
// enum ctattr_protoinfo_dccp
const (
ctaProtoInfoDCCPUnspec protoInfoDCCPType = iota // CTA_PROTOINFO_DCCP_UNSPEC
ctaProtoInfoDCCPState // CTA_PROTOINFO_DCCP_STATE
ctaProtoInfoDCCPRole // CTA_PROTOINFO_DCCP_ROLE
ctaProtoInfoDCCPHandshakeSeq // CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ
ctaProtoInfoDCCPPad // CTA_PROTOINFO_DCCP_PAD (never sent by kernel)
)
// protoInfoSCTPType describes the kind of SCTP protocol info attribute in this container.
type protoInfoSCTPType uint8
// enum ctattr_protoinfo_sctp
const (
ctaProtoInfoSCTPUnspec protoInfoSCTPType = iota // CTA_PROTOINFO_SCTP_UNSPEC
ctaProtoInfoSCTPState // CTA_PROTOINFO_SCTP_STATE
ctaProtoInfoSCTPVTagOriginal // CTA_PROTOINFO_SCTP_VTAG_ORIGINAL
ctaProtoInfoSCTPVtagReply // CTA_PROTOINFO_SCTP_VTAG_REPLY
)
// seqAdjType describes the type of sequence adjustment in this container.
type seqAdjType uint8
// enum ctattr_seqadj
const (
ctaSeqAdjUnspec seqAdjType = iota // CTA_SEQADJ_UNSPEC
ctaSeqAdjCorrectionPos // CTA_SEQADJ_CORRECTION_POS
ctaSeqAdjOffsetBefore // CTA_SEQADJ_OFFSET_BEFORE
ctaSeqAdjOffsetAfter // CTA_SEQADJ_OFFSET_AFTER
)
// synProxyType describes the type of SYNproxy attribute in this container.
type synProxyType uint8
// enum ctattr_synproxy
const (
ctaSynProxyUnspec synProxyType = iota // CTA_SYNPROXY_UNSPEC
ctaSynProxyISN // CTA_SYNPROXY_ISN
ctaSynProxyITS // CTA_SYNPROXY_ITS
ctaSynProxyTSOff // CTA_SYNPROXY_TSOFF
)
// expectType describes the type of expect attribute in this container.
type expectType uint8
// enum ctattr_expect
const (
ctaExpectUnspec expectType = iota // CTA_EXPECT_UNSPEC
ctaExpectMaster // CTA_EXPECT_MASTER
ctaExpectTuple // CTA_EXPECT_TUPLE
ctaExpectMask // CTA_EXPECT_MASK
ctaExpectTimeout // CTA_EXPECT_TIMEOUT
ctaExpectID // CTA_EXPECT_ID
ctaExpectHelpName // CTA_EXPECT_HELP_NAME
ctaExpectZone // CTA_EXPECT_ZONE
ctaExpectFlags // CTA_EXPECT_FLAGS
ctaExpectClass // CTA_EXPECT_CLASS
ctaExpectNAT // CTA_EXPECT_NAT
ctaExpectFN // CTA_EXPECT_FN
)
// expectNATType describes the type of NAT expect attribute in this container.
type expectNATType uint8
// enum ctattr_expect_nat
const (
ctaExpectNATUnspec expectNATType = iota // CTA_EXPECT_NAT_UNSPEC
ctaExpectNATDir // CTA_EXPECT_NAT_DIR
ctaExpectNATTuple // CTA_EXPECT_NAT_TUPLE
)
// cpuStatsType describes the type of CPU-specific conntrack statistics attribute in this container.
type cpuStatsType uint8
// ctattr_stats_cpu
const (
ctaStatsUnspec cpuStatsType = iota // CTA_STATS_UNSPEC
ctaStatsSearched // CTA_STATS_SEARCHED, no longer used
ctaStatsFound // CTA_STATS_FOUND
ctaStatsNew // CTA_STATS_NEW, no longer used
ctaStatsInvalid // CTA_STATS_INVALID
ctaStatsIgnore // CTA_STATS_IGNORE
ctaStatsDelete // CTA_STATS_DELETE, no longer used
ctaStatsDeleteList // CTA_STATS_DELETE_LIST, no longer used
ctaStatsInsert // CTA_STATS_INSERT
ctaStatsInsertFailed // CTA_STATS_INSERT_FAILED
ctaStatsDrop // CTA_STATS_DROP
ctaStatsEarlyDrop // CTA_STATS_EARLY_DROP
ctaStatsError // CTA_STATS_ERROR
ctaStatsSearchRestart // CTA_STATS_SEARCH_RESTART
)
// globalStatsType describes the type of global conntrack statistics attribute in this container.
type globalStatsType uint8
// enum ctattr_stats_global
const (
ctaStatsGlobalUnspec globalStatsType = iota // CTA_STATS_GLOBAL_UNSPEC
ctaStatsGlobalEntries // CTA_STATS_GLOBAL_ENTRIES
ctaStatsGlobalMaxEntries // CTA_STATS_GLOBAL_MAX_ENTRIES
)
// expectStatsType describes the type of expectation statistics attribute in this container.
type expectStatsType uint8
// enum ctattr_expect_stats
const (
ctaStatsExpUnspec expectStatsType = iota // CTA_STATS_EXP_UNSPEC
ctaStatsExpNew // CTA_STATS_EXP_NEW
ctaStatsExpCreate // CTA_STATS_EXP_CREATE
ctaStatsExpDelete // CTA_STATS_EXP_DELETE
)
// enum ctattr_natseq is unused in the kernel source
// Unused unspec constants.
var _ = []uint8{
uint8(ctaHelpUnspec), uint8(ctaCountersUnspec), uint8(ctaTimestampUnspec),
uint8(ctaSecCtxUnspec), uint8(ctaProtoInfoTCPUnspec), uint8(ctaProtoInfoDCCPUnspec),
uint8(ctaProtoInfoSCTPUnspec), uint8(ctaSeqAdjUnspec), uint8(ctaSynProxyUnspec),
}