chiark / gitweb /
4726d9345dc2ec8d92930090bacf7673166871b9
[elogind.git] / src / libsystemd-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
25 /* Endianness */
26
27 enum {
28         _BUS_INVALID_ENDIAN = 0,
29         BUS_LITTLE_ENDIAN   = 'l',
30         BUS_BIG_ENDIAN      = 'B',
31 #if __BYTE_ORDER == __BIG_ENDIAN
32         BUS_NATIVE_ENDIAN   = BUS_BIG_ENDIAN,
33         BUS_REVERSE_ENDIAN  = BUS_LITTLE_ENDIAN
34 #else
35         BUS_NATIVE_ENDIAN   = BUS_LITTLE_ENDIAN,
36         BUS_REVERSE_ENDIAN  = BUS_BIG_ENDIAN
37 #endif
38 };
39
40 /* Flags */
41
42 enum {
43         BUS_MESSAGE_NO_REPLY_EXPECTED = 1,
44         BUS_MESSAGE_NO_AUTO_START = 2
45 };
46
47 /* Header fields */
48
49 enum {
50         _BUS_MESSAGE_HEADER_INVALID = 0,
51         BUS_MESSAGE_HEADER_PATH,
52         BUS_MESSAGE_HEADER_INTERFACE,
53         BUS_MESSAGE_HEADER_MEMBER,
54         BUS_MESSAGE_HEADER_ERROR_NAME,
55         BUS_MESSAGE_HEADER_REPLY_SERIAL,
56         BUS_MESSAGE_HEADER_DESTINATION,
57         BUS_MESSAGE_HEADER_SENDER,
58         BUS_MESSAGE_HEADER_SIGNATURE,
59         BUS_MESSAGE_HEADER_UNIX_FDS,
60         _BUS_MESSAGE_HEADER_MAX
61 };
62
63 /* RequestName parameters */
64
65 enum  {
66         BUS_NAME_ALLOW_REPLACEMENT = 1,
67         BUS_NAME_REPLACE_EXISTING = 2,
68         BUS_NAME_DO_NOT_QUEUE = 4
69 };
70
71 /* RequestName returns */
72 enum  {
73         BUS_NAME_PRIMARY_OWNER = 1,
74         BUS_NAME_IN_QUEUE = 2,
75         BUS_NAME_EXISTS = 3,
76         BUS_NAME_ALREADY_OWNER = 4
77 };
78
79 /* ReleaseName returns */
80 enum {
81         BUS_NAME_RELEASED = 1,
82         BUS_NAME_NON_EXISTENT = 2,
83         BUS_NAME_NOT_OWNER = 3,
84 };
85
86 #define BUS_INTROSPECT_DOCTYPE                                       \
87         "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n" \
88         "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
89
90 #define BUS_INTROSPECT_INTERFACE_PEER                                \
91         " <interface name=\"org.freedesktop.DBus.Peer\">\n"             \
92         "  <method name=\"Ping\"/>\n"                                   \
93         "  <method name=\"GetMachineId\">\n"                            \
94         "   <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" \
95         "  </method>\n"                                                 \
96         " </interface>\n"
97
98 #define BUS_INTROSPECT_INTERFACE_INTROSPECTABLE                      \
99         " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"   \
100         "  <method name=\"Introspect\">\n"                              \
101         "   <arg name=\"data\" type=\"s\" direction=\"out\"/>\n"        \
102         "  </method>\n"                                                 \
103         " </interface>\n"
104
105 #define BUS_INTROSPECT_INTERFACE_PROPERTIES                          \
106         " <interface name=\"org.freedesktop.DBus.Properties\">\n"       \
107         "  <method name=\"Get\">\n"                                     \
108         "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"    \
109         "   <arg name=\"property\" direction=\"in\" type=\"s\"/>\n"     \
110         "   <arg name=\"value\" direction=\"out\" type=\"v\"/>\n"       \
111         "  </method>\n"                                                 \
112         "  <method name=\"GetAll\">\n"                                  \
113         "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"    \
114         "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>\n" \
115         "  </method>\n"                                                 \
116         "  <method name=\"Set\">\n"                                     \
117         "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"    \
118         "   <arg name=\"property\" direction=\"in\" type=\"s\"/>\n"     \
119         "   <arg name=\"value\" direction=\"in\" type=\"v\"/>\n"        \
120         "  </method>\n"                                                 \
121         "  <signal name=\"PropertiesChanged\">\n"                       \
122         "   <arg type=\"s\" name=\"interface\"/>\n"                     \
123         "   <arg type=\"a{sv}\" name=\"changed_properties\"/>\n"        \
124         "   <arg type=\"as\" name=\"invalidated_properties\"/>\n"       \
125         "  </signal>\n"                                                 \
126         " </interface>\n"
127
128 #define BUS_INTROSPECT_INTERFACE_OBJECT_MANAGER                      \
129         " <interface name=\"org.freedesktop.DBus.ObjectManager\">\n"    \
130         "  <method name=\"GetManagedObjects\">\n"                       \
131         "   <arg type=\"a{oa{sa{sv}}}\" name=\"object_paths_interfaces_and_properties\" direction=\"out\"/>\n" \
132         "  </method>\n"                                                 \
133         "  <signal name=\"InterfacesAdded\">\n"                         \
134         "   <arg type=\"o\" name=\"object_path\"/>\n"                   \
135         "   <arg type=\"a{sa{sv}}\" name=\"interfaces_and_properties\"/>\n" \
136         "  </signal>\n"                                                 \
137         "  <signal name=\"InterfacesRemoved\">\n"                       \
138         "   <arg type=\"o\" name=\"object_path\"/>\n"                   \
139         "   <arg type=\"as\" name=\"interfaces\"/>\n"                   \
140         "  </signal>\n"                                                 \
141         " </interface>\n"