1/* GDBus - GLib D-Bus Library
2 *
3 * Copyright (C) 2008-2010 Red Hat, Inc.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: David Zeuthen <davidz@redhat.com>
21 */
22
23#ifndef __G_DBUS_MESSAGE_H__
24#define __G_DBUS_MESSAGE_H__
25
26#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27#error "Only <gio/gio.h> can be included directly."
28#endif
29
30#include <gio/giotypes.h>
31
32G_BEGIN_DECLS
33
34#define G_TYPE_DBUS_MESSAGE (g_dbus_message_get_type ())
35#define G_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_MESSAGE, GDBusMessage))
36#define G_IS_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_MESSAGE))
37
38GIO_AVAILABLE_IN_ALL
39GType g_dbus_message_get_type (void) G_GNUC_CONST;
40GIO_AVAILABLE_IN_ALL
41GDBusMessage *g_dbus_message_new (void);
42GIO_AVAILABLE_IN_ALL
43GDBusMessage *g_dbus_message_new_signal (const gchar *path,
44 const gchar *interface_,
45 const gchar *signal);
46GIO_AVAILABLE_IN_ALL
47GDBusMessage *g_dbus_message_new_method_call (const gchar *name,
48 const gchar *path,
49 const gchar *interface_,
50 const gchar *method);
51GIO_AVAILABLE_IN_ALL
52GDBusMessage *g_dbus_message_new_method_reply (GDBusMessage *method_call_message);
53GIO_AVAILABLE_IN_ALL
54GDBusMessage *g_dbus_message_new_method_error (GDBusMessage *method_call_message,
55 const gchar *error_name,
56 const gchar *error_message_format,
57 ...) G_GNUC_PRINTF(3, 4);
58GIO_AVAILABLE_IN_ALL
59GDBusMessage *g_dbus_message_new_method_error_valist (GDBusMessage *method_call_message,
60 const gchar *error_name,
61 const gchar *error_message_format,
62 va_list var_args);
63GIO_AVAILABLE_IN_ALL
64GDBusMessage *g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message,
65 const gchar *error_name,
66 const gchar *error_message);
67GIO_AVAILABLE_IN_ALL
68gchar *g_dbus_message_print (GDBusMessage *message,
69 guint indent);
70GIO_AVAILABLE_IN_ALL
71gboolean g_dbus_message_get_locked (GDBusMessage *message);
72GIO_AVAILABLE_IN_ALL
73void g_dbus_message_lock (GDBusMessage *message);
74GIO_AVAILABLE_IN_ALL
75GDBusMessage *g_dbus_message_copy (GDBusMessage *message,
76 GError **error);
77GIO_AVAILABLE_IN_ALL
78GDBusMessageByteOrder g_dbus_message_get_byte_order (GDBusMessage *message);
79GIO_AVAILABLE_IN_ALL
80void g_dbus_message_set_byte_order (GDBusMessage *message,
81 GDBusMessageByteOrder byte_order);
82
83GIO_AVAILABLE_IN_ALL
84GDBusMessageType g_dbus_message_get_message_type (GDBusMessage *message);
85GIO_AVAILABLE_IN_ALL
86void g_dbus_message_set_message_type (GDBusMessage *message,
87 GDBusMessageType type);
88GIO_AVAILABLE_IN_ALL
89GDBusMessageFlags g_dbus_message_get_flags (GDBusMessage *message);
90GIO_AVAILABLE_IN_ALL
91void g_dbus_message_set_flags (GDBusMessage *message,
92 GDBusMessageFlags flags);
93GIO_AVAILABLE_IN_ALL
94guint32 g_dbus_message_get_serial (GDBusMessage *message);
95GIO_AVAILABLE_IN_ALL
96void g_dbus_message_set_serial (GDBusMessage *message,
97 guint32 serial);
98GIO_AVAILABLE_IN_ALL
99GVariant *g_dbus_message_get_header (GDBusMessage *message,
100 GDBusMessageHeaderField header_field);
101GIO_AVAILABLE_IN_ALL
102void g_dbus_message_set_header (GDBusMessage *message,
103 GDBusMessageHeaderField header_field,
104 GVariant *value);
105GIO_AVAILABLE_IN_ALL
106guchar *g_dbus_message_get_header_fields (GDBusMessage *message);
107GIO_AVAILABLE_IN_ALL
108GVariant *g_dbus_message_get_body (GDBusMessage *message);
109GIO_AVAILABLE_IN_ALL
110void g_dbus_message_set_body (GDBusMessage *message,
111 GVariant *body);
112
113#ifdef G_OS_UNIX
114
115GIO_AVAILABLE_IN_ALL
116GUnixFDList *g_dbus_message_get_unix_fd_list (GDBusMessage *message);
117GIO_AVAILABLE_IN_ALL
118void g_dbus_message_set_unix_fd_list (GDBusMessage *message,
119 GUnixFDList *fd_list);
120
121#endif /* G_OS_UNIX */
122
123GIO_AVAILABLE_IN_ALL
124guint32 g_dbus_message_get_reply_serial (GDBusMessage *message);
125GIO_AVAILABLE_IN_ALL
126void g_dbus_message_set_reply_serial (GDBusMessage *message,
127 guint32 value);
128
129GIO_AVAILABLE_IN_ALL
130const gchar *g_dbus_message_get_interface (GDBusMessage *message);
131GIO_AVAILABLE_IN_ALL
132void g_dbus_message_set_interface (GDBusMessage *message,
133 const gchar *value);
134
135GIO_AVAILABLE_IN_ALL
136const gchar *g_dbus_message_get_member (GDBusMessage *message);
137GIO_AVAILABLE_IN_ALL
138void g_dbus_message_set_member (GDBusMessage *message,
139 const gchar *value);
140
141GIO_AVAILABLE_IN_ALL
142const gchar *g_dbus_message_get_path (GDBusMessage *message);
143GIO_AVAILABLE_IN_ALL
144void g_dbus_message_set_path (GDBusMessage *message,
145 const gchar *value);
146
147GIO_AVAILABLE_IN_ALL
148const gchar *g_dbus_message_get_sender (GDBusMessage *message);
149GIO_AVAILABLE_IN_ALL
150void g_dbus_message_set_sender (GDBusMessage *message,
151 const gchar *value);
152
153GIO_AVAILABLE_IN_ALL
154const gchar *g_dbus_message_get_destination (GDBusMessage *message);
155GIO_AVAILABLE_IN_ALL
156void g_dbus_message_set_destination (GDBusMessage *message,
157 const gchar *value);
158
159GIO_AVAILABLE_IN_ALL
160const gchar *g_dbus_message_get_error_name (GDBusMessage *message);
161GIO_AVAILABLE_IN_ALL
162void g_dbus_message_set_error_name (GDBusMessage *message,
163 const gchar *value);
164
165GIO_AVAILABLE_IN_ALL
166const gchar *g_dbus_message_get_signature (GDBusMessage *message);
167GIO_AVAILABLE_IN_ALL
168void g_dbus_message_set_signature (GDBusMessage *message,
169 const gchar *value);
170
171GIO_AVAILABLE_IN_ALL
172guint32 g_dbus_message_get_num_unix_fds (GDBusMessage *message);
173GIO_AVAILABLE_IN_ALL
174void g_dbus_message_set_num_unix_fds (GDBusMessage *message,
175 guint32 value);
176
177GIO_AVAILABLE_IN_ALL
178const gchar *g_dbus_message_get_arg0 (GDBusMessage *message);
179GIO_AVAILABLE_IN_2_80
180const gchar *g_dbus_message_get_arg0_path (GDBusMessage *message);
181
182GIO_AVAILABLE_IN_ALL
183GDBusMessage *g_dbus_message_new_from_blob (guchar *blob,
184 gsize blob_len,
185 GDBusCapabilityFlags capabilities,
186 GError **error);
187
188GIO_AVAILABLE_IN_ALL
189gssize g_dbus_message_bytes_needed (guchar *blob,
190 gsize blob_len,
191 GError **error);
192
193GIO_AVAILABLE_IN_ALL
194guchar *g_dbus_message_to_blob (GDBusMessage *message,
195 gsize *out_size,
196 GDBusCapabilityFlags capabilities,
197 GError **error);
198
199GIO_AVAILABLE_IN_ALL
200gboolean g_dbus_message_to_gerror (GDBusMessage *message,
201 GError **error);
202
203G_END_DECLS
204
205#endif /* __G_DBUS_MESSAGE_H__ */
206