source: mod_gnutls/src/gnutls_io.h @ 86cd5f6

mod_gnutls/0.11.0
Last change on this file since 86cd5f6 was 132eadc, checked in by Fiona Klute <fiona.klute@…>, 5 months ago

Implement gnutls_pull_timeout_func

According to GnuTLS documentation it's required when using a custom
pull function. It's not called by the current mod_gnutls use of
GnuTLS, but the documentation on client-side resumption explicitly
mentions it as a requirement.

  • Property mode set to 100644
File size: 3.3 KB
Line 
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 */
45apr_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 */
59apr_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 */
71ssize_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 */
83ssize_t mgs_transport_write(gnutls_transport_ptr_t ptr,
84                            const void *buffer, size_t len);
85
86/**
87 * mgs_transport_read is called from GnuTLS check if data is available
88 * on the underlying transport.
89 *
90 * @param ptr     transport pointer, the mod_gnutls connection context
91 * @param ms      maximum time to wait in milliseconds
92 * @return GnuTLS requirement: "The callback should return 0 on
93 *      timeout, a positive number if data can be received, and -1 on
94 *      error."
95 */
96int mgs_transport_read_ready(gnutls_transport_ptr_t ptr,
97                             unsigned int ms);
98
99int mgs_reauth(mgs_handle_t * ctxt, request_rec *r);
100
101#endif /* __MOD_GNUTLS_IO_H__ */
Note: See TracBrowser for help on using the repository browser.