1 |
zoff99 |
2 |
/**
|
2 |
|
|
* Navit, a modular navigation system.
|
3 |
|
|
* Copyright (C) 2005-2008 Navit Team
|
4 |
|
|
*
|
5 |
|
|
* This program is free software; you can redistribute it and/or
|
6 |
|
|
* modify it under the terms of the GNU Library General Public License
|
7 |
|
|
* version 2 as published by the Free Software Foundation.
|
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 Library General Public License for more details.
|
13 |
|
|
*
|
14 |
|
|
* You should have received a copy of the GNU Library General Public
|
15 |
|
|
* License along with this program; if not, write to the
|
16 |
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
17 |
|
|
* Boston, MA 02110-1301, USA.
|
18 |
|
|
*/
|
19 |
|
|
|
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;
|
58 |
|
|
int buffer_len;
|
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, unsigned char *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 |
|
|
unsigned char *file_data_read_encrypted(struct file *file, long long offset, int size, int size_uncomp, int compressed, char *passwd);
|
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_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 |
|
|
void file_init(void);
|
97 |
|
|
int file_is_reg(char *name);
|
98 |
|
|
/* end of prototypes */
|
99 |
|
|
|
100 |
|
|
#ifdef __cplusplus
|
101 |
|
|
}
|
102 |
|
|
#endif
|
103 |
|
|
|
104 |
|
|
#endif
|