mem-overflow: test malloc and realloc corner cases
[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 #ifndef __G_NETWORK_MONITOR_H__
22 #define __G_NETWORK_MONITOR_H__
23
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
26 #endif
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 GLIB_AVAILABLE_IN_ALL
75 gboolean         g_network_monitor_get_network_available (GNetworkMonitor     *monitor);
76
77 GLIB_AVAILABLE_IN_ALL
78 gboolean         g_network_monitor_can_reach             (GNetworkMonitor     *monitor,
79                                                           GSocketConnectable  *connectable,
80                                                           GCancellable        *cancellable,
81                                                           GError             **error);
82 GLIB_AVAILABLE_IN_ALL
83 void             g_network_monitor_can_reach_async       (GNetworkMonitor     *monitor,
84                                                           GSocketConnectable  *connectable,
85                                                           GCancellable        *cancellable,
86                                                           GAsyncReadyCallback  callback,
87                                                           gpointer             user_data);
88 GLIB_AVAILABLE_IN_ALL
89 gboolean         g_network_monitor_can_reach_finish      (GNetworkMonitor     *monitor,
90                                                           GAsyncResult        *result,
91                                                           GError             **error);
92
93 G_END_DECLS
94
95 #endif /* __G_NETWORK_MONITOR_H__ */