adcbdae67ba717652f6736aea34f43f2f7c5f818
[platform/upstream/glib.git] / gio / giotypes.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2006-2007 Red Hat, Inc.
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: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #ifndef __GIO_TYPES_H__
24 #define __GIO_TYPES_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/gioenums.h>
31
32 G_BEGIN_DECLS
33
34 typedef struct _GAppLaunchContext             GAppLaunchContext;
35 typedef struct _GAppInfo                      GAppInfo; /* Dummy typedef */
36 typedef struct _GAsyncResult                  GAsyncResult; /* Dummy typedef */
37 typedef struct _GAsyncInitable                GAsyncInitable;
38 typedef struct _GBufferedInputStream          GBufferedInputStream;
39 typedef struct _GBufferedOutputStream         GBufferedOutputStream;
40 typedef struct _GCancellable                  GCancellable;
41 typedef struct _GCharsetConverter             GCharsetConverter;
42 typedef struct _GConverter                    GConverter;
43 typedef struct _GConverterInputStream         GConverterInputStream;
44 typedef struct _GConverterOutputStream        GConverterOutputStream;
45 typedef struct _GDataInputStream              GDataInputStream;
46 typedef struct _GSimplePermission             GSimplePermission;
47 typedef struct _GZlibCompressor               GZlibCompressor;
48 typedef struct _GZlibDecompressor             GZlibDecompressor;
49
50 typedef struct _GSimpleActionGroup            GSimpleActionGroup;
51 typedef struct _GRemoteActionGroup            GRemoteActionGroup;
52 typedef struct _GDBusActionGroup              GDBusActionGroup;
53 typedef struct _GActionMap                    GActionMap;
54 typedef struct _GActionGroup                  GActionGroup;
55 typedef struct _GPropertyAction               GPropertyAction;
56 typedef struct _GSimpleAction                 GSimpleAction;
57 typedef struct _GAction                       GAction;
58 typedef struct _GApplication                  GApplication;
59 typedef struct _GApplicationCommandLine       GApplicationCommandLine;
60 typedef struct _GSettingsBackend              GSettingsBackend;
61 typedef struct _GSettings                     GSettings;
62 typedef struct _GPermission                   GPermission;
63
64 typedef struct _GMenuModel                    GMenuModel;
65
66 /**
67  * GDrive:
68  *
69  * Opaque drive object.
70  **/
71 typedef struct _GDrive                        GDrive; /* Dummy typedef */
72 typedef struct _GFileEnumerator               GFileEnumerator;
73 typedef struct _GFileMonitor                  GFileMonitor;
74 typedef struct _GFilterInputStream            GFilterInputStream;
75 typedef struct _GFilterOutputStream           GFilterOutputStream;
76
77 /**
78  * GFile:
79  *
80  * A handle to an object implementing the #GFileIface interface.
81  * Generally stores a location within the file system. Handles do not
82  * necessarily represent files or directories that currently exist.
83  **/
84 typedef struct _GFile                         GFile; /* Dummy typedef */
85 typedef struct _GFileInfo                     GFileInfo;
86
87 /**
88  * GFileAttributeMatcher:
89  *
90  * Determines if a string matches a file attribute.
91  **/
92 typedef struct _GFileAttributeMatcher         GFileAttributeMatcher;
93 typedef struct _GFileAttributeInfo            GFileAttributeInfo;
94 typedef struct _GFileAttributeInfoList        GFileAttributeInfoList;
95 typedef struct _GFileDescriptorBased          GFileDescriptorBased;
96 typedef struct _GFileInputStream              GFileInputStream;
97 typedef struct _GFileOutputStream             GFileOutputStream;
98 typedef struct _GFileIOStream                 GFileIOStream;
99 typedef struct _GFileIcon                     GFileIcon;
100 typedef struct _GFilenameCompleter            GFilenameCompleter;
101
102
103 typedef struct _GIcon                         GIcon; /* Dummy typedef */
104 typedef struct _GInetAddress                  GInetAddress;
105 typedef struct _GInetAddressMask              GInetAddressMask;
106 typedef struct _GInetSocketAddress            GInetSocketAddress;
107 typedef struct _GInputStream                  GInputStream;
108 typedef struct _GInitable                     GInitable;
109 typedef struct _GIOModule                     GIOModule;
110 typedef struct _GIOExtensionPoint             GIOExtensionPoint;
111 typedef struct _GIOExtension                  GIOExtension;
112
113 /**
114  * GIOSchedulerJob:
115  *
116  * Opaque class for defining and scheduling IO jobs.
117  **/
118 typedef struct _GIOSchedulerJob               GIOSchedulerJob;
119 typedef struct _GIOStreamAdapter              GIOStreamAdapter;
120 typedef struct _GLoadableIcon                 GLoadableIcon; /* Dummy typedef */
121 typedef struct _GBytesIcon                    GBytesIcon;
122 typedef struct _GMemoryInputStream            GMemoryInputStream;
123 typedef struct _GMemoryOutputStream           GMemoryOutputStream;
124
125 /**
126  * GMount:
127  *
128  * A handle to an object implementing the #GMountIface interface.
129  **/
130 typedef struct _GMount                        GMount; /* Dummy typedef */
131 typedef struct _GMountOperation               GMountOperation;
132 typedef struct _GNetworkAddress               GNetworkAddress;
133 typedef struct _GNetworkMonitor               GNetworkMonitor;
134 typedef struct _GNetworkService               GNetworkService;
135 typedef struct _GOutputStream                 GOutputStream;
136 typedef struct _GIOStream                     GIOStream;
137 typedef struct _GPollableInputStream          GPollableInputStream; /* Dummy typedef */
138 typedef struct _GPollableOutputStream         GPollableOutputStream; /* Dummy typedef */
139 typedef struct _GResolver                     GResolver;
140 /**
141  * GResource:
142  *
143  * A resource bundle.
144  *
145  * Since: 2.32
146  */
147 typedef struct _GResource                     GResource;
148 typedef struct _GSeekable                     GSeekable;
149 typedef struct _GSimpleAsyncResult            GSimpleAsyncResult;
150
151 /**
152  * GSocket:
153  *
154  * A lowlevel network socket object.
155  *
156  * Since: 2.22
157  **/
158 typedef struct _GSocket                       GSocket;
159
160 /**
161  * GSocketControlMessage:
162  *
163  * Base class for socket-type specific control messages that can be sent and
164  * received over #GSocket.
165  **/
166 typedef struct _GSocketControlMessage         GSocketControlMessage;
167 /**
168  * GSocketClient:
169  *
170  * A helper class for network clients to make connections.
171  *
172  * Since: 2.22
173  **/
174 typedef struct _GSocketClient                               GSocketClient;
175 /**
176  * GSocketConnection:
177  *
178  * A socket connection GIOStream object for connection-oriented sockets.
179  *
180  * Since: 2.22
181  **/
182 typedef struct _GSocketConnection                           GSocketConnection;
183 /**
184  * GSocketListener:
185  *
186  * A helper class for network servers to listen for and accept connections.
187  *
188  * Since: 2.22
189  **/
190 typedef struct _GSocketListener                             GSocketListener;
191 /**
192  * GSocketService:
193  *
194  * A helper class for handling accepting incomming connections in the
195  * glib mainloop.
196  *
197  * Since: 2.22
198  **/
199 typedef struct _GSocketService                              GSocketService;
200 typedef struct _GSocketAddress                GSocketAddress;
201 typedef struct _GSocketAddressEnumerator      GSocketAddressEnumerator;
202 typedef struct _GSocketConnectable            GSocketConnectable;
203 typedef struct _GSrvTarget                    GSrvTarget;
204 typedef struct _GTask                         GTask;
205 /**
206  * GTcpConnection:
207  *
208  * A #GSocketConnection for TCP/IP connections.
209  *
210  * Since: 2.22
211  **/
212 typedef struct _GTcpConnection                              GTcpConnection;
213 typedef struct _GTcpWrapperConnection                       GTcpWrapperConnection;
214 /**
215  * GThreadedSocketService:
216  *
217  * A helper class for handling accepting incoming connections in the
218  * glib mainloop and handling them in a thread.
219  *
220  * Since: 2.22
221  **/
222 typedef struct _GThreadedSocketService                      GThreadedSocketService;
223 typedef struct _GThemedIcon                   GThemedIcon;
224 typedef struct _GTlsCertificate               GTlsCertificate;
225 typedef struct _GTlsClientConnection          GTlsClientConnection; /* Dummy typedef */
226 typedef struct _GTlsConnection                GTlsConnection;
227 typedef struct _GTlsDatabase                  GTlsDatabase;
228 typedef struct _GTlsFileDatabase              GTlsFileDatabase;
229 typedef struct _GTlsInteraction               GTlsInteraction;
230 typedef struct _GTlsPassword                  GTlsPassword;
231 typedef struct _GTlsServerConnection          GTlsServerConnection; /* Dummy typedef */
232 typedef struct _GVfs                          GVfs; /* Dummy typedef */
233
234 /**
235  * GProxyResolver:
236  *
237  * A helper class to enumerate proxies base on URI.
238  *
239  * Since: 2.26
240  **/
241 typedef struct _GProxyResolver                GProxyResolver;
242 typedef struct _GProxy                        GProxy;
243 typedef struct _GProxyAddress                 GProxyAddress;
244 typedef struct _GProxyAddressEnumerator       GProxyAddressEnumerator;
245
246 /**
247  * GVolume:
248  *
249  * Opaque mountable volume object.
250  **/
251 typedef struct _GVolume                       GVolume; /* Dummy typedef */
252 typedef struct _GVolumeMonitor                GVolumeMonitor;
253
254 /**
255  * GAsyncReadyCallback:
256  * @source_object: the object the asynchronous operation was started with.
257  * @res: a #GAsyncResult.
258  * @user_data: user data passed to the callback.
259  *
260  * Type definition for a function that will be called back when an asynchronous
261  * operation within GIO has been completed.
262  **/
263 typedef void (*GAsyncReadyCallback) (GObject *source_object,
264                                      GAsyncResult *res,
265                                      gpointer user_data);
266
267 /**
268  * GFileProgressCallback:
269  * @current_num_bytes: the current number of bytes in the operation.
270  * @total_num_bytes: the total number of bytes in the operation.
271  * @user_data: user data passed to the callback.
272  *
273  * When doing file operations that may take a while, such as moving
274  * a file or copying a file, a progress callback is used to pass how
275  * far along that operation is to the application.
276  **/
277 typedef void (*GFileProgressCallback) (goffset current_num_bytes,
278                                        goffset total_num_bytes,
279                                        gpointer user_data);
280
281 /**
282  * GFileReadMoreCallback:
283  * @file_contents: the data as currently read.
284  * @file_size: the size of the data currently read.
285  * @callback_data: data passed to the callback.
286  *
287  * When loading the partial contents of a file with g_file_load_partial_contents_async(),
288  * it may become necessary to determine if any more data from the file should be loaded.
289  * A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data
290  * should be read, or %FALSE otherwise.
291  *
292  * Returns: %TRUE if more data should be read back. %FALSE otherwise.
293  **/
294 typedef gboolean (* GFileReadMoreCallback) (const char *file_contents,
295                                             goffset file_size,
296                                             gpointer callback_data);
297
298
299 /**
300  * GIOSchedulerJobFunc:
301  * @job: a #GIOSchedulerJob.
302  * @cancellable: optional #GCancellable object, %NULL to ignore.
303  * @user_data: the data to pass to callback function
304  *
305  * I/O Job function.
306  *
307  * Long-running jobs should periodically check the @cancellable
308  * to see if they have been cancelled.
309  *
310  * Returns: %TRUE if this function should be called again to
311  *    complete the job, %FALSE if the job is complete (or cancelled)
312  **/
313 typedef gboolean (*GIOSchedulerJobFunc) (GIOSchedulerJob *job,
314                                          GCancellable    *cancellable,
315                                          gpointer         user_data);
316
317 /**
318  * GSimpleAsyncThreadFunc:
319  * @res: a #GSimpleAsyncResult.
320  * @object: a #GObject.
321  * @cancellable: optional #GCancellable object, %NULL to ignore.
322  *
323  * Simple thread function that runs an asynchronous operation and
324  * checks for cancellation.
325  **/
326 typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
327                                         GObject *object,
328                                         GCancellable *cancellable);
329
330 /**
331  * GSocketSourceFunc:
332  * @socket: the #GSocket
333  * @condition: the current condition at the source fired.
334  * @user_data: data passed in by the user.
335  *
336  * This is the function type of the callback used for the #GSource
337  * returned by g_socket_create_source().
338  *
339  * Returns: it should return %FALSE if the source should be removed.
340  *
341  * Since: 2.22
342  */
343 typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
344                                        GIOCondition condition,
345                                        gpointer user_data);
346
347 /**
348  * GInputVector:
349  * @buffer: Pointer to a buffer where data will be written.
350  * @size: the available size in @buffer.
351  *
352  * Structure used for scatter/gather data input.
353  * You generally pass in an array of #GInputVector<!-- -->s
354  * and the operation will store the read data starting in the
355  * first buffer, switching to the next as needed.
356  *
357  * Since: 2.22
358  */
359 typedef struct _GInputVector GInputVector;
360
361 struct _GInputVector {
362   gpointer buffer;
363   gsize size;
364 };
365
366 /**
367  * GOutputVector:
368  * @buffer: Pointer to a buffer of data to read.
369  * @size: the size of @buffer.
370  *
371  * Structure used for scatter/gather data output.
372  * You generally pass in an array of #GOutputVector<!-- -->s
373  * and the operation will use all the buffers as if they were
374  * one buffer.
375  *
376  * Since: 2.22
377  */
378 typedef struct _GOutputVector GOutputVector;
379
380 struct _GOutputVector {
381   gconstpointer buffer;
382   gsize size;
383 };
384
385 typedef struct _GCredentials                  GCredentials;
386 typedef struct _GUnixCredentialsMessage       GUnixCredentialsMessage;
387 typedef struct _GUnixFDList                   GUnixFDList;
388 typedef struct _GDBusMessage                  GDBusMessage;
389 typedef struct _GDBusConnection               GDBusConnection;
390 typedef struct _GDBusProxy                    GDBusProxy;
391 typedef struct _GDBusMethodInvocation         GDBusMethodInvocation;
392 typedef struct _GDBusServer                   GDBusServer;
393 typedef struct _GDBusAuthObserver             GDBusAuthObserver;
394 typedef struct _GDBusErrorEntry               GDBusErrorEntry;
395 typedef struct _GDBusInterfaceVTable          GDBusInterfaceVTable;
396 typedef struct _GDBusSubtreeVTable            GDBusSubtreeVTable;
397 typedef struct _GDBusAnnotationInfo           GDBusAnnotationInfo;
398 typedef struct _GDBusArgInfo                  GDBusArgInfo;
399 typedef struct _GDBusMethodInfo               GDBusMethodInfo;
400 typedef struct _GDBusSignalInfo               GDBusSignalInfo;
401 typedef struct _GDBusPropertyInfo             GDBusPropertyInfo;
402 typedef struct _GDBusInterfaceInfo            GDBusInterfaceInfo;
403 typedef struct _GDBusNodeInfo                 GDBusNodeInfo;
404
405 /**
406  * GCancellableSourceFunc:
407  * @cancellable: the #GCancellable
408  * @user_data: data passed in by the user.
409  *
410  * This is the function type of the callback used for the #GSource
411  * returned by g_cancellable_source_new().
412  *
413  * Returns: it should return %FALSE if the source should be removed.
414  *
415  * Since: 2.28
416  */
417 typedef gboolean (*GCancellableSourceFunc) (GCancellable *cancellable,
418                                             gpointer      user_data);
419
420 /**
421  * GPollableSourceFunc:
422  * @pollable_stream: the #GPollableInputStream or #GPollableOutputStream
423  * @user_data: data passed in by the user.
424  *
425  * This is the function type of the callback used for the #GSource
426  * returned by g_pollable_input_stream_create_source() and
427  * g_pollable_output_stream_create_source().
428  *
429  * Returns: it should return %FALSE if the source should be removed.
430  *
431  * Since: 2.28
432  */
433 typedef gboolean (*GPollableSourceFunc) (GObject  *pollable_stream,
434                                          gpointer  user_data);
435
436 typedef struct _GDBusInterface              GDBusInterface; /* Dummy typedef */
437 typedef struct _GDBusInterfaceSkeleton      GDBusInterfaceSkeleton;
438 typedef struct _GDBusObject                 GDBusObject;  /* Dummy typedef */
439 typedef struct _GDBusObjectSkeleton         GDBusObjectSkeleton;
440 typedef struct _GDBusObjectProxy            GDBusObjectProxy;
441 typedef struct _GDBusObjectManager          GDBusObjectManager;  /* Dummy typedef */
442 typedef struct _GDBusObjectManagerClient    GDBusObjectManagerClient;
443 typedef struct _GDBusObjectManagerServer    GDBusObjectManagerServer;
444
445 /**
446  * GDBusProxyTypeFunc:
447  * @manager: A #GDBusObjectManagerClient.
448  * @object_path: The object path of the remote object.
449  * @interface_name: (allow-none): The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested.
450  * @user_data: User data.
451  *
452  * Function signature for a function used to determine the #GType to
453  * use for an interface proxy (if @interface_name is not %NULL) or
454  * object proxy (if @interface_name is %NULL).
455  *
456  * This function is called in the
457  * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
458  * that @manager was constructed in.
459  *
460  * Returns: A #GType to use for the remote object. The returned type
461  *   must be a #GDBusProxy<!-- -->- or #GDBusObjectProxy<!-- -->-derived
462  *   type.
463  *
464  * Since: 2.30
465  */
466 typedef GType (*GDBusProxyTypeFunc) (GDBusObjectManagerClient   *manager,
467                                      const gchar                *object_path,
468                                      const gchar                *interface_name,
469                                      gpointer                    user_data);
470
471 typedef struct _GTestDBus GTestDBus;
472
473 G_END_DECLS
474
475 #endif /* __GIO_TYPES_H__ */