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, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __GIO_TYPES_H__
22#define __GIO_TYPES_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/gioenums.h>
29
30G_BEGIN_DECLS
31
32typedef struct _GAppLaunchContext GAppLaunchContext;
33typedef struct _GAppInfo GAppInfo; /* Dummy typedef */
34typedef struct _GAsyncResult GAsyncResult; /* Dummy typedef */
35typedef struct _GAsyncInitable GAsyncInitable;
36typedef struct _GBufferedInputStream GBufferedInputStream;
37typedef struct _GBufferedOutputStream GBufferedOutputStream;
38typedef struct _GCancellable GCancellable;
39typedef struct _GCharsetConverter GCharsetConverter;
40typedef struct _GConverter GConverter;
41typedef struct _GConverterInputStream GConverterInputStream;
42typedef struct _GConverterOutputStream GConverterOutputStream;
43typedef struct _GDatagramBased GDatagramBased;
44typedef struct _GDataInputStream GDataInputStream;
45typedef struct _GSimplePermission GSimplePermission;
46typedef struct _GZlibCompressor GZlibCompressor;
47typedef struct _GZlibDecompressor GZlibDecompressor;
48
49typedef struct _GSimpleActionGroup GSimpleActionGroup;
50typedef struct _GRemoteActionGroup GRemoteActionGroup;
51typedef struct _GDBusActionGroup GDBusActionGroup;
52typedef struct _GActionMap GActionMap;
53typedef struct _GActionGroup GActionGroup;
54typedef struct _GPropertyAction GPropertyAction;
55typedef struct _GSimpleAction GSimpleAction;
56typedef struct _GAction GAction;
57typedef struct _GApplication GApplication;
58typedef struct _GApplicationCommandLine GApplicationCommandLine;
59typedef struct _GSettingsBackend GSettingsBackend;
60typedef struct _GSettings GSettings;
61typedef struct _GPermission GPermission;
62
63typedef struct _GMenuModel GMenuModel;
64typedef struct _GNotification GNotification;
65
66/**
67 * GDrive:
68 *
69 * Opaque drive object.
70 **/
71typedef struct _GDrive GDrive; /* Dummy typedef */
72typedef struct _GFileEnumerator GFileEnumerator;
73typedef struct _GFileMonitor GFileMonitor;
74typedef struct _GFilterInputStream GFilterInputStream;
75typedef 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 **/
84typedef struct _GFile GFile; /* Dummy typedef */
85typedef struct _GFileInfo GFileInfo;
86
87/**
88 * GFileAttributeMatcher:
89 *
90 * Determines if a string matches a file attribute.
91 **/
92typedef struct _GFileAttributeMatcher GFileAttributeMatcher;
93typedef struct _GFileAttributeInfo GFileAttributeInfo;
94typedef struct _GFileAttributeInfoList GFileAttributeInfoList;
95typedef struct _GFileDescriptorBased GFileDescriptorBased;
96typedef struct _GFileInputStream GFileInputStream;
97typedef struct _GFileOutputStream GFileOutputStream;
98typedef struct _GFileIOStream GFileIOStream;
99typedef struct _GFileIcon GFileIcon;
100typedef struct _GFilenameCompleter GFilenameCompleter;
101
102
103typedef struct _GIcon GIcon; /* Dummy typedef */
104typedef struct _GInetAddress GInetAddress;
105typedef struct _GInetAddressMask GInetAddressMask;
106typedef struct _GInetSocketAddress GInetSocketAddress;
107typedef struct _GNativeSocketAddress GNativeSocketAddress;
108typedef struct _GInputStream GInputStream;
109typedef struct _GInitable GInitable;
110typedef struct _GIOModule GIOModule;
111typedef struct _GIOExtensionPoint GIOExtensionPoint;
112typedef struct _GIOExtension GIOExtension;
113
114/**
115 * GIOSchedulerJob:
116 *
117 * Opaque class for defining and scheduling IO jobs.
118 **/
119typedef struct _GIOSchedulerJob GIOSchedulerJob;
120typedef struct _GIOStreamAdapter GIOStreamAdapter;
121typedef struct _GLoadableIcon GLoadableIcon; /* Dummy typedef */
122typedef struct _GBytesIcon GBytesIcon;
123typedef struct _GMemoryInputStream GMemoryInputStream;
124typedef struct _GMemoryOutputStream GMemoryOutputStream;
125
126/**
127 * GMount:
128 *
129 * A handle to an object implementing the #GMountIface interface.
130 **/
131typedef struct _GMount GMount; /* Dummy typedef */
132typedef struct _GMountOperation GMountOperation;
133typedef struct _GNetworkAddress GNetworkAddress;
134typedef struct _GNetworkMonitor GNetworkMonitor;
135typedef struct _GNetworkService GNetworkService;
136typedef struct _GOutputStream GOutputStream;
137typedef struct _GIOStream GIOStream;
138typedef struct _GSimpleIOStream GSimpleIOStream;
139typedef struct _GPollableInputStream GPollableInputStream; /* Dummy typedef */
140typedef struct _GPollableOutputStream GPollableOutputStream; /* Dummy typedef */
141typedef struct _GResolver GResolver;
142
143/**
144 * GResource:
145 *
146 * A resource bundle.
147 *
148 * Since: 2.32
149 */
150typedef struct _GResource GResource;
151typedef struct _GSeekable GSeekable;
152typedef struct _GSimpleAsyncResult GSimpleAsyncResult;
153
154/**
155 * GSocket:
156 *
157 * A lowlevel network socket object.
158 *
159 * Since: 2.22
160 **/
161typedef struct _GSocket GSocket;
162
163/**
164 * GSocketControlMessage:
165 *
166 * Base class for socket-type specific control messages that can be sent and
167 * received over #GSocket.
168 **/
169typedef struct _GSocketControlMessage GSocketControlMessage;
170/**
171 * GSocketClient:
172 *
173 * A helper class for network clients to make connections.
174 *
175 * Since: 2.22
176 **/
177typedef struct _GSocketClient GSocketClient;
178/**
179 * GSocketConnection:
180 *
181 * A socket connection GIOStream object for connection-oriented sockets.
182 *
183 * Since: 2.22
184 **/
185typedef struct _GSocketConnection GSocketConnection;
186/**
187 * GSocketListener:
188 *
189 * A helper class for network servers to listen for and accept connections.
190 *
191 * Since: 2.22
192 **/
193typedef struct _GSocketListener GSocketListener;
194/**
195 * GSocketService:
196 *
197 * A helper class for handling accepting incomming connections in the
198 * glib mainloop.
199 *
200 * Since: 2.22
201 **/
202typedef struct _GSocketService GSocketService;
203typedef struct _GSocketAddress GSocketAddress;
204typedef struct _GSocketAddressEnumerator GSocketAddressEnumerator;
205typedef struct _GSocketConnectable GSocketConnectable;
206typedef struct _GSrvTarget GSrvTarget;
207typedef struct _GTask GTask;
208/**
209 * GTcpConnection:
210 *
211 * A #GSocketConnection for TCP/IP connections.
212 *
213 * Since: 2.22
214 **/
215typedef struct _GTcpConnection GTcpConnection;
216typedef struct _GTcpWrapperConnection GTcpWrapperConnection;
217/**
218 * GThreadedSocketService:
219 *
220 * A helper class for handling accepting incoming connections in the
221 * glib mainloop and handling them in a thread.
222 *
223 * Since: 2.22
224 **/
225typedef struct _GThreadedSocketService GThreadedSocketService;
226typedef struct _GDtlsConnection GDtlsConnection;
227typedef struct _GDtlsClientConnection GDtlsClientConnection; /* Dummy typedef */
228typedef struct _GDtlsServerConnection GDtlsServerConnection; /* Dummy typedef */
229typedef struct _GThemedIcon GThemedIcon;
230typedef struct _GTlsCertificate GTlsCertificate;
231typedef struct _GTlsClientConnection GTlsClientConnection; /* Dummy typedef */
232typedef struct _GTlsConnection GTlsConnection;
233typedef struct _GTlsDatabase GTlsDatabase;
234typedef struct _GTlsFileDatabase GTlsFileDatabase;
235typedef struct _GTlsInteraction GTlsInteraction;
236typedef struct _GTlsPassword GTlsPassword;
237typedef struct _GTlsServerConnection GTlsServerConnection; /* Dummy typedef */
238typedef struct _GVfs GVfs; /* Dummy typedef */
239
240/**
241 * GProxyResolver:
242 *
243 * A helper class to enumerate proxies base on URI.
244 *
245 * Since: 2.26
246 **/
247typedef struct _GProxyResolver GProxyResolver;
248typedef struct _GProxy GProxy;
249typedef struct _GProxyAddress GProxyAddress;
250typedef struct _GProxyAddressEnumerator GProxyAddressEnumerator;
251
252/**
253 * GVolume:
254 *
255 * Opaque mountable volume object.
256 **/
257typedef struct _GVolume GVolume; /* Dummy typedef */
258typedef struct _GVolumeMonitor GVolumeMonitor;
259
260/**
261 * GAsyncReadyCallback:
262 * @source_object: the object the asynchronous operation was started with.
263 * @res: a #GAsyncResult.
264 * @user_data: user data passed to the callback.
265 *
266 * Type definition for a function that will be called back when an asynchronous
267 * operation within GIO has been completed.
268 **/
269typedef void (*GAsyncReadyCallback) (GObject *source_object,
270 GAsyncResult *res,
271 gpointer user_data);
272
273/**
274 * GFileProgressCallback:
275 * @current_num_bytes: the current number of bytes in the operation.
276 * @total_num_bytes: the total number of bytes in the operation.
277 * @user_data: user data passed to the callback.
278 *
279 * When doing file operations that may take a while, such as moving
280 * a file or copying a file, a progress callback is used to pass how
281 * far along that operation is to the application.
282 **/
283typedef void (*GFileProgressCallback) (goffset current_num_bytes,
284 goffset total_num_bytes,
285 gpointer user_data);
286
287/**
288 * GFileReadMoreCallback:
289 * @file_contents: the data as currently read.
290 * @file_size: the size of the data currently read.
291 * @callback_data: data passed to the callback.
292 *
293 * When loading the partial contents of a file with g_file_load_partial_contents_async(),
294 * it may become necessary to determine if any more data from the file should be loaded.
295 * A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data
296 * should be read, or %FALSE otherwise.
297 *
298 * Returns: %TRUE if more data should be read back. %FALSE otherwise.
299 **/
300typedef gboolean (* GFileReadMoreCallback) (const char *file_contents,
301 goffset file_size,
302 gpointer callback_data);
303
304/**
305 * GFileMeasureProgressCallback:
306 * @reporting: %TRUE if more reports will come
307 * @current_size: the current cumulative size measurement
308 * @num_dirs: the number of directories visited so far
309 * @num_files: the number of non-directory files encountered
310 * @user_data: the data passed to the original request for this callback
311 *
312 * This callback type is used by g_file_measure_disk_usage() to make
313 * periodic progress reports when measuring the amount of disk spaced
314 * used by a directory.
315 *
316 * These calls are made on a best-effort basis and not all types of
317 * #GFile will support them. At the minimum, however, one call will
318 * always be made immediately.
319 *
320 * In the case that there is no support, @reporting will be set to
321 * %FALSE (and the other values undefined) and no further calls will be
322 * made. Otherwise, the @reporting will be %TRUE and the other values
323 * all-zeros during the first (immediate) call. In this way, you can
324 * know which type of progress UI to show without a delay.
325 *
326 * For g_file_measure_disk_usage() the callback is made directly. For
327 * g_file_measure_disk_usage_async() the callback is made via the
328 * default main context of the calling thread (ie: the same way that the
329 * final async result would be reported).
330 *
331 * @current_size is in the same units as requested by the operation (see
332 * %G_FILE_DISK_USAGE_APPARENT_SIZE).
333 *
334 * The frequency of the updates is implementation defined, but is
335 * ideally about once every 200ms.
336 *
337 * The last progress callback may or may not be equal to the final
338 * result. Always check the async result to get the final value.
339 *
340 * Since: 2.38
341 **/
342typedef void (* GFileMeasureProgressCallback) (gboolean reporting,
343 guint64 current_size,
344 guint64 num_dirs,
345 guint64 num_files,
346 gpointer user_data);
347
348/**
349 * GIOSchedulerJobFunc:
350 * @job: a #GIOSchedulerJob.
351 * @cancellable: optional #GCancellable object, %NULL to ignore.
352 * @user_data: the data to pass to callback function
353 *
354 * I/O Job function.
355 *
356 * Long-running jobs should periodically check the @cancellable
357 * to see if they have been cancelled.
358 *
359 * Returns: %TRUE if this function should be called again to
360 * complete the job, %FALSE if the job is complete (or cancelled)
361 **/
362typedef gboolean (*GIOSchedulerJobFunc) (GIOSchedulerJob *job,
363 GCancellable *cancellable,
364 gpointer user_data);
365
366/**
367 * GSimpleAsyncThreadFunc:
368 * @res: a #GSimpleAsyncResult.
369 * @object: a #GObject.
370 * @cancellable: optional #GCancellable object, %NULL to ignore.
371 *
372 * Simple thread function that runs an asynchronous operation and
373 * checks for cancellation.
374 **/
375typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res,
376 GObject *object,
377 GCancellable *cancellable);
378
379/**
380 * GSocketSourceFunc:
381 * @socket: the #GSocket
382 * @condition: the current condition at the source fired.
383 * @user_data: data passed in by the user.
384 *
385 * This is the function type of the callback used for the #GSource
386 * returned by g_socket_create_source().
387 *
388 * Returns: it should return %FALSE if the source should be removed.
389 *
390 * Since: 2.22
391 */
392typedef gboolean (*GSocketSourceFunc) (GSocket *socket,
393 GIOCondition condition,
394 gpointer user_data);
395
396/**
397 * GDatagramBasedSourceFunc:
398 * @datagram_based: the #GDatagramBased
399 * @condition: the current condition at the source fired
400 * @user_data: data passed in by the user
401 *
402 * This is the function type of the callback used for the #GSource
403 * returned by g_datagram_based_create_source().
404 *
405 * Returns: %G_SOURCE_REMOVE if the source should be removed,
406 * %G_SOURCE_CONTINUE otherwise
407 *
408 * Since: 2.48
409 */
410typedef gboolean (*GDatagramBasedSourceFunc) (GDatagramBased *datagram_based,
411 GIOCondition condition,
412 gpointer user_data);
413
414/**
415 * GInputVector:
416 * @buffer: Pointer to a buffer where data will be written.
417 * @size: the available size in @buffer.
418 *
419 * Structure used for scatter/gather data input.
420 * You generally pass in an array of #GInputVectors
421 * and the operation will store the read data starting in the
422 * first buffer, switching to the next as needed.
423 *
424 * Since: 2.22
425 */
426typedef struct _GInputVector GInputVector;
427
428struct _GInputVector {
429 gpointer buffer;
430 gsize size;
431};
432
433/**
434 * GInputMessage:
435 * @address: (optional) (out) (transfer full): return location
436 * for a #GSocketAddress, or %NULL
437 * @vectors: (array length=num_vectors) (out): pointer to an
438 * array of input vectors
439 * @num_vectors: the number of input vectors pointed to by @vectors
440 * @bytes_received: (out): will be set to the number of bytes that have been
441 * received
442 * @flags: (out): collection of #GSocketMsgFlags for the received message,
443 * outputted by the call
444 * @control_messages: (array length=num_control_messages) (optional)
445 * (out) (transfer full): return location for a
446 * caller-allocated array of #GSocketControlMessages, or %NULL
447 * @num_control_messages: (out) (optional): return location for the number of
448 * elements in @control_messages
449 *
450 * Structure used for scatter/gather data input when receiving multiple
451 * messages or packets in one go. You generally pass in an array of empty
452 * #GInputVectors and the operation will use all the buffers as if they
453 * were one buffer, and will set @bytes_received to the total number of bytes
454 * received across all #GInputVectors.
455 *
456 * This structure closely mirrors `struct mmsghdr` and `struct msghdr` from
457 * the POSIX sockets API (see `man 2 recvmmsg`).
458 *
459 * If @address is non-%NULL then it is set to the source address the message
460 * was received from, and the caller must free it afterwards.
461 *
462 * If @control_messages is non-%NULL then it is set to an array of control
463 * messages received with the message (if any), and the caller must free it
464 * afterwards. @num_control_messages is set to the number of elements in
465 * this array, which may be zero.
466 *
467 * Flags relevant to this message will be returned in @flags. For example,
468 * `MSG_EOR` or `MSG_TRUNC`.
469 *
470 * Since: 2.48
471 */
472typedef struct _GInputMessage GInputMessage;
473
474struct _GInputMessage {
475 GSocketAddress **address;
476
477 GInputVector *vectors;
478 guint num_vectors;
479
480 gsize bytes_received;
481 gint flags;
482
483 GSocketControlMessage ***control_messages;
484 guint *num_control_messages;
485};
486
487/**
488 * GOutputVector:
489 * @buffer: Pointer to a buffer of data to read.
490 * @size: the size of @buffer.
491 *
492 * Structure used for scatter/gather data output.
493 * You generally pass in an array of #GOutputVectors
494 * and the operation will use all the buffers as if they were
495 * one buffer.
496 *
497 * Since: 2.22
498 */
499typedef struct _GOutputVector GOutputVector;
500
501struct _GOutputVector {
502 gconstpointer buffer;
503 gsize size;
504};
505
506/**
507 * GOutputMessage:
508 * @address: (allow-none): a #GSocketAddress, or %NULL
509 * @vectors: pointer to an array of output vectors
510 * @num_vectors: the number of output vectors pointed to by @vectors.
511 * @bytes_sent: initialize to 0. Will be set to the number of bytes
512 * that have been sent
513 * @control_messages: (array length=num_control_messages) (allow-none): a pointer
514 * to an array of #GSocketControlMessages, or %NULL.
515 * @num_control_messages: number of elements in @control_messages.
516 *
517 * Structure used for scatter/gather data output when sending multiple
518 * messages or packets in one go. You generally pass in an array of
519 * #GOutputVectors and the operation will use all the buffers as if they
520 * were one buffer.
521 *
522 * If @address is %NULL then the message is sent to the default receiver
523 * (as previously set by g_socket_connect()).
524 *
525 * Since: 2.44
526 */
527typedef struct _GOutputMessage GOutputMessage;
528
529struct _GOutputMessage {
530 GSocketAddress *address;
531
532 GOutputVector *vectors;
533 guint num_vectors;
534
535 guint bytes_sent;
536
537 GSocketControlMessage **control_messages;
538 guint num_control_messages;
539};
540
541typedef struct _GCredentials GCredentials;
542typedef struct _GUnixCredentialsMessage GUnixCredentialsMessage;
543typedef struct _GUnixFDList GUnixFDList;
544typedef struct _GDBusMessage GDBusMessage;
545typedef struct _GDBusConnection GDBusConnection;
546typedef struct _GDBusProxy GDBusProxy;
547typedef struct _GDBusMethodInvocation GDBusMethodInvocation;
548typedef struct _GDBusServer GDBusServer;
549typedef struct _GDBusAuthObserver GDBusAuthObserver;
550typedef struct _GDBusErrorEntry GDBusErrorEntry;
551typedef struct _GDBusInterfaceVTable GDBusInterfaceVTable;
552typedef struct _GDBusSubtreeVTable GDBusSubtreeVTable;
553typedef struct _GDBusAnnotationInfo GDBusAnnotationInfo;
554typedef struct _GDBusArgInfo GDBusArgInfo;
555typedef struct _GDBusMethodInfo GDBusMethodInfo;
556typedef struct _GDBusSignalInfo GDBusSignalInfo;
557typedef struct _GDBusPropertyInfo GDBusPropertyInfo;
558typedef struct _GDBusInterfaceInfo GDBusInterfaceInfo;
559typedef struct _GDBusNodeInfo GDBusNodeInfo;
560
561/**
562 * GCancellableSourceFunc:
563 * @cancellable: the #GCancellable
564 * @user_data: data passed in by the user.
565 *
566 * This is the function type of the callback used for the #GSource
567 * returned by g_cancellable_source_new().
568 *
569 * Returns: it should return %FALSE if the source should be removed.
570 *
571 * Since: 2.28
572 */
573typedef gboolean (*GCancellableSourceFunc) (GCancellable *cancellable,
574 gpointer user_data);
575
576/**
577 * GPollableSourceFunc:
578 * @pollable_stream: the #GPollableInputStream or #GPollableOutputStream
579 * @user_data: data passed in by the user.
580 *
581 * This is the function type of the callback used for the #GSource
582 * returned by g_pollable_input_stream_create_source() and
583 * g_pollable_output_stream_create_source().
584 *
585 * Returns: it should return %FALSE if the source should be removed.
586 *
587 * Since: 2.28
588 */
589typedef gboolean (*GPollableSourceFunc) (GObject *pollable_stream,
590 gpointer user_data);
591
592typedef struct _GDBusInterface GDBusInterface; /* Dummy typedef */
593typedef struct _GDBusInterfaceSkeleton GDBusInterfaceSkeleton;
594typedef struct _GDBusObject GDBusObject; /* Dummy typedef */
595typedef struct _GDBusObjectSkeleton GDBusObjectSkeleton;
596typedef struct _GDBusObjectProxy GDBusObjectProxy;
597typedef struct _GDBusObjectManager GDBusObjectManager; /* Dummy typedef */
598typedef struct _GDBusObjectManagerClient GDBusObjectManagerClient;
599typedef struct _GDBusObjectManagerServer GDBusObjectManagerServer;
600
601/**
602 * GDBusProxyTypeFunc:
603 * @manager: A #GDBusObjectManagerClient.
604 * @object_path: The object path of the remote object.
605 * @interface_name: (allow-none): The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested.
606 * @user_data: User data.
607 *
608 * Function signature for a function used to determine the #GType to
609 * use for an interface proxy (if @interface_name is not %NULL) or
610 * object proxy (if @interface_name is %NULL).
611 *
612 * This function is called in the
613 * [thread-default main loop][g-main-context-push-thread-default]
614 * that @manager was constructed in.
615 *
616 * Returns: A #GType to use for the remote object. The returned type
617 * must be a #GDBusProxy<!-- -->- or #GDBusObjectProxy<!-- -->-derived
618 * type.
619 *
620 * Since: 2.30
621 */
622typedef GType (*GDBusProxyTypeFunc) (GDBusObjectManagerClient *manager,
623 const gchar *object_path,
624 const gchar *interface_name,
625 gpointer user_data);
626
627typedef struct _GTestDBus GTestDBus;
628
629/**
630 * GSubprocess:
631 *
632 * A child process.
633 *
634 * Since: 2.40
635 */
636typedef struct _GSubprocess GSubprocess;
637/**
638 * GSubprocessLauncher:
639 *
640 * Options for launching a child process.
641 *
642 * Since: 2.40
643 */
644typedef struct _GSubprocessLauncher GSubprocessLauncher;
645
646G_END_DECLS
647
648#endif /* __GIO_TYPES_H__ */
649