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