diff options
-rw-r--r-- | include/ap_mmn.h | 3 | ||||
-rw-r--r-- | include/ap_provider.h | 14 | ||||
-rw-r--r-- | server/provider.c | 32 |
3 files changed, 48 insertions, 1 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 7e2ef9f78b..3d357c214e 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -382,6 +382,7 @@ * ap_proxy_sec2hex(), ap_proxy_make_fake_req(), * ap_proxy_strmatch_path, ap_proxy_strmatch_domain, * ap_proxy_table_unmerge(), proxy_lb_workers. + * 20111203.1 (2.5.0-dev) Add ap_list_provider_groups() */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ @@ -389,7 +390,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20111203 #endif -#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/ap_provider.h b/include/ap_provider.h index adfc69cad6..0a6c10cf56 100644 --- a/include/ap_provider.h +++ b/include/ap_provider.h @@ -36,6 +36,10 @@ typedef struct { const char *provider_name; } ap_list_provider_names_t; +typedef struct { + const char *provider_group; + const char *provider_version; +} ap_list_provider_groups_t; /** * This function is used to register a provider with the global @@ -78,6 +82,16 @@ AP_DECLARE(apr_array_header_t *) ap_list_provider_names(apr_pool_t *pool, const char *provider_group, const char *provider_version); +/** + * This function is used to retrieve a list (array) of provider groups and versions + * @param pool The pool to create any storage from + * @return pointer to array of ap_list_provider_groups_t of provider groups + * and versions (could be empty) + */ + +AP_DECLARE(apr_array_header_t *) ap_list_provider_groups(apr_pool_t *pool); + + #ifdef __cplusplus } #endif diff --git a/server/provider.c b/server/provider.c index a5406ab1e8..ade0f4e9a2 100644 --- a/server/provider.c +++ b/server/provider.c @@ -163,3 +163,35 @@ AP_DECLARE(apr_array_header_t *) ap_list_provider_names(apr_pool_t *pool, } return ret; } + +AP_DECLARE(apr_array_header_t *) ap_list_provider_groups(apr_pool_t *pool) +{ + apr_array_header_t *ret = apr_array_make(pool, 10, sizeof(ap_list_provider_groups_t)); + ap_list_provider_groups_t *entry; + apr_hash_t *provider_group_hash; + apr_hash_index_t *groups_hi, *vers_hi; + char *group, *version; + + if (global_providers_names == NULL) + return ret; + + for (groups_hi = apr_hash_first(pool, global_providers_names); + groups_hi; + groups_hi = apr_hash_next(groups_hi)) + { + apr_hash_this(groups_hi, (void *)&group, NULL, (void *)&provider_group_hash); + if (provider_group_hash == NULL) + continue; + for (vers_hi = apr_hash_first(pool, provider_group_hash); + vers_hi; + vers_hi = apr_hash_next(vers_hi)) + { + apr_hash_this(vers_hi, (void *)&version, NULL, NULL); + + entry = apr_array_push(ret); + entry->provider_group = group; + entry->provider_version = version; + } + } + return ret; +} |