static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
int propid, int insvalue,
- const int *ns_map,
ap_text_header *phdr)
{
const char *value;
/* assert: scan->name != NULL */
- /* map our NS index into a global NS index */
- /* ns = ns_map[scan->ns]; */
+ /* map our namespace into a global NS index */
ns = dav_get_liveprop_ns_index(dav_fs_namespace_uris[scan->ns]);
/* DBG3("FS: inserting lp%d:%s (local %d)", ns, scan->name, scan->ns); */
}
static void dav_fs_insert_all(const dav_resource *resource, int insvalue,
- const int *ns_map, ap_text_header *phdr)
+ ap_text_header *phdr)
{
if (!resource->exists) {
/* a lock-null resource */
}
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_creationdate,
- insvalue, ns_map, phdr);
+ insvalue, phdr);
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getcontentlength,
- insvalue, ns_map, phdr);
+ insvalue, phdr);
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getlastmodified,
- insvalue, ns_map, phdr);
+ insvalue, phdr);
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_getetag,
- insvalue, ns_map, phdr);
+ insvalue, phdr);
#ifndef WIN32
/*
** well not even call it.
*/
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable,
- insvalue, ns_map, phdr);
+ insvalue, phdr);
#endif
/* ### we know the others aren't defined as liveprops */
{
DAV_FS_PROVIDER_ID,
DAV_DYN_TYPE_LIVEPROP,
- &dav_hooks_liveprop_fs,
- NULL
+ &dav_hooks_liveprop_fs
},
/* must always be last */
DAV_DYN_VERSION,
"filesystem",
- NULL, /* module_open */
- NULL, /* module_close */
- NULL, /* dir_open */
- NULL, /* dir_param */
- NULL, /* dir_merge */
- NULL, /* dir_close */
-
dav_dyn_providers_fs
};
APACHE_MODPATH_INIT(dav/main)
APACHE_MODULE(dav, WebDAV protocol handling,
- mod_dav.lo props.lo util.lo util_lock.lo opaquelock.lo dav_dyn.lo
+ mod_dav.lo props.lo util.lo util_lock.lo opaquelock.lo
liveprop.lo
, , no)
/* 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 hooks;
- void *ctx;
-
- mod = dav_find_module(name);
- /* ### if NULL? need to error out somehow... */
-
- /* Set hooks for any providers in the module */
- ctx = dav_prepare_scan(p, mod);
- if (ctx == NULL) {
- /* ### how to signal an error? */
- return;
- }
+ dav_dyn_hooks *ddh;
- while (!dav_scan_providers(ctx, &provider, &hooks)) {
+ /* ### just hard-code this stuff for now */
- switch (provider->type) {
+ /* mod = dav_find_module(name); */
+ mod = &dav_dyn_module_default;
- case DAV_DYN_TYPE_LIVEPROP:
- {
- dav_dyn_hooks *ddh = ap_palloc(p, sizeof(*ddh));
+ provider = mod->providers;
- *ddh = hooks;
- ddh->next = conf->liveprop;
- conf->liveprop = ddh;
- break;
- }
-
- default:
- /* ### need to error out somehow... */
- break;
- }
- }
+ 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,
/* DBG0("dav_init_handler"); */
ap_add_version_component(p, "DAV/" DAV_VERSION);
-
- dav_process_builtin_modules(p);
}
static void *dav_create_server_config(ap_pool_t *p, server_rec *s)
/* ### docco ... */
+/* ### add a repository friendly-name to the get_resource */
AP_DECLARE_HOOK(int, get_resource, (request_rec *r, const char *root_dir,
const char *workspace))
+
AP_DECLARE_HOOK(const dav_hooks_locks *, get_lock_hooks, (request_rec *r))
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(int, find_liveprop, (request_rec *r,
const char *ns_uri, const char *name,
const dav_hooks_liveprop **hooks))
/* ### docco goes here... */
-/*
-** This structure is used to define the runtime, per-directory/location
-** operating context for a single provider.
-*/
-typedef struct
-{
- int id; /* provider ID */
-
- void *m_context; /* module-level context (i.e. managed globals) */
-
- void *d_context; /* per-directory context */
- ap_table_t *d_params; /* per-directory DAV config parameters */
-
- int *ns_map; /* for LIVEPROP, map provider URI to global URI */
-
-} dav_dyn_context;
-
/*
** This structure is used to specify a set of hooks and its associated
** context, on a per-directory/location basis.
*/
typedef struct dav_dyn_hooks
{
- dav_dyn_context ctx; /* context for this set of hooks */
const void *hooks; /* the type-specific hooks */
struct dav_dyn_hooks *next; /* next set of hooks, if applicable */
int type; /* provider's functionality type */
const void *hooks; /* pointer to type-specific hooks */
- int (*is_active)(dav_dyn_context *ctx, int id);
-
} dav_dyn_provider;
-#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL, NULL }
+#define DAV_DYN_END_MARKER { 0, DAV_DYN_TYPE_SENTINEL, NULL }
/*
** This structure defines a module (a set of providers).
const char *name; /* friendly name */
- int (*module_open)(dav_dyn_context *ctx);
- int (*module_close)(dav_dyn_context *ctx);
-
- int (*dir_open)(dav_dyn_context *ctx);
- int (*dir_param)(dav_dyn_context *ctx, const char *param_name,
- const char *param_value);
- int (*dir_merge)(dav_dyn_context *base, dav_dyn_context *overrides,
- dav_dyn_context *result);
- int (*dir_close)(dav_dyn_context *ctx);
-
const dav_dyn_provider *providers; /* providers in this module */
} dav_dyn_module;
-int dav_load_module(const char *name, const char *module_sym,
- const char *filename);
-const dav_dyn_module *dav_find_module(const char *name);
-
-/*
-** Various management functions.
-**
-** NOTE: the pool should be the "configuration pool"
-*/
-void dav_process_builtin_modules(ap_pool_t *p);
-void dav_process_module(ap_pool_t *p, const dav_dyn_module *mod);
-
-int * dav_collect_liveprop_uris(ap_pool_t *p, const dav_hooks_liveprop *hooks);
-
-void *dav_prepare_scan(ap_pool_t *p, const dav_dyn_module *mod);
-int dav_scan_providers(void *ctx,
- const dav_dyn_provider **provider,
- dav_dyn_hooks *output);
-
/* ### deprecated */
#define DAV_GET_HOOKS_PROPDB(r) dav_get_propdb_hooks(r)
#define DAV_GET_HOOKS_LOCKS(r) dav_get_lock_hooks(r)
*/
dav_prop_insert (*insert_prop)(const dav_resource *resource,
int propid, int insvalue,
- const int *ns_map, ap_text_header *phdr);
+ ap_text_header *phdr);
/*
** Insert all known/defined property names (and values). This is
** rather than specific, individual properties.
*/
void (*insert_all)(const dav_resource *resource, int insvalue,
- const int *ns_map, ap_text_header *phdr);
+ ap_text_header *phdr);
/*
** Determine whether a given property is writeable.
typedef struct {
int propid; /* live property ID */
const dav_hooks_liveprop *provider; /* the provider defining this prop */
- const int *ns_map; /* ns map for this provider */
} dav_elem_private;
#ifdef __cplusplus
if (propid != 0) {
priv->propid = propid;
priv->provider = DAV_AS_HOOKS_LIVEPROP(ddh);
- priv->ns_map = ddh->ctx.ns_map;
return;
}
}
/* ask the provider (that defined this prop) to insert the prop */
pi = (*priv->provider->insert_prop)(propdb->resource, priv->propid,
- getvals, priv->ns_map, phdr);
+ getvals, phdr);
#if DAV_DEBUG
if (pi == DAV_PROP_INSERT_NOTME) {
/* ### the provider should have returned NOTDEF, at least */
/* 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,
- ddh->ctx.ns_map,
&hdr);
}