1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.SocketConnectableIF;
26 
27 private import gio.SocketAddressEnumerator;
28 private import gobject.ObjectG;
29 private import gtkc.gio;
30 public  import gtkc.giotypes;
31 
32 
33 /**
34  * Objects that describe one or more potential socket endpoints
35  * implement #GSocketConnectable. Callers can then use
36  * g_socket_connectable_enumerate() to get a #GSocketAddressEnumerator
37  * to try out each socket address in turn until one succeeds, as shown
38  * in the sample code below.
39  * 
40  * |[<!-- language="C" -->
41  * MyConnectionType *
42  * connect_to_host (const char    *hostname,
43  * guint16        port,
44  * GCancellable  *cancellable,
45  * GError       **error)
46  * {
47  * MyConnection *conn = NULL;
48  * GSocketConnectable *addr;
49  * GSocketAddressEnumerator *enumerator;
50  * GSocketAddress *sockaddr;
51  * GError *conn_error = NULL;
52  * 
53  * addr = g_network_address_new (hostname, port);
54  * enumerator = g_socket_connectable_enumerate (addr);
55  * g_object_unref (addr);
56  * 
57  * // Try each sockaddr until we succeed. Record the first connection error,
58  * // but not any further ones (since they'll probably be basically the same
59  * // as the first).
60  * while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
61  * {
62  * conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
63  * g_object_unref (sockaddr);
64  * }
65  * g_object_unref (enumerator);
66  * 
67  * if (conn)
68  * {
69  * if (conn_error)
70  * {
71  * // We couldn't connect to the first address, but we succeeded
72  * // in connecting to a later address.
73  * g_error_free (conn_error);
74  * }
75  * return conn;
76  * }
77  * else if (error)
78  * {
79  * /// Either initial lookup failed, or else the caller cancelled us.
80  * if (conn_error)
81  * g_error_free (conn_error);
82  * return NULL;
83  * }
84  * else
85  * {
86  * g_error_propagate (error, conn_error);
87  * return NULL;
88  * }
89  * }
90  * ]|
91  */
92 public interface SocketConnectableIF{
93 	/** Get the main Gtk struct */
94 	public GSocketConnectable* getSocketConnectableStruct();
95 
96 	/** the main Gtk struct as a void* */
97 	protected void* getStruct();
98 
99 
100 	/**
101 	 * Creates a #GSocketAddressEnumerator for @connectable.
102 	 *
103 	 * Return: a new #GSocketAddressEnumerator.
104 	 *
105 	 * Since: 2.22
106 	 */
107 	public SocketAddressEnumerator enumerate();
108 
109 	/**
110 	 * Creates a #GSocketAddressEnumerator for @connectable that will
111 	 * return #GProxyAddresses for addresses that you must connect
112 	 * to via a proxy.
113 	 *
114 	 * If @connectable does not implement
115 	 * g_socket_connectable_proxy_enumerate(), this will fall back to
116 	 * calling g_socket_connectable_enumerate().
117 	 *
118 	 * Return: a new #GSocketAddressEnumerator.
119 	 *
120 	 * Since: 2.26
121 	 */
122 	public SocketAddressEnumerator proxyEnumerate();
123 }