00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef APR_FILE_INFO_H
00056 #define APR_FILE_INFO_H
00057
00063 #include "apr.h"
00064 #include "apr_user.h"
00065 #include "apr_pools.h"
00066 #include "apr_tables.h"
00067 #include "apr_time.h"
00068 #include "apr_errno.h"
00069
00070 #if APR_HAVE_SYS_UIO_H
00071 #include <sys/uio.h>
00072 #endif
00073
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077
00084
00085
00086
00087
00088
00100 typedef enum {
00101 APR_NOFILE = 0,
00102 APR_REG,
00103 APR_DIR,
00104 APR_CHR,
00105 APR_BLK,
00106 APR_PIPE,
00107 APR_LNK,
00108 APR_SOCK,
00109 APR_UNKFILE = 127
00110 } apr_filetype_e;
00111
00117 #define APR_UREAD 0x0400
00118 #define APR_UWRITE 0x0200
00119 #define APR_UEXECUTE 0x0100
00121 #define APR_GREAD 0x0040
00122 #define APR_GWRITE 0x0020
00123 #define APR_GEXECUTE 0x0010
00125 #define APR_WREAD 0x0004
00126 #define APR_WWRITE 0x0002
00127 #define APR_WEXECUTE 0x0001
00129 #define APR_OS_DEFAULT 0x0FFF
00131
00132 #define APR_FILE_SOURCE_PERMS 0x1000
00140 typedef struct apr_dir_t apr_dir_t;
00141
00144 typedef apr_int32_t apr_fileperms_t;
00145 #if (defined WIN32) || (defined NETWARE)
00146
00149 typedef apr_uint64_t apr_ino_t;
00153 typedef apr_uint32_t apr_dev_t;
00154 #else
00155
00156 typedef ino_t apr_ino_t;
00160 typedef dev_t apr_dev_t;
00161 #endif
00162
00168 typedef struct apr_finfo_t apr_finfo_t;
00169
00170 #define APR_FINFO_LINK 0x00000001
00171 #define APR_FINFO_MTIME 0x00000010
00172 #define APR_FINFO_CTIME 0x00000020
00173 #define APR_FINFO_ATIME 0x00000040
00174 #define APR_FINFO_SIZE 0x00000100
00175 #define APR_FINFO_CSIZE 0x00000200
00176 #define APR_FINFO_DEV 0x00001000
00177 #define APR_FINFO_INODE 0x00002000
00178 #define APR_FINFO_NLINK 0x00004000
00179 #define APR_FINFO_TYPE 0x00008000
00180 #define APR_FINFO_USER 0x00010000
00181 #define APR_FINFO_GROUP 0x00020000
00182 #define APR_FINFO_UPROT 0x00100000
00183 #define APR_FINFO_GPROT 0x00200000
00184 #define APR_FINFO_WPROT 0x00400000
00185 #define APR_FINFO_ICASE 0x01000000
00186 #define APR_FINFO_NAME 0x02000000
00188 #define APR_FINFO_MIN 0x00008170
00189 #define APR_FINFO_IDENT 0x00003000
00190 #define APR_FINFO_OWNER 0x00030000
00191 #define APR_FINFO_PROT 0x00700000
00192 #define APR_FINFO_NORM 0x0073b170
00193 #define APR_FINFO_DIRENT 0x02000000
00199 struct apr_finfo_t {
00200
00201 apr_pool_t *pool;
00204 apr_int32_t valid;
00206 apr_fileperms_t protection;
00211 apr_filetype_e filetype;
00213 apr_uid_t user;
00215 apr_gid_t group;
00217 apr_ino_t inode;
00219 apr_dev_t device;
00221 apr_int32_t nlink;
00223 apr_off_t size;
00225 apr_off_t csize;
00227 apr_time_t atime;
00229 apr_time_t mtime;
00231 apr_time_t ctime;
00233 const char *fname;
00235 const char *name;
00237 struct apr_file_t *filehand;
00238 };
00239
00249 APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
00250 apr_int32_t wanted, apr_pool_t *cont);
00251
00264 APR_DECLARE(apr_status_t) apr_lstat(apr_finfo_t *finfo, const char *fname,
00265 apr_int32_t wanted, apr_pool_t *cont);
00278 APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir,
00279 const char *dirname,
00280 apr_pool_t *cont);
00281
00286 APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
00287
00295 APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
00296 apr_dir_t *thedir);
00297
00302 APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
00311 #define APR_FILEPATH_NOTABOVEROOT 0x01
00312
00314 #define APR_FILEPATH_SECUREROOTTEST 0x02
00315
00319 #define APR_FILEPATH_SECUREROOT 0x03
00320
00322 #define APR_FILEPATH_NOTRELATIVE 0x04
00323
00325 #define APR_FILEPATH_NOTABSOLUTE 0x08
00326
00329 #define APR_FILEPATH_NATIVE 0x10
00330
00335 #define APR_FILEPATH_TRUENAME 0x20
00336
00360 APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
00361 const char **filepath,
00362 apr_int32_t flags,
00363 apr_pool_t *p);
00364
00378 APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
00379 const char *rootpath,
00380 const char *addpath,
00381 apr_int32_t flags,
00382 apr_pool_t *p);
00383
00393 APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
00394 const char *liststr,
00395 apr_pool_t *p);
00396
00406 APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
00407 apr_array_header_t *pathelts,
00408 apr_pool_t *p);
00409
00417 APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
00418 apr_pool_t *p);
00419
00425 APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
00426
00428 #define APR_FILEPATH_ENCODING_UNKNOWN 0
00429
00431 #define APR_FILEPATH_ENCODING_LOCALE 1
00432
00434 #define APR_FILEPATH_ENCODING_UTF8 2
00435
00443 APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
00448 #ifdef __cplusplus
00449 }
00450 #endif
00451
00452 #endif