gsocketclient.h 11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* GIO - GLib Input, Output and Streaming Library
 *
 * Copyright © 2008, 2009 Codethink Limited
 * Copyright © 2009 Red Hat, Inc
 *
 * This program 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 of the licence or (at
 * your option) any later version.
 *
 * 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
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Authors: Ryan Lortie <desrt@desrt.ca>
 *          Alexander Larsson <alexl@redhat.com>
 */

25 26 27
#ifndef __G_SOCKET_CLIENT_H__
#define __G_SOCKET_CLIENT_H__

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 53 54
#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;

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

60 61 62 63 64 65 66 67 68 69 70 71 72
  /* 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;
};

73
GLIB_AVAILABLE_IN_ALL
74 75
GType                   g_socket_client_get_type                        (void) G_GNUC_CONST;

76
GLIB_AVAILABLE_IN_ALL
77 78
GSocketClient          *g_socket_client_new                             (void);

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

110
GLIB_AVAILABLE_IN_2_28
111
gboolean                g_socket_client_get_tls                         (GSocketClient        *client);
112
GLIB_AVAILABLE_IN_2_28
113 114
void                    g_socket_client_set_tls                         (GSocketClient        *client,
									 gboolean              tls);
115
GLIB_AVAILABLE_IN_2_28
116
GTlsCertificateFlags    g_socket_client_get_tls_validation_flags        (GSocketClient        *client);
117
GLIB_AVAILABLE_IN_2_28
118 119
void                    g_socket_client_set_tls_validation_flags        (GSocketClient        *client,
									 GTlsCertificateFlags  flags);
120 121 122 123 124
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);
125

126
GLIB_AVAILABLE_IN_ALL
127 128 129 130
GSocketConnection *     g_socket_client_connect                         (GSocketClient        *client,
                                                                         GSocketConnectable   *connectable,
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
131
GLIB_AVAILABLE_IN_ALL
132
GSocketConnection *     g_socket_client_connect_to_host                 (GSocketClient        *client,
133
									 const gchar          *host_and_port,
134
									 guint16               default_port,
135 136
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
137
GLIB_AVAILABLE_IN_ALL
138
GSocketConnection *     g_socket_client_connect_to_service              (GSocketClient        *client,
139 140
									 const gchar          *domain,
									 const gchar          *service,
141 142
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
143
GLIB_AVAILABLE_IN_2_26
144 145 146 147 148
GSocketConnection *     g_socket_client_connect_to_uri                  (GSocketClient        *client,
									 const gchar          *uri,
									 guint16               default_port,
                                                                         GCancellable         *cancellable,
                                                                         GError              **error);
149
GLIB_AVAILABLE_IN_ALL
150 151 152 153 154
void                    g_socket_client_connect_async                   (GSocketClient        *client,
                                                                         GSocketConnectable   *connectable,
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
155
GLIB_AVAILABLE_IN_ALL
156 157 158
GSocketConnection *     g_socket_client_connect_finish                  (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);
159
GLIB_AVAILABLE_IN_ALL
160
void                    g_socket_client_connect_to_host_async           (GSocketClient        *client,
161
									 const gchar          *host_and_port,
162
									 guint16               default_port,
163 164 165
                                                                         GCancellable         *cancellable,
                                                                         GAsyncReadyCallback   callback,
                                                                         gpointer              user_data);
166
GLIB_AVAILABLE_IN_ALL
167 168 169 170
GSocketConnection *     g_socket_client_connect_to_host_finish          (GSocketClient        *client,
                                                                         GAsyncResult         *result,
                                                                         GError              **error);

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

197 198 199
G_END_DECLS

#endif /* __G_SOCKET_CLIENT_H___ */