6b0168f8269c553efe55d8383926754a8747ee35
[platform/upstream/glib.git] / gio / gthreadedsocketservice.h
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
23 #ifndef __G_THREADED_SOCKET_SERVICE_H__
24 #define __G_THREADED_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/gsocketservice.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TYPE_THREADED_SOCKET_SERVICE                      (g_threaded_socket_service_get_type ())
35 #define G_THREADED_SOCKET_SERVICE(inst)                     (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
36                                                              G_TYPE_THREADED_SOCKET_SERVICE,                         \
37                                                              GThreadedSocketService))
38 #define G_THREADED_SOCKET_SERVICE_CLASS(class)              (G_TYPE_CHECK_CLASS_CAST ((class),                       \
39                                                              G_TYPE_THREADED_SOCKET_SERVICE,                         \
40                                                              GThreadedSocketServiceClass))
41 #define G_IS_THREADED_SOCKET_SERVICE(inst)                  (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
42                                                              G_TYPE_THREADED_SOCKET_SERVICE))
43 #define G_IS_THREADED_SOCKET_SERVICE_CLASS(class)           (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
44                                                              G_TYPE_THREADED_SOCKET_SERVICE))
45 #define G_THREADED_SOCKET_SERVICE_GET_CLASS(inst)           (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
46                                                              G_TYPE_THREADED_SOCKET_SERVICE,                         \
47                                                              GThreadedSocketServiceClass))
48
49 typedef struct _GThreadedSocketServicePrivate               GThreadedSocketServicePrivate;
50 typedef struct _GThreadedSocketServiceClass                 GThreadedSocketServiceClass;
51
52 struct _GThreadedSocketServiceClass
53 {
54   GSocketServiceClass parent_class;
55
56   gboolean (* run) (GThreadedSocketService *service,
57                     GSocketConnection      *connection,
58                     GObject                *source_object);
59
60   /* Padding for future expansion */
61   void (*_g_reserved1) (void);
62   void (*_g_reserved2) (void);
63   void (*_g_reserved3) (void);
64   void (*_g_reserved4) (void);
65   void (*_g_reserved5) (void);
66 };
67
68 struct _GThreadedSocketService
69 {
70   GSocketService parent_instance;
71   GThreadedSocketServicePrivate *priv;
72 };
73
74 GLIB_AVAILABLE_IN_ALL
75 GType                   g_threaded_socket_service_get_type              (void);
76 GLIB_AVAILABLE_IN_ALL
77 GSocketService *        g_threaded_socket_service_new                   (int max_threads);
78
79 G_END_DECLS
80
81 #endif /* __G_THREADED_SOCKET_SERVICE_H__ */