Enhance ServiceManager with socket unit names
[platform/core/test/security-tests.git] / src / common / service_manager.h
index f1f492f..7dbdecf 100644 (file)
 class ServiceManager {
 public:
     ServiceManager() = delete;
-    ServiceManager(const std::string &serviceName);
+    ServiceManager(const std::string &serviceName,
+                   const std::vector<std::string>& socketsNames = {});
     ~ServiceManager() = default;
 
-    void startService();
-    void stopService();
-    void restartService();
+    void startService(bool withSockets = false);
+    void stopService(bool withSockets = false);
+    void restartService(bool withSockets = false);
     pid_t getServicePid();
     timeval getServiceStartTimestamp();
     void maskService();
@@ -59,7 +60,7 @@ private:
     uint32_t handleVariantUIntMsgReply(DBus::MessageIn &messageIn);
     uint64_t handleVariantUInt64MsgReply(DBus::MessageIn &messageIn);
 
-    void sendToService(const std::string &method);
+    void sendToService(const std::string &method, const std::string &unit);
     void sendMaskToService();
     void sendUnmaskToService();
     DBus::MessageIn sendPropertyGetMsg(const std::string &interface, const std::string &property);
@@ -73,9 +74,12 @@ private:
     void signalReloadingHandler(DBus::MessageIn &messageIn);
     void waitForRunningJobsFinish();
 
+    void executeMethod(const std::string &method, const std::string &unit);
+
     DBus::Connection m_connection;
 
     const std::string m_serviceName;
+    const std::vector<std::string> m_socketsNames;
     std::string m_unitPath;
 
     std::set<std::string> m_runningJobs;