gnetworkmonitor.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __G_NETWORK_MONITOR_H__
  19. #define __G_NETWORK_MONITOR_H__
  20. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  21. #error "Only <gio/gio.h> can be included directly."
  22. #endif
  23. #include <gio/giotypes.h>
  24. G_BEGIN_DECLS
  25. /**
  26. * G_NETWORK_MONITOR_EXTENSION_POINT_NAME:
  27. *
  28. * Extension point for network status monitoring functionality.
  29. * See <link linkend="extending-gio">Extending GIO</link>.
  30. *
  31. * Since: 2.30
  32. */
  33. #define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor"
  34. #define G_TYPE_NETWORK_MONITOR (g_network_monitor_get_type ())
  35. #define G_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitor))
  36. #define G_IS_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_MONITOR))
  37. #define G_NETWORK_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitorInterface))
  38. typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface;
  39. struct _GNetworkMonitorInterface {
  40. GTypeInterface g_iface;
  41. void (*network_changed) (GNetworkMonitor *monitor,
  42. gboolean available);
  43. gboolean (*can_reach) (GNetworkMonitor *monitor,
  44. GSocketConnectable *connectable,
  45. GCancellable *cancellable,
  46. GError **error);
  47. void (*can_reach_async) (GNetworkMonitor *monitor,
  48. GSocketConnectable *connectable,
  49. GCancellable *cancellable,
  50. GAsyncReadyCallback callback,
  51. gpointer user_data);
  52. gboolean (*can_reach_finish) (GNetworkMonitor *monitor,
  53. GAsyncResult *result,
  54. GError **error);
  55. };
  56. GLIB_AVAILABLE_IN_2_32
  57. GType g_network_monitor_get_type (void) G_GNUC_CONST;
  58. GLIB_AVAILABLE_IN_2_32
  59. GNetworkMonitor *g_network_monitor_get_default (void);
  60. GLIB_AVAILABLE_IN_ALL
  61. gboolean g_network_monitor_get_network_available (GNetworkMonitor *monitor);
  62. GLIB_AVAILABLE_IN_ALL
  63. gboolean g_network_monitor_can_reach (GNetworkMonitor *monitor,
  64. GSocketConnectable *connectable,
  65. GCancellable *cancellable,
  66. GError **error);
  67. GLIB_AVAILABLE_IN_ALL
  68. void g_network_monitor_can_reach_async (GNetworkMonitor *monitor,
  69. GSocketConnectable *connectable,
  70. GCancellable *cancellable,
  71. GAsyncReadyCallback callback,
  72. gpointer user_data);
  73. GLIB_AVAILABLE_IN_ALL
  74. gboolean g_network_monitor_can_reach_finish (GNetworkMonitor *monitor,
  75. GAsyncResult *result,
  76. GError **error);
  77. G_END_DECLS
  78. #endif /* __G_NETWORK_MONITOR_H__ */