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