1 | /* |
---|
2 | * Copyright 2020 Fiona Klute |
---|
3 | * |
---|
4 | * Initial function definitions and documentation copied from |
---|
5 | * mod_gnutls.h.in under the same license, copyright notice: |
---|
6 | * |
---|
7 | * Copyright 2004-2005 Paul Querna |
---|
8 | * Copyright 2014 Nikos Mavrogiannopoulos |
---|
9 | * Copyright 2015-2020 Fiona Klute |
---|
10 | * |
---|
11 | * Licensed under the Apache License, Version 2.0 (the "License"); |
---|
12 | * you may not use this file except in compliance with the License. |
---|
13 | * You may obtain a copy of the License at |
---|
14 | * |
---|
15 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
16 | * |
---|
17 | * Unless required by applicable law or agreed to in writing, software |
---|
18 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
20 | * See the License for the specific language governing permissions and |
---|
21 | * limitations under the License. |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef __MOD_GNUTLS_IO_H__ |
---|
25 | #define __MOD_GNUTLS_IO_H__ |
---|
26 | |
---|
27 | #include <apr.h> |
---|
28 | #include <apr_buckets.h> |
---|
29 | #include <apr_errno.h> |
---|
30 | #include <gnutls/gnutls.h> |
---|
31 | #include <util_filter.h> |
---|
32 | |
---|
33 | #include "mod_gnutls.h" |
---|
34 | |
---|
35 | /** |
---|
36 | * mgs_filter_input will filter the input data |
---|
37 | * by decrypting it using GnuTLS and passes it cleartext. |
---|
38 | * |
---|
39 | * @param f the filter info record |
---|
40 | * @param bb the bucket brigade, where to store the result to |
---|
41 | * @param mode what shall we read? |
---|
42 | * @param block a block index we shall read from? |
---|
43 | * @return result status |
---|
44 | */ |
---|
45 | apr_status_t mgs_filter_input(ap_filter_t * f, |
---|
46 | apr_bucket_brigade * bb, |
---|
47 | ap_input_mode_t mode, |
---|
48 | apr_read_type_e block, |
---|
49 | apr_off_t readbytes); |
---|
50 | |
---|
51 | /** |
---|
52 | * mgs_filter_output will filter the encrypt |
---|
53 | * the incoming bucket using GnuTLS and passes it onto the next filter. |
---|
54 | * |
---|
55 | * @param f the filter info record |
---|
56 | * @param bb the bucket brigade, where to store the result to |
---|
57 | * @return result status |
---|
58 | */ |
---|
59 | apr_status_t mgs_filter_output(ap_filter_t * f, |
---|
60 | apr_bucket_brigade * bb); |
---|
61 | |
---|
62 | /** |
---|
63 | * mgs_transport_read is called from GnuTLS to provide encrypted |
---|
64 | * data from the client. |
---|
65 | * |
---|
66 | * @param ptr pointer to the filter context |
---|
67 | * @param buffer place to put data |
---|
68 | * @param len maximum size |
---|
69 | * @return size length of the data stored in buffer |
---|
70 | */ |
---|
71 | ssize_t mgs_transport_read(gnutls_transport_ptr_t ptr, |
---|
72 | void *buffer, size_t len); |
---|
73 | |
---|
74 | /** |
---|
75 | * mgs_transport_write is called from GnuTLS to |
---|
76 | * write data to the client. |
---|
77 | * |
---|
78 | * @param ptr pointer to the filter context |
---|
79 | * @param buffer buffer to write to the client |
---|
80 | * @param len size of the buffer |
---|
81 | * @return size length of the data written |
---|
82 | */ |
---|
83 | ssize_t mgs_transport_write(gnutls_transport_ptr_t ptr, |
---|
84 | const void *buffer, size_t len); |
---|
85 | |
---|
86 | int mgs_reauth(mgs_handle_t * ctxt); |
---|
87 | |
---|
88 | #endif /* __MOD_GNUTLS_IO_H__ */ |
---|