1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __mod_h2__h2_conn_io__
17 #define __mod_h2__h2_conn_io__
22 /* h2_io is the basic handler of a httpd connection. It keeps two brigades,
23 * one for input, one for output and works with the installed connection
25 * The read is done via a callback function, so that input can be processed
26 * directly without copying.
30 apr_bucket_brigade *output;
33 apr_time_t cooldown_usecs;
34 apr_int64_t warmup_size;
36 apr_size_t write_size;
37 apr_time_t last_write;
38 apr_int64_t bytes_read;
39 apr_int64_t bytes_written;
42 apr_size_t flush_threshold;
43 unsigned int is_flushed : 1;
50 apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c,
51 const struct h2_config *cfg);
54 * Append data to the buffered output.
55 * @param buf the data to append
56 * @param length the length of the data to append
58 apr_status_t h2_conn_io_write(h2_conn_io *io,
62 apr_status_t h2_conn_io_pass(h2_conn_io *io, apr_bucket_brigade *bb);
65 * Pass any buffered data on to the connection output filters.
66 * @param io the connection io
67 * @param flush if a flush bucket should be appended to any output
69 apr_status_t h2_conn_io_flush(h2_conn_io *io);
72 * Check if the buffered amount of data needs flushing.
74 int h2_conn_io_needs_flush(h2_conn_io *io);
76 #endif /* defined(__mod_h2__h2_conn_io__) */