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, write to the
18 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307, USA.
21 * Authors: Ryan Lortie <desrt@desrt.ca>
22 * Alexander Larsson <alexl@redhat.com>
25 #ifndef __G_SOCKET_CLIENT_H__
26 #define __G_SOCKET_CLIENT_H__
28 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
29 #error "Only <gio/gio.h> can be included directly."
32 #include <gio/giotypes.h>
36 #define G_TYPE_SOCKET_CLIENT (g_socket_client_get_type ())
37 #define G_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
38 G_TYPE_SOCKET_CLIENT, GSocketClient))
39 #define G_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
40 G_TYPE_SOCKET_CLIENT, GSocketClientClass))
41 #define G_IS_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
42 G_TYPE_SOCKET_CLIENT))
43 #define G_IS_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
44 G_TYPE_SOCKET_CLIENT))
45 #define G_SOCKET_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
46 G_TYPE_SOCKET_CLIENT, GSocketClientClass))
48 typedef struct _GSocketClientPrivate GSocketClientPrivate;
49 typedef struct _GSocketClientClass GSocketClientClass;
51 struct _GSocketClientClass
53 GObjectClass parent_class;
55 void (* event) (GSocketClient *client,
56 GSocketClientEvent event,
57 GSocketConnectable *connectable,
58 GIOStream *connection);
60 /* Padding for future expansion */
61 void (*_g_reserved1) (void);
62 void (*_g_reserved2) (void);
63 void (*_g_reserved3) (void);
64 void (*_g_reserved4) (void);
69 GObject parent_instance;
70 GSocketClientPrivate *priv;
74 GType g_socket_client_get_type (void) G_GNUC_CONST;
77 GSocketClient *g_socket_client_new (void);
80 GSocketFamily g_socket_client_get_family (GSocketClient *client);
82 void g_socket_client_set_family (GSocketClient *client,
83 GSocketFamily family);
85 GSocketType g_socket_client_get_socket_type (GSocketClient *client);
87 void g_socket_client_set_socket_type (GSocketClient *client,
90 GSocketProtocol g_socket_client_get_protocol (GSocketClient *client);
92 void g_socket_client_set_protocol (GSocketClient *client,
93 GSocketProtocol protocol);
95 GSocketAddress *g_socket_client_get_local_address (GSocketClient *client);
97 void g_socket_client_set_local_address (GSocketClient *client,
98 GSocketAddress *address);
100 guint g_socket_client_get_timeout (GSocketClient *client);
101 GLIB_AVAILABLE_IN_ALL
102 void g_socket_client_set_timeout (GSocketClient *client,
104 GLIB_AVAILABLE_IN_ALL
105 gboolean g_socket_client_get_enable_proxy (GSocketClient *client);
106 GLIB_AVAILABLE_IN_ALL
107 void g_socket_client_set_enable_proxy (GSocketClient *client,
110 GLIB_AVAILABLE_IN_ALL
111 gboolean g_socket_client_get_tls (GSocketClient *client);
112 GLIB_AVAILABLE_IN_ALL
113 void g_socket_client_set_tls (GSocketClient *client,
115 GLIB_AVAILABLE_IN_ALL
116 GTlsCertificateFlags g_socket_client_get_tls_validation_flags (GSocketClient *client);
117 GLIB_AVAILABLE_IN_ALL
118 void g_socket_client_set_tls_validation_flags (GSocketClient *client,
119 GTlsCertificateFlags flags);
121 GLIB_AVAILABLE_IN_ALL
122 GSocketConnection * g_socket_client_connect (GSocketClient *client,
123 GSocketConnectable *connectable,
124 GCancellable *cancellable,
126 GLIB_AVAILABLE_IN_ALL
127 GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client,
128 const gchar *host_and_port,
129 guint16 default_port,
130 GCancellable *cancellable,
132 GLIB_AVAILABLE_IN_ALL
133 GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client,
135 const gchar *service,
136 GCancellable *cancellable,
138 GLIB_AVAILABLE_IN_ALL
139 GSocketConnection * g_socket_client_connect_to_uri (GSocketClient *client,
141 guint16 default_port,
142 GCancellable *cancellable,
144 GLIB_AVAILABLE_IN_ALL
145 void g_socket_client_connect_async (GSocketClient *client,
146 GSocketConnectable *connectable,
147 GCancellable *cancellable,
148 GAsyncReadyCallback callback,
150 GLIB_AVAILABLE_IN_ALL
151 GSocketConnection * g_socket_client_connect_finish (GSocketClient *client,
152 GAsyncResult *result,
154 GLIB_AVAILABLE_IN_ALL
155 void g_socket_client_connect_to_host_async (GSocketClient *client,
156 const gchar *host_and_port,
157 guint16 default_port,
158 GCancellable *cancellable,
159 GAsyncReadyCallback callback,
161 GLIB_AVAILABLE_IN_ALL
162 GSocketConnection * g_socket_client_connect_to_host_finish (GSocketClient *client,
163 GAsyncResult *result,
166 GLIB_AVAILABLE_IN_ALL
167 void g_socket_client_connect_to_service_async (GSocketClient *client,
169 const gchar *service,
170 GCancellable *cancellable,
171 GAsyncReadyCallback callback,
173 GLIB_AVAILABLE_IN_ALL
174 GSocketConnection * g_socket_client_connect_to_service_finish (GSocketClient *client,
175 GAsyncResult *result,
177 GLIB_AVAILABLE_IN_ALL
178 void g_socket_client_connect_to_uri_async (GSocketClient *client,
180 guint16 default_port,
181 GCancellable *cancellable,
182 GAsyncReadyCallback callback,
184 GLIB_AVAILABLE_IN_ALL
185 GSocketConnection * g_socket_client_connect_to_uri_finish (GSocketClient *client,
186 GAsyncResult *result,
188 GLIB_AVAILABLE_IN_ALL
189 void g_socket_client_add_application_proxy (GSocketClient *client,
190 const gchar *protocol);
194 #endif /* __G_SOCKET_CLIENT_H___ */