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