1 |
torben |
26 |
#ifndef __COMMON_H__ |
2 |
|
|
#define __COMMON_H__ |
3 |
|
|
|
4 |
|
|
#include <string> |
5 |
|
|
|
6 |
|
|
|
7 |
torben |
36 |
//time_t is defines as long int ! //No need to include time.h |
8 |
|
|
|
9 |
|
|
class SmsCounter |
10 |
|
|
{ |
11 |
|
|
public: |
12 |
|
|
SmsCounter() : incomming(0), outgoing(0) {} |
13 |
|
|
|
14 |
|
|
unsigned int incomming; |
15 |
|
|
unsigned int outgoing; |
16 |
|
|
}; |
17 |
|
|
|
18 |
|
|
|
19 |
torben |
26 |
//Singleton |
20 |
|
|
class Common |
21 |
|
|
{ |
22 |
|
|
public: |
23 |
|
|
static Common* instance(); |
24 |
|
|
|
25 |
|
|
bool isDaemon; |
26 |
|
|
bool isDebug; |
27 |
|
|
int uid; |
28 |
|
|
int gid; |
29 |
|
|
volatile bool mainContinue; |
30 |
|
|
|
31 |
torben |
146 |
std::string configFilePath; |
32 |
|
|
|
33 |
torben |
26 |
std::string pidfile; |
34 |
|
|
std::string spooldir; |
35 |
|
|
|
36 |
torben |
36 |
long int daemonStart; |
37 |
torben |
26 |
|
38 |
torben |
36 |
SmsCounter smsCounter; |
39 |
torben |
26 |
|
40 |
torben |
92 |
class PluginManager* GetPluginManager(); |
41 |
|
|
class TaskManager* GetTaskManager(); |
42 |
torben |
146 |
class ConfigFile* GetConfigfile(); |
43 |
|
|
void SetConfigfile(class ConfigFile*); |
44 |
torben |
92 |
|
45 |
torben |
26 |
void logMessage(std::string str); |
46 |
|
|
void setLogfile(std::string file) {_logFile = file;} |
47 |
|
|
|
48 |
|
|
void loadConfig(int argc, char* argv[]); |
49 |
|
|
|
50 |
torben |
36 |
std::string getStatusMessage(); |
51 |
torben |
26 |
private: |
52 |
torben |
92 |
Common(); |
53 |
torben |
26 |
Common(const Common&) {} |
54 |
|
|
Common& operator=(const Common) {return *this;} |
55 |
torben |
92 |
~Common(); |
56 |
torben |
26 |
|
57 |
torben |
92 |
|
58 |
|
|
|
59 |
|
|
class PluginManager* _pluginManager; |
60 |
|
|
class TaskManager* _taskManager; |
61 |
torben |
146 |
class ConfigFile* _configFile; |
62 |
torben |
92 |
|
63 |
torben |
26 |
void printUsage(); |
64 |
|
|
|
65 |
|
|
std::string _logFile; |
66 |
|
|
}; |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
#endif //__COMMON_H__ |