1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 2008, 2009 Codethink Limited
4 * Copyright © 2009 Red Hat, Inc
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2 of the licence or (at
9 * your option) any later version.
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.
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/>.
19 * Authors: Ryan Lortie <desrt@desrt.ca>
20 * Alexander Larsson <alexl@redhat.com>
23 #ifndef __G_SOCKET_CLIENT_H__
24 #define __G_SOCKET_CLIENT_H__
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
30 #include <gio/giotypes.h>
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))
46 typedef struct _GSocketClientPrivate GSocketClientPrivate
;
47 typedef struct _GSocketClientClass GSocketClientClass
;
49 struct _GSocketClientClass
51 GObjectClass parent_class
;
53 void (* event
) (GSocketClient
*client
,
54 GSocketClientEvent event
,
55 GSocketConnectable
*connectable
,
56 GIOStream
*connection
);
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);
67 GObject parent_instance
;
68 GSocketClientPrivate
*priv
;
72 GType
g_socket_client_get_type (void) G_GNUC_CONST
;
75 GSocketClient
*g_socket_client_new (void);
78 GSocketFamily
g_socket_client_get_family (GSocketClient
*client
);
80 void g_socket_client_set_family (GSocketClient
*client
,
81 GSocketFamily family
);
83 GSocketType
g_socket_client_get_socket_type (GSocketClient
*client
);
85 void g_socket_client_set_socket_type (GSocketClient
*client
,
88 GSocketProtocol
g_socket_client_get_protocol (GSocketClient
*client
);
90 void g_socket_client_set_protocol (GSocketClient
*client
,
91 GSocketProtocol protocol
);
93 GSocketAddress
*g_socket_client_get_local_address (GSocketClient
*client
);
95 void g_socket_client_set_local_address (GSocketClient
*client
,
96 GSocketAddress
*address
);
98 guint
g_socket_client_get_timeout (GSocketClient
*client
);
100 void g_socket_client_set_timeout (GSocketClient
*client
,
102 GLIB_AVAILABLE_IN_ALL
103 gboolean
g_socket_client_get_enable_proxy (GSocketClient
*client
);
104 GLIB_AVAILABLE_IN_ALL
105 void g_socket_client_set_enable_proxy (GSocketClient
*client
,
108 GLIB_AVAILABLE_IN_2_28
109 gboolean
g_socket_client_get_tls (GSocketClient
*client
);
110 GLIB_AVAILABLE_IN_2_28
111 void g_socket_client_set_tls (GSocketClient
*client
,
113 GLIB_AVAILABLE_IN_2_28
114 GTlsCertificateFlags
g_socket_client_get_tls_validation_flags (GSocketClient
*client
);
115 GLIB_AVAILABLE_IN_2_28
116 void g_socket_client_set_tls_validation_flags (GSocketClient
*client
,
117 GTlsCertificateFlags flags
);
118 GLIB_AVAILABLE_IN_2_36
119 GProxyResolver
*g_socket_client_get_proxy_resolver (GSocketClient
*client
);
120 GLIB_AVAILABLE_IN_2_36
121 void g_socket_client_set_proxy_resolver (GSocketClient
*client
,
122 GProxyResolver
*proxy_resolver
);
124 GLIB_AVAILABLE_IN_ALL
125 GSocketConnection
* g_socket_client_connect (GSocketClient
*client
,
126 GSocketConnectable
*connectable
,
127 GCancellable
*cancellable
,
129 GLIB_AVAILABLE_IN_ALL
130 GSocketConnection
* g_socket_client_connect_to_host (GSocketClient
*client
,
131 const gchar
*host_and_port
,
132 guint16 default_port
,
133 GCancellable
*cancellable
,
135 GLIB_AVAILABLE_IN_ALL
136 GSocketConnection
* g_socket_client_connect_to_service (GSocketClient
*client
,
138 const gchar
*service
,
139 GCancellable
*cancellable
,
141 GLIB_AVAILABLE_IN_2_26
142 GSocketConnection
* g_socket_client_connect_to_uri (GSocketClient
*client
,
144 guint16 default_port
,
145 GCancellable
*cancellable
,
147 GLIB_AVAILABLE_IN_ALL
148 void g_socket_client_connect_async (GSocketClient
*client
,
149 GSocketConnectable
*connectable
,
150 GCancellable
*cancellable
,
151 GAsyncReadyCallback callback
,
153 GLIB_AVAILABLE_IN_ALL
154 GSocketConnection
* g_socket_client_connect_finish (GSocketClient
*client
,
155 GAsyncResult
*result
,
157 GLIB_AVAILABLE_IN_ALL
158 void 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
,
164 GLIB_AVAILABLE_IN_ALL
165 GSocketConnection
* g_socket_client_connect_to_host_finish (GSocketClient
*client
,
166 GAsyncResult
*result
,
169 GLIB_AVAILABLE_IN_ALL
170 void g_socket_client_connect_to_service_async (GSocketClient
*client
,
172 const gchar
*service
,
173 GCancellable
*cancellable
,
174 GAsyncReadyCallback callback
,
176 GLIB_AVAILABLE_IN_ALL
177 GSocketConnection
* g_socket_client_connect_to_service_finish (GSocketClient
*client
,
178 GAsyncResult
*result
,
180 GLIB_AVAILABLE_IN_ALL
181 void g_socket_client_connect_to_uri_async (GSocketClient
*client
,
183 guint16 default_port
,
184 GCancellable
*cancellable
,
185 GAsyncReadyCallback callback
,
187 GLIB_AVAILABLE_IN_ALL
188 GSocketConnection
* g_socket_client_connect_to_uri_finish (GSocketClient
*client
,
189 GAsyncResult
*result
,
191 GLIB_AVAILABLE_IN_ALL
192 void g_socket_client_add_application_proxy (GSocketClient
*client
,
193 const gchar
*protocol
);
197 #endif /* __G_SOCKET_CLIENT_H___ */