]>
Commit | Line | Data |
---|---|---|
1 | /** | |
2 | * Seccomp BPF Translator | |
3 | * | |
4 | * Copyright (c) 2012 Red Hat <pmoore@redhat.com> | |
5 | * Author: Paul Moore <paul@paul-moore.com> | |
6 | */ | |
7 | ||
8 | /* | |
9 | * This library is free software; you can redistribute it and/or modify it | |
10 | * under the terms of version 2.1 of the GNU Lesser General Public License as | |
11 | * published by the Free Software Foundation. | |
12 | * | |
13 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
16 | * for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU Lesser General Public License | |
19 | * along with this library; if not, see <http://www.gnu.org/licenses>. | |
20 | */ | |
21 | ||
22 | #ifndef _TRANSLATOR_BPF_H | |
23 | #define _TRANSLATOR_BPF_H | |
24 | ||
25 | #include <inttypes.h> | |
26 | ||
27 | #include "arch.h" | |
28 | #include "db.h" | |
29 | #include "system.h" | |
30 | ||
31 | /* NOTE - do not change this structure, it is part of the prctl() API */ | |
32 | struct bpf_program { | |
33 | uint16_t blk_cnt; | |
34 | bpf_instr_raw *blks; | |
35 | }; | |
36 | #define BPF_PGM_SIZE(x) \ | |
37 | ((x)->blk_cnt * sizeof(*((x)->blks))) | |
38 | ||
39 | struct bpf_program *gen_bpf_generate(const struct db_filter_col *col); | |
40 | void gen_bpf_release(struct bpf_program *program); | |
41 | ||
42 | #endif |