gsocketservice.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright © 2009 Codethink Limited
  4. * Copyright © 2009 Red Hat, Inc
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published
  8. * by the Free Software Foundation; either version 2 of the licence or (at
  9. * your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Authors: Ryan Lortie <desrt@desrt.ca>
  20. * Alexander Larsson <alexl@redhat.com>
  21. */
  22. #ifndef __G_SOCKET_SERVICE_H__
  23. #define __G_SOCKET_SERVICE_H__
  24. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  25. #error "Only <gio/gio.h> can be included directly."
  26. #endif
  27. #include <gio/gsocketlistener.h>
  28. G_BEGIN_DECLS
  29. #define G_TYPE_SOCKET_SERVICE (g_socket_service_get_type ())
  30. #define G_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  31. G_TYPE_SOCKET_SERVICE, GSocketService))
  32. #define G_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  33. G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
  34. #define G_IS_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  35. G_TYPE_SOCKET_SERVICE))
  36. #define G_IS_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  37. G_TYPE_SOCKET_SERVICE))
  38. #define G_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  39. G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
  40. typedef struct _GSocketServicePrivate GSocketServicePrivate;
  41. typedef struct _GSocketServiceClass GSocketServiceClass;
  42. /**
  43. * GSocketServiceClass:
  44. * @incomming: signal emitted when new connections are accepted
  45. *
  46. * Class structure for #GSocketService.
  47. */
  48. struct _GSocketServiceClass
  49. {
  50. GSocketListenerClass parent_class;
  51. gboolean (* incoming) (GSocketService *service,
  52. GSocketConnection *connection,
  53. GObject *source_object);
  54. /* Padding for future expansion */
  55. void (*_g_reserved1) (void);
  56. void (*_g_reserved2) (void);
  57. void (*_g_reserved3) (void);
  58. void (*_g_reserved4) (void);
  59. void (*_g_reserved5) (void);
  60. void (*_g_reserved6) (void);
  61. };
  62. struct _GSocketService
  63. {
  64. GSocketListener parent_instance;
  65. GSocketServicePrivate *priv;
  66. };
  67. GLIB_AVAILABLE_IN_ALL
  68. GType g_socket_service_get_type (void);
  69. GLIB_AVAILABLE_IN_ALL
  70. GSocketService *g_socket_service_new (void);
  71. GLIB_AVAILABLE_IN_ALL
  72. void g_socket_service_start (GSocketService *service);
  73. GLIB_AVAILABLE_IN_ALL
  74. void g_socket_service_stop (GSocketService *service);
  75. GLIB_AVAILABLE_IN_ALL
  76. gboolean g_socket_service_is_active (GSocketService *service);
  77. G_END_DECLS
  78. #endif /* __G_SOCKET_SERVICE_H__ */