source: mod_gnutls/src/gnutls_cache.h @ f450ac9

debian/masterdebian/stretch-backportsupstream
Last change on this file since f450ac9 was f450ac9, checked in by Thomas Klute <thomas2.klute@…>, 3 years ago

Replace mgs_session_id2sz() with apr_(p?)escape_hex()

There's no need to carry a local bin-to-hex function if APR already
provides a converter. Using integrated pool allocation even avoids a
few string copies in gnutls_hooks.c.

The session hex buffers in gnutls_cache.c don't need room for the
memcache tag because it is added in a apr_psprintf() call if
necessary, so we can save a few bytes of stack space there.

  • Property mode set to 100644
File size: 1.8 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#ifndef __MOD_GNUTLS_CACHE_H__
21#define __MOD_GNUTLS_CACHE_H__
22
23#include "mod_gnutls.h"
24#include <httpd.h>
25
26#define MGS_CACHE_MUTEX_NAME "gnutls-cache"
27
28/**
29 * Init the Cache after Configuration is done
30 */
31int mgs_cache_post_config(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
32
33/**
34 * Init the Cache inside each Process
35 */
36int mgs_cache_child_init(apr_pool_t *p, server_rec *s, mgs_srvconf_rec *sc);
37
38/**
39 * Setup the Session Caching
40 */
41int mgs_cache_session_init(mgs_handle_t *ctxt);
42
43
44
45/**
46 * Convert a time_t into a Null Terminated String
47 * @param t time_t time
48 * @param str Location to store the Hex Encoded String
49 * @param strsize The Maximum Length that can be stored in str
50 */
51char *mgs_time2sz(time_t t, char *str, int strsize);
52
53/*
54 * EXPERIMENTAL: Make DBM cache available for OCSP caching. To be
55 * replaced with properly configurable caching that can also use
56 * memcached later.
57 */
58#include <apr_dbm.h>
59int dbm_cache_store(server_rec *s, gnutls_datum_t key,
60                    gnutls_datum_t data, apr_time_t expiry);
61gnutls_datum_t dbm_cache_fetch(mgs_handle_t *ctxt, gnutls_datum_t key);
62
63#endif /** __MOD_GNUTLS_CACHE_H__ */
Note: See TracBrowser for help on using the repository browser.