X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fserver.h;fp=source%2Fhttp%2Fserver.h;h=41894db99d6141dc89c901c354d06b4f25ca25b3;hb=cf8d2e48581eeb8f1b83e8c48321a0bc2ffa6d83;hp=0000000000000000000000000000000000000000;hpb=d683ca0964182e9579838fec8d7d100eeabddee0;p=libs%2Fnet.git diff --git a/source/http/server.h b/source/http/server.h new file mode 100644 index 0000000..41894db --- /dev/null +++ b/source/http/server.h @@ -0,0 +1,53 @@ +#ifndef MSP_HTTP_SERVER_H_ +#define MSP_HTTP_SERVER_H_ + +#include +#include +#include + +namespace Msp { +namespace Http { + +class Request; +class Response; + +class Server +{ +public: + sigc::signal signal_request; + +private: + struct Client + { + RefPtr sock; + std::string in_buf; + Request *request; + Response *response; + bool async; + bool stale; + + Client(RefPtr); + ~Client(); + }; + + Net::StreamServerSocket sock; + std::list clients; + IO::EventDispatcher *event_disp; + +public: + Server(unsigned); + unsigned get_port() const; + void use_event_dispatcher(IO::EventDispatcher *); + void delay_response(Response &); + void submit_response(Response &); +private: + void data_available(); + void client_data_available(Client &); + void client_end_of_file(Client &); + Client &get_client_by_response(Response &); +}; + +} // namespace Http +} // namespace Msp + +#endif