source: mod_gnutls/include/mod_gnutls.h.in @ 5a6446d

debian/masterdebian/stretch-backportsjessie-backportsmsvaupstream
Last change on this file since 5a6446d was 5a6446d, checked in by Paul Querna <chip@…>, 15 years ago

wrap the debug log in maintainer mode.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/**
2 *  Copyright 2004-2005 Paul Querna
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 *
16 */
17
18#include "httpd.h"
19#include "http_config.h"
20#include "http_protocol.h"
21#include "http_connection.h"
22#include "http_request.h"
23#include "http_core.h"
24#include "http_log.h"
25#include "apr_buckets.h"
26#include "apr_strings.h"
27#include "apr_tables.h"
28
29#ifndef __mod_gnutls_h_inc
30#define __mod_gnutls_h_inc
31
32#define HAVE_APR_MEMCACHE    @have_apr_memcache@
33
34#include <gcrypt.h>
35#include <gnutls/gnutls.h>
36
37module AP_MODULE_DECLARE_DATA gnutls_module;
38
39#define GNUTLS_OUTPUT_FILTER_NAME "gnutls_output_filter"
40#define GNUTLS_INPUT_FILTER_NAME "gnutls_input_filter"
41
42#define GNUTLS_ENABLED_FALSE 0
43#define GNUTLS_ENABLED_TRUE  1
44
45#define MOD_GNUTLS_VERSION "@MOD_GNUTLS_VERSION@"
46
47#define MOD_GNUTLS_DEBUG @OOO_MAINTAIN@
48
49typedef enum
50{
51    mod_gnutls_cache_none,
52    mod_gnutls_cache_dbm,
53#if HAVE_APR_MEMCACHE
54    mod_gnutls_cache_memcache
55#endif
56} mod_gnutls_cache_e;
57
58typedef struct
59{
60    gnutls_certificate_credentials_t certs;
61    char *key_file;
62    char *cert_file;
63    int enabled;
64    int ciphers[16];
65    int key_exchange[16];
66    int macs[16];
67    int protocol[16];
68    int compression[16];
69    int cert_types[16];
70    apr_time_t cache_timeout;
71    mod_gnutls_cache_e cache_type;
72    const char* cache_config;
73    const char* rsa_params_file;
74    const char* dh_params_file;
75} mod_gnutls_srvconf_rec;
76
77typedef struct {
78    int length;
79    char *value;
80} mod_gnutls_char_buffer_t;
81
82typedef struct
83{
84    mod_gnutls_srvconf_rec *sc;
85    conn_rec* c;
86    gnutls_session_t session;
87
88    apr_status_t input_rc;
89    ap_filter_t *input_filter;
90    apr_bucket_brigade *input_bb;
91    apr_read_type_e input_block;
92    ap_input_mode_t input_mode;
93    mod_gnutls_char_buffer_t input_cbuf;
94    char input_buffer[AP_IOBUFSIZE];
95
96    apr_status_t output_rc;
97    ap_filter_t *output_filter;
98    apr_bucket_brigade *output_bb;
99    char output_buffer[AP_IOBUFSIZE];
100    apr_size_t output_blen;
101    apr_size_t output_length;
102
103    int status;
104    int non_https;
105} mod_gnutls_handle_t;
106
107/** Functions in gnutls_io.c **/
108
109/**
110 * mod_gnutls_filter_input will filter the input data
111 * by decrypting it using GnuTLS and passes it cleartext.
112 *
113 * @param f     the filter info record
114 * @param bb    the bucket brigade, where to store the result to
115 * @param mode  what shall we read?
116 * @param block a block index we shall read from?
117 * @return result status
118 */
119apr_status_t mod_gnutls_filter_input(ap_filter_t * f,
120                                     apr_bucket_brigade * bb,
121                                     ap_input_mode_t mode,
122                                     apr_read_type_e block,
123                                     apr_off_t readbytes);
124
125/**
126 * mod_gnutls_filter_output will filter the encrypt
127 * the incoming bucket using GnuTLS and passes it onto the next filter.
128 *
129 * @param f     the filter info record
130 * @param bb    the bucket brigade, where to store the result to
131 * @return result status
132 */
133apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
134                                      apr_bucket_brigade * bb);
135
136
137/**
138 * mod_gnutls_transport_read is called from GnuTLS to provide encrypted
139 * data from the client.
140 *
141 * @param ptr     pointer to the filter context
142 * @param buffer  place to put data
143 * @param len     maximum size
144 * @return size   length of the data stored in buffer
145 */
146ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr,
147                                  void *buffer, size_t len);
148
149/**
150 * mod_gnutls_transport_write is called from GnuTLS to
151 * write data to the client.
152 *
153 * @param ptr     pointer to the filter context
154 * @param buffer  buffer to write to the client
155 * @param len     size of the buffer
156 * @return size   length of the data written
157 */
158ssize_t mod_gnutls_transport_write(gnutls_transport_ptr_t ptr,
159                                   const void *buffer, size_t len);
160
161
162/**
163 * Init the Cache after Configuration is done
164 */
165int mod_gnutls_cache_post_config(apr_pool_t *p, server_rec *s,
166                                 mod_gnutls_srvconf_rec *sc);
167/**
168 * Init the Cache inside each Process
169 */
170int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s,
171                                mod_gnutls_srvconf_rec *sc);
172/**
173 * Setup the Session Caching
174 */
175int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt);
176
177#define GNUTLS_SESSION_ID_STRING_LEN \
178    ((GNUTLS_MAX_SESSION_ID + 1) * 2)
179   
180/**
181 * Convert a SSL Session ID into a Null Terminated Hex Encoded String
182 * @param id raw SSL Session ID
183 * @param idlen Length of the raw Session ID
184 * @param str Location to store the Hex Encoded String
185 * @param strsize The Maximum Length that can be stored in str
186 */
187char *mod_gnutls_session_id2sz(unsigned char *id, int idlen,
188                                char *str, int strsize);
189
190#endif /*  __mod_gnutls_h_inc */
Note: See TracBrowser for help on using the repository browser.