-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfcgi.h
87 lines (71 loc) · 1.47 KB
/
fcgi.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
#ifndef __FCGI_H
#define __FCGI_H
#include <stddef.h>
#include <event.h>
#include <semaphore.h>
#include "type.h"
#include "trie.h"
#include "list.h"
struct fcgi
{
/* fastcgi request information */
int request_id;
int version;
int role;
char flags;
/* Misc */
struct bufferevent* bufev;
int sockfd;
sem_t stdin_ready;
int stdin_read;
int stdin_write;
sem_t stdout_ready;
int stdout_read;
int stdout_write;
sem_t stderr_ready;
int stderr_read;
int stderr_write;
struct list_elem elem;
/* key => value mapping for environment variables */
struct trie env;
char* _stdin;
};
enum fcgi_type
{
BEGIN_REQUEST = 1,
ABORT_REQUEST = 2,
END_REQUEST = 3,
PARAMS = 4,
STDIN = 5,
STDOUT = 6,
STDERR = 7,
DATA = 8,
GET_VALUES = 9,
GET_VALUES_RESULT = 10,
UNKNOWN_TYPE = 11
};
enum fcgi_role
{
FCGI_RESPONDER = 1,
FCGI_AUTHORIZER = 2,
FCGI_FILTER = 3
};
/*
* Literal layout of a fastcgi multiplexed frame.
* */
struct frame_header
{
byte version;
byte type;
byte request_id_1;
byte request_id_0;
byte content_length_1;
byte content_length_0;
byte padding_length;
byte reserved;
};
void init_fcgi ();
int fcgi_read (const char* str, size_t num, struct bufferevent* in);
void fcgi_env_add (struct fcgi* fcgi, const char* key, const char* val);
const char* fcgi_env_get (struct fcgi* fcgi, const char* key);
#endif //__FCGI_H