Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_proxy_session.h
Go to the documentation of this file.
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 h2_proxy_session_h
17 #define h2_proxy_session_h
18 
19 #define H2_ALEN(a) (sizeof(a)/sizeof((a)[0]))
20 
21 #include <nghttp2/nghttp2.h>
22 
23 struct h2_proxy_iqueue;
24 struct h2_proxy_ihash_t;
25 
26 typedef enum {
27  H2_PROXYS_ST_INIT, /* send initial SETTINGS, etc. */
28  H2_PROXYS_ST_DONE, /* finished, connection close */
29  H2_PROXYS_ST_IDLE, /* no streams to process */
30  H2_PROXYS_ST_BUSY, /* read/write without stop */
31  H2_PROXYS_ST_WAIT, /* waiting for tasks reporting back */
32  H2_PROXYS_ST_LOCAL_SHUTDOWN, /* we announced GOAWAY */
33  H2_PROXYS_ST_REMOTE_SHUTDOWN, /* client announced GOAWAY */
35 
36 typedef enum {
37  H2_PROXYS_EV_INIT, /* session was initialized */
38  H2_PROXYS_EV_LOCAL_GOAWAY, /* we send a GOAWAY */
39  H2_PROXYS_EV_REMOTE_GOAWAY, /* remote send us a GOAWAY */
40  H2_PROXYS_EV_CONN_ERROR, /* connection error */
41  H2_PROXYS_EV_PROTO_ERROR, /* protocol error */
42  H2_PROXYS_EV_CONN_TIMEOUT, /* connection timeout */
43  H2_PROXYS_EV_NO_IO, /* nothing has been read or written */
44  H2_PROXYS_EV_STREAM_SUBMITTED, /* stream has been submitted */
45  H2_PROXYS_EV_STREAM_DONE, /* stream has been finished */
46  H2_PROXYS_EV_STREAM_RESUMED, /* stream signalled availability of headers/data */
47  H2_PROXYS_EV_DATA_READ, /* connection data has been read */
48  H2_PROXYS_EV_NGH2_DONE, /* nghttp2 wants neither read nor write anything */
49  H2_PROXYS_EV_PRE_CLOSE, /* connection will close after this */
51 
52 
55  apr_status_t status, int touched);
56 
58  const char *id;
63  nghttp2_session *ngh2; /* the nghttp2 session itself */
64 
65  unsigned int aborted : 1;
66  unsigned int check_ping : 1;
67  unsigned int h2_front : 1; /* if front-end connection is HTTP/2 */
68 
70  void *user_data;
71 
72  unsigned char window_bits_stream;
73  unsigned char window_bits_connection;
74 
77 
81  int last_stream_id; /* last stream id processed by backend, or 0 */
83 
86 };
87 
90  int h2_front,
91  unsigned char window_bits_connection,
92  unsigned char window_bits_stream,
93  h2_proxy_request_done *done);
94 
96  request_rec *r, int standalone);
97 
107 
109 
111 
113  conn_rec *c, apr_off_t bytes);
114 
115 #define H2_PROXY_REQ_URL_NOTE "h2-proxy-req-url"
116 
117 #endif /* h2_proxy_session_h */
size_t apr_size_t
Definition: apr.h:375
apr_time_t last_frame_received
Definition: h2_proxy_session.h:82
int last_stream_id
Definition: h2_proxy_session.h:81
void h2_proxy_session_cancel_all(h2_proxy_session *s)
Definition: h2_proxy_session.h:57
Definition: h2_proxy_session.h:45
h2_proxys_state state
Definition: h2_proxy_session.h:75
Definition: h2_proxy_session.h:32
struct h2_proxy_iqueue * suspended
Definition: h2_proxy_session.h:79
Definition: h2_proxy_session.h:38
h2_proxy_request_done * done
Definition: h2_proxy_session.h:69
unsigned char window_bits_stream
Definition: h2_proxy_session.h:72
Definition: h2_proxy_session.h:48
Definition: h2_proxy_session.h:37
void h2_proxy_request_done(h2_proxy_session *s, request_rec *r, apr_status_t status, int touched)
Definition: h2_proxy_session.h:54
conn_rec * c
Definition: h2_proxy_session.h:59
apr_bucket_brigade * output
Definition: h2_proxy_session.h:85
Definition: apr_buckets.h:258
proxy_conn_rec * p_conn
Definition: h2_proxy_session.h:60
h2_proxys_state
Definition: h2_proxy_session.h:26
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
Definition: h2_proxy_session.h:29
Structure to store things which are per connection.
Definition: httpd.h:1110
unsigned int h2_front
Definition: h2_proxy_session.h:67
struct h2_proxy_ihash_t h2_proxy_ihash_t
Definition: h2_proxy_util.h:30
Definition: mod_proxy.h:146
Definition: h2_proxy_session.h:31
unsigned int check_ping
Definition: h2_proxy_session.h:66
apr_int64_t apr_time_t
Definition: apr_time.h:45
unsigned char window_bits_connection
Definition: h2_proxy_session.h:73
Definition: h2_proxy_util.h:65
void * user_data
Definition: h2_proxy_session.h:70
const char * id
Definition: h2_proxy_session.h:58
Definition: mod_proxy.h:253
Definition: h2_proxy_session.h:44
Definition: h2_proxy_session.h:46
Definition: h2_proxy_session.h:39
apr_size_t remote_max_concurrent
Definition: h2_proxy_session.h:80
nghttp2_session * ngh2
Definition: h2_proxy_session.h:63
proxy_worker proxy_server_conf char * url
Definition: mod_proxy.h:602
proxy_server_conf * conf
Definition: h2_proxy_session.h:61
Definition: h2_proxy_session.h:28
Definition: h2_proxy_session.h:41
Definition: h2_proxy_session.h:27
apr_bucket_brigade * input
Definition: h2_proxy_session.h:84
apr_status_t h2_proxy_session_submit(h2_proxy_session *s, const char *url, request_rec *r, int standalone)
A structure that represents the current request.
Definition: httpd.h:805
apr_pool_t * pool
Definition: h2_proxy_session.h:62
Definition: h2_proxy_session.h:49
Definition: h2_proxy_session.h:33
void h2_proxy_session_cleanup(h2_proxy_session *s, h2_proxy_request_done *done)
void h2_proxy_session_update_window(h2_proxy_session *s, conn_rec *c, apr_off_t bytes)
int status
Definition: mod_dav.h:141
h2_proxy_session * h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn, proxy_server_conf *conf, int h2_front, unsigned char window_bits_connection, unsigned char window_bits_stream, h2_proxy_request_done *done)
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
unsigned int aborted
Definition: h2_proxy_session.h:65
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:519
apr_status_t h2_proxy_session_process(h2_proxy_session *s)
proxy_worker proxy_server_conf * conf
Definition: mod_proxy.h:602
Definition: h2_proxy_session.h:40
h2_proxys_event_t
Definition: h2_proxy_session.h:36
struct h2_proxy_ihash_t * streams
Definition: h2_proxy_session.h:78
off_t apr_off_t
Definition: apr.h:377
apr_interval_time_t wait_timeout
Definition: h2_proxy_session.h:76
Definition: h2_proxy_session.h:43
Definition: h2_proxy_session.h:30
Definition: h2_proxy_session.h:47
Definition: h2_proxy_session.h:42