Apache HTTPD
provider.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_tables.h"
20#include "apr_strings.h"
21
22#include "ap_provider.h"
23
26
27
34
36 const char *provider_group,
37 const char *provider_name,
38 const char *provider_version,
39 const void *provider)
40{
42
43 if (global_providers == NULL) {
48 }
49
50 /* First, deal with storing the provider away */
53
58 }
59
62
67 }
68
69 /* just set it. no biggy if it was there before. */
71 provider);
72
73 /* Now, tuck away the provider names in an easy-to-get format */
76
81 }
82
85
90 }
91
92 /* just set it. no biggy if it was there before. */
94 provider_name);
95
96 return APR_SUCCESS;
97}
98
99AP_DECLARE(void *) ap_lookup_provider(const char *provider_group,
100 const char *provider_name,
101 const char *provider_version)
102{
104
105 if (global_providers == NULL) {
106 return NULL;
107 }
108
111
112 if (provider_group_hash == NULL) {
113 return NULL;
114 }
115
118
119 if (provider_name_hash == NULL) {
120 return NULL;
121 }
122
123 return apr_hash_get(provider_name_hash, provider_version,
125}
126
128 const char *provider_group,
129 const char *provider_version)
130{
135 char *val;
136
138 goto out;
139 }
140
143
144 if (provider_group_hash == NULL) {
145 goto out;
146 }
147
149
150 if (h == NULL) {
151 goto out;
152 }
153
155 for (hi = apr_hash_first(pool, h); hi; hi = apr_hash_next(hi)) {
156 apr_hash_this(hi, NULL, NULL, (void *)&val);
157 entry = apr_array_push(ret);
159 }
160
161out:
162 if (ret == NULL) {
164 }
165 return ret;
166}
167
169{
174 char *group, *version;
175
177 return ret;
178
180 groups_hi;
182 {
183 apr_hash_this(groups_hi, (void *)&group, NULL, (void *)&provider_group_hash);
185 continue;
187 vers_hi;
189 {
190 apr_hash_this(vers_hi, (void *)&version, NULL, NULL);
191
192 entry = apr_array_push(ret);
193 entry->provider_group = group;
194 entry->provider_version = version;
195 }
196 }
197 return ret;
198}
#define AP_DECLARE(type)
Definition ap_config.h:67
Apache Provider API.
APR Hash Tables.
APR memory allocation.
APR Strings library.
APR Table library.
apr_array_header_t * ap_list_provider_names(apr_pool_t *pool, const char *provider_group, const char *provider_version)
Definition provider.c:127
apr_array_header_t * ap_list_provider_groups(apr_pool_t *pool)
Definition provider.c:168
apr_status_t ap_register_provider(apr_pool_t *pool, const char *provider_group, const char *provider_name, const char *provider_version, const void *provider)
Definition provider.c:35
void * ap_lookup_provider(const char *provider_group, const char *provider_name, const char *provider_version)
Definition provider.c:99
apr_brigade_flush void * ctx
apr_size_t size
apr_uint32_t val
Definition apr_atomic.h:66
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
const apr_hash_t * h
Definition apr_hash.h:97
#define APR_HASH_KEY_STRING
Definition apr_hash.h:47
static apr_file_t * out
Definition mod_info.c:85
return NULL
Definition mod_so.c:359
static apr_hash_t * global_providers
Definition provider.c:24
static apr_status_t cleanup_global_providers(void *ctx)
Definition provider.c:28
static apr_hash_t * global_providers_names
Definition provider.c:25
const char * provider_group
Definition ap_provider.h:40
const char * provider_version
Definition ap_provider.h:41
const char * provider_name
Definition ap_provider.h:36