Implemented seek() and tell() for r/o streams of 'http'.
[gnome-vfs-httpcaptive.git] / libgnomevfs / gnome-vfs-mime-sniff-buffer.h
1 /*
2  * gnome-vfs-mime-sniff-buffer.h
3  * Utility for implementing gnome_vfs_mime_type_from_magic, and other
4  * mime-type sniffing calls.
5  *
6  * Copyright (C) 2000 Eazel, Inc.
7  * All rights reserved.
8  *
9  * This file is part of the Gnome Library.
10  *
11  * The Gnome Library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public License as
13  * published by the Free Software Foundation; either version 2 of the
14  * License, or (at your option) any later version.
15  *
16  * The Gnome Library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
23  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  */
26
27 #ifndef GNOME_VFS_MIME_SNIFF_BUFFER_H
28 #define GNOME_VFS_MIME_SNIFF_BUFFER_H
29
30 #include <libgnomevfs/gnome-vfs-handle.h>
31
32 G_BEGIN_DECLS
33
34 typedef GnomeVFSResult (* GnomeVFSSniffBufferSeekCall)(gpointer context, 
35                 GnomeVFSSeekPosition whence, GnomeVFSFileOffset offset);
36 typedef GnomeVFSResult (* GnomeVFSSniffBufferReadCall)(gpointer context, 
37                 gpointer buffer, GnomeVFSFileSize bytes, GnomeVFSFileSize *bytes_read);
38                 
39 typedef struct GnomeVFSMimeSniffBuffer GnomeVFSMimeSniffBuffer;
40
41 void                     _gnome_vfs_mime_clear_magic_table              (void);
42
43 GnomeVFSMimeSniffBuffer *_gnome_vfs_mime_sniff_buffer_new_from_handle   
44                                         (GnomeVFSHandle                 *file);
45 GnomeVFSMimeSniffBuffer *_gnome_vfs_mime_sniff_buffer_new_from_memory 
46                                         (const guchar                   *buffer, 
47                                          gssize                         buffer_size);
48 GnomeVFSMimeSniffBuffer *gnome_vfs_mime_sniff_buffer_new_from_existing_data     
49                                         (const guchar                   *buffer, 
50                                          gssize                         buffer_size);
51 GnomeVFSMimeSniffBuffer *_gnome_vfs_mime_sniff_buffer_new_generic       
52                                         (GnomeVFSSniffBufferSeekCall    seek_callback, 
53                                          GnomeVFSSniffBufferReadCall    read_callback,
54                                          gpointer                       context);
55
56
57 void                     gnome_vfs_mime_sniff_buffer_free 
58                                         (GnomeVFSMimeSniffBuffer        *buffer);
59
60 GnomeVFSResult           _gnome_vfs_mime_sniff_buffer_get
61                                         (GnomeVFSMimeSniffBuffer        *buffer,
62                                          gssize                         size);
63
64 const char              *gnome_vfs_get_mime_type_for_buffer
65                                          (GnomeVFSMimeSniffBuffer       *buffer);
66
67 gboolean                 _gnome_vfs_sniff_buffer_looks_like_text
68                                          (GnomeVFSMimeSniffBuffer       *buffer);
69 gboolean                 _gnome_vfs_sniff_buffer_looks_like_mp3
70                                          (GnomeVFSMimeSniffBuffer       *buffer);
71 G_END_DECLS
72
73 #endif