1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Michael Zucchi <notzed@ximian.com>
6 * Jeffrey Stedfast <fejj@ximian.com>
7 * Dan Winship <danw@ximian.com>
9 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
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.
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.
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
26 #if !defined (__CAMEL_H_INSIDE__) && !defined (CAMEL_COMPILATION)
27 #error "Only <camel/camel.h> can be included directly."
30 #ifndef CAMEL_FILE_UTILS_H
31 #define CAMEL_FILE_UTILS_H
35 #include <sys/types.h>
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);
60 gchar *camel_file_util_safe_filename (const gchar *name);
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
69 gssize camel_read (gint fd,
72 GCancellable *cancellable,
74 gssize camel_write (gint fd,
77 GCancellable *cancellable,
80 gssize camel_read_socket (gint fd,
83 GCancellable *cancellable,
85 gssize camel_write_socket (gint fd,
88 GCancellable *cancellable,
91 gchar * camel_file_util_savename (const gchar *filename);
95 #endif /* CAMEL_FILE_UTILS_H */