// http2email/Http2EmailDaemon.hh // This file is part of Decimail; see http://decimail.org/ // (C) 2005-2006 Philip Endecott // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef Http2EmailDaemon_hh #define Http2EmailDaemon_hh #include #include #include #include #include "HttpDaemon.hh" #include "HttpRequest.hh" #include "HttpResponse.hh" #include "SessionId.hh" #include "ImapConnection.hh" #include "Shared.hh" class Http2EmailDaemon: public pbe::HttpDaemon { private: typedef std::map raw_connections_t; typedef Shared connections_t; connections_t connections; const std::string imap_host; const short imap_port; const std::string smtp_host; const short smtp_port; boost::thread* reaper_thread; public: Http2EmailDaemon(short httpport=8143, std::string user="", short imap_port_=143, std::string imap_host_="localhost", short smtp_port_=25, std::string smtp_host_="localhost"): HttpDaemon(httpport,"http2email",user,false), imap_host(imap_host_), imap_port(imap_port_), smtp_host(smtp_host_), smtp_port(smtp_port_) {} void handle(const pbe::HttpRequest& req, pbe::HttpResponse& resp); void startup(void); private: void handle_imap(std::string uri, std::string body, pbe::HttpResponse& resp); void handle_smtp(std::string uri, std::string body, pbe::HttpResponse& resp); void run_reaper(void); }; #endif