X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fserver.h;fp=source%2Fserver.h;h=ea1213483774799f69c2cc60bd8f3f2c25dc39b6;hb=b06cf07513fdd85e249398ebfce500fbf3dfb6a7;hp=0000000000000000000000000000000000000000;hpb=a4049d7c4126126ca3abd12b1aca8715e7006d44;p=libs%2Fnet.git diff --git a/source/server.h b/source/server.h new file mode 100644 index 0000000..ea12134 --- /dev/null +++ b/source/server.h @@ -0,0 +1,54 @@ +/* $Id$ + +This file is part of libmsphttp +Copyright © 2008 Mikkosoft Productions, Mikko Rasa +Distributed under the LGPL +*/ + +#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; + bool stale; + + Client(RefPtr); + ~Client(); + }; + + Net::StreamListenSocket sock; + std::list clients; + IO::EventDispatcher *event_disp; + +public: + Server(unsigned); + void use_event_dispatcher(IO::EventDispatcher *); +private: + void data_available(); + void client_data_available(Client &); + void client_end_of_file(Client &); +}; + +} // namespace Http +} // namespace Msp + +#endif