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