1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GIOMM_PROXY_H
3 #define _GIOMM_PROXY_H
4 
5 
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8 
9 /* Copyright (C) 2010 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #include <glibmm/error.h>
26 #include <glibmm/interface.h>
27 #include <giomm/asyncresult.h>
28 #include <giomm/cancellable.h>
29 #include <giomm/proxyaddress.h>
30 #include <giomm/iostream.h>
31 //#include <giomm/error.h> //Because this is thrown by some of these methods.
32 
33 
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GProxyInterface GProxyInterface;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37 
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 using GProxy = struct _GProxy;
40 using GProxyClass = struct _GProxyClass;
41 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
42 
43 
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45 namespace Gio
46 { class GIOMM_API Proxy_Class; } // namespace Gio
47 #endif // DOXYGEN_SHOULD_SKIP_THIS
48 
49 namespace Gio
50 {
51 
52 
53 /** Proxy - Interface for proxy handling.
54  * A Proxy handles connecting to a remote host via a given type of proxy
55  * server. It is implemented by the 'gio-proxy' extension point. The
56  * extensions are named after their proxy protocol name. As an example, a
57  * SOCKS5 proxy implementation can be retrieved with the name 'socks5' using
58  * the C API's function g_io_extension_point_get_extension_by_name().
59  *
60  * @ingroup NetworkIO
61  * @newin{2,28}
62  */
63 
64 class GIOMM_API Proxy : public Glib::Interface
65 {
66 
67 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 
69 public:
70   using CppObjectType = Proxy;
71   using CppClassType = Proxy_Class;
72   using BaseObjectType = GProxy;
73   using BaseClassType = GProxyInterface;
74 
75   // noncopyable
76   Proxy(const Proxy&) = delete;
77   Proxy& operator=(const Proxy&) = delete;
78 
79 private:
80   friend class Proxy_Class;
81   static CppClassType proxy_class_;
82 
83 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
84 protected:
85   /**
86    * You should derive from this class to use it.
87    */
88   Proxy();
89 
90 #ifndef DOXYGEN_SHOULD_SKIP_THIS
91   /** Called by constructors of derived classes. Provide the result of
92    * the Class init() function to ensure that it is properly
93    * initialized.
94    *
95    * @param interface_class The Class object for the derived type.
96    */
97   explicit Proxy(const Glib::Interface_Class& interface_class);
98 
99 public:
100   // This is public so that C++ wrapper instances can be
101   // created for C instances of unwrapped types.
102   // For instance, if an unexpected C type implements the C interface.
103   explicit Proxy(GProxy* castitem);
104 
105 protected:
106 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
107 
108 public:
109 
110   Proxy(Proxy&& src) noexcept;
111   Proxy& operator=(Proxy&& src) noexcept;
112 
113   ~Proxy() noexcept override;
114 
115   static void add_interface(GType gtype_implementer);
116 
117   /** Get the GType for this class, for use with the underlying GObject type system.
118    */
119   static GType get_type()      G_GNUC_CONST;
120 
121 #ifndef DOXYGEN_SHOULD_SKIP_THIS
122   static GType get_base_type() G_GNUC_CONST;
123 #endif
124 
125   ///Provides access to the underlying C GObject.
gobj()126   GProxy*       gobj()       { return reinterpret_cast<GProxy*>(gobject_); }
127 
128   ///Provides access to the underlying C GObject.
gobj()129   const GProxy* gobj() const { return reinterpret_cast<GProxy*>(gobject_); }
130 
131 private:
132 
133 
134 public:
135 
136 
137   /** Find the `gio-proxy` extension point for a proxy implementation that supports
138    * the specified protocol.
139    *
140    * @newin{2,26}
141    *
142    * @param protocol The proxy protocol name (e.g. http, socks, etc).
143    * @return Return a Proxy or <tt>nullptr</tt> if protocol
144    * is not supported.
145    */
146   static Glib::RefPtr<Proxy> get_default_for_protocol(const Glib::ustring& protocol);
147 
148 
149   /** Given @a connection to communicate with a proxy (eg, a
150    * SocketConnection that is connected to the proxy server), this
151    * does the necessary handshake to connect to @a proxy_address, and if
152    * required, wraps the IOStream to handle proxy payload.
153    *
154    * @newin{2,26}
155    *
156    * @param connection A IOStream.
157    * @param proxy_address A ProxyAddress.
158    * @param cancellable A Cancellable.
159    * @return A IOStream that will replace @a connection. This might
160    * be the same as @a connection, in which case a reference
161    * will be added.
162    *
163    * @throws Glib::Error
164    */
165   Glib::RefPtr<IOStream> connect(const Glib::RefPtr<IOStream>& connection, const Glib::RefPtr<const ProxyAddress>& proxy_address, const Glib::RefPtr<Cancellable>& cancellable);
166 
167   /** An Asynchronous version of connect().
168    */
169   void connect_async(const Glib::RefPtr<IOStream>& connection, const Glib::RefPtr<const ProxyAddress>& proxy_address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
170 
171   /** An Asynchronous version of connect().
172    */
173   void connect_async(const Glib::RefPtr<IOStream>& connection, const Glib::RefPtr<const ProxyAddress>& proxy_address, const SlotAsyncReady& slot);
174 
175 
176   /** See g_proxy_connect().
177    *
178    * @newin{2,26}
179    *
180    * @param result A AsyncResult.
181    * @return A IOStream.
182    *
183    * @throws Glib::Error
184    */
185   Glib::RefPtr<IOStream> connect_finish(const Glib::RefPtr<AsyncResult>& result);
186 
187 
188   /** Some proxy protocols expect to be passed a hostname, which they
189    * will resolve to an IP address themselves. Others, like SOCKS4, do
190    * not allow this. This function will return <tt>false</tt> if @a proxy is
191    * implementing such a protocol. When <tt>false</tt> is returned, the caller
192    * should resolve the destination hostname first, and then pass a
193    * ProxyAddress containing the stringified IP address to
194    * g_proxy_connect() or g_proxy_connect_async().
195    *
196    * @newin{2,26}
197    *
198    * @return <tt>true</tt> if hostname resolution is supported.
199    */
200   bool supports_hostname() const;
201 
202 
203 public:
204 
205 public:
206   //C++ methods used to invoke GTK+ virtual functions:
207 
208 protected:
209   //GTK+ Virtual Functions (override these to change behaviour):
210 
211   //Default Signal Handlers::
212 
213 
214 };
215 
216 
217 } // namespace Gio
218 
219 
220 namespace Glib
221 {
222   /** A Glib::wrap() method for this object.
223    *
224    * @param object The C instance.
225    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
226    * @result A C++ instance that wraps this C instance.
227    *
228    * @relates Gio::Proxy
229    */
230   GIOMM_API
231   Glib::RefPtr<Gio::Proxy> wrap(GProxy* object, bool take_copy = false);
232 
233 } // namespace Glib
234 
235 
236 #endif /* _GIOMM_PROXY_H */
237 
238