00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef APR_FILE_INFO_H
00018 #define APR_FILE_INFO_H
00019
00025 #include "apr.h"
00026 #include "apr_user.h"
00027 #include "apr_pools.h"
00028 #include "apr_tables.h"
00029 #include "apr_time.h"
00030 #include "apr_errno.h"
00031
00032 #if APR_HAVE_SYS_UIO_H
00033 #include <sys/uio.h>
00034 #endif
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00046
00047
00048
00049
00050
00062 typedef enum {
00063 APR_NOFILE = 0,
00064 APR_REG,
00065 APR_DIR,
00066 APR_CHR,
00067 APR_BLK,
00068 APR_PIPE,
00069 APR_LNK,
00070 APR_SOCK,
00071 APR_UNKFILE = 127
00072 } apr_filetype_e;
00073
00079 #define APR_FPROT_USETID 0x8000
00080 #define APR_FPROT_UREAD 0x0400
00081 #define APR_FPROT_UWRITE 0x0200
00082 #define APR_FPROT_UEXECUTE 0x0100
00084 #define APR_FPROT_GSETID 0x4000
00085 #define APR_FPROT_GREAD 0x0040
00086 #define APR_FPROT_GWRITE 0x0020
00087 #define APR_FPROT_GEXECUTE 0x0010
00089 #define APR_FPROT_WSTICKY 0x2000
00090 #define APR_FPROT_WREAD 0x0004
00091 #define APR_FPROT_WWRITE 0x0002
00092 #define APR_FPROT_WEXECUTE 0x0001
00094 #define APR_FPROT_OS_DEFAULT 0x0FFF
00096
00097 #define APR_FPROT_FILE_SOURCE_PERMS 0x1000
00099
00100 #define APR_USETID APR_FPROT_USETID
00101 #define APR_UREAD APR_FPROT_UREAD
00102 #define APR_UWRITE APR_FPROT_UWRITE
00103 #define APR_UEXECUTE APR_FPROT_UEXECUTE
00104 #define APR_GSETID APR_FPROT_GSETID
00105 #define APR_GREAD APR_FPROT_GREAD
00106 #define APR_GWRITE APR_FPROT_GWRITE
00107 #define APR_GEXECUTE APR_FPROT_GEXECUTE
00108 #define APR_WSTICKY APR_FPROT_WSTICKY
00109 #define APR_WREAD APR_FPROT_WREAD
00110 #define APR_WWRITE APR_FPROT_WWRITE
00111 #define APR_WEXECUTE APR_FPROT_WEXECUTE
00112 #define APR_OS_DEFAULT APR_FPROT_OS_DEFAULT
00113 #define APR_FILE_SOURCE_PERMS APR_FPROT_FILE_SOURCE_PERMS
00121 typedef struct apr_dir_t apr_dir_t;
00122
00125 typedef apr_int32_t apr_fileperms_t;
00126 #if (defined WIN32) || (defined NETWARE)
00127
00130 typedef apr_uint64_t apr_ino_t;
00134 typedef apr_uint32_t apr_dev_t;
00135 #else
00136
00137 typedef ino_t apr_ino_t;
00141 typedef dev_t apr_dev_t;
00142 #endif
00143
00149 typedef struct apr_finfo_t apr_finfo_t;
00150
00151 #define APR_FINFO_LINK 0x00000001
00152 #define APR_FINFO_MTIME 0x00000010
00153 #define APR_FINFO_CTIME 0x00000020
00154 #define APR_FINFO_ATIME 0x00000040
00155 #define APR_FINFO_SIZE 0x00000100
00156 #define APR_FINFO_CSIZE 0x00000200
00157 #define APR_FINFO_DEV 0x00001000
00158 #define APR_FINFO_INODE 0x00002000
00159 #define APR_FINFO_NLINK 0x00004000
00160 #define APR_FINFO_TYPE 0x00008000
00161 #define APR_FINFO_USER 0x00010000
00162 #define APR_FINFO_GROUP 0x00020000
00163 #define APR_FINFO_UPROT 0x00100000
00164 #define APR_FINFO_GPROT 0x00200000
00165 #define APR_FINFO_WPROT 0x00400000
00166 #define APR_FINFO_ICASE 0x01000000
00167 #define APR_FINFO_NAME 0x02000000
00169 #define APR_FINFO_MIN 0x00008170
00170 #define APR_FINFO_IDENT 0x00003000
00171 #define APR_FINFO_OWNER 0x00030000
00172 #define APR_FINFO_PROT 0x00700000
00173 #define APR_FINFO_NORM 0x0073b170
00174 #define APR_FINFO_DIRENT 0x02000000
00180 struct apr_finfo_t {
00181
00182 apr_pool_t *pool;
00185 apr_int32_t valid;
00187 apr_fileperms_t protection;
00192 apr_filetype_e filetype;
00194 apr_uid_t user;
00196 apr_gid_t group;
00198 apr_ino_t inode;
00200 apr_dev_t device;
00202 apr_int32_t nlink;
00204 apr_off_t size;
00206 apr_off_t csize;
00208 apr_time_t atime;
00210 apr_time_t mtime;
00212 apr_time_t ctime;
00214 const char *fname;
00216 const char *name;
00218 struct apr_file_t *filehand;
00219 };
00220
00235 APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
00236 apr_int32_t wanted, apr_pool_t *pool);
00237
00250 APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir,
00251 const char *dirname,
00252 apr_pool_t *pool);
00253
00258 APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
00259
00272 APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
00273 apr_dir_t *thedir);
00274
00279 APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
00288 #define APR_FILEPATH_NOTABOVEROOT 0x01
00289
00291 #define APR_FILEPATH_SECUREROOTTEST 0x02
00292
00296 #define APR_FILEPATH_SECUREROOT 0x03
00297
00299 #define APR_FILEPATH_NOTRELATIVE 0x04
00300
00302 #define APR_FILEPATH_NOTABSOLUTE 0x08
00303
00306 #define APR_FILEPATH_NATIVE 0x10
00307
00312 #define APR_FILEPATH_TRUENAME 0x20
00313
00337 APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
00338 const char **filepath,
00339 apr_int32_t flags,
00340 apr_pool_t *p);
00341
00355 APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
00356 const char *rootpath,
00357 const char *addpath,
00358 apr_int32_t flags,
00359 apr_pool_t *p);
00360
00370 APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
00371 const char *liststr,
00372 apr_pool_t *p);
00373
00383 APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
00384 apr_array_header_t *pathelts,
00385 apr_pool_t *p);
00386
00394 APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
00395 apr_pool_t *p);
00396
00402 APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
00403
00405 #define APR_FILEPATH_ENCODING_UNKNOWN 0
00406
00408 #define APR_FILEPATH_ENCODING_LOCALE 1
00409
00411 #define APR_FILEPATH_ENCODING_UTF8 2
00412
00420 APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
00425 #ifdef __cplusplus
00426 }
00427 #endif
00428
00429 #endif