-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.h
More file actions
64 lines (53 loc) · 922 Bytes
/
task.h
File metadata and controls
64 lines (53 loc) · 922 Bytes
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
#ifndef TASK_H
#define TASK_H
struct client;
enum task {
TASK_READ = 0,
TASK_DIR,
TASK_TXT,
TASK_GOPHERMAP,
TASK_GPH,
TASK_BINARY,
TASK_ERROR,
TASK_REDIRECT,
TASK_CGI,
TASK_DCGI,
};
struct dir_task {
struct dirent **entries;
char *base;
int n;
int i;
int dfd;
};
struct txt_task {
char linebuf[512];
int rfd;
size_t used;
};
struct gph_task {
char linebuf[512];
size_t used;
char *base;
int rfd;
};
struct binary_task {
int rfd;
};
struct cgi_task {
ev_io input_watcher;
ev_child child_watcher;
pid_t pid;
int rfd;
};
struct dcgi_task {
struct gph_task gpht;
struct cgi_task ct;
};
struct task_ {
void (*init)(EV_P_ struct client *c, int fd, struct stat *sb, const char *path, const char *fn, const char *pi, const char *qs, const char *ss);
void (*update)(EV_P_ struct client *c, int events);
void (*finish)(EV_P_ struct client *c);
};
extern const struct task_ tasks[];
#endif