Changeset 19e80a5 in mod_gnutls for src/gnutls_cache.h


Ignore:
Timestamp:
Jan 28, 2019, 2:50:38 PM (20 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
debian/master
Children:
102aa67
Parents:
0931b35 (diff), ea9c699 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Update upstream source from tag 'upstream/0.9.0'

Update to upstream version '0.9.0'
with Debian dir 619b546038886b240d2c8e61ee1a1b13ce0867d7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_cache.h

    r0931b35 r19e80a5  
    22 *  Copyright 2004-2005 Paul Querna
    33 *  Copyright 2014 Nikos Mavrogiannopoulos
    4  *  Copyright 2015-2016 Fiona Klute
     4 *  Copyright 2015-2018 Fiona Klute
    55 *
    66 *  Licensed under the Apache License, Version 2.0 (the "License");
     
    2828#include "mod_gnutls.h"
    2929#include <httpd.h>
     30#include <ap_socache.h>
    3031
    3132/** Name of the mod_gnutls cache access mutex, for use with Apache's
     
    3435
    3536/**
     37 * Configure a cache instance
     38 *
     39 * This function is supposed to be called during config and
     40 * initializes an mgs_cache_t by finding the named socache provider
     41 * and creating a cache instance with the given configuration. Note
     42 * that the socache instance is only created, not initialized, which
     43 * is supposed to happen during post_config.
     44 *
     45 * @param cache pointer to the mgs_cache_t, will be assigned only if
     46 * configuration succeeds
     47 *
     48 * @param server associated server for logging purposes
     49 *
     50 * @param type socache provider type
     51 *
     52 * @param config configuration string for the socache provider, may be
     53 * `NULL` if the provider accepts an empty configuration
     54 *
     55 * @param pconf configuration memory pool, used to store cache
     56 * configuration
     57 *
     58 * @param ptemp temporary memory pool
     59 */
     60const char *mgs_cache_inst_config(mgs_cache_t *cache, server_rec *server,
     61                                  const char* type, const char* config,
     62                                  apr_pool_t *pconf, apr_pool_t *ptemp);
     63
     64/**
    3665 * Initialize the internal cache configuration structure. This
    3766 * function is called after the configuration file(s) have been
    3867 * parsed.
    3968 *
    40  * @param p configuration memory pool
     69 * @param pconf configuration memory pool
     70 * @param ptemp temporary memory pool
    4171 * @param s default server of the Apache configuration, head of the
    4272 * server list
    4373 * @param sc mod_gnutls data associated with `s`
    4474 */
    45 int mgs_cache_post_config(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
     75int mgs_cache_post_config(apr_pool_t *pconf, apr_pool_t *ptemp,
     76                          server_rec *s, mgs_srvconf_rec *sc);
    4677
    4778/**
     
    5182 * @param s default server of the Apache configuration, head of the
    5283 * server list
    53  * @param sc mod_gnutls data associated with `s`
     84 * @param cache the cache to reinit
     85 * @param mutex_name name of the mutex associated with the cache for
     86 * logging purposes
    5487 */
    55 int mgs_cache_child_init(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
     88int mgs_cache_child_init(apr_pool_t *p, server_rec *server,
     89                         mgs_cache_t cache, const char *mutex_name);
    5690
    5791/**
     
    79113
    80114/**
    81  * Generic store function for the mod_gnutls object cache.
     115 * Store function for the mod_gnutls object caches.
    82116 *
     117 * @param cache the cache to store the entry in
    83118 * @param s server associated with the cache entry
    84119 * @param key key for the cache entry
     
    88123 * @return `-1` on error, `0` on success
    89124 */
    90 typedef int (*cache_store_func)(server_rec *s, gnutls_datum_t key,
    91                                 gnutls_datum_t data, apr_time_t expiry);
     125int mgs_cache_store(mgs_cache_t cache, server_rec *server, gnutls_datum_t key,
     126                    gnutls_datum_t data, apr_time_t expiry);
     127
    92128/**
    93  * Generic fetch function for the mod_gnutls object cache.
     129 * Fetch function for the mod_gnutls object caches.
    94130 *
    95131 * *Warning*: The `data` element of the returned `gnutls_datum_t` is
     
    97133 * session caching API, and must be released using `gnutls_free()`.
    98134 *
    99  * @param ctxt mod_gnutls session context for the request
     135 * @param cache the cache to fetch from
     136 *
     137 * @param server server context for the request
     138 *
    100139 * @param key key for the cache entry to be fetched
     140 *
     141 * @param pool pool to allocate the response and other temporary
     142 * memory from
    101143 *
    102144 * @return the requested cache entry, or `{NULL, 0}`
    103145 */
    104 typedef gnutls_datum_t (*cache_fetch_func)(mgs_handle_t *ctxt,
    105                                            gnutls_datum_t key);
     146gnutls_datum_t mgs_cache_fetch(mgs_cache_t cache, server_rec *server,
     147                               gnutls_datum_t key, apr_pool_t *pool);
     148
    106149/**
    107150 * Internal cache configuration structure
    108151 */
    109152struct mgs_cache {
    110     /** Store function for this cache */
    111     cache_store_func store;
    112     /** Fetch function for this cache */
    113     cache_fetch_func fetch;
     153    /** Socache provider to use for this cache */
     154    const ap_socache_provider_t *prov;
     155    /** The actual socache instance */
     156    ap_socache_instance_t *socache;
     157    /** Cache configuration string (as passed to the socache create
     158     * function, for logging) */
     159    const char *config;
    114160    /** Mutex for cache access (used only if the cache type is not
    115161     * thread-safe) */
     
    117163};
    118164
     165/**
     166 * Write cache status to a mod_status report
     167 *
     168 * @param cache the cache to report on
     169 *
     170 * @param header_title string to prefix the report with to distinguish
     171 * caches
     172 *
     173 * @param r status output is added to the response for this request
     174 *
     175 * @param flags request flags, used to toggle "short status" mode
     176 *
     177 * @return request status, currently always `OK`
     178 */
     179int mgs_cache_status(mgs_cache_t cache, const char *header_title,
     180                     request_rec *r, int flags);
     181
    119182#endif /** __MOD_GNUTLS_CACHE_H__ */
Note: See TracChangeset for help on using the changeset viewer.