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