ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Daemon.hpp
(Generate patch)

Comparing Smersh/Daemon.hpp (file contents):
Revision 164 by Douglas Thrift, 2004-06-17T22:12:33-07:00 vs.
Revision 175 by Douglas Thrift, 2004-06-25T01:10:49-07:00

# Line 7 | Line 7
7   #ifndef _Daemon_hpp_
8   #define _Daemon_hpp_
9  
10 < #include "Smersh.hpp"
10 > #include <menes-api/socket.hpp>
11 > #include <menes-api/threads.hpp>
12 > #include <menes-etl/fnbind.hpp>
13 > #include <menes-ios/stdadapters.hpp>
14 >
15 > #include "Person.hpp"
16  
17   class Daemon
18   {
19   private:
20 +        virtual int handle(api::TcpSocket* client);
21   protected:
22 +        enum Status { ok = 200, found = 302, seeOther, bad = 400, notFound = 404,
23 +                lengthRequired = 411, mediaType = 415, error = 500, notImplemented,
24 +                version = 505 };
25 +        static string crlf;
26 +        Daemon() {}
27 +        void serve(int port, bool fork, Daemon* self);
28 +        istream& getline(istream& sin, string& line) { ::getline(sin, line, '\r');
29 +                sin.get(); return sin; }
30 +        Status request(istream& sin, Environment& env, ostream& post, ostream& log);
31 +        void status(ostream& sout, Status status);
32   public:
33 <        Daemon();
34 <        virtual ~Daemon();
33 >        Daemon(int port, bool fork) { Person::configure(); serve(port, fork, this);
34 >        }
35 >        virtual ~Daemon() {}
36   };
37  
38   #endif // _Daemon_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines