/[projects]/smsdaemon/Common.h
ViewVC logotype

Annotation of /smsdaemon/Common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 216 - (hide annotations) (download)
Tue Dec 23 12:09:08 2008 UTC (15 years, 4 months ago) by torben
File MIME type: text/plain
File size: 1369 byte(s)
Added config option of privileged and blacklisted phone numbers, and applied the blacklist to
Proxy Transceiver.

Am still missing the equivalent for incomming messages (ProxyPlugin)

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

Properties

Name Value
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.20