]> git.proxmox.com Git - systemd.git/blob - src/libsystemd/sd-bus/bus-protocol.h
Enable seccomp support on powerpc, ppc64el, and s390x
[systemd.git] / src / libsystemd / sd-bus / bus-protocol.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2013 Lennart Poettering
9
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.
14
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.
19
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/>.
22 ***/
23
24 #include <endian.h>
25
26 #include "macro.h"
27
28 /* Packet header */
29
30 struct _packed_ bus_header {
31 /* The first four fields are identical for dbus1, and dbus2 */
32 uint8_t endian;
33 uint8_t type;
34 uint8_t flags;
35 uint8_t version;
36
37 union _packed_ {
38 /* dbus1: Used for SOCK_STREAM connections */
39 struct _packed_ {
40 uint32_t body_size;
41
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. */
45 uint32_t serial;
46 uint32_t fields_size;
47 } dbus1;
48
49 /* dbus2: Used for kdbus connections */
50 struct _packed_ {
51 uint32_t _reserved;
52 uint64_t cookie;
53 } dbus2;
54
55 /* Note that both header versions have the same size! */
56 };
57 };
58
59 /* Endianness */
60
61 enum {
62 _BUS_INVALID_ENDIAN = 0,
63 BUS_LITTLE_ENDIAN = 'l',
64 BUS_BIG_ENDIAN = 'B',
65 #if __BYTE_ORDER == __BIG_ENDIAN
66 BUS_NATIVE_ENDIAN = BUS_BIG_ENDIAN,
67 BUS_REVERSE_ENDIAN = BUS_LITTLE_ENDIAN
68 #else
69 BUS_NATIVE_ENDIAN = BUS_LITTLE_ENDIAN,
70 BUS_REVERSE_ENDIAN = BUS_BIG_ENDIAN
71 #endif
72 };
73
74 /* Flags */
75
76 enum {
77 BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
78 BUS_MESSAGE_NO_AUTO_START = 2,
79 BUS_MESSAGE_ALLOW_INTERACTIVE_AUTHORIZATION = 4,
80 };
81
82 /* Header fields */
83
84 enum {
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
96 };
97
98 /* RequestName parameters */
99
100 enum {
101 BUS_NAME_ALLOW_REPLACEMENT = 1,
102 BUS_NAME_REPLACE_EXISTING = 2,
103 BUS_NAME_DO_NOT_QUEUE = 4
104 };
105
106 /* RequestName returns */
107 enum {
108 BUS_NAME_PRIMARY_OWNER = 1,
109 BUS_NAME_IN_QUEUE = 2,
110 BUS_NAME_EXISTS = 3,
111 BUS_NAME_ALREADY_OWNER = 4
112 };
113
114 /* ReleaseName returns */
115 enum {
116 BUS_NAME_RELEASED = 1,
117 BUS_NAME_NON_EXISTENT = 2,
118 BUS_NAME_NOT_OWNER = 3,
119 };
120
121 /* StartServiceByName returns */
122 enum {
123 BUS_START_REPLY_SUCCESS = 1,
124 BUS_START_REPLY_ALREADY_RUNNING = 2,
125 };
126
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"
130
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" \
136 " </method>\n" \
137 " </interface>\n"
138
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" \
143 " </method>\n" \
144 " </interface>\n"
145
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" \
152 " </method>\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" \
156 " </method>\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" \
161 " </method>\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" \
166 " </signal>\n" \
167 " </interface>\n"
168
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" \
173 " </method>\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" \
177 " </signal>\n" \
178 " <signal name=\"InterfacesRemoved\">\n" \
179 " <arg type=\"o\" name=\"object_path\"/>\n" \
180 " <arg type=\"as\" name=\"interfaces\"/>\n" \
181 " </signal>\n" \
182 " </interface>\n"