ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Daemon.hpp
Revision: 175
Committed: 2004-06-25T01:10:49-07:00 (20 years, 11 months ago) by Douglas Thrift
File size: 932 byte(s)
Log Message:
Arg, I wish it worked better.

File Contents

# User Rev Content
1 Douglas Thrift 164 // Smersh
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _Daemon_hpp_
8     #define _Daemon_hpp_
9    
10 Douglas Thrift 172 #include <menes-api/socket.hpp>
11 Douglas Thrift 173 #include <menes-api/threads.hpp>
12 Douglas Thrift 174 #include <menes-etl/fnbind.hpp>
13     #include <menes-ios/stdadapters.hpp>
14 Douglas Thrift 164
15 Douglas Thrift 172 #include "Person.hpp"
16    
17 Douglas Thrift 164 class Daemon
18     {
19     private:
20 Douglas Thrift 174 virtual int handle(api::TcpSocket* client);
21 Douglas Thrift 164 protected:
22 Douglas Thrift 175 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 Douglas Thrift 173 Daemon() {}
27     void serve(int port, bool fork, Daemon* self);
28 Douglas Thrift 175 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 Douglas Thrift 164 public:
33 Douglas Thrift 173 Daemon(int port, bool fork) { Person::configure(); serve(port, fork, this);
34     }
35 Douglas Thrift 172 virtual ~Daemon() {}
36 Douglas Thrift 164 };
37    
38     #endif // _Daemon_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id