| 69 | |
| 70 | |
| 71 | Session::Session(DBus::Connection::Ptr dbuscon, |
| 72 | DBus::Object::Manager::Ptr objmgr, |
| 73 | DBus::Credentials::Query::Ptr creds_qry_, |
| 74 | ::Signals::SessionManagerEvent::Ptr sig_sessionmgr, |
| 75 | const DBus::Object::Path &sespath, |
| 76 | const uid_t owner, |
| 77 | const std::string &be_busname, |
| 78 | const pid_t be_pid, |
| 79 | const DBus::Object::Path &cfg_path, |
| 80 | const unsigned int loglev, |
| 81 | LogWriter::Ptr logwr) |
| 82 | : DBus::Object::Base(std::move(sespath), Constants::GenInterface("sessions")), |
| 83 | dbus_conn(dbuscon), object_mgr(objmgr), creds_qry(creds_qry_), |
| 84 | sig_sessmgr(sig_sessionmgr), |
| 85 | backend_pid(be_pid), config_path(std::move(cfg_path)) |
| 86 | { |
| 87 | // Set up the D-Bus proxy towards the back-end VPN client process |
| 88 | be_prx = DBus::Proxy::Client::Create(dbus_conn, be_busname); |
| 89 | be_target = DBus::Proxy::TargetPreset::Create(Constants::GenPath("backends/session"), |
| 90 | Constants::GenInterface("backends")); |
| 91 | |
| 92 | // Prepare the signal subscription handler, this will handle |
| 93 | sigsubscr = DBus::Signals::SubscriptionManager::Create(dbus_conn); |
| 94 | |
| 95 | // The subscriptions being configured is targeting the backend VPN client |
| 96 | auto subscr_tgt = DBus::Signals::Target::Create(be_busname, |
| 97 | be_target->object_path, |
| 98 | be_target->interface); |
| 99 | |
| 100 | // Prepare signals the session object will send |
| 101 | sig_session = Log::Create(dbus_conn, LogGroup::SESSIONMGR, GetPath(), logwr); |
| 102 | sig_statuschg = sig_session->CreateSignal<::Signals::StatusChange>(sigsubscr, subscr_tgt); |
| 103 | |
| 104 | // Prepare a signal group which will do broadcasts, this will be used |
| 105 | // for when proxying the AttentionRequired signals |
| 106 | sig_session->GroupCreate("broadcast"); |
| 107 | sig_session->GroupAddTarget("broadcast", ""); |
| 108 | sig_attreq = sig_session->GroupCreateSignal<::Signals::AttentionRequired>("broadcast", |
| 109 | sigsubscr, |
| 110 | subscr_tgt); |
| 111 | // Prepare the object handling access control lists |
| 112 | object_acl = GDBusPP::Object::Extension::ACL::Create(dbus_conn, owner); |
| 113 | |
| 114 | // |
| 115 | // Set up the D-Bus methods |
| 116 | // |
| 117 | |
| 118 | AddMethod( |
| 119 | "Ready", |
| 120 | [=](Object::Method::Arguments::Ptr args) |
| 121 | { |
| 122 | method_ready(args); |
| 123 | }); |
| 124 | |
| 125 | |
| 126 | AddMethod( |
| 127 | "Connect", |
| 128 | [=](Object::Method::Arguments::Ptr args) |
nothing calls this directly
no test coverage detected