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
25#ifndef __G_SOCKET_SERVICE_H__
26#define __G_SOCKET_SERVICE_H__
27
28#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
29#error "Only <gio/gio.h> can be included directly."
30#endif
31
32#include <gio/gsocketlistener.h>
33
34G_BEGIN_DECLS
35
36#define G_TYPE_SOCKET_SERVICE (g_socket_service_get_type ())
37#define G_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
38 G_TYPE_SOCKET_SERVICE, GSocketService))
39#define G_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
40 G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
41#define G_IS_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
42 G_TYPE_SOCKET_SERVICE))
43#define G_IS_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
44 G_TYPE_SOCKET_SERVICE))
45#define G_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
46 G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
47
48typedef struct _GSocketServicePrivate GSocketServicePrivate;
49typedef struct _GSocketServiceClass GSocketServiceClass;
50
51/**
52 * GSocketServiceClass:
53 * @incoming: signal emitted when new connections are accepted
54 *
55 * Class structure for #GSocketService.
56 */
57struct _GSocketServiceClass
58{
59 GSocketListenerClass parent_class;
60
61 gboolean (* incoming) (GSocketService *service,
62 GSocketConnection *connection,
63 GObject *source_object);
64
65 /* Padding for future expansion */
66 void (*_g_reserved1) (void);
67 void (*_g_reserved2) (void);
68 void (*_g_reserved3) (void);
69 void (*_g_reserved4) (void);
70 void (*_g_reserved5) (void);
71 void (*_g_reserved6) (void);
72};
73
74struct _GSocketService
75{
76 GSocketListener parent_instance;
77 GSocketServicePrivate *priv;
78};
79
80GIO_AVAILABLE_IN_ALL
81GType g_socket_service_get_type (void);
82
83GIO_AVAILABLE_IN_ALL
84GSocketService *g_socket_service_new (void);
85GIO_AVAILABLE_IN_ALL
86void g_socket_service_start (GSocketService *service);
87GIO_AVAILABLE_IN_ALL
88void g_socket_service_stop (GSocketService *service);
89GIO_AVAILABLE_IN_ALL
90gboolean g_socket_service_is_active (GSocketService *service);
91
92
93G_END_DECLS
94
95#endif /* __G_SOCKET_SERVICE_H__ */
96