gsocketservice.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 <[email protected]>
  20. * Alexander Larsson <[email protected]>
  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. struct _GSocketServiceClass
  47. {
  48. GSocketListenerClass parent_class;
  49. gboolean (* incoming) (GSocketService *service,
  50. GSocketConnection *connection,
  51. GObject *source_object);
  52. /* Padding for future expansion */
  53. void (*_g_reserved1) (void);
  54. void (*_g_reserved2) (void);
  55. void (*_g_reserved3) (void);
  56. void (*_g_reserved4) (void);
  57. void (*_g_reserved5) (void);
  58. void (*_g_reserved6) (void);
  59. };
  60. struct _GSocketService
  61. {
  62. GSocketListener parent_instance;
  63. GSocketServicePrivate *priv;
  64. };
  65. GLIB_AVAILABLE_IN_ALL
  66. GType g_socket_service_get_type (void);
  67. GLIB_AVAILABLE_IN_ALL
  68. GSocketService *g_socket_service_new (void);
  69. GLIB_AVAILABLE_IN_ALL
  70. void g_socket_service_start (GSocketService *service);
  71. GLIB_AVAILABLE_IN_ALL
  72. void g_socket_service_stop (GSocketService *service);
  73. GLIB_AVAILABLE_IN_ALL
  74. gboolean g_socket_service_is_active (GSocketService *service);
  75. G_END_DECLS
  76. #endif /* __G_SOCKET_SERVICE_H__ */