source: mod_gnutls/src/gnutls_cache.h @ 14548b9

debian/masterdebian/stretch-backportsproxy-ticketupstream
Last change on this file since 14548b9 was 14548b9, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Update comments in gnutls_cache.(c|h) to work with Doxygen

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  Copyright 2004-2005 Paul Querna
3 *  Copyright 2014 Nikos Mavrogiannopoulos
4 *  Copyright 2015-2016 Thomas Klute
5 *
6 *  Licensed under the Apache License, Version 2.0 (the "License");
7 *  you may not use this file except in compliance with the License.
8 *  You may obtain a copy of the License at
9 *
10 *      http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *  Unless required by applicable law or agreed to in writing, software
13 *  distributed under the License is distributed on an "AS IS" BASIS,
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *  See the License for the specific language governing permissions and
16 *  limitations under the License.
17 */
18
19/**
20 * @file
21 *
22 * Generic object cache for mod_gnutls
23 */
24
25#ifndef __MOD_GNUTLS_CACHE_H__
26#define __MOD_GNUTLS_CACHE_H__
27
28#include "mod_gnutls.h"
29#include <httpd.h>
30
31/** Name of the mod_gnutls cache access mutex, for use with Apache's
32 * `Mutex` directive */
33#define MGS_CACHE_MUTEX_NAME "gnutls-cache"
34
35/**
36 * Initialize the internal cache configuration structure. This
37 * function is called after the configuration file(s) have been
38 * parsed.
39 */
40int mgs_cache_post_config(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
41
42/**
43 * (Re-)Initialize the cache in a child process after forking
44 */
45int mgs_cache_child_init(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
46
47/**
48 * Setup caching for the given TLS session
49 *
50 * @param ctxt mod_gnutls session context
51 * @return 0
52 */
53int mgs_cache_session_init(mgs_handle_t *ctxt);
54
55
56
57/**
58 * Convert a `time_t` into a null terminated string in a format
59 * compatible with OpenSSL's `ASN1_TIME_print()`
60 *
61 * @param t time_t time
62 * @param str Location to store the time string
63 * @param strsize The maximum length that can be stored in `str`
64 * @return `str`
65 */
66char *mgs_time2sz(time_t t, char *str, int strsize);
67
68/**
69 * Generic store function for the mod_gnutls object cache
70 *
71 * @param s server associated with the cache entry
72 * @param key key for the cache entry
73 * @param data data to be cached
74 * @param expiry expiration time
75 * @return -1 on error, 0 on success
76 */
77typedef int (*cache_store_func)(server_rec *s, gnutls_datum_t key,
78                                gnutls_datum_t data, apr_time_t expiry);
79/**
80 * Generic fetch function for the mod_gnutls object cache
81 *
82 * @param ctxt mod_gnutls session context for the request
83 * @param key key for the cache entry to be fetched
84 * @return the requested cache entry, or `{NULL, 0}`
85 */
86typedef gnutls_datum_t (*cache_fetch_func)(mgs_handle_t *ctxt,
87                                           gnutls_datum_t key);
88/**
89 * Internal cache configuration structure
90 */
91struct mgs_cache {
92    /** Store function for this cache */
93    cache_store_func store;
94    /** Fetch function for this cache */
95    cache_fetch_func fetch;
96    /** Mutex for cache access (used only if the cache type is not
97     * thread-safe) */
98    apr_global_mutex_t *mutex;
99};
100
101#endif /** __MOD_GNUTLS_CACHE_H__ */
Note: See TracBrowser for help on using the repository browser.