• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2009 Codethink Limited
4  * Copyright © 2009 Red Hat, Inc
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at 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 
23 #ifndef __G_SOCKET_SERVICE_H__
24 #define __G_SOCKET_SERVICE_H__
25 
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
29 
30 #include <gio/gsocketlistener.h>
31 
32 G_BEGIN_DECLS
33 
34 #define G_TYPE_SOCKET_SERVICE                               (g_socket_service_get_type ())
35 #define G_SOCKET_SERVICE(inst)                              (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
36                                                              G_TYPE_SOCKET_SERVICE, GSocketService))
37 #define G_SOCKET_SERVICE_CLASS(class)                       (G_TYPE_CHECK_CLASS_CAST ((class),                       \
38                                                              G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
39 #define G_IS_SOCKET_SERVICE(inst)                           (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
40                                                              G_TYPE_SOCKET_SERVICE))
41 #define G_IS_SOCKET_SERVICE_CLASS(class)                    (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
42                                                              G_TYPE_SOCKET_SERVICE))
43 #define G_SOCKET_SERVICE_GET_CLASS(inst)                    (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
44                                                              G_TYPE_SOCKET_SERVICE, GSocketServiceClass))
45 
46 typedef struct _GSocketServicePrivate                       GSocketServicePrivate;
47 typedef struct _GSocketServiceClass                         GSocketServiceClass;
48 
49 /**
50  * GSocketServiceClass:
51  * @incoming: signal emitted when new connections are accepted
52  *
53  * Class structure for #GSocketService.
54  */
55 struct _GSocketServiceClass
56 {
57   GSocketListenerClass parent_class;
58 
59   gboolean (* incoming) (GSocketService    *service,
60                          GSocketConnection *connection,
61 			 GObject           *source_object);
62 
63   /* Padding for future expansion */
64   void (*_g_reserved1) (void);
65   void (*_g_reserved2) (void);
66   void (*_g_reserved3) (void);
67   void (*_g_reserved4) (void);
68   void (*_g_reserved5) (void);
69   void (*_g_reserved6) (void);
70 };
71 
72 struct _GSocketService
73 {
74   GSocketListener parent_instance;
75   GSocketServicePrivate *priv;
76 };
77 
78 GLIB_AVAILABLE_IN_ALL
79 GType           g_socket_service_get_type  (void);
80 
81 GLIB_AVAILABLE_IN_ALL
82 GSocketService *g_socket_service_new       (void);
83 GLIB_AVAILABLE_IN_ALL
84 void            g_socket_service_start     (GSocketService *service);
85 GLIB_AVAILABLE_IN_ALL
86 void            g_socket_service_stop      (GSocketService *service);
87 GLIB_AVAILABLE_IN_ALL
88 gboolean        g_socket_service_is_active (GSocketService *service);
89 
90 
91 G_END_DECLS
92 
93 #endif /* __G_SOCKET_SERVICE_H__ */
94