[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / gio / gunixconnection.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2009 Codethink Limited
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2 of the licence or (at
8  * your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Authors: Ryan Lortie <desrt@desrt.ca>
19  */
20
21 #ifndef __G_UNIX_CONNECTION_H__
22 #define __G_UNIX_CONNECTION_H__
23
24 #include <gio/gio.h>
25
26 G_BEGIN_DECLS
27
28 #define G_TYPE_UNIX_CONNECTION                              (g_unix_connection_get_type ())
29 #define G_UNIX_CONNECTION(inst)                             (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
30                                                              G_TYPE_UNIX_CONNECTION, GUnixConnection))
31 #define G_UNIX_CONNECTION_CLASS(class)                      (G_TYPE_CHECK_CLASS_CAST ((class),                       \
32                                                              G_TYPE_UNIX_CONNECTION, GUnixConnectionClass))
33 #define G_IS_UNIX_CONNECTION(inst)                          (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
34                                                              G_TYPE_UNIX_CONNECTION))
35 #define G_IS_UNIX_CONNECTION_CLASS(class)                   (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
36                                                              G_TYPE_UNIX_CONNECTION))
37 #define G_UNIX_CONNECTION_GET_CLASS(inst)                   (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
38                                                              G_TYPE_UNIX_CONNECTION, GUnixConnectionClass))
39
40 typedef struct _GUnixConnection                             GUnixConnection;
41 typedef struct _GUnixConnectionPrivate                      GUnixConnectionPrivate;
42 typedef struct _GUnixConnectionClass                        GUnixConnectionClass;
43
44 struct _GUnixConnectionClass
45 {
46   GSocketConnectionClass parent_class;
47 };
48
49 struct _GUnixConnection
50 {
51   GSocketConnection parent_instance;
52   GUnixConnectionPrivate *priv;
53 };
54
55 GLIB_AVAILABLE_IN_ALL
56 GType                   g_unix_connection_get_type                      (void);
57
58 GLIB_AVAILABLE_IN_ALL
59 gboolean                g_unix_connection_send_fd                       (GUnixConnection      *connection,
60                                                                          gint                  fd,
61                                                                          GCancellable         *cancellable,
62                                                                          GError              **error);
63 GLIB_AVAILABLE_IN_ALL
64 gint                    g_unix_connection_receive_fd                    (GUnixConnection      *connection,
65                                                                          GCancellable         *cancellable,
66                                                                          GError              **error);
67
68 GLIB_AVAILABLE_IN_ALL
69 gboolean                g_unix_connection_send_credentials              (GUnixConnection      *connection,
70                                                                          GCancellable         *cancellable,
71                                                                          GError              **error);
72 GLIB_AVAILABLE_IN_2_32
73 void                    g_unix_connection_send_credentials_async        (GUnixConnection      *connection,
74                                                                          GCancellable         *cancellable,
75                                                                          GAsyncReadyCallback   callback,
76                                                                          gpointer              user_data);
77 GLIB_AVAILABLE_IN_2_32
78 gboolean                g_unix_connection_send_credentials_finish       (GUnixConnection      *connection,
79                                                                          GAsyncResult         *result,
80                                                                          GError              **error);
81
82 GLIB_AVAILABLE_IN_2_32
83 GCredentials           *g_unix_connection_receive_credentials           (GUnixConnection      *connection,
84                                                                          GCancellable         *cancellable,
85                                                                          GError              **error);
86 GLIB_AVAILABLE_IN_2_32
87 void                    g_unix_connection_receive_credentials_async     (GUnixConnection      *connection,
88                                                                          GCancellable         *cancellable,
89                                                                          GAsyncReadyCallback   callback,
90                                                                          gpointer              user_data);
91 GLIB_AVAILABLE_IN_ALL
92 GCredentials           *g_unix_connection_receive_credentials_finish    (GUnixConnection      *connection,
93                                                                          GAsyncResult         *result,
94                                                                          GError              **error);
95
96 G_END_DECLS
97
98 #endif /* __G_UNIX_CONNECTION_H__ */