diff options
author | lns <matzeton@googlemail.com> | 2018-04-11 14:28:18 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2018-06-13 18:23:43 +0200 |
commit | f2f11e477a489ac25a4c4be064eddc26fc9d677c (patch) | |
tree | d4f679146a61b28056e772e30570c53fb4721b80 /src/jail.h | |
parent | ebabaa69c0a3ba992895c7a66729e81e0923d5f1 (diff) |
POTD skeleton.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/jail.h')
-rw-r--r-- | src/jail.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/jail.h b/src/jail.h new file mode 100644 index 0000000..ef7d61a --- /dev/null +++ b/src/jail.h @@ -0,0 +1,34 @@ +#ifndef POTD_JAIL_H +#define POTD_JAIL_H 1 + +#include <sys/types.h> +#include <unistd.h> + +#include "forward.h" +#include "pevent.h" + +#define MIN_STACKSIZE 2048 +#define MAX_STACKSIZE BUFSIZ + +typedef struct jail_ctx { + forward_ctx fwd_ctx; + char host_buf[NI_MAXHOST], service_buf[NI_MAXSERV]; + size_t stacksize; + void *stack_ptr; + void *stack_beg; + char *newroot; +} jail_ctx; + + +void jail_init_ctx(jail_ctx **ctx, size_t stacksize); + +int jail_setup(jail_ctx *ctx, + const char *listen_addr, const char *listen_port); + +int jail_validate_ctx(const jail_ctx *jail_ctx); + +int jail_setup_event(jail_ctx *ctx[], size_t siz, event_ctx **ev_ctx); + +pid_t jail_daemonize(event_ctx **ev_ctx, jail_ctx *ctx[], size_t siz); + +#endif |