Annotate API introduced for 2.32 with GLIB_AVAILABLE_IN_2_32
[platform/upstream/glib.git] / gio / gnetworkmonitor.h
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 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, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
22 #error "Only <gio/gio.h> can be included directly."
23 #endif
24
25 #ifndef __G_NETWORK_MONITOR_H__
26 #define __G_NETWORK_MONITOR_H__
27
28 #include <gio/giotypes.h>
29
30 G_BEGIN_DECLS
31
32 /**
33  * G_NETWORK_MONITOR_EXTENSION_POINT_NAME:
34  *
35  * Extension point for network status monitoring functionality.
36  * See <link linkend="extending-gio">Extending GIO</link>.
37  *
38  * Since: 2.30
39  */
40 #define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor"
41
42 #define G_TYPE_NETWORK_MONITOR         (g_network_monitor_get_type ())
43 #define G_NETWORK_MONITOR(o)               (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitor))
44 #define G_IS_NETWORK_MONITOR(o)            (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_MONITOR))
45 #define G_NETWORK_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitorInterface))
46
47 typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface;
48
49 struct _GNetworkMonitorInterface {
50   GTypeInterface g_iface;
51
52   void     (*network_changed)  (GNetworkMonitor      *monitor,
53                                 gboolean              available);
54
55   gboolean (*can_reach)        (GNetworkMonitor      *monitor,
56                                 GSocketConnectable   *connectable,
57                                 GCancellable         *cancellable,
58                                 GError              **error);
59   void     (*can_reach_async)  (GNetworkMonitor      *monitor,
60                                 GSocketConnectable   *connectable,
61                                 GCancellable         *cancellable,
62                                 GAsyncReadyCallback   callback,
63                                 gpointer              user_data);
64   gboolean (*can_reach_finish) (GNetworkMonitor      *monitor,
65                                 GAsyncResult         *result,
66                                 GError              **error);
67 };
68
69 GLIB_AVAILABLE_IN_2_32
70 GType            g_network_monitor_get_type              (void) G_GNUC_CONST;
71 GLIB_AVAILABLE_IN_2_32
72 GNetworkMonitor *g_network_monitor_get_default           (void);
73
74 gboolean         g_network_monitor_get_network_available (GNetworkMonitor     *monitor);
75
76 gboolean         g_network_monitor_can_reach             (GNetworkMonitor     *monitor,
77                                                           GSocketConnectable  *connectable,
78                                                           GCancellable        *cancellable,
79                                                           GError             **error);
80 void             g_network_monitor_can_reach_async       (GNetworkMonitor     *monitor,
81                                                           GSocketConnectable  *connectable,
82                                                           GCancellable        *cancellable,
83                                                           GAsyncReadyCallback  callback,
84                                                           gpointer             user_data);
85 gboolean         g_network_monitor_can_reach_finish      (GNetworkMonitor     *monitor,
86                                                           GAsyncResult        *result,
87                                                           GError             **error);
88
89 G_END_DECLS
90
91 #endif /* __G_NETWORK_MONITOR_H__ */