-
Notifications
You must be signed in to change notification settings - Fork 90
/
dbus.hpp
109 lines (85 loc) · 5 KB
/
dbus.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
Copyright Contributors to the libdnf project.
This file is part of libdnf: https://github.com/rpm-software-management/libdnf/
Libdnf is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Libdnf is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with libdnf. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DNF5DAEMON_SERVER_DBUS_HPP
#define DNF5DAEMON_SERVER_DBUS_HPP
#include <sdbus-c++/sdbus-c++.h>
#include <map>
#include <string>
namespace dnfdaemon {
// types
using KeyValueMap = std::map<std::string, sdbus::Variant>;
using KeyValueMapList = std::vector<KeyValueMap>;
enum class RepoStatus { NOT_READY, PENDING, READY, ERROR };
enum class ResolveResult { NO_PROBLEM, WARNING, ERROR };
enum class DbusTransactionItemType : int { PACKAGE, GROUP, ENVIRONMENT, MODULE, SKIPPED };
using DbusTransactionItem = sdbus::Struct<
std::string, // DbusTransactionItemType
std::string, // libdnf5::transaction::TransactionItemAction
std::string, // libdnf5::transaction::TransactionItemReason
KeyValueMap, // other transaction item attributes - e.g. group id for REASON_CHANGE to GROUP,
// packages that are replaced by this transaction item
KeyValueMap>; // transaction object (package / group / module)
// (timestamp, author, text)
using Changelog = sdbus::Struct<int64_t, std::string, std::string>;
// (id, type, title, url)
using AdvisoryReference = sdbus::Struct<std::string, std::string, std::string, std::string>;
// constants
const char * const DBUS_NAME = "org.rpm.dnf.v0";
const char * const DBUS_OBJECT_PATH = "/org/rpm/dnf/v0";
// interfaces
const char * const INTERFACE_BASE = "org.rpm.dnf.v0.Base";
const char * const INTERFACE_REPO = "org.rpm.dnf.v0.rpm.Repo";
const char * const INTERFACE_RPM = "org.rpm.dnf.v0.rpm.Rpm";
const char * const INTERFACE_GOAL = "org.rpm.dnf.v0.Goal";
const char * const INTERFACE_GROUP = "org.rpm.dnf.v0.comps.Group";
const char * const INTERFACE_ADVISORY = "org.rpm.dnf.v0.Advisory";
const char * const INTERFACE_SESSION_MANAGER = "org.rpm.dnf.v0.SessionManager";
// signals
const char * const SIGNAL_DOWNLOAD_ADD_NEW = "download_add_new";
const char * const SIGNAL_DOWNLOAD_PROGRESS = "download_progress";
const char * const SIGNAL_DOWNLOAD_END = "download_end";
const char * const SIGNAL_DOWNLOAD_MIRROR_FAILURE = "download_mirror_failure";
const char * const SIGNAL_REPO_KEY_IMPORT_REQUEST = "repo_key_import_request";
const char * const SIGNAL_TRANSACTION_BEFORE_BEGIN = "transaction_before_begin";
const char * const SIGNAL_TRANSACTION_AFTER_COMPLETE = "transaction_after_complete";
const char * const SIGNAL_TRANSACTION_TRANSACTION_START = "transaction_transaction_start";
const char * const SIGNAL_TRANSACTION_TRANSACTION_PROGRESS = "transaction_transaction_progress";
const char * const SIGNAL_TRANSACTION_TRANSACTION_STOP = "transaction_transaction_stop";
const char * const SIGNAL_TRANSACTION_VERIFY_START = "transaction_verify_start";
const char * const SIGNAL_TRANSACTION_VERIFY_PROGRESS = "transaction_verify_progress";
const char * const SIGNAL_TRANSACTION_VERIFY_STOP = "transaction_verify_stop";
const char * const SIGNAL_TRANSACTION_ACTION_START = "transaction_action_start";
const char * const SIGNAL_TRANSACTION_ACTION_PROGRESS = "transaction_action_progress";
const char * const SIGNAL_TRANSACTION_ACTION_STOP = "transaction_action_stop";
const char * const SIGNAL_TRANSACTION_SCRIPT_START = "transaction_script_start";
const char * const SIGNAL_TRANSACTION_SCRIPT_STOP = "transaction_script_stop";
const char * const SIGNAL_TRANSACTION_SCRIPT_ERROR = "transaction_script_error";
const char * const SIGNAL_TRANSACTION_UNPACK_ERROR = "transaction_unpack_error";
const char * const SIGNAL_TRANSACTION_ELEM_PROGRESS = "transaction_elem_progress";
const char * const SIGNAL_TRANSACTION_FINISHED = "transaction_finished";
const char * const SIGNAL_WRITE_TO_FD_FINISHED = "write_to_fd_finished";
// polkit actions
const char * const POLKIT_REPOCONF_WRITE = "org.rpm.dnf.v0.rpm.Repo.conf_write";
const char * const POLKIT_EXECUTE_RPM_TRANSACTION = "org.rpm.dnf.v0.rpm.execute_transaction";
const char * const POLKIT_CONFIRM_KEY_IMPORT = "org.rpm.dnf.v0.rpm.Repo.confirm_key";
const char * const POLKIT_CONFIG_OVERRIDE = "org.rpm.dnf.v0.base.Config.override";
// errors
const char * const ERROR = "org.rpm.dnf.v0.Error";
const char * const ERROR_REPOCONF = "org.rpm.dnf.v0.rpm.Repo.ConfError";
const char * const ERROR_REPO_ID_UNKNOWN = "org.rpm.dnf.v0.rpm.Repo.NoMatchingIdError";
const char * const ERROR_RESOLVE = "org.rpm.dnf.v0.rpm.Rpm.ResolveError";
const char * const ERROR_TRANSACTION = "org.rpm.dnf.v0.rpm.Rpm.TransactionError";
} // namespace dnfdaemon
#endif