gsocketclient.h 10.9 KB
Newer Older
1 2 3 4 5
/* GIO - GLib Input, Output and Streaming Library
 *
 * Copyright © 2008, 2009 Codethink Limited
 * Copyright © 2009 Red Hat, Inc
 *
6 7 8 9
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * 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 20 21 22
 *
 * Authors: Ryan Lortie <desrt@desrt.ca>
 *          Alexander Larsson <alexl@redhat.com>
 */

23 24 25
#ifndef __G_SOCKET_CLIENT_H__
#define __G_SOCKET_CLIENT_H__

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

#include <gio/giotypes.h>

G_BEGIN_DECLS

#define G_TYPE_SOCKET_CLIENT                                (g_socket_client_get_type ())
#define G_SOCKET_CLIENT(inst)                               (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
                                                             G_TYPE_SOCKET_CLIENT, GSocketClient))
#define G_SOCKET_CLIENT_CLASS(class)                        (G_TYPE_CHECK_CLASS_CAST ((class),                       \
                                                             G_TYPE_SOCKET_CLIENT, GSocketClientClass))
#define G_IS_SOCKET_CLIENT(inst)                            (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
                                                             G_TYPE_SOCKET_CLIENT))
#define G_IS_SOCKET_CLIENT_CLASS(class)                     (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
                                                             G_TYPE_SOCKET_CLIENT))
#define G_SOCKET_CLIENT_GET_CLASS(inst)                     (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
                                                             G_TYPE_SOCKET_CLIENT, GSocketClientClass))

typedef struct _GSocketClientPrivate                        GSocketClientPrivate;
typedef struct _GSocketClientClass                          GSocketClientClass;

struct _GSocketClientClass
{
  GObjectClass parent_class;

53 54 55 56 57
  void (* event) (GSocketClient       *client,
		  GSocketClientEvent  event,
		  GSocketConnectable  *connectable,
		  GIOStream           *connection);

58 59 60 61 62 63 64 65 66 67 68 69 70
  /* Padding for future expansion */
  void (*_g_reserved1) (void);
  void (*_g_reserved2) (void);
  void (*_g_reserved3) (void);
  void (*_g_reserved4) (void);
};

struct _GSocketClient
{
  GObject parent_instance;
  GSocketClientPrivate *priv;
};

71
GLIB_AVAILABLE_IN_ALL
72 73
GType                   g_socket_client_get_type                        (void) G_GNUC_CONST;

74
GLIB_AVAILABLE_IN_ALL
75 76
GSocketClient          *g_socket_client_new                             (void);

77
GLIB_AVAILABLE_IN_ALL
78
GSocketFamily           g_socket_client_get_family                      (GSocketClient        *client);
79
GLIB_AVAILABLE_IN_ALL
80 81
void                    g_socket_client_set_family                      (GSocketClient        *client,
									 GSocketFamily         family);
82
GLIB_AVAILABLE_IN_ALL
83
GSocketType             g_socket_client_get_socket_type                 (GSocketClient        *client);
84
GLIB_AVAILABLE_IN_ALL
85 86
void                    g_socket_client_set_socket_type                 (GSocketClient        *client,
									 GSocketType           type);
87
GLIB_AVAILABLE_IN_ALL
88
GSocketProtocol         g_socket_client_get_protocol                    (GSocketClient        *client);
89
GLIB_AVAILABLE_IN_ALL
90
void                    g_socket_client_set_protocol                    (GSocketClient        *client,
91
									 GSocketProtocol       protocol);
92
GLIB_AVAILABLE_IN_ALL
93
GSocketAddress         *g_socket_client_get_local_address               (GSocketClient        *client);
94
GLIB_AVAILABLE_IN_ALL
95 96
void                    g_socket_client_set_local_address               (GSocketClient        *client,
									 GSocketAddress       *address);
97
GLIB_AVAILABLE_IN_ALL
98
guint                   g_socket_client_get_timeout                     (GSocketClient        *client);
99
GLIB_AVAILABLE_IN_ALL
100 101
void                    g_socket_client_set_timeout                     (GSocketClient        *client,
									 guint                 timeout);
102
GLIB_AVAILABLE_IN_ALL
103
gboolean                g_socket_client_get_enable_proxy                (GSocketClient        *client);
104
GLIB_AVAILABLE_IN_ALL
105 106
void                    g_socket_client_set_enable_proxy                (GSocketClient        *client,
    									 gboolean	      enable);
107

108
GLIB_AVAILABLE_IN_2_28
109
gboolean                g_socket_client_get_tls                         (GSocketClient        *client);
110
GLIB_AVAILABLE_IN_2_28
111 112
void                    g_socket_client_set_tls                         (GSocketClient        *client,
									 gboolean              tls);
113
GLIB_AVAILABLE_IN_2_28
114
GTlsCertificateFlags    g_socket_client_get_tls_validation_flags        (GSocketClient        *client);
115
GLIB_AVAILABLE_IN_2_28
116 117
void                    g_socket_client_set_tls_validation_flags        (GSocketClient        *client,
									 GTlsCertificateFlags  flags);
118 119 120 121 122
GLIB_AVAILABLE_IN_2_36
GProxyResolver         *g_socket_client_get_proxy_resolver              (GSocketClient        *client);
GLIB_AVAILABLE_IN_2_36
void                    g_socket_client_set_proxy_resolver              (GSocketClient        *client,
                                                                         GProxyResolver       *proxy_resolver);
123

124
GLIB_AVAILABLE_IN_ALL
125 126 127 128
GSocketConnection *     g_socket_client_connect                         (GSocketClient        *client,
                                                                         GSocketConnectable   *connectable,
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
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 134
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
135
GLIB_AVAILABLE_IN_ALL
136
GSocketConnection *     g_socket_client_connect_to_service              (GSocketClient        *client,
137 138
									 const gchar          *domain,
									 const gchar          *service,
139 140
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
141
GLIB_AVAILABLE_IN_2_26
142 143 144 145 146
GSocketConnection *     g_socket_client_connect_to_uri                  (GSocketClient        *client,
									 const gchar          *uri,
									 guint16               default_port,
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
147
GLIB_AVAILABLE_IN_ALL
148 149 150 151 152
void                    g_socket_client_connect_async                   (GSocketClient        *client,
                                                                         GSocketConnectable   *connectable,
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
153
GLIB_AVAILABLE_IN_ALL
154 155 156
GSocketConnection *     g_socket_client_connect_finish                  (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
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 162 163
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
164
GLIB_AVAILABLE_IN_ALL
165 166 167 168
GSocketConnection *     g_socket_client_connect_to_host_finish          (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);

169
GLIB_AVAILABLE_IN_ALL
170
void                    g_socket_client_connect_to_service_async        (GSocketClient        *client,
171 172
									 const gchar          *domain,
									 const gchar          *service,
173 174 175
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
176
GLIB_AVAILABLE_IN_ALL
177 178 179
GSocketConnection *     g_socket_client_connect_to_service_finish       (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
180
GLIB_AVAILABLE_IN_ALL
181 182 183 184 185 186
void                    g_socket_client_connect_to_uri_async            (GSocketClient        *client,
									 const gchar          *uri,
									 guint16               default_port,
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
187
GLIB_AVAILABLE_IN_ALL
188 189 190
GSocketConnection *     g_socket_client_connect_to_uri_finish           (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
191
GLIB_AVAILABLE_IN_ALL
192 193
void			g_socket_client_add_application_proxy		(GSocketClient        *client,
									 const gchar          *protocol);
194

195 196 197
G_END_DECLS

#endif /* __G_SOCKET_CLIENT_H___ */