1 |
#ifndef __COMMON_H__ |
2 |
#define __COMMON_H__ |
3 |
|
4 |
#include <string> |
5 |
#include <set> |
6 |
|
7 |
//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 |
//Singleton |
20 |
class Common |
21 |
{ |
22 |
public: |
23 |
static Common* instance(); |
24 |
|
25 |
bool isDaemon; |
26 |
bool isDebug; |
27 |
bool daemonized; |
28 |
int uid; |
29 |
int gid; |
30 |
volatile bool mainContinue; |
31 |
volatile bool reloadConfig; |
32 |
|
33 |
std::string configFilePath; |
34 |
|
35 |
std::string pidfile; |
36 |
std::string spooldir; |
37 |
|
38 |
long int daemonStart; |
39 |
|
40 |
|
41 |
SmsCounter smsCounter; |
42 |
|
43 |
class PluginManager* GetPluginManager(); |
44 |
class TaskManager* GetTaskManager(); |
45 |
class ConfigFile* GetConfigfile(); |
46 |
void SetConfigfile(class ConfigFile*); |
47 |
|
48 |
|
49 |
void loadConfig(int argc, char* argv[]); |
50 |
|
51 |
void LoadLists(); //load blacklist & privileged |
52 |
bool IsBlacklisted(const std::string& phone); |
53 |
bool IsPrivileged(const std::string& phone); |
54 |
|
55 |
std::string getStatusMessage(); |
56 |
private: |
57 |
Common(); |
58 |
Common(const Common&) {} |
59 |
Common& operator=(const Common) |
60 |
{ |
61 |
return *this; |
62 |
} |
63 |
~Common(); |
64 |
|
65 |
|
66 |
|
67 |
class PluginManager* _pluginManager; |
68 |
class TaskManager* _taskManager; |
69 |
class ConfigFile* _configFile; |
70 |
|
71 |
void printUsage(); |
72 |
void LoadWorker(std::set<std::string>& set, std::string config); |
73 |
|
74 |
|
75 |
std::set<std::string> _blacklist; |
76 |
std::set<std::string> _privileged; |
77 |
}; |
78 |
|
79 |
|
80 |
#endif //__COMMON_H__ |