softwarecontainer  0.18.0-739e8d7 2017-05-04
softwarecontaineragent_dbus_stub.h
1 #pragma once
2 #include <string>
3 #include <glibmm.h>
4 #include <giomm.h>
5 
6 #include "softwarecontaineragent_dbus_common.h"
7 
8 
9 namespace com {
10 namespace pelagicore {
12 public:
14 
15 protected:
16  void connect (Gio::DBus::BusType, std::string);
17 
18  virtual void List (
20 
21  virtual void Create (
22  std::string config,
24 
25  virtual void Execute (
26  gint32 containerID,
27  std::string commandLine,
28  std::string workingDirectory,
29  std::string outputFile,
30  std::map<std::string, std::string> env,
32 
33  virtual void Suspend (
34  gint32 containerID,
36 
37  virtual void Resume (
38  gint32 containerID,
40 
41  virtual void Destroy (
42  gint32 containerID,
44 
45  virtual void BindMount (
46  gint32 containerID,
47  std::string pathInHost,
48  std::string pathInContainer,
49  bool readOnly,
51 
52  virtual void ListCapabilities (
54 
55  virtual void SetCapabilities (
56  gint32 containerID,
57  std::vector<std::string> capabilities,
59 
60  void ProcessStateChanged_emitter(gint32, guint32, bool, guint32);
61  sigc::signal<void, gint32, guint32, bool, guint32 > ProcessStateChanged_signal;
62 
63  void on_bus_acquired(const Glib::RefPtr<Gio::DBus::Connection>& connection,
64  const Glib::ustring& /* name */);
65 
66  void on_name_acquired(const Glib::RefPtr<Gio::DBus::Connection>& /* connection */,
67  const Glib::ustring& /* name */);
68 
69  void on_name_lost(const Glib::RefPtr<Gio::DBus::Connection>& connection,
70  const Glib::ustring& /* name */);
71 
72  void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connection */,
73  const Glib::ustring& /* sender */,
74  const Glib::ustring& /* object_path */,
75  const Glib::ustring& /* interface_name */,
76  const Glib::ustring& method_name,
77  const Glib::VariantContainerBase& parameters,
78  const Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation);
79 
80  void on_interface_get_property(Glib::VariantBase& property,
81  const Glib::RefPtr<Gio::DBus::Connection>& connection,
82  const Glib::ustring& sender,
83  const Glib::ustring& object_path,
84  const Glib::ustring& interface_name,
85  const Glib::ustring& property_name);
86 
87  bool on_interface_set_property(
88  const Glib::RefPtr<Gio::DBus::Connection>& connection,
89  const Glib::ustring& sender,
90  const Glib::ustring& object_path,
91  const Glib::ustring& interface_name,
92  const Glib::ustring& property_name,
93  const Glib::VariantBase& value);
94 
95  /*
96  * We emit these signals when we have a lost/acquired a name on dbus,
97  * so that subclasses of this class can bind slots to these signals.
98  */
99  sigc::signal<void, std::string> name_lost;
100  sigc::signal<void, std::string> name_acquired;
101  sigc::signal<void, std::string> object_not_registered;
102 
103 private:
104  bool emitSignal(const std::string& propName, Glib::VariantBase& value);
105 
106  guint connectionId;
107  guint registeredId;
108  Glib::RefPtr<Gio::DBus::NodeInfo> introspection_data;
109  Glib::RefPtr<Gio::DBus::Connection> m_connection;
110  std::string m_objectPath;
111  std::string m_interfaceName;
112 };
113 }// pelagicore
114 }// com
115