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
// This file is part of linux-support. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT. No part of linux-support, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2020 The developers of linux-support. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT.
// Sourced from `linux/bpf_common.h` and `linux/filter.h`.
/// Instruction class.
pub const
/// Instruction class.
pub const BPF_LD: u16 = 0x00;
/// Instruction class.
pub const BPF_LDX: u16 = 0x01;
/// Instruction class.
pub const BPF_ST: u16 = 0x02;
/// Instruction class.
pub const BPF_STX: u16 = 0x03;
/// Instruction class.
pub const BPF_ALU: u16 = 0x04;
/// Instruction class.
pub const BPF_JMP: u16 = 0x05;
/// Instruction class.
pub const BPF_RET: u16 = 0x06;
/// Instruction class.
pub const BPF_MISC: u16 = 0x07;
/// ld/ldx field (size).
pubconst
/// ld/ldx field (size).
///
/// 32-bit.
pub const BPF_W: u16 = 0x00;
/// ld/ldx field (size).
///
/// 16-bit.
pub const BPF_H: u16 = 0x08;
/// ld/ldx field (size).
///
/// 8-bit.
pub const BPF_B: u16 = 0x10;
/// ld/ldx field (addressing mode).
pubconst
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Constant.
pub const BPF_IMM: u16 = 0x00;
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Struct (Packet) Data at a Fixed Offset.
pub const BPF_ABS: u16 = 0x20;
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Struct (Packet) Data at a Variable Offset.
pub const BPF_IND: u16 = 0x40;
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Word in the Scratch Memory store.
pub const BPF_MEM: u16 = 0x60;
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Struct (Packet) Length.
pub const BPF_LEN: u16 = 0x80;
/// ld/ldx field (addressing mode).
///
/// Addressing Mode: Hack for efficiently loading the IP header length.
pub const BPF_MSH: u16 = 0xA0;
/// alu/jmp field (op).
pub const
/// alu/jmp field (op).
pub const BPF_ADD: u16 = 0x00;
/// alu/jmp field (op).
pub const BPF_SUB: u16 = 0x10;
/// alu/jmp field (op).
pub const BPF_MUL: u16 = 0x20;
/// alu/jmp field (op).
pub const BPF_DIV: u16 = 0x30;
/// alu/jmp field (op).
pub const BPF_OR: u16 = 0x40;
/// alu/jmp field (op).
pub const BPF_AND: u16 = 0x50;
/// alu/jmp field (op).
pub const BPF_LSH: u16 = 0x60;
/// alu/jmp field (op).
pub const BPF_RSH: u16 = 0x70;
/// alu/jmp field (op).
pub const BPF_NEG: u16 = 0x80;
/// alu/jmp field (op).
pub const BPF_MOD: u16 = 0x90;
/// alu/jmp field (op).
pub const BPF_XOR: u16 = 0xA0;
/// alu/jmp field (op).
pub const BPF_JA: u16 = 0x00;
/// alu/jmp field (op).
pub const BPF_JEQ: u16 = 0x10;
/// alu/jmp field (op).
pub const BPF_JGT: u16 = 0x20;
/// alu/jmp field (op).
pub const BPF_JGE: u16 = 0x30;
/// alu/jmp field (op).
pub const BPF_JSET: u16 = 0x40;
/// alu/jmp field source.
pubconst
/// alu/jmp field source or return value.
///
/// Source is constant.
pub const BPF_K: u16 = 0x00;
/// alu/jmp field source only.
///
/// Source is IndexRegister (`X`).
pub const BPF_X: u16 = 0x08;
/// return value only.
pub const
/// alu/jmp field return value only.
///
/// Source is Accumulator (`X`).
pub const BPF_A: u16 = 0x10;
/// Miscellanous op.
pub const
/// Miscellanous op.
pub const BPF_TAX: u16 = 0x00;
/// Miscellanous op.
pub const BPF_TXA: u16 = 0x80;