1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright 2011 Red Hat, Inc.
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.
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.
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/>.
19 #ifndef __G_NETWORK_MONITOR_H__
20 #define __G_NETWORK_MONITOR_H__
22 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
23 #error "Only <gio/gio.h> can be included directly."
26 #include <gio/giotypes.h>
31 * G_NETWORK_MONITOR_EXTENSION_POINT_NAME:
33 * Extension point for network status monitoring functionality.
34 * See [Extending GIO][extending-gio].
38 #define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor"
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))
45 typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface
;
47 struct _GNetworkMonitorInterface
{
48 GTypeInterface g_iface
;
50 void (*network_changed
) (GNetworkMonitor
*monitor
,
51 gboolean network_available
);
53 gboolean (*can_reach
) (GNetworkMonitor
*monitor
,
54 GSocketConnectable
*connectable
,
55 GCancellable
*cancellable
,
57 void (*can_reach_async
) (GNetworkMonitor
*monitor
,
58 GSocketConnectable
*connectable
,
59 GCancellable
*cancellable
,
60 GAsyncReadyCallback callback
,
62 gboolean (*can_reach_finish
) (GNetworkMonitor
*monitor
,
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);
72 GLIB_AVAILABLE_IN_2_32
73 gboolean
g_network_monitor_get_network_available (GNetworkMonitor
*monitor
);
75 GLIB_AVAILABLE_IN_2_46
76 gboolean
g_network_monitor_get_network_metered (GNetworkMonitor
*monitor
);
78 GLIB_AVAILABLE_IN_2_44
79 GNetworkConnectivity
g_network_monitor_get_connectivity (GNetworkMonitor
*monitor
);
81 GLIB_AVAILABLE_IN_2_32
82 gboolean
g_network_monitor_can_reach (GNetworkMonitor
*monitor
,
83 GSocketConnectable
*connectable
,
84 GCancellable
*cancellable
,
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
,
92 GLIB_AVAILABLE_IN_2_32
93 gboolean
g_network_monitor_can_reach_finish (GNetworkMonitor
*monitor
,
99 #endif /* __G_NETWORK_MONITOR_H__ */