1 |
Douglas Thrift |
3 |
// Host Update |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
Douglas Thrift |
12 |
#ifndef _HostUpdate_hpp_ |
8 |
|
|
#define _HostUpdate_hpp_ |
9 |
Douglas Thrift |
3 |
|
10 |
|
|
#include <iostream> |
11 |
Douglas Thrift |
14 |
#include <fstream> |
12 |
|
|
#include <string> |
13 |
Douglas Thrift |
15 |
#include <sstream> |
14 |
Douglas Thrift |
14 |
#include <set> |
15 |
Douglas Thrift |
15 |
#include <map> |
16 |
|
|
#include <cstdlib> |
17 |
Douglas Thrift |
19 |
#include <ctime> |
18 |
Douglas Thrift |
3 |
|
19 |
Douglas Thrift |
15 |
using namespace std; |
20 |
|
|
|
21 |
Douglas Thrift |
12 |
#include <sys/types.h> |
22 |
|
|
#include <sys/stat.h> |
23 |
|
|
|
24 |
|
|
#ifndef _WIN32 |
25 |
|
|
|
26 |
|
|
#include <unistd.h> |
27 |
Douglas Thrift |
14 |
#include <dirent.h> |
28 |
Douglas Thrift |
12 |
|
29 |
Douglas Thrift |
19 |
const char slash = '/'; |
30 |
|
|
|
31 |
Douglas Thrift |
14 |
inline int mkdir(const char* path) |
32 |
|
|
{ |
33 |
|
|
return mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); |
34 |
|
|
} |
35 |
|
|
|
36 |
Douglas Thrift |
12 |
#else |
37 |
|
|
|
38 |
|
|
#include <direct.h> |
39 |
|
|
|
40 |
Douglas Thrift |
19 |
const char slash = '\\'; |
41 |
|
|
|
42 |
Douglas Thrift |
12 |
#endif |
43 |
|
|
|
44 |
Douglas Thrift |
15 |
inline string sgetenv(const string& name) |
45 |
|
|
{ |
46 |
|
|
char* value = getenv(name.c_str()); |
47 |
Douglas Thrift |
17 |
|
48 |
Douglas Thrift |
15 |
return value != NULL ? value : ""; |
49 |
|
|
} |
50 |
Douglas Thrift |
3 |
|
51 |
Douglas Thrift |
20 |
class Host; |
52 |
|
|
|
53 |
Douglas Thrift |
3 |
class HostUpdate |
54 |
|
|
{ |
55 |
|
|
private: |
56 |
Douglas Thrift |
15 |
multimap<string, string> cgi; |
57 |
|
|
void parse(const string& method); |
58 |
|
|
void update(const string& agent); |
59 |
|
|
void display(); |
60 |
Douglas Thrift |
20 |
void display(const Host& host); |
61 |
Douglas Thrift |
3 |
public: |
62 |
|
|
HostUpdate(); |
63 |
Douglas Thrift |
20 |
~HostUpdate() {} |
64 |
Douglas Thrift |
3 |
}; |
65 |
|
|
|
66 |
Douglas Thrift |
12 |
#endif // _HostUpdate_hpp_ |