From ff4b919683537625f693eedf53006364d0f8444d Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Sat, 29 Jan 2005 20:14:37 +0000 Subject: initial commit into repository --- (limited to 'include/kingate/fastcgi.h') 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 + +/** + * @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: + */ -- cgit v0.9.0.2