gcredentials: add NetBSD support
[platform/upstream/glib.git] / gio / gsocketclient.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2008, 2009 Codethink Limited
4  * Copyright © 2009 Red Hat, Inc
5  *
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.
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
32 G_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
46 typedef struct _GSocketClientPrivate                        GSocketClientPrivate;
47 typedef struct _GSocketClientClass                          GSocketClientClass;
48
49 struct _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
65 struct _GSocketClient
66 {
67   GObject parent_instance;
68   GSocketClientPrivate *priv;
69 };
70
71 GLIB_AVAILABLE_IN_ALL
72 GType                   g_socket_client_get_type                        (void) G_GNUC_CONST;
73
74 GLIB_AVAILABLE_IN_ALL
75 GSocketClient          *g_socket_client_new                             (void);
76
77 GLIB_AVAILABLE_IN_ALL
78 GSocketFamily           g_socket_client_get_family                      (GSocketClient        *client);
79 GLIB_AVAILABLE_IN_ALL
80 void                    g_socket_client_set_family                      (GSocketClient        *client,
81                                                                          GSocketFamily         family);
82 GLIB_AVAILABLE_IN_ALL
83 GSocketType             g_socket_client_get_socket_type                 (GSocketClient        *client);
84 GLIB_AVAILABLE_IN_ALL
85 void                    g_socket_client_set_socket_type                 (GSocketClient        *client,
86                                                                          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 void                    g_socket_client_set_local_address               (GSocketClient        *client,
96                                                                          GSocketAddress       *address);
97 GLIB_AVAILABLE_IN_ALL
98 guint                   g_socket_client_get_timeout                     (GSocketClient        *client);
99 GLIB_AVAILABLE_IN_ALL
100 void                    g_socket_client_set_timeout                     (GSocketClient        *client,
101                                                                          guint                 timeout);
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,
106                                                                          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 void                    g_socket_client_set_tls                         (GSocketClient        *client,
112                                                                          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 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);
123
124 GLIB_AVAILABLE_IN_ALL
125 GSocketConnection *     g_socket_client_connect                         (GSocketClient        *client,
126                                                                          GSocketConnectable   *connectable,
127                                                                          GCancellable         *cancellable,
128                                                                          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                                                                          GCancellable         *cancellable,
134                                                                          GError              **error);
135 GLIB_AVAILABLE_IN_ALL
136 GSocketConnection *     g_socket_client_connect_to_service              (GSocketClient        *client,
137                                                                          const gchar          *domain,
138                                                                          const gchar          *service,
139                                                                          GCancellable         *cancellable,
140                                                                          GError              **error);
141 GLIB_AVAILABLE_IN_2_26
142 GSocketConnection *     g_socket_client_connect_to_uri                  (GSocketClient        *client,
143                                                                          const gchar          *uri,
144                                                                          guint16               default_port,
145                                                                          GCancellable         *cancellable,
146                                                                          GError              **error);
147 GLIB_AVAILABLE_IN_ALL
148 void                    g_socket_client_connect_async                   (GSocketClient        *client,
149                                                                          GSocketConnectable   *connectable,
150                                                                          GCancellable         *cancellable,
151                                                                          GAsyncReadyCallback   callback,
152                                                                          gpointer              user_data);
153 GLIB_AVAILABLE_IN_ALL
154 GSocketConnection *     g_socket_client_connect_finish                  (GSocketClient        *client,
155                                                                          GAsyncResult         *result,
156                                                                          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                                                                          GCancellable         *cancellable,
162                                                                          GAsyncReadyCallback   callback,
163                                                                          gpointer              user_data);
164 GLIB_AVAILABLE_IN_ALL
165 GSocketConnection *     g_socket_client_connect_to_host_finish          (GSocketClient        *client,
166                                                                          GAsyncResult         *result,
167                                                                          GError              **error);
168
169 GLIB_AVAILABLE_IN_ALL
170 void                    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);
176 GLIB_AVAILABLE_IN_ALL
177 GSocketConnection *     g_socket_client_connect_to_service_finish       (GSocketClient        *client,
178                                                                          GAsyncResult         *result,
179                                                                          GError              **error);
180 GLIB_AVAILABLE_IN_ALL
181 void                    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);
187 GLIB_AVAILABLE_IN_ALL
188 GSocketConnection *     g_socket_client_connect_to_uri_finish           (GSocketClient        *client,
189                                                                          GAsyncResult         *result,
190                                                                          GError              **error);
191 GLIB_AVAILABLE_IN_ALL
192 void                    g_socket_client_add_application_proxy           (GSocketClient        *client,
193                                                                          const gchar          *protocol);
194
195 G_END_DECLS
196
197 #endif /* __G_SOCKET_CLIENT_H___ */