-rw-r--r-- | include/kingate/fastcgi.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/kingate/fastcgi.h b/include/kingate/fastcgi.h index fd293b9..6f136b3 100644 --- a/include/kingate/fastcgi.h +++ b/include/kingate/fastcgi.h | |||
@@ -1,98 +1,113 @@ | |||
1 | #ifndef __KINGATE_FASTCGI_H | 1 | #ifndef __KINGATE_FASTCGI_H |
2 | #define __KINGATE_FASTCGI_H | 2 | #define __KINGATE_FASTCGI_H |
3 | 3 | ||
4 | #include "kingate/cgi_interface.h" | 4 | #include "kingate/cgi_interface.h" |
5 | #include <fcgio.h> | 5 | #include <fcgio.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * @file | 8 | * @file |
9 | * @brief the fastcgi-specific implementation. | 9 | * @brief the fastcgi-specific implementation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | namespace kingate { | 12 | namespace kingate { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * The fcgi listening socket. | 15 | * The fcgi listening socket. |
16 | */ | 16 | */ |
17 | class fcgi_socket { | 17 | class fcgi_socket { |
18 | static bool _initialized; | 18 | static bool _initialized; |
19 | public: | 19 | public: |
20 | /** | 20 | /** |
21 | * socket file descriptor. | 21 | * socket file descriptor. |
22 | */ | 22 | */ |
23 | int sock; | 23 | int sock; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @param s the socket name. (if the socket starts with a colon, | 26 | * @param s the socket name. (if the socket starts with a colon, |
27 | * then it is interpreted as a tcp port number. | 27 | * then it is interpreted as a tcp port number. |
28 | * @param bl backlog listen queue depth. | 28 | * @param bl backlog listen queue depth. |
29 | */ | 29 | */ |
30 | fcgi_socket(const char* s,int bl); | 30 | fcgi_socket(const char* s,int bl); |
31 | /** | 31 | /** |
32 | * @param s the file descriptor of preopened socket. | 32 | * @param s the file descriptor of preopened socket. |
33 | */ | 33 | */ |
34 | fcgi_socket(int s); | 34 | fcgi_socket(int s); |
35 | ~fcgi_socket(); | 35 | ~fcgi_socket(); |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * The implementation of the interface to the FastCGI. | 39 | * The implementation of the interface to the FastCGI. |
40 | */ | 40 | */ |
41 | class fcgi_interface : public cgi_interface { | 41 | class fcgi_interface : public cgi_interface { |
42 | public: | 42 | public: |
43 | /** | 43 | /** |
44 | * buffer for sbin | ||
45 | * @see sbin | ||
46 | */ | ||
47 | char buf_sbin[512]; | ||
48 | /** | ||
44 | * stdin fcgi streambuf. | 49 | * stdin fcgi streambuf. |
45 | */ | 50 | */ |
46 | fcgi_streambuf sbin; | 51 | fcgi_streambuf sbin; |
47 | /** | 52 | /** |
53 | * buffer for sbout | ||
54 | * @see sbout | ||
55 | */ | ||
56 | char buf_sbout[512]; | ||
57 | /** | ||
48 | * stdout fcgi streambuf. | 58 | * stdout fcgi streambuf. |
49 | */ | 59 | */ |
50 | fcgi_streambuf sbout; | 60 | fcgi_streambuf sbout; |
51 | /** | 61 | /** |
62 | * buffer for sberr | ||
63 | * @see sberr | ||
64 | */ | ||
65 | char buf_sberr[512]; | ||
66 | /** | ||
52 | * stderr fcgi streambuf. | 67 | * stderr fcgi streambuf. |
53 | */ | 68 | */ |
54 | fcgi_streambuf sberr; | 69 | fcgi_streambuf sberr; |
55 | /** | 70 | /** |
56 | * stdin istream. | 71 | * stdin istream. |
57 | */ | 72 | */ |
58 | istream sin; | 73 | istream sin; |
59 | /** | 74 | /** |
60 | * stdout ostream. | 75 | * stdout ostream. |
61 | */ | 76 | */ |
62 | ostream sout; | 77 | ostream sout; |
63 | /** | 78 | /** |
64 | * stderr ostream. | 79 | * stderr ostream. |
65 | */ | 80 | */ |
66 | ostream serr; | 81 | ostream serr; |
67 | /** | 82 | /** |
68 | * The FCGI request. | 83 | * The FCGI request. |
69 | */ | 84 | */ |
70 | FCGX_Request request; | 85 | FCGX_Request request; |
71 | 86 | ||
72 | /** | 87 | /** |
73 | * @param s the socked used for interfacing with the server. | 88 | * @param s the socked used for interfacing with the server. |
74 | * @param f the request flags (e.g. FCGI_FAIL_ON_INTR). | 89 | * @param f the request flags (e.g. FCGI_FAIL_ON_INTR). |
75 | */ | 90 | */ |
76 | fcgi_interface(fcgi_socket& s,int f=0); | 91 | fcgi_interface(fcgi_socket& s,int f=0); |
77 | virtual ~fcgi_interface(); | 92 | virtual ~fcgi_interface(); |
78 | 93 | ||
79 | /** | 94 | /** |
80 | * @overload cgi_interface::in() | 95 | * @overload cgi_interface::in() |
81 | */ | 96 | */ |
82 | istream& in() { return sin; } | 97 | istream& in() { return sin; } |
83 | /** | 98 | /** |
84 | * @overload cgi_interface::out() | 99 | * @overload cgi_interface::out() |
85 | */ | 100 | */ |
86 | ostream& out() { return sout; } | 101 | ostream& out() { return sout; } |
87 | /** | 102 | /** |
88 | * @overload cgi_interface::out() | 103 | * @overload cgi_interface::out() |
89 | */ | 104 | */ |
90 | ostream& err() { return serr; } | 105 | ostream& err() { return serr; } |
91 | }; | 106 | }; |
92 | 107 | ||
93 | } | 108 | } |
94 | 109 | ||
95 | #endif /* __KINGATE_FASTCGI_H */ | 110 | #endif /* __KINGATE_FASTCGI_H */ |
96 | /* | 111 | /* |
97 | * vim:set ft=cpp: | 112 | * vim:set ft=cpp: |
98 | */ | 113 | */ |