Commit de93981c authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Add new ap_list_provider_groups() API for mod_info


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1225798 13f79535-47bb-0310-9956-ffa450edef68
parent 19763f0d
Loading
Loading
Loading
Loading
+2 −1
Changes for include/ap_mmn.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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
+14 −0
Changes for include/ap_provider.h: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
+32 −0
Changes for server/provider.c: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
}