navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
file.h
Go to the documentation of this file.
1 
20 #ifndef NAVIT_FILE_H
21 #define NAVIT_FILE_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #ifndef PATH_MAX
28 #define PATH_MAX 4096
29 #endif
30 #ifndef __CEGCC__
31 #include <time.h>
32 #endif
33 #include "param.h"
34 #include <stdio.h>
35 
36 struct file {
37  struct file *next;
38  unsigned char *begin;
39  unsigned char *end;
40  unsigned char *mmap_end;
41  long long size;
42  int name_id;
43  int fd;
44 #ifndef __CEGCC__
45  time_t mtime;
46  time_t ctime;
47  int version;
48 #endif
49 #if defined(_WIN32) || defined(__CEGCC__)
50  long map_handle;
51  long map_file;
52 #endif
53  char *name;
54  int special;
55  int cache;
56  int requests;
57  unsigned char *buffer;
59  GHashTable *headers;
60 };
61 
62 struct attr;
63 
64 /* prototypes */
65 int file_request(struct file *f, struct attr **options);
66 char *file_http_header(struct file *f, char *header);
67 struct file *file_create(char *name, struct attr **options);
68 int file_is_dir(char *name);
69 long long file_size(struct file *file);
70 int file_mkdir(char *name, int pflag);
71 int file_mmap(struct file *file);
72 unsigned char *file_data_read(struct file *file, long long offset, int size);
73 unsigned char *file_data_read_special(struct file *file, int size, int *size_ret);
74 unsigned char *file_data_read_all(struct file *file);
75 void file_data_flush(struct file *file, long long offset, int size);
76 int file_data_write(struct file *file, long long offset, int size, const void *data);
77 int file_get_contents(char *name, unsigned char **buffer, int *size);
78 unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
79 void file_data_free(struct file *file, unsigned char *data);
80 int file_exists(char const *name);
81 void file_remap_readonly(struct file *f);
82 void file_unmap(struct file *f);
83 void *file_opendir(char *dir);
84 char *file_readdir(void *hnd);
85 void file_closedir(void *hnd);
86 struct file *file_create_caseinsensitive(char *name, struct attr **options);
87 void file_fsync(struct file *f);
88 void file_destroy(struct file *f);
89 struct file_wordexp *file_wordexp_new(const char *pattern);
90 int file_wordexp_get_count(struct file_wordexp *wexp);
91 char **file_wordexp_get_array(struct file_wordexp *wexp);
92 void file_wordexp_destroy(struct file_wordexp *wexp);
93 int file_get_param(struct file *file, struct param_list *param, int count);
94 int file_version(struct file *file, int byname);
95 void *file_get_os_handle(struct file *file);
96 int file_set_cache_size(int cache_size);
97 void file_init(void);
98 int file_is_reg(char *name);
99 void file_data_remove(struct file *file, unsigned char *data);
100 /* end of prototypes */
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
struct file * file_create(char *name, struct attr **options)
Definition: file.c:194
int special
Definition: file.h:54
struct file * next
Definition: file.h:37
struct file_wordexp * file_wordexp_new(const char *pattern)
Definition: file.c:745
void file_wordexp_destroy(struct file_wordexp *wexp)
Definition: file.c:773
int offset
Definition: garmin_img.c:69
unsigned char * file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp)
Definition: file.c:518
void file_data_remove(struct file *file, unsigned char *data)
Definition: file.c:566
int file_request(struct file *f, struct attr **options)
Definition: file.c:176
int file_version(struct file *file, int byname)
Definition: file.c:783
int file_wordexp_get_count(struct file_wordexp *wexp)
Definition: file.c:757
time_t mtime
Definition: file.h:45
int size
Definition: garmin_img.c:131
int buffer_len
Definition: file.h:58
int version
Definition: file.h:47
void * file_get_os_handle(struct file *file)
Definition: file.c:816
char * file_http_header(struct file *f, char *header)
Definition: file.c:186
unsigned char * file_data_read_all(struct file *file)
Definition: file.c:445
int requests
Definition: file.h:56
char * file_readdir(void *hnd)
Definition: file.c:634
int file_is_reg(char *name)
Definition: file.c:257
Definition: file.c:738
char ** file_wordexp_get_array(struct file_wordexp *wexp)
Definition: file.c:765
void file_fsync(struct file *f)
Definition: file.c:709
int cache
Definition: file.h:55
char * name
Definition: file.h:53
struct file * file_create_caseinsensitive(char *name, struct attr **options)
Definition: file.c:672
void file_closedir(void *hnd)
Definition: file.c:659
unsigned char * begin
Definition: file.h:38
void file_init(void)
Definition: file.c:833
char * pattern
Definition: file.c:740
Definition: param.h:23
time_t ctime
Definition: file.h:46
int fd
Definition: file.h:43
int file_mkdir(char *name, int pflag)
Definition: file.c:272
void file_remap_readonly(struct file *f)
Definition: file.c:590
unsigned char * file_data_read_special(struct file *file, int size, int *size_ret)
Definition: file.c:396
void * file_opendir(char *dir)
Definition: file.c:614
int file_get_contents(char *name, unsigned char **buffer, int *size)
Definition: file.c:473
char data
Definition: garmin_img.c:354
Definition: attr.h:156
int file_get_param(struct file *file, struct param_list *param, int count)
void file_unmap(struct file *f)
Definition: file.c:603
int file_mmap(struct file *file)
Definition: file.c:304
void file_data_flush(struct file *file, long long offset, int size)
Definition: file.c:451
long long size
Definition: file.h:41
int name_id
Definition: file.h:42
void file_data_free(struct file *file, unsigned char *data)
Definition: file.c:551
long long file_size(struct file *file)
Definition: file.c:267
unsigned char * buffer
Definition: file.h:57
int file_data_write(struct file *file, long long offset, int size, const void *data)
Definition: file.c:461
Definition: maptool.h:168
FILE * f
Definition: garmin_img.c:40
int file_set_cache_size(int cache_size)
Definition: file.c:822
GHashTable * headers
Definition: file.h:59
unsigned char * mmap_end
Definition: file.h:40
char name[0]
Definition: street.c:559
int file_exists(char const *name)
Definition: file.c:581
void file_destroy(struct file *f)
Definition: file.c:717
unsigned char * end
Definition: file.h:39
unsigned char * file_data_read(struct file *file, long long offset, int size)
Definition: file.c:329
int file_is_dir(char *name)
Definition: file.c:247
Definition: file.h:36