Navit SVN

/work/compile/navit/src/navit/file.h

00001 
00020 #ifndef NAVIT_FILE_H
00021 #define NAVIT_FILE_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 #ifndef PATH_MAX
00028 #define PATH_MAX 4096
00029 #endif
00030 #ifndef __CEGCC__
00031 #include <time.h>
00032 #endif
00033 #include "param.h"
00034 #include <stdio.h>
00035 
00036 struct file {
00037         struct file *next;
00038         unsigned char *begin;
00039         unsigned char *end;
00040         unsigned char *mmap_end;
00041         long long size;
00042         int name_id;
00043         int fd;
00044 #ifndef __CEGCC__
00045         time_t mtime;
00046         time_t ctime;
00047         int version;                    
00048 #endif
00049 #if defined(_WIN32) || defined(__CEGCC__)
00050         long map_handle;
00051         long map_file;
00052 #endif
00053         char *name;
00054         int special;
00055         int cache;
00056         int requests;
00057         unsigned char *buffer;
00058         int buffer_len;
00059         GHashTable *headers;
00060 };
00061 
00062 struct attr;
00063 
00064 /* prototypes */
00065 int file_request(struct file *f, struct attr **options);
00066 char *file_http_header(struct file *f, char *header);
00067 struct file *file_create(char *name, struct attr **options);
00068 int file_is_dir(char *name);
00069 long long file_size(struct file *file);
00070 int file_mkdir(char *name, int pflag);
00071 int file_mmap(struct file *file);
00072 unsigned char *file_data_read(struct file *file, long long offset, int size);
00073 unsigned char *file_data_read_special(struct file *file, int size, int *size_ret);
00074 unsigned char *file_data_read_all(struct file *file);
00075 void file_data_flush(struct file *file, long long offset, int size);
00076 int file_data_write(struct file *file, long long offset, int size, unsigned char *data);
00077 int file_get_contents(char *name, unsigned char **buffer, int *size);
00078 unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
00079 unsigned char *file_data_read_encrypted(struct file *file, long long offset, int size, int size_uncomp, int compressed, char *passwd);
00080 void file_data_free(struct file *file, unsigned char *data);
00081 int file_exists(char const *name);
00082 void file_remap_readonly(struct file *f);
00083 void file_unmap(struct file *f);
00084 void *file_opendir(char *dir);
00085 char *file_readdir(void *hnd);
00086 void file_closedir(void *hnd);
00087 struct file *file_create_caseinsensitive(char *name, struct attr **options);
00088 void file_destroy(struct file *f);
00089 struct file_wordexp *file_wordexp_new(const char *pattern);
00090 int file_wordexp_get_count(struct file_wordexp *wexp);
00091 char **file_wordexp_get_array(struct file_wordexp *wexp);
00092 void file_wordexp_destroy(struct file_wordexp *wexp);
00093 int file_get_param(struct file *file, struct param_list *param, int count);
00094 int file_version(struct file *file, int byname);
00095 void *file_get_os_handle(struct file *file);
00096 void file_init(void);
00097 int file_is_reg(char *name);
00098 void file_data_remove(struct file *file, unsigned char *data);
00099 /* end of prototypes */
00100 
00101 #ifdef __cplusplus
00102 }
00103 #endif
00104 
00105 #endif