Extending test-client-custom-summary to try e_book_client_get_contacts_uids()
[platform/upstream/evolution-data-server.git] / camel / camel-file-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /*
4  * Authors:
5  *   Michael Zucchi <notzed@ximian.com>
6  *   Jeffrey Stedfast <fejj@ximian.com>
7  *   Dan Winship <danw@ximian.com>
8  *
9  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of version 2 of the GNU Lesser General Public
13  * License as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23  * USA
24  */
25
26 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
27 #error "Only <camel/camel.h> can be included directly."
28 #endif
29
30 #ifndef CAMEL_FILE_UTILS_H
31 #define CAMEL_FILE_UTILS_H
32
33 #include <gio/gio.h>
34 #include <stdio.h>
35 #include <sys/types.h>
36 #include <time.h>
37 #include <fcntl.h>
38
39 #ifndef O_BINARY
40 #define O_BINARY 0
41 #endif
42
43 G_BEGIN_DECLS
44
45 gint camel_file_util_encode_fixed_int32 (FILE *out, gint32 value);
46 gint camel_file_util_decode_fixed_int32 (FILE *in, gint32 *dest);
47 gint camel_file_util_encode_uint32 (FILE *out, guint32 value);
48 gint camel_file_util_decode_uint32 (FILE *in, guint32 *dest);
49 gint camel_file_util_encode_time_t (FILE *out, time_t value);
50 gint camel_file_util_decode_time_t (FILE *in, time_t *dest);
51 gint camel_file_util_encode_off_t (FILE *out, off_t value);
52 gint camel_file_util_decode_off_t (FILE *in, off_t *dest);
53 gint camel_file_util_encode_gsize (FILE *out, gsize value);
54 gint camel_file_util_decode_gsize (FILE *in, gsize *dest);
55 gint camel_file_util_encode_string (FILE *out, const gchar *str);
56 gint camel_file_util_decode_string (FILE *in, gchar **str);
57 gint camel_file_util_encode_fixed_string (FILE *out, const gchar *str, gsize len);
58 gint camel_file_util_decode_fixed_string (FILE *in, gchar **str, gsize len);
59
60 gchar *camel_file_util_safe_filename (const gchar *name);
61
62 /* Code that intends to be portable to Win32 should use camel_read()
63  * and camel_write() only on file descriptors returned from open(),
64  * creat(), pipe() or fileno(). On Win32 camel_read() and
65  * camel_write() calls will not be cancellable. For sockets, use
66  * camel_read_socket() and camel_write_socket(). These are cancellable
67  * also on Win32.
68  */
69 gssize          camel_read                      (gint fd,
70                                                  gchar *buf,
71                                                  gsize n,
72                                                  GCancellable *cancellable,
73                                                  GError **error);
74 gssize          camel_write                     (gint fd,
75                                                  const gchar *buf,
76                                                  gsize n,
77                                                  GCancellable *cancellable,
78                                                  GError **error);
79
80 gssize          camel_read_socket               (gint fd,
81                                                  gchar *buf,
82                                                  gsize n,
83                                                  GCancellable *cancellable,
84                                                  GError **error);
85 gssize          camel_write_socket              (gint fd,
86                                                  const gchar *buf,
87                                                  gsize n,
88                                                  GCancellable *cancellable,
89                                                  GError **error);
90
91 gchar *         camel_file_util_savename        (const gchar *filename);
92
93 G_END_DECLS
94
95 #endif /* CAMEL_FILE_UTILS_H */