Apache HTTPD
liveprop.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "apr_pools.h"
18#include "apr_hash.h"
19#include "apr_errno.h"
20#include "apr_strings.h"
21#include "util_xml.h" /* for apr_text_header */
22#include "mod_dav.h"
23
24
26static long dav_liveprop_count = 0;
27
28
35
37{
38 long value;
39
40 if (dav_liveprop_uris == NULL) {
43 }
44
46 if (value != 0) {
47 /* already registered */
48 return;
49 }
50
51 /* start at 1, and count up */
53 (void *)++dav_liveprop_count);
54}
55
60
65
68{
70
71 for ( ; idx != NULL; idx = apr_hash_next(idx) ) {
72 const void *key;
73 void *val;
74 const char *s;
75
77
78 s = apr_psprintf(p, " xmlns:lp%ld=\"%s\"", (long)val, (const char *)key);
80 }
81}
82
83DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
84 const dav_liveprop_group *group,
86{
87 const char * const *uris = group->namespace_uris;
89 int ns;
90
91 /* first: locate the namespace in the namespace table */
92 for (ns = 0; uris[ns] != NULL; ++ns)
93 if (strcmp(ns_uri, uris[ns]) == 0)
94 break;
95 if (uris[ns] == NULL) {
96 /* not our property (the namespace matched none of ours) */
97 return 0;
98 }
99
100 /* second: look for the property in the liveprop specs */
101 for (scan = group->specs; scan->name != NULL; ++scan)
102 if (ns == scan->ns && strcmp(name, scan->name) == 0) {
103 *hooks = group->hooks;
104 return scan->propid;
105 }
106
107 /* not our property (same namespace, but no matching prop name) */
108 return 0;
109}
110
112 const dav_liveprop_group *group,
113 const dav_liveprop_spec **info)
114{
115 const dav_liveprop_spec *scan;
116
117 for (scan = group->specs; scan->name != NULL; ++scan) {
118 if (scan->propid == propid) {
119 *info = scan;
120
121 /* map the provider-local NS into a global NS index */
123 }
124 }
125
126 /* assert: should not reach this point */
127 *info = NULL;
128 return 0;
129}
130
132 const dav_liveprop_group *group)
133{
134 /* register the namespace URIs */
135 const char * const * uris = group->namespace_uris;
136
137 for ( ; *uris != NULL; ++uris) {
139 }
140}
APR Error Codes.
APR Hash Tables.
APR memory allocation.
APR Strings library.
apr_brigade_flush void * ctx
const char * uri
Definition apr_uri.h:159
long dav_get_liveprop_info(int propid, const dav_liveprop_group *group, const dav_liveprop_spec **info)
Definition liveprop.c:111
void dav_register_liveprop_group(apr_pool_t *p, const dav_liveprop_group *group)
Definition liveprop.c:131
long dav_get_liveprop_ns_index(const char *uri)
Definition liveprop.c:56
int dav_do_find_liveprop(const char *ns_uri, const char *name, const dav_liveprop_group *group, const dav_hooks_liveprop **hooks)
Definition liveprop.c:83
void dav_add_all_liveprop_xmlns(apr_pool_t *p, apr_text_header *phdr)
Definition liveprop.c:66
#define DAV_DECLARE(type)
Definition mod_dav.h:85
long dav_get_liveprop_ns_count(void)
Definition liveprop.c:61
apr_size_t size
apr_uint32_t val
Definition apr_atomic.h:66
const char * value
Definition apr_env.h:51
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
const char * key
#define APR_HASH_KEY_STRING
Definition apr_hash.h:47
const char * s
Definition apr_strings.h:95
static void dav_register_liveprop_namespace(apr_pool_t *p, const char *uri)
Definition liveprop.c:36
static apr_status_t dav_cleanup_liveprops(void *ctx)
Definition liveprop.c:29
static long dav_liveprop_count
Definition liveprop.c:26
static apr_hash_t * dav_liveprop_uris
Definition liveprop.c:25
apr_pool_t * p
Definition md_event.c:32
DAV extension module for Apache 2.0.*.
static const char *const hooks[]
return NULL
Definition mod_so.c:359
char * name
const dav_hooks_liveprop * hooks
Definition mod_dav.h:1037
const char *const * namespace_uris
Definition mod_dav.h:1036
const dav_liveprop_spec * specs
Definition mod_dav.h:1035
Apache XML library.
INT info
#define ns(x)
Definition xmltok.c:1644