[kdbus] Integrate kdbus core with new API.
[platform/upstream/glib.git] / gio / gproxy.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2
3 /* GIO - GLib Input, Output and Streaming Library
4  *
5  * Copyright (C) 2010 Collabora Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
21  */
22
23 #ifndef __G_PROXY_H__
24 #define __G_PROXY_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_PROXY            (g_proxy_get_type ())
35 #define G_PROXY(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY, GProxy))
36 #define G_IS_PROXY(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY))
37 #define G_PROXY_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_PROXY, GProxyInterface))
38
39 /**
40  * G_PROXY_EXTENSION_POINT_NAME:
41  *
42  * Extension point for proxy functionality.
43  * See [Extending GIO][extending-gio].
44  *
45  * Since: 2.26
46  */
47 #define G_PROXY_EXTENSION_POINT_NAME "gio-proxy"
48
49 /**
50  * GProxy:
51  *
52  * Interface that handles proxy connection and payload.
53  *
54  * Since: 2.26
55  */
56 typedef struct _GProxyInterface GProxyInterface;
57
58 /**
59  * GProxyInterface:
60  * @g_iface: The parent interface.
61  * @connect: Connect to proxy server and wrap (if required) the #connection
62  *           to handle payload.
63  * @connect_async: Same as connect() but asynchronous.
64  * @connect_finish: Returns the result of connect_async()
65  * @supports_hostname: Returns whether the proxy supports hostname lookups.
66  *
67  * Provides an interface for handling proxy connection and payload.
68  *
69  * Since: 2.26
70  */
71 struct _GProxyInterface
72 {
73   GTypeInterface g_iface;
74
75   /* Virtual Table */
76
77   GIOStream * (* connect)           (GProxy               *proxy,
78                                      GIOStream            *connection,
79                                      GProxyAddress        *proxy_address,
80                                      GCancellable         *cancellable,
81                                      GError              **error);
82
83   void        (* connect_async)     (GProxy               *proxy,
84                                      GIOStream            *connection,
85                                      GProxyAddress        *proxy_address,
86                                      GCancellable         *cancellable,
87                                      GAsyncReadyCallback   callback,
88                                      gpointer              user_data);
89
90   GIOStream * (* connect_finish)    (GProxy               *proxy,
91                                      GAsyncResult         *result,
92                                      GError              **error);
93
94   gboolean    (* supports_hostname) (GProxy             *proxy);
95 };
96
97 GLIB_AVAILABLE_IN_ALL
98 GType      g_proxy_get_type                 (void) G_GNUC_CONST;
99
100 GLIB_AVAILABLE_IN_ALL
101 GProxy    *g_proxy_get_default_for_protocol (const gchar *protocol);
102
103 GLIB_AVAILABLE_IN_ALL
104 GIOStream *g_proxy_connect           (GProxy               *proxy,
105                                       GIOStream            *connection,
106                                       GProxyAddress        *proxy_address,
107                                       GCancellable         *cancellable,
108                                       GError              **error);
109
110 GLIB_AVAILABLE_IN_ALL
111 void       g_proxy_connect_async     (GProxy               *proxy,
112                                       GIOStream            *connection,
113                                       GProxyAddress        *proxy_address,
114                                       GCancellable         *cancellable,
115                                       GAsyncReadyCallback   callback,
116                                       gpointer              user_data);
117
118 GLIB_AVAILABLE_IN_ALL
119 GIOStream *g_proxy_connect_finish    (GProxy               *proxy,
120                                       GAsyncResult         *result,
121                                       GError              **error);
122
123 GLIB_AVAILABLE_IN_ALL
124 gboolean   g_proxy_supports_hostname (GProxy               *proxy);
125
126 G_END_DECLS
127
128 #endif /* __G_PROXY_H__ */