summaryrefslogtreecommitdiff
path: root/tst/stubs/gio/gio-stub.h
blob: fbb4d0e53c63c4c63c825af7d1504f77ac2c450e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* NHM - NodeHealthMonitor
 *
 * Definition of stubs for gio
 *
 * Author: Jean-Pierre Bogler <Jean-Pierre.Bogler@continental-corporation.com>
 *
 * Copyright (C) 2013 Continental Automotive Systems, Inc.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef GIO_STUB_H
#define GIO_STUB_H

/*******************************************************************************
*
* Header includes
*
*******************************************************************************/

#include <gio/gio.h> /* Include header of real gio */

/*******************************************************************************
*
* Exported variables, constants and defines
*
*******************************************************************************/

typedef struct
{
  gchar    *method;
  GVariant *rval;
} GdbusConnectionCallSyncStubCalls;

typedef struct
{
  guint                             count;
  GdbusConnectionCallSyncStubCalls *calls;
} GdbusConnectionCallSyncStubControl;


extern gboolean                           g_main_loop_quit_stub_called;
extern gboolean                           g_bus_get_sync_set_error;
extern guint                              g_timeout_add_seconds_called_interval;
extern gboolean                           g_timeout_add_seconds_called;
extern gboolean                           g_dbus_interface_skeleton_export_stub_set_error;
extern gboolean                           g_dbus_connection_new_for_address_sync_stub_set_error;
extern gboolean                           g_dbus_connection_call_sync_stub_set_error;
extern GdbusConnectionCallSyncStubControl g_dbus_connection_call_sync_stub_control;


/*******************************************************************************
*
* Exported functions
*
*******************************************************************************/

/* File and folder reading */
gboolean          g_file_test_stub                      (const gchar             *filename,
                                                         GFileTest                test);
gchar            *g_file_read_link_stub                 (const gchar             *filename,
                                                         GError                 **error);
GDir             *g_dir_open_stub                       (const gchar             *path,
                                                         guint                    flags,
                                                         GError                 **error);
const gchar      *g_dir_read_name_stub                  (GDir                    *dir);
void              g_dir_close_stub                      (GDir                    *dir);

/* Mainloop handling */
void              g_main_loop_run_stub                  (GMainLoop               *loop);
void              g_main_loop_quit_stub                 (GMainLoop               *loop);

/* Dbus handling */
GDBusConnection  *g_bus_get_sync_stub                   (GBusType                 bus_type,
                                                         GCancellable            *cancellable,
                                                         GError                 **error);
const gchar      *g_dbus_connection_get_unique_name_stub(GDBusConnection         *connection);
guint             g_bus_own_name_stub                   (GBusType                 bus_type,
                                                         const gchar             *name,
                                                         GBusNameOwnerFlags       flags,
                                                         GBusAcquiredCallback     bus_acquired_handler,
                                                         GBusNameAcquiredCallback name_acquired_handler,
                                                         GBusNameLostCallback     name_lost_handler,
                                                         gpointer                 user_data,
                                                         GDestroyNotify           user_data_free_func);


gboolean          g_dbus_interface_skeleton_export_stub (GDBusInterfaceSkeleton  *interface_,
                                                         GDBusConnection         *connection,
                                                         const gchar             *object_path,
                                                         GError                 **error);

GDBusConnection *g_dbus_connection_new_for_address_sync_stub(const gchar            *address,
                                                             GDBusConnectionFlags    flags,
                                                             GDBusAuthObserver      *observer,
                                                             GCancellable           *cancellable,
                                                             GError                **error);

GVariant        *g_dbus_connection_call_sync_stub           (GDBusConnection    *connection,
                                                             const gchar        *bus_name,
                                                             const gchar        *object_path,
                                                             const gchar        *interface_name,
                                                             const gchar        *method_name,
                                                             GVariant           *parameters,
                                                             const GVariantType *reply_type,
                                                             GDBusCallFlags      flags,
                                                             gint                timeout_msec,
                                                             GCancellable       *cancellable,
                                                             GError            **error);
guint            g_dbus_connection_signal_subscribe_stub    (GDBusConnection     *connection,
                                                             const gchar         *sender,
                                                             const gchar         *interface_name,
                                                             const gchar         *member,
                                                             const gchar         *object_path,
                                                             const gchar         *arg0,
                                                             GDBusSignalFlags     flags,
                                                             GDBusSignalCallback  callback,
                                                             gpointer             user_data,
                                                             GDestroyNotify       user_data_free_func);
void             g_dbus_connection_signal_unsubscribe_stub  (GDBusConnection     *connection,
                                                             guint                subscription_id);
GVariant        *g_dbus_connection_call_sync_stub           (GDBusConnection    *connection,
                                                             const gchar        *bus_name,
                                                             const gchar        *object_path,
                                                             const gchar        *interface_name,
                                                             const gchar        *method_name,
                                                             GVariant           *parameters,
                                                             const GVariantType *reply_type,
                                                             GDBusCallFlags      flags,
                                                             gint                timeout_msec,
                                                             GCancellable       *cancellable,
                                                             GError            **error);

/* Timer and signals */
guint             g_timeout_add_seconds_stub            (guint                    interval,
                                                         GSourceFunc              function,
                                                         gpointer                 data);

gulong            g_signal_connect_data_stub            (gpointer                 instance,
                                                         const gchar             *detailed_signal,
                                                         GCallback                c_handler,
                                                         gpointer                 data,
                                                         GClosureNotify           destroy_data,
                                                         GConnectFlags            connect_flags);

/* Process handling */
gboolean          g_spawn_sync_stub                     (const gchar             *working_directory,
                                                         gchar                  **argv,
                                                         gchar                  **envp,
                                                         GSpawnFlags              flags,
                                                         GSpawnChildSetupFunc     child_setup,
                                                         gpointer                 user_data,
                                                         gchar                  **standard_output,
                                                         gchar                  **standard_error,
                                                         gint                    *exit_status,
                                                         GError                 **error);


#endif /* GIO_STUB_H */