1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2013 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
30 struct _packed_ bus_header
{
31 /* The first four fields are identical for dbus1, and dbus2 */
38 /* dbus1: Used for SOCK_STREAM connections */
42 /* Note that what the bus spec calls "serial" we'll call
43 "cookie" instead, because we don't want to imply that the
44 cookie was in any way monotonically increasing. */
49 /* dbus2: Used for kdbus connections */
55 /* Note that both header versions have the same size! */
62 _BUS_INVALID_ENDIAN
= 0,
63 BUS_LITTLE_ENDIAN
= 'l',
65 #if __BYTE_ORDER == __BIG_ENDIAN
66 BUS_NATIVE_ENDIAN
= BUS_BIG_ENDIAN
,
67 BUS_REVERSE_ENDIAN
= BUS_LITTLE_ENDIAN
69 BUS_NATIVE_ENDIAN
= BUS_LITTLE_ENDIAN
,
70 BUS_REVERSE_ENDIAN
= BUS_BIG_ENDIAN
77 BUS_MESSAGE_NO_REPLY_EXPECTED
= 1,
78 BUS_MESSAGE_NO_AUTO_START
= 2,
79 BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION
= 4,
85 _BUS_MESSAGE_HEADER_INVALID
= 0,
86 BUS_MESSAGE_HEADER_PATH
,
87 BUS_MESSAGE_HEADER_INTERFACE
,
88 BUS_MESSAGE_HEADER_MEMBER
,
89 BUS_MESSAGE_HEADER_ERROR_NAME
,
90 BUS_MESSAGE_HEADER_REPLY_SERIAL
,
91 BUS_MESSAGE_HEADER_DESTINATION
,
92 BUS_MESSAGE_HEADER_SENDER
,
93 BUS_MESSAGE_HEADER_SIGNATURE
,
94 BUS_MESSAGE_HEADER_UNIX_FDS
,
95 _BUS_MESSAGE_HEADER_MAX
98 /* RequestName parameters */
101 BUS_NAME_ALLOW_REPLACEMENT
= 1,
102 BUS_NAME_REPLACE_EXISTING
= 2,
103 BUS_NAME_DO_NOT_QUEUE
= 4
106 /* RequestName returns */
108 BUS_NAME_PRIMARY_OWNER
= 1,
109 BUS_NAME_IN_QUEUE
= 2,
111 BUS_NAME_ALREADY_OWNER
= 4
114 /* ReleaseName returns */
116 BUS_NAME_RELEASED
= 1,
117 BUS_NAME_NON_EXISTENT
= 2,
118 BUS_NAME_NOT_OWNER
= 3,
121 /* StartServiceByName returns */
123 BUS_START_REPLY_SUCCESS
= 1,
124 BUS_START_REPLY_ALREADY_RUNNING
= 2,
127 #define BUS_INTROSPECT_DOCTYPE \
128 "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n" \
129 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
131 #define BUS_INTROSPECT_INTERFACE_PEER \
132 " <interface name=\"org.freedesktop.DBus.Peer\">\n" \
133 " <method name=\"Ping\"/>\n" \
134 " <method name=\"GetMachineId\">\n" \
135 " <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" \
139 #define BUS_INTROSPECT_INTERFACE_INTROSPECTABLE \
140 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" \
141 " <method name=\"Introspect\">\n" \
142 " <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" \
146 #define BUS_INTROSPECT_INTERFACE_PROPERTIES \
147 " <interface name=\"org.freedesktop.DBus.Properties\">\n" \
148 " <method name=\"Get\">\n" \
149 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" \
150 " <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" \
151 " <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" \
153 " <method name=\"GetAll\">\n" \
154 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" \
155 " <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" \
157 " <method name=\"Set\">\n" \
158 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" \
159 " <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" \
160 " <arg name=\"value\" direction=\"in\" type=\"v\"/>\n" \
162 " <signal name=\"PropertiesChanged\">\n" \
163 " <arg type=\"s\" name=\"interface\"/>\n" \
164 " <arg type=\"a{sv}\" name=\"changed_properties\"/>\n" \
165 " <arg type=\"as\" name=\"invalidated_properties\"/>\n" \
169 #define BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER \
170 " <interface name=\"org.freedesktop.DBus.ObjectManager\">\n" \
171 " <method name=\"GetManagedObjects\">\n" \
172 " <arg type=\"a{oa{sa{sv}}}\" name=\"object_paths_interfaces_and_properties\" direction=\"out\"/>\n" \
174 " <signal name=\"InterfacesAdded\">\n" \
175 " <arg type=\"o\" name=\"object_path\"/>\n" \
176 " <arg type=\"a{sa{sv}}\" name=\"interfaces_and_properties\"/>\n" \
178 " <signal name=\"InterfacesRemoved\">\n" \
179 " <arg type=\"o\" name=\"object_path\"/>\n" \
180 " <arg type=\"as\" name=\"interfaces\"/>\n" \