[kdbus] Import gio/gkdbus* files from previous patchset.
[platform/upstream/glib.git] / gio / gkdbus.h
1 /*  GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2013 Samsung Electronics
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at 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  * Author: Michal Eljasiewicz   <m.eljasiewic@samsung.com>
21  * Author: Lukasz Skalski       <l.skalski@samsung.com>
22  */
23
24 #ifndef __G_KDBUS_H__
25 #define __G_KDBUS_H__
26
27 #if !defined (GIO_COMPILATION)
28 #error "gkdbus.h is a private header file."
29 #endif
30
31 #include <gio/giotypes.h>
32 #include "gdbusprivate.h"
33
34 G_BEGIN_DECLS
35
36 #define G_TYPE_KDBUS                                       (_g_kdbus_get_type ())
37 #define G_KDBUS(o)                                         (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_KDBUS, GKdbus))
38 #define G_KDBUS_CLASS(k)                                   (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_KDBUS, GKdbusClass))
39 #define G_KDBUS_GET_CLASS(o)                               (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_KDBUS, GKdbusClass))
40 #define G_IS_KDBUS(o)                                      (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_KDBUS))
41 #define G_IS_KDBUS_CLASS(k)                                (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_KDBUS))
42
43 typedef struct _GKdbus                                      GKdbus;
44 typedef struct _GKdbusClass                                 GKdbusClass;
45 typedef struct _GKdbusPrivate                               GKdbusPrivate;
46
47 struct _GKdbusClass
48 {
49   GObjectClass parent_class;
50 };
51
52 struct _GKdbus
53 {
54   GObject parent_instance;
55   GKdbusPrivate *priv;
56 };
57
58 typedef struct
59 {
60   gchar  *data;
61   gsize   size;
62 } msg_part;
63
64 GType                                   _g_kdbus_get_type                  (void) G_GNUC_CONST;
65
66 gboolean                                _g_kdbus_open                      (GKdbus       *kdbus,
67                                                                             const gchar  *address,
68                                                                             GError      **error);
69
70 gboolean                                _g_kdbus_close                     (GKdbus  *kdbus,
71                                                                             GError **error);
72
73 gboolean                                _g_kdbus_is_closed                 (GKdbus  *kdbus);
74
75
76 gssize                                  _g_kdbus_receive                   (GKdbus        *kdbus,
77                                                                             GCancellable  *cancellable,
78                                                                             GError       **error);
79
80 gsize                                   _g_kdbus_send                      (GDBusWorker   *worker,
81                                                                             GKdbus        *kdbus,
82                                                                             GDBusMessage  *dbus_msg,
83                                                                             gchar         *blob,
84                                                                             gsize          blob_size,
85                                                                             GUnixFDList   *fd_list,
86                                                                             GCancellable  *cancellable,
87                                                                             GError       **error);
88
89 GSource *                               _g_kdbus_create_source             (GKdbus        *kdbus,
90                                                                             GIOCondition   condition,
91                                                                             GCancellable  *cancellable);
92
93 gchar *                                 _g_kdbus_hexdump_all_items         (GSList        *kdbus_msg_items);
94
95 void                                    _g_kdbus_release_kmsg              (GKdbus        *kdbus);
96
97 void                                    _g_kdbus_attach_fds_to_msg         (GKdbus        *kdbus,
98                                                                             GUnixFDList  **fd_list);
99
100 GSList *                                _g_kdbus_get_last_msg_items        (GKdbus        *kdbus);
101
102 gchar *                                 _g_kdbus_get_last_msg_sender       (GKdbus        *kdbus);
103
104 gchar *                                 _g_kdbus_get_last_msg_destination  (GKdbus        *kdbus);
105
106 G_END_DECLS
107
108 #endif /* __G_KDBUS_H__ */