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_USETID      0x8000 
00080 #define APR_UREAD       0x0400 
00081 #define APR_UWRITE      0x0200 
00082 #define APR_UEXECUTE    0x0100 
00084 #define APR_GSETID      0x4000 
00085 #define APR_GREAD       0x0040 
00086 #define APR_GWRITE      0x0020 
00087 #define APR_GEXECUTE    0x0010 
00089 #define APR_WSTICKY     0x2000 
00090 #define APR_WREAD       0x0004 
00091 #define APR_WWRITE      0x0002 
00092 #define APR_WEXECUTE    0x0001 
00094 #define APR_OS_DEFAULT  0x0FFF 
00096 /* additional permission flags for apr_file_copy  and apr_file_append */
00097 #define APR_FILE_SOURCE_PERMS 0x1000 
00105 typedef struct apr_dir_t          apr_dir_t;
00106 
00109 typedef apr_int32_t               apr_fileperms_t;
00110 #if (defined WIN32) || (defined NETWARE)
00111 
00114 typedef apr_uint32_t              apr_dev_t;
00115 #else
00116 
00119 typedef dev_t                     apr_dev_t;
00120 #endif
00121 
00127 typedef struct apr_finfo_t        apr_finfo_t;
00128 
00129 #define APR_FINFO_LINK   0x00000001 
00130 #define APR_FINFO_MTIME  0x00000010 
00131 #define APR_FINFO_CTIME  0x00000020 
00132 #define APR_FINFO_ATIME  0x00000040 
00133 #define APR_FINFO_SIZE   0x00000100 
00134 #define APR_FINFO_CSIZE  0x00000200 
00135 #define APR_FINFO_DEV    0x00001000 
00136 #define APR_FINFO_INODE  0x00002000 
00137 #define APR_FINFO_NLINK  0x00004000 
00138 #define APR_FINFO_TYPE   0x00008000 
00139 #define APR_FINFO_USER   0x00010000 
00140 #define APR_FINFO_GROUP  0x00020000 
00141 #define APR_FINFO_UPROT  0x00100000 
00142 #define APR_FINFO_GPROT  0x00200000 
00143 #define APR_FINFO_WPROT  0x00400000 
00144 #define APR_FINFO_ICASE  0x01000000 
00145 #define APR_FINFO_NAME   0x02000000 
00147 #define APR_FINFO_MIN    0x00008170 
00148 #define APR_FINFO_IDENT  0x00003000 
00149 #define APR_FINFO_OWNER  0x00030000 
00150 #define APR_FINFO_PROT   0x00700000 
00151 #define APR_FINFO_NORM   0x0073b170 
00152 #define APR_FINFO_DIRENT 0x02000000 
00158 struct apr_finfo_t {
00159 
00160     apr_pool_t *pool;
00163     apr_int32_t valid;
00165     apr_fileperms_t protection;
00170     apr_filetype_e filetype;
00172     apr_uid_t user;
00174     apr_gid_t group;
00176     apr_ino_t inode;
00178     apr_dev_t device;
00180     apr_int32_t nlink;
00182     apr_off_t size;
00184     apr_off_t csize;
00186     apr_time_t atime;
00188     apr_time_t mtime;
00190     apr_time_t ctime;
00192     const char *fname;
00194     const char *name;
00196     struct apr_file_t *filehand;
00197 };
00198 
00213 APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
00214                                    apr_int32_t wanted, apr_pool_t *cont);
00215 
00228 APR_DECLARE(apr_status_t) apr_lstat(apr_finfo_t *finfo, const char *fname,
00229                                     apr_int32_t wanted, apr_pool_t *cont);
00242 APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir, 
00243                                        const char *dirname, 
00244                                        apr_pool_t *cont);
00245 
00250 APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
00251 
00264 APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
00265                                        apr_dir_t *thedir);
00266 
00271 APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
00280 #define APR_FILEPATH_NOTABOVEROOT   0x01
00281 
00283 #define APR_FILEPATH_SECUREROOTTEST 0x02
00284 
00288 #define APR_FILEPATH_SECUREROOT     0x03
00289 
00291 #define APR_FILEPATH_NOTRELATIVE    0x04
00292 
00294 #define APR_FILEPATH_NOTABSOLUTE    0x08
00295 
00298 #define APR_FILEPATH_NATIVE         0x10
00299 
00304 #define APR_FILEPATH_TRUENAME       0x20
00305 
00329 APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, 
00330                                             const char **filepath, 
00331                                             apr_int32_t flags,
00332                                             apr_pool_t *p);
00333 
00347 APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, 
00348                                              const char *rootpath,
00349                                              const char *addpath, 
00350                                              apr_int32_t flags,
00351                                              apr_pool_t *p);
00352 
00362 APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
00363                                                   const char *liststr,
00364                                                   apr_pool_t *p);
00365 
00375 APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
00376                                                   apr_array_header_t *pathelts,
00377                                                   apr_pool_t *p);
00378 
00386 APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
00387                                            apr_pool_t *p);
00388 
00394 APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
00395 
00397 #define APR_FILEPATH_ENCODING_UNKNOWN  0
00398 
00400 #define APR_FILEPATH_ENCODING_LOCALE   1
00401 
00403 #define APR_FILEPATH_ENCODING_UTF8     2
00404 
00412 APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
00417 #ifdef __cplusplus
00418 }
00419 #endif
00420 
00421 #endif  /* ! APR_FILE_INFO_H */

Generated on Mon Nov 26 11:47:26 2007 for Apache Portable Runtime by  doxygen 1.5.2