Fixed SIGSEGV during close of GnomeVFSHandle reopened due to its timeout.
[captive.git] / src / install / acquire / cabinet.h
1 /* $Id$
2  * Include file for drivers acquiring installation utility
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 #ifndef _CAPTIVE_INSTALL_ACQUIRE_CABINET_H
21 #define _CAPTIVE_INSTALL_ACQUIRE_CABINET_H 1
22
23
24 #include <glib/gtypes.h>
25 #include <libgnomevfs/gnome-vfs-file-size.h>
26 #include <libgnomevfs/gnome-vfs-handle.h>
27
28
29 G_BEGIN_DECLS
30
31 /* It is not 'GObject'-based as we will move to GnomeVFS handler cabextract://
32  * anyway.
33  */
34
35 struct acquire_cabinet {
36         gpointer base;
37         guint8 *base_cached;
38         GnomeVFSFileOffset offset;
39         GnomeVFSHandle **handlep;
40         GnomeVFSFileSize size;
41         const gchar *filename;
42         GnomeVFSURI *uri;
43         GnomeVFSURI *handle_uri;
44         void (*seek)(struct acquire_cabinet *acquire_cabinet,GnomeVFSFileOffset offset);
45         void (*seek_skip)(struct acquire_cabinet *acquire_cabinet,GnomeVFSFileOffset offset);
46         GnomeVFSFileOffset (*tell)(struct acquire_cabinet *acquire_cabinet);
47         GnomeVFSResult (*read)
48                         (struct acquire_cabinet *acquire_cabinet,gpointer buffer,GnomeVFSFileSize bytes,GnomeVFSFileSize *bytes_read);
49         gint cabinet_done,cabinet_used;
50         };
51
52 void acquire_cabinet_seek(struct acquire_cabinet *acquire_cabinet,GnomeVFSFileOffset offset);
53 void acquire_cabinet_seek_skip(struct acquire_cabinet *acquire_cabinet,GnomeVFSFileOffset offset);
54 GnomeVFSFileOffset acquire_cabinet_tell(struct acquire_cabinet *acquire_cabinet);
55 GnomeVFSResult acquire_cabinet_read
56                 (struct acquire_cabinet *acquire_cabinet,gpointer buffer,GnomeVFSFileSize bytes,GnomeVFSFileSize *bytes_read);
57
58 struct acquire_cabinet *acquire_cabinet_new_from_memory
59                 (gconstpointer file_base,size_t file_length,GnomeVFSURI *uri,gint cabinet_used);
60 struct acquire_cabinet *acquire_cabinet_new_from_handle
61                 (GnomeVFSHandle **handlep,GnomeVFSFileInfo *file_info,GnomeVFSURI *uri,gint cabinet_used);
62 void acquire_cabinet_free(struct acquire_cabinet *acquire_cabinet);
63 void acquire_cabinet_load(struct acquire_cabinet *acquire_cabinet);
64
65 G_END_DECLS
66
67
68 #endif /* _CAPTIVE_INSTALL_ACQUIRE_CABINET_H */