⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_dav.h

📁 最新apache的源代码
💻 H
📖 第 1 页 / 共 5 页
字号:
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//*** DAV extension module for Apache 2.0.**/#ifndef _MOD_DAV_H_#define _MOD_DAV_H_#include "apr_hooks.h"#include "apr_hash.h"#include "apr_dbm.h"#include "apr_tables.h"#include "httpd.h"#include "util_filter.h"#include "util_xml.h"#include <limits.h>     /* for INT_MAX */#include <time.h>       /* for time_t */#ifdef __cplusplusextern "C" {#endif#define DAV_VERSION             AP_SERVER_BASEREVISION#define DAV_XML_HEADER          "<?xml version=\"1.0\" encoding=\"utf-8\"?>"#define DAV_XML_CONTENT_TYPE    "text/xml; charset=\"utf-8\""#define DAV_READ_BLOCKSIZE      2048    /* used for reading input blocks */#define DAV_RESPONSE_BODY_1     "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>"#define DAV_RESPONSE_BODY_2     "</title>\n</head><body>\n<h1>"#define DAV_RESPONSE_BODY_3     "</h1>\n<p>"#define DAV_RESPONSE_BODY_4     "</p>\n"#define DAV_RESPONSE_BODY_5     "</body></html>\n"#define DAV_DO_COPY             0#define DAV_DO_MOVE             1#if 1#define DAV_DEBUG        1#define DEBUG_CR         "\n"#define DBG0(f)          ap_log_error(APLOG_MARK, \                                APLOG_ERR, 0, NULL, (f))#define DBG1(f,a1)       ap_log_error(APLOG_MARK, \                                APLOG_ERR, 0, NULL, f, a1)#define DBG2(f,a1,a2)    ap_log_error(APLOG_MARK, \                                APLOG_ERR, 0, NULL, f, a1, a2)#define DBG3(f,a1,a2,a3) ap_log_error(APLOG_MARK, \                                APLOG_ERR, 0, NULL, f, a1, a2, a3)#else#undef DAV_DEBUG#define DEBUG_CR        ""#endif#define DAV_INFINITY    INT_MAX    /* for the Depth: header *//* Create a set of DAV_DECLARE(type), DAV_DECLARE_NONSTD(type) and  * DAV_DECLARE_DATA with appropriate export and import tags for the platform */#if !defined(WIN32)#define DAV_DECLARE(type)            type#define DAV_DECLARE_NONSTD(type)     type#define DAV_DECLARE_DATA#elif defined(DAV_DECLARE_STATIC)#define DAV_DECLARE(type)            type __stdcall#define DAV_DECLARE_NONSTD(type)     type#define DAV_DECLARE_DATA#elif defined(DAV_DECLARE_EXPORT)#define DAV_DECLARE(type)            __declspec(dllexport) type __stdcall#define DAV_DECLARE_NONSTD(type)     __declspec(dllexport) type#define DAV_DECLARE_DATA             __declspec(dllexport)#else#define DAV_DECLARE(type)            __declspec(dllimport) type __stdcall#define DAV_DECLARE_NONSTD(type)     __declspec(dllimport) type#define DAV_DECLARE_DATA             __declspec(dllimport)#endif/* --------------------------------------------------------------------**** ERROR MANAGEMENT*//*** dav_error structure.**** In most cases, mod_dav uses a pointer to a dav_error structure. If the** pointer is NULL, then no error has occurred.**** In certain cases, a dav_error structure is directly used. In these cases,** a status value of 0 means that an error has not occurred.**** Note: this implies that status != 0 whenever an error occurs.**** The desc field is optional (it may be NULL). When NULL, it typically** implies that Apache has a proper description for the specified status.*/typedef struct dav_error {    int status;                 /* suggested HTTP status (0 for no error) */    int error_id;               /* DAV-specific error ID */    const char *desc;           /* DAV:responsedescription and error log */    int save_errno;             /* copy of errno causing the error */    const char *namespace;      /* [optional] namespace of error */    const char *tagname;        /* name of error-tag */    struct dav_error *prev;     /* previous error (in stack) */} dav_error;/*** Create a new error structure. save_errno will be filled with the current** errno value.*/DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status,                                       int error_id, const char *desc);/*** Create a new error structure with tagname and (optional) namespace;** namespace may be NULL, which means "DAV:". save_errno will be** filled with the current errno value.*/DAV_DECLARE(dav_error*) dav_new_error_tag(apr_pool_t *p, int status,                                           int error_id, const char *desc,                                          const char *namespace,                                          const char *tagname);/*** Push a new error description onto the stack of errors.**** This function is used to provide an additional description to an existing** error.**** <status> should contain the caller's view of what the current status is,** given the underlying error. If it doesn't have a better idea, then the** caller should pass prev->status.**** <error_id> can specify a new error_id since the topmost description has** changed.*/DAV_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status, int error_id,                                       const char *desc, dav_error *prev);/* error ID values... *//* IF: header errors */#define DAV_ERR_IF_PARSE                100    /* general parsing error */#define DAV_ERR_IF_MULTIPLE_NOT         101    /* multiple "Not" found */#define DAV_ERR_IF_UNK_CHAR             102    /* unknown char in header */#define DAV_ERR_IF_ABSENT               103    /* no locktokens given */#define DAV_ERR_IF_TAGGED               104    /* in parsing tagged-list */#define DAV_ERR_IF_UNCLOSED_PAREN       105    /* in no-tagged-list *//* Prop DB errors */#define DAV_ERR_PROP_BAD_MAJOR          200    /* major version was wrong */#define DAV_ERR_PROP_READONLY           201    /* prop is read-only */#define DAV_ERR_PROP_NO_DATABASE        202    /* writable db not avail */#define DAV_ERR_PROP_NOT_FOUND          203    /* prop not found */#define DAV_ERR_PROP_BAD_LOCKDB         204    /* could not open lockdb */#define DAV_ERR_PROP_OPENING            205    /* problem opening propdb */#define DAV_ERR_PROP_EXEC               206    /* problem exec'ing patch *//* Predefined DB errors *//* ### any to define?? *//* Predefined locking system errors */#define DAV_ERR_LOCK_OPENDB             400    /* could not open lockdb */#define DAV_ERR_LOCK_NO_DB              401    /* no database defined */#define DAV_ERR_LOCK_CORRUPT_DB         402    /* DB is corrupt */#define DAV_ERR_LOCK_UNK_STATE_TOKEN    403    /* unknown State-token */#define DAV_ERR_LOCK_PARSE_TOKEN        404    /* bad opaquelocktoken */#define DAV_ERR_LOCK_SAVE_LOCK          405    /* err saving locks *//*** Some comments on Error ID values:**** The numbers do not necessarily need to be unique. Uniqueness simply means** that two errors that have not been predefined above can be distinguished** from each other. At the moment, mod_dav does not use this distinguishing** feature, but it could be used in the future to collapse <response> elements** into groups based on the error ID (and associated responsedescription).**** If a compute_desc is provided, then the error ID should be unique within** the context of the compute_desc function (so the function can figure out** what to filled into the desc).**** Basically, subsystems can ignore defining new error ID values if they want** to. The subsystems *do* need to return the predefined errors when** appropriate, so that mod_dav can figure out what to do. Subsystems can** simply leave the error ID field unfilled (zero) if there isn't an error** that must be placed there.*//* --------------------------------------------------------------------**** HOOK STRUCTURES**** These are here for forward-declaration purposes. For more info, see** the section title "HOOK HANDLING" for more information, plus each** structure definition.*//* forward-declare this structure */typedef struct dav_hooks_propdb dav_hooks_propdb;typedef struct dav_hooks_locks dav_hooks_locks;typedef struct dav_hooks_vsn dav_hooks_vsn;typedef struct dav_hooks_repository dav_hooks_repository;typedef struct dav_hooks_liveprop dav_hooks_liveprop;typedef struct dav_hooks_binding dav_hooks_binding;typedef struct dav_hooks_search dav_hooks_search;/* ### deprecated name */typedef dav_hooks_propdb dav_hooks_db;/* --------------------------------------------------------------------**** RESOURCE HANDLING*//*** Resource Types:** The base protocol defines only file and collection resources.** The versioning protocol defines several additional resource types** to represent artifacts of a version control system.**** This enumeration identifies the type of URL used to identify the** resource. Since the same resource may have more than one type of** URL which can identify it, dav_resource_type cannot be used** alone to determine the type of the resource; attributes of the** dav_resource object must also be consulted.*/typedef enum {    DAV_RESOURCE_TYPE_UNKNOWN,    DAV_RESOURCE_TYPE_REGULAR,          /* file or collection; could be                                         * unversioned, or version selector,                                         * or baseline selector */    DAV_RESOURCE_TYPE_VERSION,          /* version or baseline URL */    DAV_RESOURCE_TYPE_HISTORY,          /* version or baseline history URL */    DAV_RESOURCE_TYPE_WORKING,          /* working resource URL */    DAV_RESOURCE_TYPE_WORKSPACE,        /* workspace URL */    DAV_RESOURCE_TYPE_ACTIVITY,         /* activity URL */    DAV_RESOURCE_TYPE_PRIVATE           /* repository-private type */} dav_resource_type;/*** Opaque, repository-specific information for a resource.*/typedef struct dav_resource_private dav_resource_private;/*** Resource descriptor, generated by a repository provider.**** Note: the lock-null state is not explicitly represented here,** since it may be expensive to compute. Use dav_get_resource_state()** to determine whether a non-existent resource is a lock-null resource.**** A quick explanation of how the flags can apply to different resources:**** unversioned file or collection:**     type       = DAV_RESOURCE_TYPE_REGULAR**     exists     = ? (1 if exists)**     collection = ? (1 if collection)**     versioned  = 0**     baselined  = 0**     working    = 0**** version-controlled resource or configuration:**     type       = DAV_RESOURCE_TYPE_REGULAR**     exists     = 1**     collection = ? (1 if collection)**     versioned  = 1**     baselined  = ? (1 if configuration)**     working    = ? (1 if checked out)**** version/baseline history:**     type       = DAV_RESOURCE_TYPE_HISTORY**     exists     = 1**     collection = 0**     versioned  = 0**     baselined  = 0**     working    = 0**** version/baseline:**     type       = DAV_RESOURCE_TYPE_VERSION**     exists     = 1**     collection = ? (1 if collection)**     versioned  = 1**     baselined  = ? (1 if baseline)**     working    = 0**** working resource:**     type       = DAV_RESOURCE_TYPE_WORKING**     exists     = 1**     collection = ? (1 if collection)**     versioned  = 1**     baselined  = 0**     working    = 1**** workspace:**     type       = DAV_RESOURCE_TYPE_WORKSPACE**     exists     = ? (1 if exists)**     collection = 1**     versioned  = ? (1 if version-controlled)**     baselined  = ? (1 if baseline-controlled)**     working    = ? (1 if checked out)**** activity:**     type       = DAV_RESOURCE_TYPE_ACTIVITY**     exists     = ? (1 if exists)**     collection = 0**     versioned  = 0**     baselined  = 0**     working    = 0*/typedef struct dav_resource {    dav_resource_type type;    int exists;         /* 0 => null resource */    int collection;     /* 0 => file; can be 1 for                         * REGULAR, VERSION, and WORKING resources,                         * and is always 1 for WORKSPACE */    int versioned;      /* 0 => unversioned; can be 1 for                         * REGULAR and WORKSPACE resources,                         * and is always 1 for VERSION and WORKING */    int baselined;      /* 0 => not baselined; can be 1 for                         * REGULAR, VERSION, and WORKSPACE resources;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -