GMenuModel: remove a type safety bug
[platform/upstream/glib.git] / gio / gsocketcontrolmessage.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright © 2009 Codethink Limited
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2 of the licence or (at
8  * your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Authors: Ryan Lortie <desrt@desrt.ca>
21  */
22
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
26
27 #ifndef __G_SOCKET_CONTROL_MESSAGE_H__
28 #define __G_SOCKET_CONTROL_MESSAGE_H__
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TYPE_SOCKET_CONTROL_MESSAGE                       (g_socket_control_message_get_type ())
35 #define G_SOCKET_CONTROL_MESSAGE(inst)                      (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
36                                                              G_TYPE_SOCKET_CONTROL_MESSAGE,                          \
37                                                              GSocketControlMessage))
38 #define G_SOCKET_CONTROL_MESSAGE_CLASS(class)               (G_TYPE_CHECK_CLASS_CAST ((class),                       \
39                                                              G_TYPE_SOCKET_CONTROL_MESSAGE,                          \
40                                                              GSocketControlMessageClass))
41 #define G_IS_SOCKET_CONTROL_MESSAGE(inst)                   (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
42                                                              G_TYPE_SOCKET_CONTROL_MESSAGE))
43 #define G_IS_SOCKET_CONTROL_MESSAGE_CLASS(class)            (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
44                                                              G_TYPE_SOCKET_CONTROL_MESSAGE))
45 #define G_SOCKET_CONTROL_MESSAGE_GET_CLASS(inst)            (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
46                                                              G_TYPE_SOCKET_CONTROL_MESSAGE,                          \
47                                                              GSocketControlMessageClass))
48
49 typedef struct _GSocketControlMessagePrivate                GSocketControlMessagePrivate;
50 typedef struct _GSocketControlMessageClass                  GSocketControlMessageClass;
51
52 /**
53  * GSocketControlMessageClass:
54  * @get_size: gets the size of the message.
55  * @get_level: gets the protocol of the message.
56  * @get_type: gets the protocol specific type of the message.
57  * @serialize: Writes out the message data.
58  * @deserialize: Tries to deserialize a message.
59  **/
60
61 struct _GSocketControlMessageClass
62 {
63   GObjectClass parent_class;
64
65   gsize                  (* get_size)  (GSocketControlMessage  *message);
66   int                    (* get_level) (GSocketControlMessage  *message);
67   int                    (* get_type)  (GSocketControlMessage  *message);
68   void                   (* serialize) (GSocketControlMessage  *message,
69                                         gpointer                data);
70   GSocketControlMessage *(* deserialize) (int                   level,
71                                           int                   type,
72                                           gsize                 size,
73                                           gpointer              data);
74
75   /*< private >*/
76
77   /* Padding for future expansion */
78   void (*_g_reserved1) (void);
79   void (*_g_reserved2) (void);
80   void (*_g_reserved3) (void);
81   void (*_g_reserved4) (void);
82   void (*_g_reserved5) (void);
83 };
84
85 struct _GSocketControlMessage
86 {
87   GObject parent_instance;
88   GSocketControlMessagePrivate *priv;
89 };
90
91 GType                  g_socket_control_message_get_type     (void) G_GNUC_CONST;
92 gsize                  g_socket_control_message_get_size     (GSocketControlMessage *message);
93 int                    g_socket_control_message_get_level    (GSocketControlMessage *message);
94 int                    g_socket_control_message_get_msg_type (GSocketControlMessage *message);
95 void                   g_socket_control_message_serialize    (GSocketControlMessage *message,
96                                                               gpointer               data);
97 GSocketControlMessage *g_socket_control_message_deserialize  (int                    level,
98                                                               int                    type,
99                                                               gsize                  size,
100                                                               gpointer               data);
101
102
103 G_END_DECLS
104
105 #endif /* __G_SOCKET_CONTROL_MESSAGE_H__ */