navit  0.5.3-trunk
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(const char *name);
69 int file_is_reg(const char *name);
70 long long file_size(struct file *file);
71 int file_mkdir(char *name, int pflag);
72 int file_mmap(struct file *file);
73 unsigned char *file_data_read(struct file *file, long long offset, int size);
74 unsigned char *file_data_read_special(struct file *file, int size, int *size_ret);
75 unsigned char *file_data_read_all(struct file *file);
76 void file_data_flush(struct file *file, long long offset, int size);
77 int file_data_write(struct file *file, long long offset, int size, const void *data);
78 int file_get_contents(char *name, unsigned char **buffer, int *size);
79 unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
80 void file_data_free(struct file *file, unsigned char *data);
81 int file_exists(char const *name);
82 void file_remap_readonly(struct file *f);
83 void file_unmap(struct file *f);
84 void *file_opendir(char *dir);
85 char *file_readdir(void *hnd);
86 void file_closedir(void *hnd);
87 struct file *file_create_caseinsensitive(char *name, struct attr **options);
88 void file_fsync(struct file *f);
89 void file_destroy(struct file *f);
90 struct file_wordexp *file_wordexp_new(const char *pattern);
91 int file_wordexp_get_count(struct file_wordexp *wexp);
92 char **file_wordexp_get_array(struct file_wordexp *wexp);
93 void file_wordexp_destroy(struct file_wordexp *wexp);
94 int file_get_param(struct file *file, struct param_list *param, int count);
95 int file_version(struct file *file, int byname);
96 void *file_get_os_handle(struct file *file);
97 int file_set_cache_size(int cache_size);
98 void file_init(void);
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
unsigned char * file_data_read(struct file *file, long long offset, int size)
Definition: file.c:319
void file_destroy(struct file *f)
Definition: file.c:662
int file_set_cache_size(int cache_size)
Definition: file.c:753
struct file * file_create(char *name, struct attr **options)
Definition: file.c:182
unsigned char * file_data_read_special(struct file *file, int size, int *size_ret)
Definition: file.c:380
void file_closedir(void *hnd)
Definition: file.c:611
int file_is_reg(const char *name)
Check if a given path corresponds to a regular file.
Definition: file.c:254
void file_fsync(struct file *f)
Definition: file.c:656
struct file * file_create_caseinsensitive(char *name, struct attr **options)
Definition: file.c:621
int file_wordexp_get_count(struct file_wordexp *wexp)
Definition: file.c:698
int file_get_contents(char *name, unsigned char **buffer, int *size)
Definition: file.c:449
int file_data_write(struct file *file, long long offset, int size, const void *data)
Definition: file.c:439
int file_get_param(struct file *file, struct param_list *param, int count)
int file_exists(char const *name)
Definition: file.c:547
void * file_opendir(char *dir)
Definition: file.c:574
struct file_wordexp * file_wordexp_new(const char *pattern)
Definition: file.c:688
int file_version(struct file *file, int byname)
Definition: file.c:718
int file_mmap(struct file *file)
Definition: file.c:296
void file_data_flush(struct file *file, long long offset, int size)
Definition: file.c:431
char * file_http_header(struct file *f, char *header)
Definition: file.c:175
void file_data_remove(struct file *file, unsigned char *data)
Definition: file.c:534
void * file_get_os_handle(struct file *file)
Definition: file.c:749
int file_request(struct file *f, struct attr **options)
Definition: file.c:167
void file_wordexp_destroy(struct file_wordexp *wexp)
Definition: file.c:710
long long file_size(struct file *file)
Definition: file.c:262
char * file_readdir(void *hnd)
Definition: file.c:590
char ** file_wordexp_get_array(struct file_wordexp *wexp)
Definition: file.c:704
void file_init(void)
Definition: file.c:762
int file_is_dir(const char *name)
Check if a given path corresponds to a directory.
Definition: file.c:239
int file_mkdir(char *name, int pflag)
Definition: file.c:266
unsigned char * file_data_read_all(struct file *file)
Definition: file.c:427
void file_remap_readonly(struct file *f)
Definition: file.c:554
unsigned char * file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp)
Definition: file.c:490
void file_unmap(struct file *f)
Definition: file.c:565
void file_data_free(struct file *file, unsigned char *data)
Definition: file.c:521
char data
Definition: garmin_img.c:2
int size
Definition: garmin_img.c:3
int offset
Definition: garmin_img.c:0
char name[0]
Definition: street.c:3
Definition: attr.h:157
Definition: maptool.h:169
Definition: file.c:681
char * pattern
Definition: file.c:683
Definition: file.h:36
int buffer_len
Definition: file.h:58
int cache
Definition: file.h:55
unsigned char * end
Definition: file.h:39
int name_id
Definition: file.h:42
struct file * next
Definition: file.h:37
unsigned char * mmap_end
Definition: file.h:40
time_t mtime
Definition: file.h:45
int special
Definition: file.h:54
unsigned char * begin
Definition: file.h:38
GHashTable * headers
Definition: file.h:59
char * name
Definition: file.h:53
long long size
Definition: file.h:41
int fd
Definition: file.h:43
int version
Definition: file.h:47
unsigned char * buffer
Definition: file.h:57
time_t ctime
Definition: file.h:46
FILE * f
Definition: garmin_img.c:40
int requests
Definition: file.h:56
Definition: param.h:23