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