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.NetworkMonitorIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.NetworkMonitor;
30 private import gio.NetworkMonitorIF;
31 private import gio.SocketConnectableIF;
32 private import glib.ErrorG;
33 private import glib.GException;
34 private import gobject.ObjectG;
35 private import gobject.Signals;
36 public  import gtkc.gdktypes;
37 private import gtkc.gio;
38 public  import gtkc.giotypes;
39 private import std.algorithm;
40 
41 
42 /**
43  * #GNetworkMonitor provides an easy-to-use cross-platform API
44  * for monitoring network connectivity. On Linux, the implementation
45  * is based on the kernel's netlink interface.
46  *
47  * Since: 2.32
48  */
49 public interface NetworkMonitorIF{
50 	/** Get the main Gtk struct */
51 	public GNetworkMonitor* getNetworkMonitorStruct();
52 
53 	/** the main Gtk struct as a void* */
54 	protected void* getStruct();
55 
56 
57 	/**
58 	 * Gets the default #GNetworkMonitor for the system.
59 	 *
60 	 * Return: a #GNetworkMonitor
61 	 *
62 	 * Since: 2.32
63 	 */
64 	public static NetworkMonitorIF getDefault();
65 
66 	/**
67 	 * Attempts to determine whether or not the host pointed to by
68 	 * @connectable can be reached, without actually trying to connect to
69 	 * it.
70 	 *
71 	 * This may return %TRUE even when #GNetworkMonitor:network-available
72 	 * is %FALSE, if, for example, @monitor can determine that
73 	 * @connectable refers to a host on a local network.
74 	 *
75 	 * If @monitor believes that an attempt to connect to @connectable
76 	 * will succeed, it will return %TRUE. Otherwise, it will return
77 	 * %FALSE and set @error to an appropriate error (such as
78 	 * %G_IO_ERROR_HOST_UNREACHABLE).
79 	 *
80 	 * Note that although this does not attempt to connect to
81 	 * @connectable, it may still block for a brief period of time (eg,
82 	 * trying to do multicast DNS on the local network), so if you do not
83 	 * want to block, you should use g_network_monitor_can_reach_async().
84 	 *
85 	 * Params:
86 	 *     connectable = a #GSocketConnectable
87 	 *     cancellable = a #GCancellable, or %NULL
88 	 *
89 	 * Return: %TRUE if @connectable is reachable, %FALSE if not.
90 	 *
91 	 * Since: 2.32
92 	 *
93 	 * Throws: GException on failure.
94 	 */
95 	public bool canReach(SocketConnectableIF connectable, Cancellable cancellable);
96 
97 	/**
98 	 * Asynchronously attempts to determine whether or not the host
99 	 * pointed to by @connectable can be reached, without actually
100 	 * trying to connect to it.
101 	 *
102 	 * For more details, see g_network_monitor_can_reach().
103 	 *
104 	 * When the operation is finished, @callback will be called.
105 	 * You can then call g_network_monitor_can_reach_finish()
106 	 * to get the result of the operation.
107 	 *
108 	 * Params:
109 	 *     connectable = a #GSocketConnectable
110 	 *     cancellable = a #GCancellable, or %NULL
111 	 *     callback = a #GAsyncReadyCallback to call when the
112 	 *         request is satisfied
113 	 *     userData = the data to pass to callback function
114 	 */
115 	public void canReachAsync(SocketConnectableIF connectable, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
116 
117 	/**
118 	 * Finishes an async network connectivity test.
119 	 * See g_network_monitor_can_reach_async().
120 	 *
121 	 * Params:
122 	 *     result = a #GAsyncResult
123 	 *
124 	 * Return: %TRUE if network is reachable, %FALSE if not.
125 	 *
126 	 * Throws: GException on failure.
127 	 */
128 	public bool canReachFinish(AsyncResultIF result);
129 
130 	/**
131 	 * Gets a more detailed networking state than
132 	 * g_network_monitor_get_network_available().
133 	 *
134 	 * If #GNetworkMonitor:network-available is %FALSE, then the
135 	 * connectivity state will be %G_NETWORK_CONNECTIVITY_LOCAL.
136 	 *
137 	 * If #GNetworkMonitor:network-available is %TRUE, then the
138 	 * connectivity state will be %G_NETWORK_CONNECTIVITY_FULL (if there
139 	 * is full Internet connectivity), %G_NETWORK_CONNECTIVITY_LIMITED (if
140 	 * the host has a default route, but appears to be unable to actually
141 	 * reach the full Internet), or %G_NETWORK_CONNECTIVITY_PORTAL (if the
142 	 * host is trapped behind a "captive portal" that requires some sort
143 	 * of login or acknowledgement before allowing full Internet access).
144 	 *
145 	 * Note that in the case of %G_NETWORK_CONNECTIVITY_LIMITED and
146 	 * %G_NETWORK_CONNECTIVITY_PORTAL, it is possible that some sites are
147 	 * reachable but others are not. In this case, applications can
148 	 * attempt to connect to remote servers, but should gracefully fall
149 	 * back to their "offline" behavior if the connection attempt fails.
150 	 *
151 	 * Return: the network connectivity state
152 	 *
153 	 * Since: 2.44
154 	 */
155 	public GNetworkConnectivity getConnectivity();
156 
157 	/**
158 	 * Checks if the network is available. "Available" here means that the
159 	 * system has a default route available for at least one of IPv4 or
160 	 * IPv6. It does not necessarily imply that the public Internet is
161 	 * reachable. See #GNetworkMonitor:network-available for more details.
162 	 *
163 	 * Return: whether the network is available
164 	 *
165 	 * Since: 2.32
166 	 */
167 	public bool getNetworkAvailable();
168 
169 	/**
170 	 * Checks if the network is metered.
171 	 * See #GNetworkMonitor:network-metered for more details.
172 	 *
173 	 * Return: whether the connection is metered
174 	 *
175 	 * Since: 2.46
176 	 */
177 	public bool getNetworkMetered();
178 	/**
179 	 * Emitted when the network configuration changes. If @available is
180 	 * %TRUE, then some hosts may be reachable that were not reachable
181 	 * before, while others that were reachable before may no longer be
182 	 * reachable. If @available is %FALSE, then no remote hosts are
183 	 * reachable.
184 	 *
185 	 * Params:
186 	 *     available = the current value of #GNetworkMonitor:network-available
187 	 *
188 	 * Since: 2.32
189 	 */
190 	gulong addOnNetworkChanged(void delegate(bool, NetworkMonitorIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
191 	;
192 
193 }