| Index: sandbox/linux/system_headers/linux_filter.h
|
| diff --git a/sandbox/linux/system_headers/linux_filter.h b/sandbox/linux/system_headers/linux_filter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..748846cfb9b053b21827131c0593064eea6d2dd2
|
| --- /dev/null
|
| +++ b/sandbox/linux/system_headers/linux_filter.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_FILTER_H_
|
| +#define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_FILTER_H_
|
| +
|
| +#include <stdint.h>
|
| +
|
| +// The following structs and macros are taken from linux/filter.h,
|
| +// as some toolchain does not expose them.
|
| +struct sock_filter {
|
| + uint16_t code;
|
| + uint8_t jt;
|
| + uint8_t jf;
|
| + uint32_t k;
|
| +};
|
| +
|
| +struct sock_fprog {
|
| + uint16_t len;
|
| + struct sock_filter *filter;
|
| +};
|
| +
|
| +#define BPF_CLASS(code) ((code) & 0x07)
|
| +#define BPF_LD 0x00
|
| +#define BPF_ALU 0x04
|
| +#define BPF_JMP 0x05
|
| +#define BPF_RET 0x06
|
| +
|
| +#define BPF_SIZE(code) ((code) & 0x18)
|
| +#define BPF_W 0x00
|
| +
|
| +#define BPF_MODE(code) ((code) & 0xe0)
|
| +#define BPF_ABS 0x20
|
| +
|
| +#define BPF_OP(code) ((code) & 0xf0)
|
| +#define BPF_ADD 0x00
|
| +#define BPF_SUB 0x10
|
| +#define BPF_MUL 0x20
|
| +#define BPF_DIV 0x30
|
| +#define BPF_OR 0x40
|
| +#define BPF_AND 0x50
|
| +#define BPF_LSH 0x60
|
| +#define BPF_RSH 0x70
|
| +#define BPF_NEG 0x80
|
| +#define BPF_MOD 0x90
|
| +#define BPF_XOR 0xA0
|
| +
|
| +#define BPF_JA 0x00
|
| +#define BPF_JEQ 0x10
|
| +#define BPF_JGT 0x20
|
| +#define BPF_JGE 0x30
|
| +#define BPF_JSET 0x40
|
| +
|
| +#define BPF_SRC(code) ((code) & 0x08)
|
| +#define BPF_K 0x00
|
| +
|
| +#define BPF_MAXINSNS 4096
|
| +
|
| +#endif
|
|
|