| 1 | /* GIO - GLib Input, Output and Streaming Library |
| 2 | * |
| 3 | * Copyright 2011 Red Hat, Inc. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library 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 GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General |
| 16 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __G_NETWORK_MONITOR_H__ |
| 20 | #define __G_NETWORK_MONITOR_H__ |
| 21 | |
| 22 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
| 23 | #error "Only <gio/gio.h> can be included directly." |
| 24 | #endif |
| 25 | |
| 26 | #include <gio/giotypes.h> |
| 27 | |
| 28 | G_BEGIN_DECLS |
| 29 | |
| 30 | /** |
| 31 | * G_NETWORK_MONITOR_EXTENSION_POINT_NAME: |
| 32 | * |
| 33 | * Extension point for network status monitoring functionality. |
| 34 | * See [Extending GIO][extending-gio]. |
| 35 | * |
| 36 | * Since: 2.30 |
| 37 | */ |
| 38 | #define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor" |
| 39 | |
| 40 | #define G_TYPE_NETWORK_MONITOR (g_network_monitor_get_type ()) |
| 41 | #define G_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitor)) |
| 42 | #define G_IS_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_MONITOR)) |
| 43 | #define G_NETWORK_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitorInterface)) |
| 44 | |
| 45 | typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface; |
| 46 | |
| 47 | struct _GNetworkMonitorInterface { |
| 48 | GTypeInterface g_iface; |
| 49 | |
| 50 | void (*network_changed) (GNetworkMonitor *monitor, |
| 51 | gboolean network_available); |
| 52 | |
| 53 | gboolean (*can_reach) (GNetworkMonitor *monitor, |
| 54 | GSocketConnectable *connectable, |
| 55 | GCancellable *cancellable, |
| 56 | GError **error); |
| 57 | void (*can_reach_async) (GNetworkMonitor *monitor, |
| 58 | GSocketConnectable *connectable, |
| 59 | GCancellable *cancellable, |
| 60 | GAsyncReadyCallback callback, |
| 61 | gpointer user_data); |
| 62 | gboolean (*can_reach_finish) (GNetworkMonitor *monitor, |
| 63 | GAsyncResult *result, |
| 64 | GError **error); |
| 65 | }; |
| 66 | |
| 67 | GLIB_AVAILABLE_IN_2_32 |
| 68 | GType g_network_monitor_get_type (void) G_GNUC_CONST; |
| 69 | GLIB_AVAILABLE_IN_2_32 |
| 70 | GNetworkMonitor *g_network_monitor_get_default (void); |
| 71 | |
| 72 | GLIB_AVAILABLE_IN_2_32 |
| 73 | gboolean g_network_monitor_get_network_available (GNetworkMonitor *monitor); |
| 74 | |
| 75 | GLIB_AVAILABLE_IN_2_46 |
| 76 | gboolean g_network_monitor_get_network_metered (GNetworkMonitor *monitor); |
| 77 | |
| 78 | GLIB_AVAILABLE_IN_2_44 |
| 79 | GNetworkConnectivity g_network_monitor_get_connectivity (GNetworkMonitor *monitor); |
| 80 | |
| 81 | GLIB_AVAILABLE_IN_2_32 |
| 82 | gboolean g_network_monitor_can_reach (GNetworkMonitor *monitor, |
| 83 | GSocketConnectable *connectable, |
| 84 | GCancellable *cancellable, |
| 85 | GError **error); |
| 86 | GLIB_AVAILABLE_IN_2_32 |
| 87 | void g_network_monitor_can_reach_async (GNetworkMonitor *monitor, |
| 88 | GSocketConnectable *connectable, |
| 89 | GCancellable *cancellable, |
| 90 | GAsyncReadyCallback callback, |
| 91 | gpointer user_data); |
| 92 | GLIB_AVAILABLE_IN_2_32 |
| 93 | gboolean g_network_monitor_can_reach_finish (GNetworkMonitor *monitor, |
| 94 | GAsyncResult *result, |
| 95 | GError **error); |
| 96 | |
| 97 | G_END_DECLS |
| 98 | |
| 99 | #endif /* __G_NETWORK_MONITOR_H__ */ |
| 100 | |