/[zanavi_public1]/navit/navit/file.h
ZANavi

Contents of /navit/navit/file.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50 - (hide annotations) (download)
Wed Jun 22 07:33:35 2016 UTC (7 years, 9 months ago) by zoff99
File MIME type: text/plain
File size: 4388 byte(s)
v2.0.51
1 zoff99 2 /**
2 zoff99 50 * ZANavi, Zoff Android Navigation system.
3     * Copyright (C) 2011-2012 Zoff <zoff@zoff.cc>
4     *
5     * This program is free software; you can redistribute it and/or
6     * modify it under the terms of the GNU 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 General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * 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     /**
21 zoff99 2 * Navit, a modular navigation system.
22     * Copyright (C) 2005-2008 Navit Team
23     *
24     * This program is free software; you can redistribute it and/or
25     * modify it under the terms of the GNU Library General Public License
26     * version 2 as published by the Free Software Foundation.
27     *
28     * This program is distributed in the hope that it will be useful,
29     * but WITHOUT ANY WARRANTY; without even the implied warranty of
30     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31     * GNU Library General Public License for more details.
32     *
33     * You should have received a copy of the GNU Library General Public
34     * License along with this program; if not, write to the
35     * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
36     * Boston, MA 02110-1301, USA.
37     */
38    
39     #ifndef NAVIT_FILE_H
40     #define NAVIT_FILE_H
41    
42     #ifdef __cplusplus
43 zoff99 50 extern "C"
44     {
45 zoff99 2 #endif
46    
47     #ifndef PATH_MAX
48     #define PATH_MAX 4096
49     #endif
50     #ifndef __CEGCC__
51     #include <time.h>
52     #endif
53     #include "param.h"
54     #include <stdio.h>
55    
56 zoff99 50 #define MAX_SPLIT_FILES 50
57    
58     #define CACHE_SIZE 1
59    
60     struct file
61     {
62 zoff99 2 struct file *next;
63     unsigned char *begin;
64     unsigned char *end;
65     unsigned char *mmap_end;
66     long long size;
67     int name_id;
68     int fd;
69     #ifndef __CEGCC__
70     time_t mtime;
71     time_t ctime;
72 zoff99 50 int version;
73 zoff99 2 #endif
74     #if defined(_WIN32) || defined(__CEGCC__)
75     long map_handle;
76     long map_file;
77     #endif
78     char *name;
79     int special;
80     int cache;
81     int requests;
82     unsigned char *buffer;
83     int buffer_len;
84     GHashTable *headers;
85 zoff99 50 /* 0-> only orig file, >0 -> we have also some split files ".1" -> ".50" */
86     int num_splits;
87     long long split_size_in_bytes;
88     long long last_splitter_size_in_bytes;
89     int current_splitter; // 0 -> orig file opened, >0 -> splitter X opened
90 zoff99 2 };
91    
92     struct attr;
93    
94     /* prototypes */
95     int file_request(struct file *f, struct attr **options);
96     char *file_http_header(struct file *f, char *header);
97     struct file *file_create(char *name, struct attr **options);
98     int file_is_dir(char *name);
99     long long file_size(struct file *file);
100     int file_mkdir(char *name, int pflag);
101     int file_mmap(struct file *file);
102     unsigned char *file_data_read(struct file *file, long long offset, int size);
103     unsigned char *file_data_read_special(struct file *file, int size, int *size_ret);
104     unsigned char *file_data_read_all(struct file *file);
105     void file_data_flush(struct file *file, long long offset, int size);
106     int file_data_write(struct file *file, long long offset, int size, unsigned char *data);
107     int file_get_contents(char *name, unsigned char **buffer, int *size);
108     unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
109     unsigned char *file_data_read_encrypted(struct file *file, long long offset, int size, int size_uncomp, int compressed, char *passwd);
110     void file_data_free(struct file *file, unsigned char *data);
111     int file_exists(char const *name);
112     void file_remap_readonly(struct file *f);
113     void file_unmap(struct file *f);
114     void *file_opendir(char *dir);
115     char *file_readdir(void *hnd);
116     void file_closedir(void *hnd);
117     struct file *file_create_caseinsensitive(char *name, struct attr **options);
118     void file_destroy(struct file *f);
119     struct file_wordexp *file_wordexp_new(const char *pattern);
120     int file_wordexp_get_count(struct file_wordexp *wexp);
121     char **file_wordexp_get_array(struct file_wordexp *wexp);
122     void file_wordexp_destroy(struct file_wordexp *wexp);
123     int file_get_param(struct file *file, struct param_list *param, int count);
124     int file_version(struct file *file, int byname);
125     void *file_get_os_handle(struct file *file);
126     void file_init(void);
127     int file_is_reg(char *name);
128 zoff99 50 void file_cache_init(void);
129 zoff99 2 /* end of prototypes */
130    
131     #ifdef __cplusplus
132     }
133     #endif
134    
135     #endif

   
Visit the ZANavi Wiki