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 gio.c.functions;
29 public  import gio.c.types;
30 private import glib.Str;
31 private import glib.c.functions;
32 private import gobject.ObjectG;
33 
34 
35 /**
36  * Objects that describe one or more potential socket endpoints
37  * implement #GSocketConnectable. Callers can then use
38  * g_socket_connectable_enumerate() to get a #GSocketAddressEnumerator
39  * to try out each socket address in turn until one succeeds, as shown
40  * in the sample code below.
41  * 
42  * |[<!-- language="C" -->
43  * MyConnectionType *
44  * connect_to_host (const char    *hostname,
45  * guint16        port,
46  * GCancellable  *cancellable,
47  * GError       **error)
48  * {
49  * MyConnection *conn = NULL;
50  * GSocketConnectable *addr;
51  * GSocketAddressEnumerator *enumerator;
52  * GSocketAddress *sockaddr;
53  * GError *conn_error = NULL;
54  * 
55  * addr = g_network_address_new (hostname, port);
56  * enumerator = g_socket_connectable_enumerate (addr);
57  * g_object_unref (addr);
58  * 
59  * // Try each sockaddr until we succeed. Record the first connection error,
60  * // but not any further ones (since they'll probably be basically the same
61  * // as the first).
62  * while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
63  * {
64  * conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error);
65  * g_object_unref (sockaddr);
66  * }
67  * g_object_unref (enumerator);
68  * 
69  * if (conn)
70  * {
71  * if (conn_error)
72  * {
73  * // We couldn't connect to the first address, but we succeeded
74  * // in connecting to a later address.
75  * g_error_free (conn_error);
76  * }
77  * return conn;
78  * }
79  * else if (error)
80  * {
81  * /// Either initial lookup failed, or else the caller cancelled us.
82  * if (conn_error)
83  * g_error_free (conn_error);
84  * return NULL;
85  * }
86  * else
87  * {
88  * g_error_propagate (error, conn_error);
89  * return NULL;
90  * }
91  * }
92  * ]|
93  */
94 public interface SocketConnectableIF{
95 	/** Get the main Gtk struct */
96 	public GSocketConnectable* getSocketConnectableStruct(bool transferOwnership = false);
97 
98 	/** the main Gtk struct as a void* */
99 	protected void* getStruct();
100 
101 
102 	/** */
103 	public static GType getType()
104 	{
105 		return g_socket_connectable_get_type();
106 	}
107 
108 	/**
109 	 * Creates a #GSocketAddressEnumerator for @connectable.
110 	 *
111 	 * Returns: a new #GSocketAddressEnumerator.
112 	 *
113 	 * Since: 2.22
114 	 */
115 	public SocketAddressEnumerator enumerate();
116 
117 	/**
118 	 * Creates a #GSocketAddressEnumerator for @connectable that will
119 	 * return a #GProxyAddress for each of its addresses that you must connect
120 	 * to via a proxy.
121 	 *
122 	 * If @connectable does not implement
123 	 * g_socket_connectable_proxy_enumerate(), this will fall back to
124 	 * calling g_socket_connectable_enumerate().
125 	 *
126 	 * Returns: a new #GSocketAddressEnumerator.
127 	 *
128 	 * Since: 2.26
129 	 */
130 	public SocketAddressEnumerator proxyEnumerate();
131 
132 	/**
133 	 * Format a #GSocketConnectable as a string. This is a human-readable format for
134 	 * use in debugging output, and is not a stable serialization format. It is not
135 	 * suitable for use in user interfaces as it exposes too much information for a
136 	 * user.
137 	 *
138 	 * If the #GSocketConnectable implementation does not support string formatting,
139 	 * the implementation’s type name will be returned as a fallback.
140 	 *
141 	 * Returns: the formatted string
142 	 *
143 	 * Since: 2.48
144 	 */
145 	public string toString();
146 }