2 # Seccomp Library Python Bindings
4 # Copyright (c) 2012,2013 Red Hat <pmoore@redhat.com>
5 # Author: Paul Moore <paul@paul-moore.com>
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.
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
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>.
22 from libc.stdint cimport uint8_t, uint32_t, uint64_t
24 cdef extern from "seccomp.h":
26 cdef struct scmp_version:
31 ctypedef void* scmp_filter_ctx
52 cdef enum scmp_filter_attr:
53 SCMP_FLTATR_ACT_DEFAULT
54 SCMP_FLTATR_ACT_BADARCH
58 cdef enum scmp_compare:
71 unsigned int SCMP_ACT_ERRNO(int errno)
72 unsigned int SCMP_ACT_TRACE(int value)
74 ctypedef uint64_t scmp_datum_t
76 cdef struct scmp_arg_cmp:
82 scmp_version *seccomp_version()
84 scmp_filter_ctx seccomp_init(uint32_t def_action)
85 int seccomp_reset(scmp_filter_ctx ctx, uint32_t def_action)
86 void seccomp_release(scmp_filter_ctx ctx)
88 int seccomp_merge(scmp_filter_ctx ctx_dst, scmp_filter_ctx ctx_src)
90 uint32_t seccomp_arch_resolve_name(char *arch_name)
91 uint32_t seccomp_arch_native()
92 int seccomp_arch_exist(scmp_filter_ctx ctx, int arch_token)
93 int seccomp_arch_add(scmp_filter_ctx ctx, int arch_token)
94 int seccomp_arch_remove(scmp_filter_ctx ctx, int arch_token)
96 int seccomp_load(scmp_filter_ctx ctx)
98 int seccomp_attr_get(scmp_filter_ctx ctx,
99 scmp_filter_attr attr, uint32_t* value)
100 int seccomp_attr_set(scmp_filter_ctx ctx,
101 scmp_filter_attr attr, uint32_t value)
103 char *seccomp_syscall_resolve_num_arch(int arch_token, int num)
104 int seccomp_syscall_resolve_name_arch(int arch_token, char *name)
105 int seccomp_syscall_resolve_name_rewrite(int arch_token, char *name)
106 int seccomp_syscall_resolve_name(char *name)
107 int seccomp_syscall_priority(scmp_filter_ctx ctx,
108 int syscall, uint8_t priority)
110 int seccomp_rule_add(scmp_filter_ctx ctx, uint32_t action,
111 int syscall, unsigned int arg_cnt, ...)
112 int seccomp_rule_add_array(scmp_filter_ctx ctx,
113 uint32_t action, int syscall,
114 unsigned int arg_cnt,
115 scmp_arg_cmp *arg_array)
116 int seccomp_rule_add_exact(scmp_filter_ctx ctx, uint32_t action,
117 int syscall, unsigned int arg_cnt, ...)
118 int seccomp_rule_add_exact_array(scmp_filter_ctx ctx,
119 uint32_t action, int syscall,
120 unsigned int arg_cnt,
121 scmp_arg_cmp *arg_array)
123 int seccomp_export_pfc(scmp_filter_ctx ctx, int fd)
124 int seccomp_export_bpf(scmp_filter_ctx ctx, int fd)
126 # kate: syntax python;
127 # kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;