1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright © 2009 Codethink Limited
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 * Authors: Ryan Lortie <desrt@desrt.ca>
21 */
22
23#ifndef __G_UNIX_CONNECTION_H__
24#define __G_UNIX_CONNECTION_H__
25
26#include <gio/gio.h>
27
28G_BEGIN_DECLS
29
30#define G_TYPE_UNIX_CONNECTION (g_unix_connection_get_type ())
31#define G_UNIX_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
32 G_TYPE_UNIX_CONNECTION, GUnixConnection))
33#define G_UNIX_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
34 G_TYPE_UNIX_CONNECTION, GUnixConnectionClass))
35#define G_IS_UNIX_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
36 G_TYPE_UNIX_CONNECTION))
37#define G_IS_UNIX_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
38 G_TYPE_UNIX_CONNECTION))
39#define G_UNIX_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
40 G_TYPE_UNIX_CONNECTION, GUnixConnectionClass))
41
42typedef struct _GUnixConnection GUnixConnection;
43typedef struct _GUnixConnectionPrivate GUnixConnectionPrivate;
44typedef struct _GUnixConnectionClass GUnixConnectionClass;
45
46G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixConnection, g_object_unref)
47
48struct _GUnixConnectionClass
49{
50 GSocketConnectionClass parent_class;
51};
52
53struct _GUnixConnection
54{
55 GSocketConnection parent_instance;
56 GUnixConnectionPrivate *priv;
57};
58
59GIO_AVAILABLE_IN_ALL
60GType g_unix_connection_get_type (void);
61
62GIO_AVAILABLE_IN_ALL
63gboolean g_unix_connection_send_fd (GUnixConnection *connection,
64 gint fd,
65 GCancellable *cancellable,
66 GError **error);
67GIO_AVAILABLE_IN_ALL
68gint g_unix_connection_receive_fd (GUnixConnection *connection,
69 GCancellable *cancellable,
70 GError **error);
71
72GIO_AVAILABLE_IN_ALL
73gboolean g_unix_connection_send_credentials (GUnixConnection *connection,
74 GCancellable *cancellable,
75 GError **error);
76GIO_AVAILABLE_IN_2_32
77void g_unix_connection_send_credentials_async (GUnixConnection *connection,
78 GCancellable *cancellable,
79 GAsyncReadyCallback callback,
80 gpointer user_data);
81GIO_AVAILABLE_IN_2_32
82gboolean g_unix_connection_send_credentials_finish (GUnixConnection *connection,
83 GAsyncResult *result,
84 GError **error);
85
86GIO_AVAILABLE_IN_2_32
87GCredentials *g_unix_connection_receive_credentials (GUnixConnection *connection,
88 GCancellable *cancellable,
89 GError **error);
90GIO_AVAILABLE_IN_2_32
91void g_unix_connection_receive_credentials_async (GUnixConnection *connection,
92 GCancellable *cancellable,
93 GAsyncReadyCallback callback,
94 gpointer user_data);
95GIO_AVAILABLE_IN_ALL
96GCredentials *g_unix_connection_receive_credentials_finish (GUnixConnection *connection,
97 GAsyncResult *result,
98 GError **error);
99
100G_END_DECLS
101
102#endif /* __G_UNIX_CONNECTION_H__ */
103