📄 mod_dav.h
字号:
** the provided value is valid. ** ** elem will point to the XML element that names the property. For ** example: ** <lp1:executable>T</lp1:executable> ** ** The provider can access the cdata fields and the child elements ** to extract the relevant pieces. ** ** operation is one of DAV_PROP_OP_SET or _DELETE. ** ** The provider may return a value in *context which will be passed ** to each of the exec/commit/rollback functions. For example, this ** may contain an internal value which has been processed from the ** input element. ** ** The provider must set defer_to_dead to true (non-zero) or false. ** If true, then the set/remove is deferred to the dead property ** database. Note: it will be set to zero on entry. */ dav_error * (*patch_validate)(const dav_resource *resource, const ap_xml_elem *elem, int operation, void **context, int *defer_to_dead); /* ### doc... */ dav_error * (*patch_exec)(const dav_resource *resource, const ap_xml_elem *elem, int operation, void *context, dav_liveprop_rollback **rollback_ctx); /* ### doc... */ void (*patch_commit)(const dav_resource *resource, int operation, void *context, dav_liveprop_rollback *rollback_ctx); /* ### doc... */ dav_error * (*patch_rollback)(const dav_resource *resource, int operation, void *context, dav_liveprop_rollback *rollback_ctx);};/*** dav_liveprop_spec: specify a live property**** This structure is used as a standard way to determine if a particular** property is a live property. Its use is not part of the mandated liveprop** interface, but can be used by liveprop providers in conjuction with the** utility routines below.*/typedef struct { int ns; /* provider-local namespace index */ const char *name; /* name of the property */ int propid; /* provider-local property ID */ int is_writable; /* is the property writable? */} dav_liveprop_spec;/*** dav_liveprop_group: specify a group of liveprops**** This structure specifies a group of live properties, their namespaces,** and how to handle them.*/typedef struct { const dav_liveprop_spec *specs; const char * const *namespace_uris; const dav_hooks_liveprop *hooks;} dav_liveprop_group;/* ### docco */DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name, const dav_liveprop_group *group, const dav_hooks_liveprop **hooks);/* ### docco */DAV_DECLARE(int) dav_get_liveprop_info(int propid, const dav_liveprop_group *group, const dav_liveprop_spec **info);/* ### docco */DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *pool, const dav_liveprop_group *group);/* ### docco */DAV_DECLARE(int) dav_get_liveprop_ns_index(const char *uri);/* ### docco */int dav_get_liveprop_ns_count(void);/* ### docco */void dav_add_all_liveprop_xmlns(apr_pool_t *p, ap_text_header *phdr);/*** The following three functions are part of mod_dav's internal handling** for the core WebDAV properties. They are not part of mod_dav's API.*/int dav_core_find_liveprop(const dav_resource *resource, const char *ns_uri, const char *name, const dav_hooks_liveprop **hooks);void dav_core_insert_all_liveprops(request_rec *r, const dav_resource *resource, dav_prop_insert what, ap_text_header *phdr);void dav_core_register_uris(apr_pool_t *p);/*** Standard WebDAV Property Identifiers**** A live property provider does not need to use these; they are simply** provided for convenience.**** Property identifiers need to be unique within a given provider, but not** *across* providers (note: this uniqueness constraint was different in** older versions of mod_dav).**** The identifiers start at 20000 to make it easier for providers to avoid** conflicts with the standard properties. The properties are arranged** alphabetically, and may be reordered from time to time (as properties** are introduced).**** NOTE: there is no problem with reordering (e.g. binary compat) since the** identifiers are only used within a given provider, which would pick up** the entire set of changes upon a recompile.*/enum { DAV_PROPID_BEGIN = 20000, /* Standard WebDAV properties (RFC 2518 and DeltaV I-D) */ DAV_PROPID_comment, /* from DeltaV I-D */ DAV_PROPID_creationdate, DAV_PROPID_creator_displayname, /* from DeltaV I-D */ DAV_PROPID_displayname, DAV_PROPID_getcontentlanguage, DAV_PROPID_getcontentlength, DAV_PROPID_getcontenttype, DAV_PROPID_getetag, DAV_PROPID_getlastmodified, DAV_PROPID_lockdiscovery, DAV_PROPID_resourcetype, DAV_PROPID_source, DAV_PROPID_supportedlock, /* DeltaV properties (from the I-D) */ DAV_PROPID_activity_collection_set, DAV_PROPID_activity_set, DAV_PROPID_auto_merge_set, DAV_PROPID_auto_version, DAV_PROPID_baseline_selector, DAV_PROPID_baselined_collection, DAV_PROPID_baselined_collection_set, DAV_PROPID_checked_out, DAV_PROPID_checkin_date, DAV_PROPID_checkin_fork, DAV_PROPID_checkout_fork, DAV_PROPID_checkout_set, DAV_PROPID_current_activity_set, DAV_PROPID_current_workspace_set, DAV_PROPID_initial_version, DAV_PROPID_label_name_set, DAV_PROPID_latest_version, DAV_PROPID_merge_set, DAV_PROPID_mutable, DAV_PROPID_predecessor_set, DAV_PROPID_subactivity_set, DAV_PROPID_successor_set, DAV_PROPID_target, DAV_PROPID_unreserved, DAV_PROPID_version, DAV_PROPID_version_history, DAV_PROPID_version_name, DAV_PROPID_version_set, DAV_PROPID_workspace, DAV_PROPID_workspace_checkout_set, DAV_PROPID_workspace_collection_set, DAV_PROPID_END};/*** Property Identifier Registration**** At the moment, mod_dav requires live property providers to ensure that** each property returned has a unique value. For now, this is done through** central registration (there are no known providers other than the default,** so this remains manageable).**** WARNING: the TEST ranges should never be "shipped".*/#define DAV_PROPID_CORE 10000 /* ..10099. defined by mod_dav */#define DAV_PROPID_FS 10100 /* ..10299. mod_dav filesystem provider. */#define DAV_PROPID_TEST1 10300 /* ..10399 */#define DAV_PROPID_TEST2 10400 /* ..10499 */#define DAV_PROPID_TEST3 10500 /* ..10599 *//* Next: 10600 *//* --------------------------------------------------------------------**** DATABASE FUNCTIONS*/typedef struct dav_db dav_db;typedef apr_datum_t dav_datum;/* hook functions to enable pluggable databases */struct dav_hooks_propdb{ dav_error * (*open)(apr_pool_t *p, const dav_resource *resource, int ro, dav_db **pdb); void (*close)(dav_db *db); /* ** Fetch the value from the database. If the value does not exist, ** then *pvalue should be zeroed. ** ** Note: it is NOT an error for the key/value pair to not exist. */ dav_error * (*fetch)(dav_db *db, dav_datum key, dav_datum *pvalue); dav_error * (*store)(dav_db *db, dav_datum key, dav_datum value); dav_error * (*remove)(dav_db *db, dav_datum key); /* returns 1 if the record specified by "key" exists; 0 otherwise */ int (*exists)(dav_db *db, dav_datum key); dav_error * (*firstkey)(dav_db *db, dav_datum *pkey); dav_error * (*nextkey)(dav_db *db, dav_datum *pkey); void (*freedatum)(dav_db *db, dav_datum data);};/* --------------------------------------------------------------------**** LOCK FUNCTIONS*//* Used to represent a Timeout header of "Infinity" */#define DAV_TIMEOUT_INFINITE 0time_t dav_get_timeout(request_rec *r);/*** Opaque, provider-specific information for a lock database.*/typedef struct dav_lockdb_private dav_lockdb_private;/*** Opaque, provider-specific information for a lock record.*/typedef struct dav_lock_private dav_lock_private;/*** Lock database type. Lock providers are urged to implement a "lazy" open, so** doing an "open" is cheap until something is actually needed from the DB.*/typedef struct{ const dav_hooks_locks *hooks; /* the hooks used for this lockdb */ int ro; /* was it opened readonly? */ dav_lockdb_private *info;} dav_lockdb;typedef enum { DAV_LOCKSCOPE_UNKNOWN, DAV_LOCKSCOPE_EXCLUSIVE, DAV_LOCKSCOPE_SHARED} dav_lock_scope;typedef enum { DAV_LOCKTYPE_UNKNOWN, DAV_LOCKTYPE_WRITE} dav_lock_type;typedef enum { DAV_LOCKREC_DIRECT, /* lock asserted on this resource */ DAV_LOCKREC_INDIRECT, /* lock inherited from a parent */ DAV_LOCKREC_INDIRECT_PARTIAL /* most info is not filled in */} dav_lock_rectype;/*** dav_lock: hold information about a lock on a resource.**** This structure is used for both direct and indirect locks. A direct lock** is a lock applied to a specific resource by the client. An indirect lock** is one that is inherited from a parent resource by virtue of a non-zero** Depth: header when the lock was applied.**** mod_dav records both types of locks in the lock database, managing their** addition/removal as resources are moved about the namespace.**** Note that the lockdb is free to marshal this structure in any form that** it likes.**** For a "partial" lock, the <rectype> and <locktoken> fields must be filled** in. All other (user) fields should be zeroed. The lock provider will** usually fill in the <info> field, and the <next> field may be used to** construct a list of partial locks.**** The lock provider MUST use the info field to store a value such that a** dav_lock structure can locate itself in the underlying lock database.** This requirement is needed for refreshing: when an indirect dav_lock is** refreshed, its reference to the direct lock does not specify the direct's** resource, so the only way to locate the (refreshed, direct) lock in the** database is to use the info field.**** Note that <is_locknull> only refers to the resource where this lock was** found.** ### hrm. that says the abstraction is wrong. is_locknull may disappear.*/typedef struct dav_lock{ dav_lock_rectype rectype; /* type of lock record */ int is_locknull; /* lock establishes a locknull resource */ /* ### put the resource in here? */ dav_lock_scope scope; /* scope of the lock */ dav_lock_type type; /* type of lock */ int depth; /* depth of the lock */ time_t timeout; /* when the lock will timeout */ const dav_locktoken *locktoken; /* the token that was issued */ const char *owner; /* (XML) owner of the lock */ const char *auth_user; /* auth'd username owning lock */ dav_lock_private *info; /* private to the lockdb */ struct dav_lock *next; /* for managing a list of locks */} dav_lock;/* Property-related public lock functions */const char *dav_lock_get_activelock(request_rec *r, dav_lock *locks, dav_buffer *pbuf);/* LockDB-related public lock functions */dav_error * dav_lock_parse_lockinfo(request_rec *r, const dav_resource *resrouce, dav_lockdb *lockdb, const ap_xml_doc *doc, dav_lock **lock_request);int dav_unlock(request_rec *r, const dav_resource *resource, const dav_locktoken *locktoken);dav_error * dav_add_lock(request_rec *r, const dav_resource *resource, dav_lockdb *lockdb, dav_lock *request, dav_response **response);dav_error * dav_notify_created(request_rec *r, dav_lockdb *lockdb, const dav_resource *resource, int resource_state, int depth);DAV_DECLARE(dav_error*) dav_lock_query(dav_lockdb *lockdb, const dav_resource *resource, dav_lock **locks);dav_error * dav_validate_request(request_rec *r, dav_resource *resource, int depth, dav_locktoken *locktoken, dav_response **response, int flags, dav_lockdb *lockdb);/*** flags:** 0x0F -- reserved for <dav_lock_scope> values**** other flags, detailed below*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -