1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #ifndef foosdbusprotocolhfoo
3 #define foosdbusprotocolhfoo
4 
5 /***
6   systemd is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or
9   (at your option) any later version.
10 
11   systemd is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   Lesser General Public License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public License
17   along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19 
20 #include "_sd-common.h"
21 
22 _SD_BEGIN_DECLARATIONS;
23 
24 /* Types of message */
25 
26 enum {
27         _SD_BUS_MESSAGE_TYPE_INVALID = 0,
28         SD_BUS_MESSAGE_METHOD_CALL,
29         SD_BUS_MESSAGE_METHOD_RETURN,
30         SD_BUS_MESSAGE_METHOD_ERROR,
31         SD_BUS_MESSAGE_SIGNAL,
32         _SD_BUS_MESSAGE_TYPE_MAX
33 };
34 
35 /* Primitive types */
36 
37 enum {
38         _SD_BUS_TYPE_INVALID         = 0,
39         SD_BUS_TYPE_BYTE             = 'y',
40         SD_BUS_TYPE_BOOLEAN          = 'b',
41         SD_BUS_TYPE_INT16            = 'n',
42         SD_BUS_TYPE_UINT16           = 'q',
43         SD_BUS_TYPE_INT32            = 'i',
44         SD_BUS_TYPE_UINT32           = 'u',
45         SD_BUS_TYPE_INT64            = 'x',
46         SD_BUS_TYPE_UINT64           = 't',
47         SD_BUS_TYPE_DOUBLE           = 'd',
48         SD_BUS_TYPE_STRING           = 's',
49         SD_BUS_TYPE_OBJECT_PATH      = 'o',
50         SD_BUS_TYPE_SIGNATURE        = 'g',
51         SD_BUS_TYPE_UNIX_FD          = 'h',
52         SD_BUS_TYPE_ARRAY            = 'a',
53         SD_BUS_TYPE_VARIANT          = 'v',
54         SD_BUS_TYPE_STRUCT           = 'r', /* not actually used in signatures */
55         SD_BUS_TYPE_STRUCT_BEGIN     = '(',
56         SD_BUS_TYPE_STRUCT_END       = ')',
57         SD_BUS_TYPE_DICT_ENTRY       = 'e', /* not actually used in signatures */
58         SD_BUS_TYPE_DICT_ENTRY_BEGIN = '{',
59         SD_BUS_TYPE_DICT_ENTRY_END   = '}'
60 };
61 
62 /* Well-known errors. Note that this is only a sanitized subset of the
63  * errors that the reference implementation generates. */
64 
65 #define SD_BUS_ERROR_FAILED                     "org.freedesktop.DBus.Error.Failed"
66 #define SD_BUS_ERROR_NO_MEMORY                  "org.freedesktop.DBus.Error.NoMemory"
67 #define SD_BUS_ERROR_SERVICE_UNKNOWN            "org.freedesktop.DBus.Error.ServiceUnknown"
68 #define SD_BUS_ERROR_NAME_HAS_NO_OWNER          "org.freedesktop.DBus.Error.NameHasNoOwner"
69 #define SD_BUS_ERROR_NO_REPLY                   "org.freedesktop.DBus.Error.NoReply"
70 #define SD_BUS_ERROR_IO_ERROR                   "org.freedesktop.DBus.Error.IOError"
71 #define SD_BUS_ERROR_BAD_ADDRESS                "org.freedesktop.DBus.Error.BadAddress"
72 #define SD_BUS_ERROR_NOT_SUPPORTED              "org.freedesktop.DBus.Error.NotSupported"
73 #define SD_BUS_ERROR_LIMITS_EXCEEDED            "org.freedesktop.DBus.Error.LimitsExceeded"
74 #define SD_BUS_ERROR_ACCESS_DENIED              "org.freedesktop.DBus.Error.AccessDenied"
75 #define SD_BUS_ERROR_AUTH_FAILED                "org.freedesktop.DBus.Error.AuthFailed"
76 #define SD_BUS_ERROR_NO_SERVER                  "org.freedesktop.DBus.Error.NoServer"
77 #define SD_BUS_ERROR_TIMEOUT                    "org.freedesktop.DBus.Error.Timeout"
78 #define SD_BUS_ERROR_NO_NETWORK                 "org.freedesktop.DBus.Error.NoNetwork"
79 #define SD_BUS_ERROR_ADDRESS_IN_USE             "org.freedesktop.DBus.Error.AddressInUse"
80 #define SD_BUS_ERROR_DISCONNECTED               "org.freedesktop.DBus.Error.Disconnected"
81 #define SD_BUS_ERROR_INVALID_ARGS               "org.freedesktop.DBus.Error.InvalidArgs"
82 #define SD_BUS_ERROR_FILE_NOT_FOUND             "org.freedesktop.DBus.Error.FileNotFound"
83 #define SD_BUS_ERROR_FILE_EXISTS                "org.freedesktop.DBus.Error.FileExists"
84 #define SD_BUS_ERROR_UNKNOWN_METHOD             "org.freedesktop.DBus.Error.UnknownMethod"
85 #define SD_BUS_ERROR_UNKNOWN_OBJECT             "org.freedesktop.DBus.Error.UnknownObject"
86 #define SD_BUS_ERROR_UNKNOWN_INTERFACE          "org.freedesktop.DBus.Error.UnknownInterface"
87 #define SD_BUS_ERROR_UNKNOWN_PROPERTY           "org.freedesktop.DBus.Error.UnknownProperty"
88 #define SD_BUS_ERROR_PROPERTY_READ_ONLY         "org.freedesktop.DBus.Error.PropertyReadOnly"
89 #define SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN    "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
90 #define SD_BUS_ERROR_INVALID_SIGNATURE          "org.freedesktop.DBus.Error.InvalidSignature"
91 #define SD_BUS_ERROR_INCONSISTENT_MESSAGE       "org.freedesktop.DBus.Error.InconsistentMessage"
92 #define SD_BUS_ERROR_MATCH_RULE_NOT_FOUND       "org.freedesktop.DBus.Error.MatchRuleNotFound"
93 #define SD_BUS_ERROR_MATCH_RULE_INVALID         "org.freedesktop.DBus.Error.MatchRuleInvalid"
94 #define SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED \
95                                                 "org.freedesktop.DBus.Error.InteractiveAuthorizationRequired"
96 
97 /* https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-signature */
98 #define SD_BUS_MAXIMUM_SIGNATURE_LENGTH 255
99 
100 /* https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names */
101 #define SD_BUS_MAXIMUM_NAME_LENGTH 255
102 
103 _SD_END_DECLARATIONS;
104 
105 #endif
106