2 |
#define __COMMON_H__ |
#define __COMMON_H__ |
3 |
|
|
4 |
#include <string> |
#include <string> |
|
#define VERSION "smsdaemon v0.1 by Torben Nielsen\n" |
|
5 |
|
|
6 |
|
|
7 |
#include "PluginManager.h" |
//time_t is defines as long int ! //No need to include time.h |
8 |
#include "TaskManager.h" |
|
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 |
//Singleton |
//Singleton |
20 |
class Common |
class Common |
24 |
|
|
25 |
bool isDaemon; |
bool isDaemon; |
26 |
bool isDebug; |
bool isDebug; |
27 |
|
bool daemonized; |
28 |
int uid; |
int uid; |
29 |
int gid; |
int gid; |
30 |
volatile bool mainContinue; |
volatile bool mainContinue; |
31 |
|
|
32 |
|
std::string configFilePath; |
33 |
|
|
34 |
std::string pidfile; |
std::string pidfile; |
35 |
std::string spooldir; |
std::string spooldir; |
36 |
|
|
37 |
PluginManager pluginManager; |
long int daemonStart; |
38 |
TaskManager taskManager; |
|
39 |
|
SmsCounter smsCounter; |
40 |
|
|
41 |
|
class PluginManager* GetPluginManager(); |
42 |
|
class TaskManager* GetTaskManager(); |
43 |
|
class ConfigFile* GetConfigfile(); |
44 |
|
void SetConfigfile(class ConfigFile*); |
45 |
|
|
|
void logMessage(std::string str); |
|
|
void setLogfile(std::string file) {_logFile = file;} |
|
46 |
|
|
47 |
void loadConfig(int argc, char* argv[]); |
void loadConfig(int argc, char* argv[]); |
48 |
|
|
49 |
|
std::string getStatusMessage(); |
50 |
private: |
private: |
51 |
Common() {} |
Common(); |
52 |
Common(const Common&) {} |
Common(const Common&) {} |
53 |
Common& operator=(const Common) {return *this;} |
Common& operator=(const Common) |
54 |
|
{ |
55 |
|
return *this; |
56 |
|
} |
57 |
|
~Common(); |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
class PluginManager* _pluginManager; |
62 |
|
class TaskManager* _taskManager; |
63 |
|
class ConfigFile* _configFile; |
64 |
|
|
65 |
void printUsage(); |
void printUsage(); |
66 |
|
|
|
std::string _logFile; |
|
67 |
}; |
}; |
68 |
|
|
69 |
|
|