source: mod_gnutls/include/mod_gnutls.h.in @ 6e0bfd6

debian/masterdebian/stretch-backportsjessie-backportsmsvaupstream
Last change on this file since 6e0bfd6 was 6e0bfd6, checked in by Paul Querna <chip@…>, 14 years ago
  • make memcahe optional
  • update for 2.1.x branch changes.
  • some mucking around with the conf stuff
  • Property mode set to 100644
File size: 5.0 KB
Line 
1/* ====================================================================
2 *  Copyright 2004 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
46/**
47 * GnuTLS changed the names of several structures between 1.0.X and 1.1.X
48 * This is just a simple hack so we can compile with both versions.
49 * There is a full list in <gnutls/compat.h>, But I am just
50 * doing this for a few types we use.
51 */
52#ifndef gnutls_certificate_credentials_t
53#define gnutls_certificate_credentials_t    gnutls_certificate_credentials
54#define gnutls_anon_server_credentials_t    gnutls_anon_server_credentials
55#define gnutls_session_t                    gnutls_session
56#define gnutls_transport_ptr_t              gnutls_transport_ptr
57#define gnutls_dh_params_t                  gnutls_dh_params
58#define gnutls_rsa_params_t                 gnutls_rsa_params
59#endif
60
61typedef struct
62{
63    gnutls_certificate_credentials_t certs;
64    gnutls_anon_server_credentials_t anoncred;
65    char *key_file;
66    char *cert_file;
67    int enabled;
68    int ciphers[16];
69    int key_exchange[16];
70    int macs[16];
71    int protocol[16];
72    int compression[16];
73    const char* cache_config;
74} mod_gnutls_srvconf_rec;
75
76typedef struct {
77    int length;
78    char *value;
79} mod_gnutls_char_buffer_t;
80
81typedef struct
82{
83    mod_gnutls_srvconf_rec *sc;
84    conn_rec* c;
85    gnutls_session_t session;
86
87    apr_status_t input_rc;
88    ap_filter_t *input_filter;
89    apr_bucket_brigade *input_bb;
90    apr_read_type_e input_block;
91    ap_input_mode_t input_mode;
92    mod_gnutls_char_buffer_t input_cbuf;
93    char input_buffer[AP_IOBUFSIZE];
94
95    apr_status_t output_rc;
96    ap_filter_t *output_filter;
97    apr_bucket_brigade *output_bb;
98    char output_buffer[AP_IOBUFSIZE];
99    apr_size_t output_blen;
100    apr_size_t output_length;
101
102    int status;
103    int non_https;
104} mod_gnutls_handle_t;
105
106/** Functions in gnutls_io.c **/
107
108/**
109 * mod_gnutls_filter_input will filter the input data
110 * by decrypting it using GnuTLS and passes it cleartext.
111 *
112 * @param f     the filter info record
113 * @param bb    the bucket brigade, where to store the result to
114 * @param mode  what shall we read?
115 * @param block a block index we shall read from?
116 * @return result status
117 */
118apr_status_t mod_gnutls_filter_input(ap_filter_t * f,
119                                     apr_bucket_brigade * bb,
120                                     ap_input_mode_t mode,
121                                     apr_read_type_e block,
122                                     apr_off_t readbytes);
123
124/**
125 * mod_gnutls_filter_output will filter the encrypt
126 * the incoming bucket using GnuTLS and passes it onto the next filter.
127 *
128 * @param f     the filter info record
129 * @param bb    the bucket brigade, where to store the result to
130 * @return result status
131 */
132apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
133                                      apr_bucket_brigade * bb);
134
135
136/**
137 * mod_gnutls_transport_read is called from GnuTLS to provide encrypted
138 * data from the client.
139 *
140 * @param ptr     pointer to the filter context
141 * @param buffer  place to put data
142 * @param len     maximum size
143 * @return size   length of the data stored in buffer
144 */
145ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr,
146                                  void *buffer, size_t len);
147
148/**
149 * mod_gnutls_transport_write is called from GnuTLS to
150 * write data to the client.
151 *
152 * @param ptr     pointer to the filter context
153 * @param buffer  buffer to write to the client
154 * @param len     size of the buffer
155 * @return size   length of the data written
156 */
157ssize_t mod_gnutls_transport_write(gnutls_transport_ptr_t ptr,
158                                   const void *buffer, size_t len);
159
160
161/**
162 * Init the Cache inside each Process
163 */
164int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s,
165                                mod_gnutls_srvconf_rec *sc);
166/**
167 * Setup the Session Caching
168 */
169int mod_gnutls_cache_session_init(mod_gnutls_handle_t *ctxt);
170
171#endif /*  __mod_gnutls_h_inc */
Note: See TracBrowser for help on using the repository browser.