-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathextern.h
99 lines (87 loc) · 3.02 KB
/
extern.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* $Id$ */
/*
* Copyright (c) 2014, 2015, 2016, 2018 Kristaps Dzonsons <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef EXTERN_H
#define EXTERN_H
/*
* Types of field we can read from the child.
* This governs the list of fields into which we'll assign this
* particular field.
*/
enum input {
IN_COOKIE = 0, /* cookies (environment variable) */
IN_QUERY, /* query string */
IN_FORM, /* any sort of standard input form */
IN__MAX
};
enum sandtype {
SAND_WORKER,
SAND_CONTROL_NEW,
SAND_CONTROL_OLD
};
#define KWORKER_PARENT 1
#define KWORKER_CHILD 0
__BEGIN_DECLS
struct kdata *kdata_alloc(int, int, uint16_t,
unsigned int, const struct kopts *);
void kdata_free(struct kdata *, int);
int kworker_auth_child(int, const char *);
enum kcgi_err kworker_auth_parent(int, struct khttpauth *);
enum kcgi_err kworker_child(int,
const struct kvalid *, size_t,
const char *const *, size_t,
unsigned int);
void kworker_fcgi_child(int, int,
const struct kvalid *, size_t,
const char *const *, size_t,
unsigned int);
enum kcgi_err kworker_parent(int, struct kreq *, int, size_t);
int fullread(int, void *, size_t, int, enum kcgi_err *);
enum kcgi_err fullreadword(int, char **);
enum kcgi_err fullreadwordsz(int, char **, size_t *);
int fullreadfd(int, int *, void *, size_t);
void fullwrite(int, const void *, size_t);
enum kcgi_err fullwritenoerr(int, const void *, size_t);
void fullwriteword(int, const char *);
int fullwritefd(int, int, void *, size_t);
int ksandbox_init_child(enum sandtype, int, int, int, int);
#if HAVE_CAPSICUM
int ksandbox_capsicum_init_child
(enum sandtype, int, int, int, int);
#endif
#if HAVE_PLEDGE
int ksandbox_pledge_init_child(enum sandtype);
#endif
#if HAVE_SANDBOX_INIT
int ksandbox_darwin_init_child(enum sandtype);
#endif
#if HAVE_SECCOMP_FILTER
int ksandbox_seccomp_init_child(enum sandtype);
#endif
void kreq_free(struct kreq *);
enum kcgi_err kxsocketpair(int[2]);
enum kcgi_err kxsocketprep(int);
enum kcgi_err kxwaitpid(pid_t);
int kxasprintf(char **, const char *, ...)
__attribute__((format(printf, 2, 3)));
int kxvasprintf(char **, const char *, va_list);
void *kxcalloc(size_t, size_t);
void *kxmalloc(size_t);
void *kxrealloc(void *, size_t);
void *kxreallocarray(void *, size_t, size_t);
char *kxstrdup(const char *);
__END_DECLS
#endif