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 private import glib.ErrorG; 73 private import glib.GException; 74 private import gio.AsyncResultIF; 75 private import gio.Cancellable; 76 private import gio.NetworkMonitorIF; 77 private import gio.SocketConnectableIF; 78 79 80 81 /** 82 * GNetworkMonitor provides an easy-to-use cross-platform API 83 * for monitoring network connectivity. On Linux, the implementation 84 * is based on the kernel's netlink interface. 85 */ 86 public interface NetworkMonitorIF 87 { 88 89 90 /** Get the main Gtk struct */ 91 public GNetworkMonitor* getNetworkMonitorTStruct(); 92 93 /** the main Gtk struct as a void* */ 94 protected void* getStruct(); 95 96 97 /** 98 */ 99 100 @property void delegate(gboolean, NetworkMonitorIF)[] onNetworkChangedListeners(); 101 /** 102 * Emitted when the network configuration changes. If available is 103 * TRUE, then some hosts may be reachable that were not reachable 104 * before, while others that were reachable before may no longer be 105 * reachable. If available is FALSE, then no remote hosts are 106 * reachable. 107 * Since 2.32 108 */ 109 void addOnNetworkChanged(void delegate(gboolean, NetworkMonitorIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 110 111 /** 112 * Gets the default GNetworkMonitor for the system. 113 * Since 2.32 114 * Returns: a GNetworkMonitor. [transfer none] 115 */ 116 public static NetworkMonitorIF getDefault(); 117 118 /** 119 * Checks if the network is available. "Available" here means that the 120 * system has a default route available for at least one of IPv4 or 121 * IPv6. It does not necessarily imply that the public Internet is 122 * reachable. See "network-available" for more details. 123 * Since 2.32 124 * Returns: whether the network is available 125 */ 126 public int getNetworkAvailable(); 127 128 /** 129 * Attempts to determine whether or not the host pointed to by 130 * connectable can be reached, without actually trying to connect to 131 * it. 132 * This may return TRUE even when "network-available" 133 * is FALSE, if, for example, monitor can determine that 134 * connectable refers to a host on a local network. 135 * If monitor believes that an attempt to connect to connectable 136 * will succeed, it will return TRUE. Otherwise, it will return 137 * FALSE and set error to an appropriate error (such as 138 * G_IO_ERROR_HOST_UNREACHABLE). 139 * Note that although this does not attempt to connect to 140 * connectable, it may still block for a brief period of time (eg, 141 * trying to do multicast DNS on the local network), so if you do not 142 * want to block, you should use g_network_monitor_can_reach_async(). 143 * Since 2.32 144 * Params: 145 * connectable = a GSocketConnectable 146 * cancellable = a GCancellable, or NULL. [allow-none] 147 * Returns: TRUE if connectable is reachable, FALSE if not. 148 * Throws: GException on failure. 149 */ 150 public int canReach(SocketConnectableIF connectable, Cancellable cancellable); 151 152 /** 153 * Asynchronously attempts to determine whether or not the host 154 * pointed to by connectable can be reached, without actually 155 * trying to connect to it. 156 * For more details, see g_network_monitor_can_reach(). 157 * When the operation is finished, callback will be called. 158 * You can then call g_network_monitor_can_reach_finish() 159 * to get the result of the operation. 160 * Params: 161 * connectable = a GSocketConnectable 162 * cancellable = a GCancellable, or NULL. [allow-none] 163 * callback = a GAsyncReadyCallback to call when the 164 * request is satisfied. [scope async] 165 * userData = the data to pass to callback function. [closure] 166 */ 167 public void canReachAsync(SocketConnectableIF connectable, Cancellable cancellable, GAsyncReadyCallback callback, void* userData); 168 169 /** 170 * Finishes an async network connectivity test. 171 * See g_network_monitor_can_reach_async(). 172 * Params: 173 * result = a GAsyncResult 174 * Returns: TRUE if network is reachable, FALSE if not. 175 * Throws: GException on failure. 176 */ 177 public int canReachFinish(AsyncResultIF result); 178 }