Move single-include guards inside include guards
[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, write to the
19  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
23  */
24
25 #ifndef __G_PROXY_H__
26 #define __G_PROXY_H__
27
28 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
29 #error "Only <gio/gio.h> can be included directly."
30 #endif
31
32 #include <gio/giotypes.h>
33
34 G_BEGIN_DECLS
35
36 #define G_TYPE_PROXY            (g_proxy_get_type ())
37 #define G_PROXY(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY, GProxy))
38 #define G_IS_PROXY(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY))
39 #define G_PROXY_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_PROXY, GProxyInterface))
40
41 /**
42  * G_PROXY_EXTENSION_POINT_NAME:
43  *
44  * Extension point for proxy functionality.
45  * See <link linkend="extending-gio">Extending GIO</link>.
46  *
47  * Since: 2.26
48  */
49 #define G_PROXY_EXTENSION_POINT_NAME "gio-proxy"
50
51 /**
52  * GProxy:
53  *
54  * Interface that handles proxy connection and payload.
55  *
56  * Since: 2.26
57  */
58 typedef struct _GProxyInterface GProxyInterface;
59
60 /**
61  * GProxyInterface:
62  * @g_iface: The parent interface.
63  * @connect: Connect to proxy server and wrap (if required) the #connection
64  *           to handle payload.
65  * @connect_async: Same as connect() but asynchronous.
66  * @connect_finish: Returns the result of connect_async()
67  * @supports_hostname: Returns whether the proxy supports hostname lookups.
68  *
69  * Provides an interface for handling proxy connection and payload.
70  *
71  * Since: 2.26
72  */
73 struct _GProxyInterface
74 {
75   GTypeInterface g_iface;
76
77   /* Virtual Table */
78
79   GIOStream * (* connect)           (GProxy               *proxy,
80                                      GIOStream            *connection,
81                                      GProxyAddress        *proxy_address,
82                                      GCancellable         *cancellable,
83                                      GError              **error);
84
85   void        (* connect_async)     (GProxy               *proxy,
86                                      GIOStream            *connection,
87                                      GProxyAddress        *proxy_address,
88                                      GCancellable         *cancellable,
89                                      GAsyncReadyCallback   callback,
90                                      gpointer              user_data);
91
92   GIOStream * (* connect_finish)    (GProxy               *proxy,
93                                      GAsyncResult         *result,
94                                      GError              **error);
95
96   gboolean    (* supports_hostname) (GProxy             *proxy);
97 };
98
99 GType      g_proxy_get_type                 (void) G_GNUC_CONST;
100
101 GProxy    *g_proxy_get_default_for_protocol (const gchar *protocol);
102
103 GIOStream *g_proxy_connect           (GProxy               *proxy,
104                                       GIOStream            *connection,
105                                       GProxyAddress        *proxy_address,
106                                       GCancellable         *cancellable,
107                                       GError              **error);
108
109 void       g_proxy_connect_async     (GProxy               *proxy,
110                                       GIOStream            *connection,
111                                       GProxyAddress        *proxy_address,
112                                       GCancellable         *cancellable,
113                                       GAsyncReadyCallback   callback,
114                                       gpointer              user_data);
115
116 GIOStream *g_proxy_connect_finish    (GProxy               *proxy,
117                                       GAsyncResult         *result,
118                                       GError              **error);
119
120 gboolean   g_proxy_supports_hostname (GProxy               *proxy);
121
122 G_END_DECLS
123
124 #endif /* __G_PROXY_H__ */