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