gsocketservice.h 3.6 KB

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