1 |
Douglas Thrift |
27 |
// Host Status |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _HostStatus_hpp_ |
8 |
|
|
#define _HostStatus_hpp_ |
9 |
|
|
|
10 |
Douglas Thrift |
32 |
#define _BSD_SOURCE |
11 |
|
|
|
12 |
Douglas Thrift |
27 |
#include <iostream> |
13 |
|
|
#include <string> |
14 |
|
|
#include <sstream> |
15 |
Douglas Thrift |
34 |
#include <list> |
16 |
Douglas Thrift |
44 |
#include <set> |
17 |
Douglas Thrift |
27 |
#include <map> |
18 |
|
|
#include <cstdlib> |
19 |
|
|
#include <ctime> |
20 |
|
|
|
21 |
|
|
#include <pstream.h> |
22 |
|
|
|
23 |
|
|
using namespace std; |
24 |
|
|
using namespace redi; |
25 |
|
|
|
26 |
|
|
inline string sgetenv(const string& name) |
27 |
|
|
{ |
28 |
|
|
char* value = getenv(name.c_str()); |
29 |
|
|
|
30 |
|
|
return value != NULL ? value : ""; |
31 |
|
|
} |
32 |
|
|
|
33 |
Douglas Thrift |
33 |
inline int sputenv(const string& name) |
34 |
|
|
{ |
35 |
|
|
char* value = new char[name.size() + 1]; |
36 |
|
|
|
37 |
|
|
sprintf(value, name.c_str()); |
38 |
Douglas Thrift |
39 |
|
39 |
Douglas Thrift |
33 |
int code = putenv(value); |
40 |
|
|
|
41 |
|
|
return code; |
42 |
|
|
} |
43 |
|
|
|
44 |
Douglas Thrift |
27 |
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
45 |
|
|
|
46 |
|
|
class HostStatus |
47 |
|
|
{ |
48 |
|
|
private: |
49 |
|
|
multimap<string, string> cgi; |
50 |
Douglas Thrift |
35 |
bool page; |
51 |
Douglas Thrift |
39 |
bool host; |
52 |
|
|
bool name; |
53 |
|
|
bool address; |
54 |
|
|
bool platform; |
55 |
|
|
bool since; |
56 |
Douglas Thrift |
29 |
void parse(const string& method); |
57 |
Douglas Thrift |
39 |
void mode(); |
58 |
Douglas Thrift |
29 |
void display(const string& method); |
59 |
Douglas Thrift |
40 |
void header(const string& method); |
60 |
Douglas Thrift |
35 |
void footer(); |
61 |
Douglas Thrift |
27 |
public: |
62 |
|
|
HostStatus(); |
63 |
|
|
~HostStatus() {} |
64 |
|
|
}; |
65 |
|
|
|
66 |
|
|
#endif // _HostStatus_hpp_ |