]> granicus.if.org Git - apache/blob - modules/http2/h2_conn_io.h
merged latest changes in 2.4.x
[apache] / modules / http2 / h2_conn_io.h
1 /* Copyright 2015 greenbytes GmbH (https://www.greenbytes.de)
2  *
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
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  
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.
14  */
15
16 #ifndef __mod_h2__h2_conn_io__
17 #define __mod_h2__h2_conn_io__
18
19 /* h2_io is the basic handler of a httpd connection. It keeps two brigades,
20  * one for input, one for output and works with the installed connection
21  * filters.
22  * The read is done via a callback function, so that input can be processed
23  * directly without copying.
24  */
25 typedef struct {
26     conn_rec *connection;
27     apr_bucket_brigade *input;
28     apr_bucket_brigade *output;
29     int buffer_output;
30     int write_size;
31     apr_time_t last_write;
32     apr_size_t bytes_written;
33     
34     char *buffer;
35     apr_size_t buflen;
36     apr_size_t bufsize;
37     int unflushed;
38 } h2_conn_io;
39
40 apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c);
41 void h2_conn_io_destroy(h2_conn_io *io);
42
43 typedef apr_status_t (*h2_conn_io_on_read_cb)(const char *data, apr_size_t len,
44                                          apr_size_t *readlen, int *done,
45                                          void *puser);
46
47 apr_status_t h2_conn_io_read(h2_conn_io *io,
48                         apr_read_type_e block,
49                         h2_conn_io_on_read_cb on_read_cb,
50                         void *puser);
51
52 apr_status_t h2_conn_io_write(h2_conn_io *io,
53                          const char *buf,
54                          size_t length);
55
56 apr_status_t h2_conn_io_flush(h2_conn_io *io);
57
58 #endif /* defined(__mod_h2__h2_conn_io__) */