GME  13
apr_file_info.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
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 /* __cplusplus */
00039 
00046 /* Many applications use the type member to determine the
00047  * existance of a file or initialization of the file info,
00048  * so the APR_NOFILE value must be distinct from APR_UNKFILE.
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 /* additional permission flags for apr_file_copy  and apr_file_append */
00097 #define APR_FPROT_FILE_SOURCE_PERMS 0x1000 
00099 /* backcompat */
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_uint32_t              apr_dev_t;
00131 #else
00132 
00135 typedef dev_t                     apr_dev_t;
00136 #endif
00137 
00143 typedef struct apr_finfo_t        apr_finfo_t;
00144 
00145 #define APR_FINFO_LINK   0x00000001 
00146 #define APR_FINFO_MTIME  0x00000010 
00147 #define APR_FINFO_CTIME  0x00000020 
00148 #define APR_FINFO_ATIME  0x00000040 
00149 #define APR_FINFO_SIZE   0x00000100 
00150 #define APR_FINFO_CSIZE  0x00000200 
00151 #define APR_FINFO_DEV    0x00001000 
00152 #define APR_FINFO_INODE  0x00002000 
00153 #define APR_FINFO_NLINK  0x00004000 
00154 #define APR_FINFO_TYPE   0x00008000 
00155 #define APR_FINFO_USER   0x00010000 
00156 #define APR_FINFO_GROUP  0x00020000 
00157 #define APR_FINFO_UPROT  0x00100000 
00158 #define APR_FINFO_GPROT  0x00200000 
00159 #define APR_FINFO_WPROT  0x00400000 
00160 #define APR_FINFO_ICASE  0x01000000 
00161 #define APR_FINFO_NAME   0x02000000 
00163 #define APR_FINFO_MIN    0x00008170 
00164 #define APR_FINFO_IDENT  0x00003000 
00165 #define APR_FINFO_OWNER  0x00030000 
00166 #define APR_FINFO_PROT   0x00700000 
00167 #define APR_FINFO_NORM   0x0073b170 
00168 #define APR_FINFO_DIRENT 0x02000000 
00174 struct apr_finfo_t {
00175 
00176     apr_pool_t *pool;
00179     apr_int32_t valid;
00181     apr_fileperms_t protection;
00186     apr_filetype_e filetype;
00188     apr_uid_t user;
00190     apr_gid_t group;
00192     apr_ino_t inode;
00194     apr_dev_t device;
00196     apr_int32_t nlink;
00198     apr_off_t size;
00200     apr_off_t csize;
00202     apr_time_t atime;
00204     apr_time_t mtime;
00206     apr_time_t ctime;
00208     const char *fname;
00210     const char *name;
00212     struct apr_file_t *filehand;
00213 };
00214 
00229 APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
00230                                    apr_int32_t wanted, apr_pool_t *pool);
00231 
00244 APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir, 
00245                                        const char *dirname, 
00246                                        apr_pool_t *pool);
00247 
00252 APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
00253 
00267 APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
00268                                        apr_dir_t *thedir);
00269 
00274 APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
00287 #define APR_FILEPATH_NOTABOVEROOT   0x01
00288 
00290 #define APR_FILEPATH_SECUREROOTTEST 0x02
00291 
00295 #define APR_FILEPATH_SECUREROOT     0x03
00296 
00298 #define APR_FILEPATH_NOTRELATIVE    0x04
00299 
00301 #define APR_FILEPATH_NOTABSOLUTE    0x08
00302 
00305 #define APR_FILEPATH_NATIVE         0x10
00306 
00311 #define APR_FILEPATH_TRUENAME       0x20
00312 
00336 APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, 
00337                                             const char **filepath, 
00338                                             apr_int32_t flags,
00339                                             apr_pool_t *p);
00340 
00354 APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, 
00355                                              const char *rootpath,
00356                                              const char *addpath, 
00357                                              apr_int32_t flags,
00358                                              apr_pool_t *p);
00359 
00369 APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
00370                                                   const char *liststr,
00371                                                   apr_pool_t *p);
00372 
00382 APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
00383                                                   apr_array_header_t *pathelts,
00384                                                   apr_pool_t *p);
00385 
00393 APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
00394                                            apr_pool_t *p);
00395 
00401 APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
00402 
00404 #define APR_FILEPATH_ENCODING_UNKNOWN  0
00405 
00407 #define APR_FILEPATH_ENCODING_LOCALE   1
00408 
00410 #define APR_FILEPATH_ENCODING_UTF8     2
00411 
00419 APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
00424 #ifdef __cplusplus
00425 }
00426 #endif
00427 
00428 #endif  /* ! APR_FILE_INFO_H */