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

# Content
1 // Smersh
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #ifndef _Daemon_hpp_
8 #define _Daemon_hpp_
9
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(int port, bool fork) { Person::configure(); serve(port, fork, this);
34 }
35 virtual ~Daemon() {}
36 };
37
38 #endif // _Daemon_hpp_

Properties

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