1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright © 2008, 2009 Codethink Limited
4 * Copyright © 2009 Red Hat, Inc
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authors: Ryan Lortie <desrt@desrt.ca>
20 * Alexander Larsson <alexl@redhat.com>
21 */
22
23#ifndef __G_SOCKET_CLIENT_H__
24#define __G_SOCKET_CLIENT_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_SOCKET_CLIENT (g_socket_client_get_type ())
35#define G_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
36 G_TYPE_SOCKET_CLIENT, GSocketClient))
37#define G_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
38 G_TYPE_SOCKET_CLIENT, GSocketClientClass))
39#define G_IS_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
40 G_TYPE_SOCKET_CLIENT))
41#define G_IS_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
42 G_TYPE_SOCKET_CLIENT))
43#define G_SOCKET_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
44 G_TYPE_SOCKET_CLIENT, GSocketClientClass))
45
46typedef struct _GSocketClientPrivate GSocketClientPrivate;
47typedef struct _GSocketClientClass GSocketClientClass;
48
49struct _GSocketClientClass
50{
51 GObjectClass parent_class;
52
53 void (* event) (GSocketClient *client,
54 GSocketClientEvent event,
55 GSocketConnectable *connectable,
56 GIOStream *connection);
57
58 /* Padding for future expansion */
59 void (*_g_reserved1) (void);
60 void (*_g_reserved2) (void);
61 void (*_g_reserved3) (void);
62 void (*_g_reserved4) (void);
63};
64
65struct _GSocketClient
66{
67 GObject parent_instance;
68 GSocketClientPrivate *priv;
69};
70
71GLIB_AVAILABLE_IN_ALL
72GType g_socket_client_get_type (void) G_GNUC_CONST;
73
74GLIB_AVAILABLE_IN_ALL
75GSocketClient *g_socket_client_new (void);
76
77GLIB_AVAILABLE_IN_ALL
78GSocketFamily g_socket_client_get_family (GSocketClient *client);
79GLIB_AVAILABLE_IN_ALL
80void g_socket_client_set_family (GSocketClient *client,
81 GSocketFamily family);
82GLIB_AVAILABLE_IN_ALL
83GSocketType g_socket_client_get_socket_type (GSocketClient *client);
84GLIB_AVAILABLE_IN_ALL
85void g_socket_client_set_socket_type (GSocketClient *client,
86 GSocketType type);
87GLIB_AVAILABLE_IN_ALL
88GSocketProtocol g_socket_client_get_protocol (GSocketClient *client);
89GLIB_AVAILABLE_IN_ALL
90void g_socket_client_set_protocol (GSocketClient *client,
91 GSocketProtocol protocol);
92GLIB_AVAILABLE_IN_ALL
93GSocketAddress *g_socket_client_get_local_address (GSocketClient *client);
94GLIB_AVAILABLE_IN_ALL
95void g_socket_client_set_local_address (GSocketClient *client,
96 GSocketAddress *address);
97GLIB_AVAILABLE_IN_ALL
98guint g_socket_client_get_timeout (GSocketClient *client);
99GLIB_AVAILABLE_IN_ALL
100void g_socket_client_set_timeout (GSocketClient *client,
101 guint timeout);
102GLIB_AVAILABLE_IN_ALL
103gboolean g_socket_client_get_enable_proxy (GSocketClient *client);
104GLIB_AVAILABLE_IN_ALL
105void g_socket_client_set_enable_proxy (GSocketClient *client,
106 gboolean enable);
107
108GLIB_AVAILABLE_IN_2_28
109gboolean g_socket_client_get_tls (GSocketClient *client);
110GLIB_AVAILABLE_IN_2_28
111void g_socket_client_set_tls (GSocketClient *client,
112 gboolean tls);
113GLIB_DEPRECATED_IN_2_72
114GTlsCertificateFlags g_socket_client_get_tls_validation_flags (GSocketClient *client);
115GLIB_DEPRECATED_IN_2_72
116void g_socket_client_set_tls_validation_flags (GSocketClient *client,
117 GTlsCertificateFlags flags);
118GLIB_AVAILABLE_IN_2_36
119GProxyResolver *g_socket_client_get_proxy_resolver (GSocketClient *client);
120GLIB_AVAILABLE_IN_2_36
121void g_socket_client_set_proxy_resolver (GSocketClient *client,
122 GProxyResolver *proxy_resolver);
123
124GLIB_AVAILABLE_IN_ALL
125GSocketConnection * g_socket_client_connect (GSocketClient *client,
126 GSocketConnectable *connectable,
127 GCancellable *cancellable,
128 GError **error);
129GLIB_AVAILABLE_IN_ALL
130GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
131 const gchar *host_and_port,
132 guint16 default_port,
133 GCancellable *cancellable,
134 GError **error);
135GLIB_AVAILABLE_IN_ALL
136GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
137 const gchar *domain,
138 const gchar *service,
139 GCancellable *cancellable,
140 GError **error);
141GLIB_AVAILABLE_IN_2_26
142GSocketConnection * g_socket_client_connect_to_uri (GSocketClient *client,
143 const gchar *uri,
144 guint16 default_port,
145 GCancellable *cancellable,
146 GError **error);
147GLIB_AVAILABLE_IN_ALL
148void g_socket_client_connect_async (GSocketClient *client,
149 GSocketConnectable *connectable,
150 GCancellable *cancellable,
151 GAsyncReadyCallback callback,
152 gpointer user_data);
153GLIB_AVAILABLE_IN_ALL
154GSocketConnection * g_socket_client_connect_finish (GSocketClient *client,
155 GAsyncResult *result,
156 GError **error);
157GLIB_AVAILABLE_IN_ALL
158void g_socket_client_connect_to_host_async (GSocketClient *client,
159 const gchar *host_and_port,
160 guint16 default_port,
161 GCancellable *cancellable,
162 GAsyncReadyCallback callback,
163 gpointer user_data);
164GLIB_AVAILABLE_IN_ALL
165GSocketConnection * g_socket_client_connect_to_host_finish (GSocketClient *client,
166 GAsyncResult *result,
167 GError **error);
168
169GLIB_AVAILABLE_IN_ALL
170void g_socket_client_connect_to_service_async (GSocketClient *client,
171 const gchar *domain,
172 const gchar *service,
173 GCancellable *cancellable,
174 GAsyncReadyCallback callback,
175 gpointer user_data);
176GLIB_AVAILABLE_IN_ALL
177GSocketConnection * g_socket_client_connect_to_service_finish (GSocketClient *client,
178 GAsyncResult *result,
179 GError **error);
180GLIB_AVAILABLE_IN_ALL
181void g_socket_client_connect_to_uri_async (GSocketClient *client,
182 const gchar *uri,
183 guint16 default_port,
184 GCancellable *cancellable,
185 GAsyncReadyCallback callback,
186 gpointer user_data);
187GLIB_AVAILABLE_IN_ALL
188GSocketConnection * g_socket_client_connect_to_uri_finish (GSocketClient *client,
189 GAsyncResult *result,
190 GError **error);
191GLIB_AVAILABLE_IN_ALL
192void g_socket_client_add_application_proxy (GSocketClient *client,
193 const gchar *protocol);
194
195G_END_DECLS
196
197#endif /* __G_SOCKET_CLIENT_H___ */
198

source code of include/glib-2.0/gio/gsocketclient.h