summaryrefslogtreecommitdiffabout
path: root/include/kingate/fastcgi.h
authorMichael Krelin <hacker@klever.net>2005-01-29 20:14:37 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 20:14:37 (UTC)
commitff4b919683537625f693eedf53006364d0f8444d (patch) (side-by-side diff)
tree4c19e38c0832b16b4ca98ae5af6542d932373eb1 /include/kingate/fastcgi.h
parentf9a64a67c89a7566e63ed66c3a69c359abea4dfd (diff)
downloadkingate-ff4b919683537625f693eedf53006364d0f8444d.zip
kingate-ff4b919683537625f693eedf53006364d0f8444d.tar.gz
kingate-ff4b919683537625f693eedf53006364d0f8444d.tar.bz2
initial commit into repository0.0
Diffstat (limited to 'include/kingate/fastcgi.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/kingate/fastcgi.h98
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 @@
+#ifndef __KINGATE_FASTCGI_H
+#define __KINGATE_FASTCGI_H
+
+#include "kingate/cgi_interface.h"
+#include <fcgio.h>
+
+/**
+ * @file
+ * @brief the fastcgi-specific implementation.
+ */
+
+namespace kingate {
+
+ /**
+ * The fcgi listening socket.
+ */
+ class fcgi_socket {
+ static bool _initialized;
+ public:
+ /**
+ * socket file descriptor.
+ */
+ int sock;
+
+ /**
+ * @param s the socket name. (if the socket starts with a colon,
+ * then it is interpreted as a tcp port number.
+ * @param bl backlog listen queue depth.
+ */
+ fcgi_socket(const char* s,int bl);
+ /**
+ * @param s the file descriptor of preopened socket.
+ */
+ fcgi_socket(int s);
+ ~fcgi_socket();
+ };
+
+ /**
+ * The implementation of the interface to the FastCGI.
+ */
+ class fcgi_interface : public cgi_interface {
+ public:
+ /**
+ * stdin fcgi streambuf.
+ */
+ fcgi_streambuf sbin;
+ /**
+ * stdout fcgi streambuf.
+ */
+ fcgi_streambuf sbout;
+ /**
+ * stderr fcgi streambuf.
+ */
+ fcgi_streambuf sberr;
+ /**
+ * stdin istream.
+ */
+ istream sin;
+ /**
+ * stdout ostream.
+ */
+ ostream sout;
+ /**
+ * stderr ostream.
+ */
+ ostream serr;
+ /**
+ * The FCGI request.
+ */
+ FCGX_Request request;
+
+ /**
+ * @param s the socked used for interfacing with the server.
+ * @param f the request flags (e.g. FCGI_FAIL_ON_INTR).
+ */
+ fcgi_interface(fcgi_socket& s,int f=0);
+ virtual ~fcgi_interface();
+
+ /**
+ * @overload cgi_interface::in()
+ */
+ istream& in() { return sin; }
+ /**
+ * @overload cgi_interface::out()
+ */
+ ostream& out() { return sout; }
+ /**
+ * @overload cgi_interface::out()
+ */
+ ostream& err() { return serr; }
+ };
+
+}
+
+#endif /* __KINGATE_FASTCGI_H */
+/*
+ * vim:set ft=cpp:
+ */