ap_hook_get_lock_hooks(dav_fs_get_lock_hooks, NULL, NULL, AP_HOOK_MIDDLE);
ap_hook_get_propdb_hooks(dav_fs_get_propdb_hooks, NULL, NULL,
AP_HOOK_MIDDLE);
+ ap_hook_gather_propsets(dav_fs_gather_propsets, NULL, NULL,
+ AP_HOOK_MIDDLE);
+ ap_hook_find_liveprop(dav_fs_find_liveprop, NULL, NULL, AP_HOOK_MIDDLE);
+ ap_hook_insert_all_liveprops(dav_fs_insert_all_liveprops, NULL, NULL,
+ AP_HOOK_MIDDLE);
dav_fs_register_uris(NULL /* ### pconf */);
}
dav_fs_patch_rollback,
};
-/*
-** Note: we do not provide an is_active function at this point. In the
-** future, mod_dav may use that to determine if a particular provider is
-** active/enabled, but it doesn't now.
-*/
-static const dav_dyn_provider dav_dyn_providers_fs[] =
-{
- /* liveprop provider */
- {
- DAV_FS_PROVIDER_ID,
- DAV_DYN_TYPE_LIVEPROP,
- &dav_hooks_liveprop_fs
- },
-
- /* must always be last */
- DAV_DYN_END_MARKER
-};
-
-const dav_dyn_module dav_dyn_module_default =
-{
- DAV_DYN_MAGIC,
- DAV_DYN_VERSION,
- "filesystem",
-
- dav_dyn_providers_fs
-};
int dav_fs_hook_get_resource(request_rec *r, const char *root_dir,
const char *workspace)
return &dav_hooks_db_dbm;
}
+void dav_fs_gather_propsets(ap_array_header_t *uris)
+{
+#ifndef WIN32
+ *(const char **)ap_push_array(uris) =
+ "<http://apache.org/dav/propset/fs/1>";
+#endif
+}
+
+int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name,
+ const dav_hooks_liveprop **hooks)
+{
+ int propid = dav_fs_find_prop(ns_uri, name);
+
+ if (propid == 0)
+ return 0;
+
+ *hooks = &dav_hooks_liveprop_fs;
+ return propid;
+}
+
+void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource,
+ int insvalue, ap_text_header *phdr)
+{
+ dav_fs_insert_all(resource, insvalue, phdr);
+}
+
void dav_fs_register_uris(ap_pool_t *p)
{
const char * const * uris = dav_fs_namespace_uris;
const dav_hooks_locks *dav_fs_get_lock_hooks(request_rec *r);
const dav_hooks_propdb *dav_fs_get_propdb_hooks(request_rec *r);
+void dav_fs_gather_propsets(ap_array_header_t *uris);
+int dav_fs_find_liveprop(request_rec *r, const char *ns_uri, const char *name,
+ const dav_hooks_liveprop **hooks);
+void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource,
+ int insvalue, ap_text_header *phdr);
+
void dav_fs_register_uris(ap_pool_t *p);
#endif /* _DAV_FS_REPOS_H_ */
INCLUDES="$INCLUDES -I\$(top_srcdir)/$modpath_current"
fi
-dnl ### hack. we reference a symbol from the dav_fs "library", but that lib
-dnl ### appears on the link line first. nothing refers to the variable, so
-dnl ### it doesn't get sucked in. we will add the lib one more time *after*
-dnl ### our location on the link line, so we pick the thing up.
-if test "$enable_dav" = "yes"; then
- BUILTIN_LIBS="$BUILTIN_LIBS $modpath_current/../fs/libapachemod_dav_fs.la"
-fi
-
APACHE_MODPATH_FINISH
long limit_xml_body;
ap_table_t *d_params; /* per-directory DAV config parameters */
- struct dav_dyn_mod_ctx *dmc;
- dav_dyn_hooks *liveprop;
} dav_dir_conf;
/* per-server configuration */
/* forward-declare for use in configuration lookup */
extern module MODULE_VAR_EXPORT dav_module;
-/* copy a module's providers into our per-directory configuration state */
-static void dav_copy_providers(ap_pool_t *p, const char *name, dav_dir_conf *conf)
-{
- extern const dav_dyn_module dav_dyn_module_default;
-
- const dav_dyn_module *mod;
- const dav_dyn_provider *provider;
- dav_dyn_hooks *ddh;
-
- /* ### just hard-code this stuff for now */
-
- /* mod = dav_find_module(name); */
- mod = &dav_dyn_module_default;
-
- provider = mod->providers;
-
- ddh = ap_pcalloc(p, sizeof(*ddh));
- ddh->hooks = provider->hooks;
- conf->liveprop = ddh;
-}
-
static void dav_init_handler(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp,
server_rec *s)
{
conf->d_params = ap_make_table(p, 1);
conf->limit_xml_body = DAV_LIMIT_UNSET;
- /* DBG1("dav_create_dir_config: %08lx", (long)conf); */
-
- /*
- ** Locate the appropriate module (NULL == default) and copy the module's
- ** providers' hooks into our configuration state.
- */
- dav_copy_providers(p, NULL, conf);
-
return conf;
}
ap_overlap_tables(newconf->d_params, child->d_params,
AP_OVERLAP_TABLES_SET);
- if (child->liveprop != NULL)
- newconf->liveprop = child->liveprop;
- else
- newconf->liveprop = parent->liveprop;
-
return newconf;
}
return hooks;
}
-const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r)
-{
- dav_dir_conf *conf;
-
- conf = ap_get_module_config(r->per_dir_config, &dav_module);
- return conf->liveprop;
-}
-
/*
* Command handler for the DAV directive, which is FLAG.
*/
const char *dav_level;
const char *vsn_level;
int result;
- const dav_dir_conf *conf;
- const dav_dyn_hooks *lp;
+ ap_array_header_t *uri_ary;
+ const char *uris;
/* per HTTP/1.1 S9.2, we can discard this body */
if ((result = ap_discard_request_body(r)) != OK) {
vsn_level = (*vsn_hooks->get_vsn_header)();
}
- /*
- ** Iterate through the live property providers; add their URIs to
- ** the dav_level string.
- */
- conf = (dav_dir_conf *) ap_get_module_config(r->per_dir_config,
- &dav_module);
- for (lp = conf->liveprop; lp != NULL; lp = lp->next) {
- const char *uri = DAV_AS_HOOKS_LIVEPROP(lp)->propset_uri;
-
- if (uri != NULL)
- dav_level = ap_pstrcat(r->pool, dav_level, ",<", uri, ">", NULL);
+ /* gather property set URIs from all the liveprop providers */
+ uri_ary = ap_make_array(r->pool, 5, sizeof(const char *));
+ ap_run_gather_propsets(uri_ary);
+ uris = ap_array_pstrcat(r->pool, uri_ary, ',');
+ if (*uris) {
+ dav_level = ap_pstrcat(r->pool, dav_level, ",", uris, NULL);
}
/* this tells MSFT products to skip looking for FrontPage extensions */
AP_HOOK_LINK(get_lock_hooks)
AP_HOOK_LINK(get_propdb_hooks)
AP_HOOK_LINK(get_vsn_hooks)
+ AP_HOOK_LINK(gather_propsets)
AP_HOOK_LINK(find_liveprop)
AP_HOOK_LINK(insert_all_liveprops)
)
(request_rec *r), (r), NULL);
AP_IMPLEMENT_HOOK_RUN_FIRST(const dav_hooks_vsn *, get_vsn_hooks,
(request_rec *r), (r), NULL);
+AP_IMPLEMENT_HOOK_VOID(gather_propsets, (ap_array_header_t *uris), (uris))
+AP_IMPLEMENT_HOOK_RUN_FIRST(int, find_liveprop,
+ (request_rec *r,
+ const char *ns_uri, const char *name,
+ const dav_hooks_liveprop **hooks),
+ (r, ns_uri, name, hooks), 0);
+AP_IMPLEMENT_HOOK_VOID(insert_all_liveprops,
+ (request_rec *r, const dav_resource *resource,
+ int insvalue, ap_text_header *phdr),
+ (r, resource, insvalue, phdr));
AP_DECLARE_HOOK(const dav_hooks_propdb *, get_propdb_hooks, (request_rec *r))
AP_DECLARE_HOOK(const dav_hooks_vsn *, get_vsn_hooks, (request_rec *r))
+AP_DECLARE_HOOK(void, gather_propsets, (ap_array_header_t *uris))
AP_DECLARE_HOOK(int, find_liveprop, (request_rec *r,
const char *ns_uri, const char *name,
const dav_hooks_liveprop **hooks))
void dav_add_all_liveprop_xmlns(ap_pool_t *p, ap_text_header *phdr);
-/* --------------------------------------------------------------------
-**
-** ====> DEPRECATED <====
-**
-** DYNAMIC EXTENSIONS
-*/
-
-/* ### docco goes here... */
-
-
-/*
-** This structure is used to specify a set of hooks and its associated
-** context, on a per-directory/location basis.
-**
-** Note: the context is assembled from various sources. dav_dyn_hooks
-** structures will typically have the same pointer values within the
-** context (e.g. ctx.m_context is shared across all providers in a module).
-*/
-typedef struct dav_dyn_hooks
-{
- const void *hooks; /* the type-specific hooks */
-
- struct dav_dyn_hooks *next; /* next set of hooks, if applicable */
-
-} dav_dyn_hooks;
-
-/*
-** These enumerated values define the different types of functionality that
-** a provider can implement.
-*/
-enum
-{
- DAV_DYN_TYPE_SENTINEL,
-
- DAV_DYN_TYPE_PROPDB, /* property database (1 per dir) */
- DAV_DYN_TYPE_LOCKS, /* lock handling (1 per dir) */
- DAV_DYN_TYPE_QUERY_GRAMMAR, /* DASL search grammar (N per dir) */
- DAV_DYN_TYPE_ACL, /* ACL handling (1 per dir) */
- DAV_DYN_TYPE_VSN, /* versioning (1 per dir) */
- DAV_DYN_TYPE_LIVEPROP, /* live property handler (N per dir) */
-
- DAV_DYN_TYPE_MAX
-};
-
-/*
-** This structure defines a provider for a particular type of functionality.
-**
-** The ID is private to a provider and can be used to differentiate between
-** different subclasses of functionality which are implemented using the
-** same set of hooks. For example, a hook function could perform two entirely
-** different operations based on the ID which is passed.
-**
-** is_active() is used by the system to determine whether a particular
-** provider is "active" for the given context. It is possible that a provider
-** is configured for a directory, but has not been enabled -- the is_active()
-** function is used to determine that information.
-**
-** ### is_active is not used right now
-**
-** Note: dav_dyn_provider structures are always treated as "const" by mod_dav.
-*/
-typedef struct dav_dyn_provider
-{
- int id; /* provider ID */
-
- int type; /* provider's functionality type */
- const void *hooks; /* pointer to type-specific hooks */
-
-} dav_dyn_provider;
-
-#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL }
-
-/*
-** This structure defines a module (a set of providers).
-**
-** The friendly name should be a single word. It is used with the "DAV"
-** directive to specify the module to use for a particular directory/location.
-**
-** The module_open/close functions are used to initialize per-module "global"
-** data. The functions are expected to update ctx->m_context.
-**
-** ### module_open/close are not used at the moment
-** ### dir_* are not well-defined, nor are they used
-**
-** Note: The DAV_DYN_VERSION specifies the version of the dav_dyn_module
-** structure itself. It will be updated if changes in the structure
-** are made. There are no provisions for forward or backward
-** compatible changes.
-**
-** Note: dav_dyn_module structures are always treated as "const" by mod_dav.
-*/
-typedef struct
-{
- int magic;
-#define DAV_DYN_MAGIC 0x44415621 /* "DAV!" */
-
- int version;
-#define DAV_DYN_VERSION 1 /* must match exactly */
-
- const char *name; /* friendly name */
-
- const dav_dyn_provider *providers; /* providers in this module */
-
-} dav_dyn_module;
-
/* ### deprecated */
#define DAV_GET_HOOKS_PROPDB(r) dav_get_propdb_hooks(r)
#define DAV_GET_HOOKS_LOCKS(r) dav_get_lock_hooks(r)
#define DAV_GET_HOOKS_VSN(r) dav_get_vsn_hooks(r)
-/* ### temporary; this semantic won't apply in the new scheme */
-const dav_dyn_hooks *dav_get_liveprop_hooks(request_rec *r);
-#define DAV_AS_HOOKS_LIVEPROP(ph) ((const dav_hooks_liveprop *)((ph)->hooks))
-#define DAV_GET_HOOKS_LIVEPROP(r) DAV_AS_HOOKS_LIVEPROP(dav_get_liveprop_hooks(r))
-
/* --------------------------------------------------------------------
**
const dav_hooks_db *db_hooks;
const dav_hooks_vsn *vsn_hooks;
- const dav_dyn_hooks *liveprop; /* head of list */
};
/* ### move these into a "core" liveprop provider? */
{
int propid;
const char *ns_uri;
- const dav_dyn_hooks *ddh;
dav_elem_private *priv = elem->private;
+ const dav_hooks_liveprop *hooks;
if (elem->ns == AP_XML_NS_DAV_ID) {
const char * const *p = dav_core_props;
return;
}
+ /* get the URI for the element's namespace id */
ns_uri = AP_XML_GET_URI_ITEM(propdb->ns_xlate, elem->ns);
- for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
- propid = (*DAV_AS_HOOKS_LIVEPROP(ddh)->find_prop)(ns_uri, elem->name);
- if (propid != 0) {
- priv->propid = propid;
- priv->provider = DAV_AS_HOOKS_LIVEPROP(ddh);
- return;
- }
+ /* is there a liveprop provider for this property? */
+ propid = ap_run_find_liveprop(propdb->r, ns_uri, elem->name, &hooks);
+ if (propid != 0) {
+ priv->propid = propid;
+ priv->provider = hooks;
+ return;
}
priv->propid = DAV_PROPID_CORE_UNKNOWN;
}
/* is the live property read/write? */
-static int dav_rw_liveprop(dav_propdb *propdb, int propid)
+static int dav_rw_liveprop(dav_propdb *propdb, dav_elem_private *priv)
{
- dav_prop_rw rw;
- const dav_dyn_hooks *ddh;
+ int propid = priv->propid;
/* these are defined as read-only */
if (propid == DAV_PROPID_CORE_lockdiscovery
/*
** Check the liveprop providers
*/
- for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
- rw = (*DAV_AS_HOOKS_LIVEPROP(ddh)->is_writeable)(propdb->resource,
- propid);
- if (rw == DAV_PROP_RW_YES)
- return 1;
- if (rw == DAV_PROP_RW_NO)
- return 0;
+ if (priv->provider != NULL) {
+ dav_prop_rw rw;
+
+ rw = (*priv->provider->is_writeable)(propdb->resource, propid);
+ if (rw == DAV_PROP_RW_YES)
+ return 1;
+ if (rw == DAV_PROP_RW_NO)
+ return 0;
}
/*
propdb->db_hooks = DAV_GET_HOOKS_PROPDB(r);
propdb->vsn_hooks = DAV_GET_HOOKS_VSN(r);
- /* ### this will need to change */
- propdb->liveprop = dav_get_liveprop_hooks(r);
-
propdb->lockdb = lockdb;
if (!ro) {
int found_contenttype = 0;
int found_contentlang = 0;
int unused_inserted;
- const dav_dyn_hooks *ddh;
/* generate all the namespaces that are in the propdb */
dav_get_propdb_xmlns(propdb, &hdr_ns);
dav_add_all_liveprop_xmlns(propdb->p, &hdr_ns);
/* ask the liveprop providers to insert their properties */
- for (ddh = propdb->liveprop; ddh != NULL; ddh = ddh->next) {
- (*DAV_AS_HOOKS_LIVEPROP(ddh)->insert_all)(propdb->resource, getvals,
- &hdr);
- }
+ ap_run_insert_all_liveprops(propdb->r, propdb->resource, getvals, &hdr);
/* insert the standard properties */
/* ### should be handling the return errors here */
ctx->is_liveprop = priv->provider != NULL;
}
- if (!dav_rw_liveprop(propdb, priv->propid)) {
+ if (!dav_rw_liveprop(propdb, priv)) {
ctx->err = dav_new_error(propdb->p, HTTP_CONFLICT,
DAV_ERR_PROP_READONLY,
"Property is read-only.");