aboutsummaryrefslogtreecommitdiff
path: root/src/common/sandbox.h
diff options
context:
space:
mode:
authorCristian Toader <cristian.matei.toader@gmail.com>2013-09-02 13:54:43 +0300
committerCristian Toader <cristian.matei.toader@gmail.com>2013-09-02 13:54:43 +0300
commitb4b0eddd29b0b2ad78e4cf61362283034677f42f (patch)
treeb57fbaea35a654ac09d39c6c935e31b8d1ee898a /src/common/sandbox.h
parentfe6e2733ab1e75e0b56741fa06094b257b3695b8 (diff)
downloadtor-b4b0eddd29b0b2ad78e4cf61362283034677f42f.tar
tor-b4b0eddd29b0b2ad78e4cf61362283034677f42f.tar.gz
switched to a more generic way of handling the sandbox configuration
Diffstat (limited to 'src/common/sandbox.h')
-rw-r--r--src/common/sandbox.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index 9a61749a3..59474c4fe 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -40,27 +40,48 @@
#define PARAM_NUM 1
/**
- * Structure used to manage a sandbox configuration.
- *
- * It is implemented as a linked list of parameters. Currently only controls
- * parameters for open, openat, execve, stat64.
+ * Enum used to manage the type of the implementation for general purpose.
*/
-struct pfd_elem {
+typedef enum {
+ /** Libseccomp implementation based on seccomp2*/
+ LIBSECCOMP2 = 0
+} SB_IMPL;
+
+/**
+ * Configuration parameter structure associated with the LIBSECCOMP2
+ * implementation.
+ */
+typedef struct smp_param {
/** syscall associated with parameter. */
int syscall;
/** parameter index. */
int pindex;
/** parameter value. */
- intptr_t param;
+ intptr_t value;
/** parameter flag (0 = not protected, 1 = protected). */
int prot;
+} smp_param_t;
+
+/**
+ * Structure used to manage a sandbox configuration.
+ *
+ * It is implemented as a linked list of parameters. Currently only controls
+ * parameters for open, openat, execve, stat64.
+ */
+struct sandbox_cfg_elem {
+ /** Sandbox implementation which dictates the parameter type. */
+ SB_IMPL implem;
+
+ /** Configuration parameter. */
+ void *param;
- struct pfd_elem *next;
+ /** Next element of the configuration*/
+ struct sandbox_cfg_elem *next;
};
/** Typedef to structure used to manage a sandbox configuration. */
-typedef struct pfd_elem sandbox_cfg_t;
+typedef struct sandbox_cfg_elem sandbox_cfg_t;
/**
* Structure used for keeping a linked list of getaddrinfo pre-recorded