source: mod_gnutls/include/mod_gnutls.h @ 76bd3bf

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

add check for apr_memcache

  • Property mode set to 100644
File size: 4.7 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#ifndef __mod_gnutls_h_inc
19#define __mod_gnutls_h_inc
20
21#include "httpd.h"
22#include "http_config.h"
23#include "http_protocol.h"
24#include "http_connection.h"
25#include "http_request.h"
26#include "http_core.h"
27#include "http_log.h"
28#include "apr_buckets.h"
29#include "apr_strings.h"
30#include "apr_tables.h"
31
32#include <gcrypt.h>
33#include <gnutls/gnutls.h>
34
35module AP_MODULE_DECLARE_DATA gnutls_module;
36
37#define GNUTLS_OUTPUT_FILTER_NAME "gnutls_output_filter"
38#define GNUTLS_INPUT_FILTER_NAME "gnutls_input_filter"
39
40#define GNUTLS_ENABLED_FALSE 0
41#define GNUTLS_ENABLED_TRUE  1
42
43
44/**
45 * GnuTLS changed the names of several structures between 1.0.X and 1.1.X
46 * This is just a simple hack so we can compile with both versions.
47 * There is a full list in <gnutls/compat.h>, But I am just
48 * doing this for a few types we use.
49 */
50#ifndef gnutls_certificate_credentials_t
51#define gnutls_certificate_credentials_t    gnutls_certificate_credentials
52#define gnutls_anon_server_credentials_t    gnutls_anon_server_credentials
53#define gnutls_session_t                    gnutls_session
54#define gnutls_transport_ptr_t              gnutls_transport_ptr
55#define gnutls_dh_params_t                  gnutls_dh_params
56#define gnutls_rsa_params_t                 gnutls_rsa_params
57#endif
58
59typedef struct
60{
61    gnutls_certificate_credentials_t certs;
62    gnutls_anon_server_credentials_t anoncred;
63    char *key_file;
64    char *cert_file;
65    int enabled;
66    int ciphers[16];
67    int key_exchange[16];
68    int macs[16];
69    int protocol[16];
70    int compression[16];
71} mod_gnutls_srvconf_rec;
72
73typedef struct {
74    int length;
75    char *value;
76} mod_gnutls_char_buffer_t;
77
78typedef struct
79{
80    mod_gnutls_srvconf_rec *sc;
81    conn_rec* c;
82    gnutls_session_t session;
83
84    apr_status_t input_rc;
85    ap_filter_t *input_filter;
86    apr_bucket_brigade *input_bb;
87    apr_read_type_e input_block;
88    ap_input_mode_t input_mode;
89    mod_gnutls_char_buffer_t input_cbuf;
90    char input_buffer[AP_IOBUFSIZE];
91
92    apr_status_t output_rc;
93    ap_filter_t *output_filter;
94    apr_bucket_brigade *output_bb;
95    char output_buffer[AP_IOBUFSIZE];
96    apr_size_t output_blen;
97    apr_size_t output_length;
98
99    int status;
100    int non_https;
101} mod_gnutls_handle_t;
102
103/** Functions in gnutls_io.c **/
104
105/**
106 * mod_gnutls_filter_input will filter the input data
107 * by decrypting it using GnuTLS and passes it cleartext.
108 *
109 * @param f     the filter info record
110 * @param bb    the bucket brigade, where to store the result to
111 * @param mode  what shall we read?
112 * @param block a block index we shall read from?
113 * @return result status
114 */
115apr_status_t mod_gnutls_filter_input(ap_filter_t * f,
116                                     apr_bucket_brigade * bb,
117                                     ap_input_mode_t mode,
118                                     apr_read_type_e block,
119                                     apr_off_t readbytes);
120
121/**
122 * mod_gnutls_filter_output will filter the encrypt
123 * the incoming bucket using GnuTLS and passes it onto the next filter.
124 *
125 * @param f     the filter info record
126 * @param bb    the bucket brigade, where to store the result to
127 * @return result status
128 */
129apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
130                                      apr_bucket_brigade * bb);
131
132
133/**
134 * mod_gnutls_transport_read is called from GnuTLS to provide encrypted
135 * data from the client.
136 *
137 * @param ptr     pointer to the filter context
138 * @param buffer  place to put data
139 * @param len     maximum size
140 * @return size   length of the data stored in buffer
141 */
142ssize_t mod_gnutls_transport_read(gnutls_transport_ptr_t ptr,
143                                  void *buffer, size_t len);
144
145/**
146 * mod_gnutls_transport_write is called from GnuTLS to
147 * write data to the client.
148 *
149 * @param ptr     pointer to the filter context
150 * @param buffer  buffer to write to the client
151 * @param len     size of the buffer
152 * @return size   length of the data written
153 */
154ssize_t mod_gnutls_transport_write(gnutls_transport_ptr_t ptr,
155                                   const void *buffer, size_t len);
156
157
158#endif /*  __mod_gnutls_h_inc */
Note: See TracBrowser for help on using the repository browser.