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 * Conversion parameters: 26 * inFile = GNetworkMonitor.html 27 * outPack = gio 28 * outFile = NetworkMonitorIF 29 * strct = GNetworkMonitor 30 * realStrct= 31 * ctorStrct= 32 * clss = NetworkMonitorT 33 * interf = NetworkMonitorIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_network_monitor_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.ErrorG 47 * - glib.GException 48 * - gio.AsyncResultIF 49 * - gio.Cancellable 50 * - gio.NetworkMonitorIF 51 * - gio.SocketConnectableIF 52 * structWrap: 53 * - GAsyncResult* -> AsyncResultIF 54 * - GCancellable* -> Cancellable 55 * - GNetworkMonitor* -> NetworkMonitorIF 56 * - GSocketConnectable* -> SocketConnectableIF 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module gio.NetworkMonitorIF; 63 64 public import gtkc.giotypes; 65 66 private import gtkc.gio; 67 private import glib.ConstructionException; 68 private import gobject.ObjectG; 69 70 private import gobject.Signals; 71 public import gtkc.gdktypes; 72 73 private import glib.ErrorG; 74 private import glib.GException; 75 private import gio.AsyncResultIF; 76 private import gio.Cancellable; 77 private import gio.NetworkMonitorIF; 78 private import gio.SocketConnectableIF; 79 80 81 82 83 /** 84 * GNetworkMonitor provides an easy-to-use cross-platform API 85 * for monitoring network connectivity. On Linux, the implementation 86 * is based on the kernel's netlink interface. 87 */ 88 public interface NetworkMonitorIF 89 { 90 91 92 public GNetworkMonitor* getNetworkMonitorTStruct(); 93 94 /** the main Gtk struct as a void* */ 95 protected void* getStruct(); 96 97 98 /** 99 */ 100 101 @property void delegate(gboolean, NetworkMonitorIF)[] onNetworkChangedListeners(); 102 /** 103 * Emitted when the network configuration changes. If available is 104 * TRUE, then some hosts may be reachable that were not reachable 105 * before, while others that were reachable before may no longer be 106 * reachable. If available is FALSE, then no remote hosts are 107 * reachable. 108 * Since 2.32 109 */ 110 void addOnNetworkChanged(void delegate(gboolean, NetworkMonitorIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 111 112 /** 113 * Gets the default GNetworkMonitor for the system. 114 * Since 2.32 115 * Returns: a GNetworkMonitor. [transfer none] 116 */ 117 public static NetworkMonitorIF getDefault(); 118 119 /** 120 * Checks if the network is available. "Available" here means that the 121 * system has a default route available for at least one of IPv4 or 122 * IPv6. It does not necessarily imply that the public Internet is 123 * reachable. See "network-available" for more details. 124 * Since 2.32 125 * Returns: whether the network is available 126 */ 127 public int getNetworkAvailable(); 128 129 /** 130 * Attempts to determine whether or not the host pointed to by 131 * connectable can be reached, without actually trying to connect to 132 * it. 133 * This may return TRUE even when "network-available" 134 * is FALSE, if, for example, monitor can determine that 135 * connectable refers to a host on a local network. 136 * If monitor believes that an attempt to connect to connectable 137 * will succeed, it will return TRUE. Otherwise, it will return 138 * FALSE and set error to an appropriate error (such as 139 * G_IO_ERROR_HOST_UNREACHABLE). 140 * Note that although this does not attempt to connect to 141 * connectable, it may still block for a brief period of time (eg, 142 * trying to do multicast DNS on the local network), so if you do not 143 * want to block, you should use g_network_monitor_can_reach_async(). 144 * Since 2.32 145 * Params: 146 * connectable = a GSocketConnectable 147 * cancellable = a GCancellable, or NULL. [allow-none] 148 * Returns: TRUE if connectable is reachable, FALSE if not. 149 * Throws: GException on failure. 150 */ 151 public int canReach(SocketConnectableIF connectable, Cancellable cancellable); 152 153 /** 154 * Asynchronously attempts to determine whether or not the host 155 * pointed to by connectable can be reached, without actually 156 * trying to connect to it. 157 * For more details, see g_network_monitor_can_reach(). 158 * When the operation is finished, callback will be called. 159 * You can then call g_network_monitor_can_reach_finish() 160 * to get the result of the operation. 161 * Params: 162 * connectable = a GSocketConnectable 163 * cancellable = a GCancellable, or NULL. [allow-none] 164 * callback = a GAsyncReadyCallback to call when the 165 * request is satisfied. [scope async] 166 * userData = the data to pass to callback function. [closure] 167 */ 168 public void canReachAsync(SocketConnectableIF connectable, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 169 170 /** 171 * Finishes an async network connectivity test. 172 * See g_network_monitor_can_reach_async(). 173 * Params: 174 * result = a GAsyncResult 175 * Returns: TRUE if network is reachable, FALSE if not. 176 * Throws: GException on failure. 177 */ 178 public int canReachFinish(AsyncResultIF result); 179 }