00001 00002 /* 00003 DBusServer.h 00004 */ 00005 00006 #ifndef DBUSSERVER_H 00007 #define DBUSSERVER_H 00008 00009 #include "config.h" 00010 00011 #include <dbus/dbus.h> 00012 00013 #include "DBusConn.h" 00014 #include "ScriptingAgent.h" 00015 00016 #ifdef HAVE_POLKIT 00017 #include "PolKit.h" 00018 #endif 00019 00020 extern "C" 00021 { 00022 #include <unistd.h> 00023 #include <signal.h> 00024 } 00025 00026 class DBusServer 00027 { 00028 public: 00029 00030 DBusServer(); 00031 ~DBusServer(); 00032 00033 bool connect(); 00038 void run(bool forever = false); 00039 00040 private: 00041 00042 DBusConn connection; 00043 00044 #ifdef HAVE_POLKIT 00045 PolKit policykit; 00046 bool isActionAllowed(const std::string &caller, const std::string &path, 00047 const std::string &method, const std::string &arg, const std::string &opt); 00048 #endif 00049 00050 // SCR access 00051 ScriptingAgent *sa; 00052 00053 // disable copying 00054 DBusServer(const DBusServer&); 00055 DBusServer& operator=(const DBusServer&); 00056 00057 void resetTimer(); 00058 void registerSignalHandler(); 00059 bool isProcessRunning(pid_t pid); 00060 bool canFinish(); 00061 pid_t callerPid(const std::string &bus_name); 00062 00063 typedef std::map<std::string, pid_t> Clients; 00064 00065 Clients clients; 00066 }; 00067 00068 00069 #endif 00070
1.5.6