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 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef h2_proxy_session_h
18 #define h2_proxy_session_h
19 
20 #define H2_ALEN(a) (sizeof(a)/sizeof((a)[0]))
21 
22 #include <nghttp2/nghttp2.h>
23 
24 struct h2_proxy_iqueue;
25 struct h2_proxy_ihash_t;
26 
27 typedef enum {
36 
37 typedef enum {
38  H2_PROXYS_ST_INIT, /* send initial SETTINGS, etc. */
39  H2_PROXYS_ST_DONE, /* finished, connection close */
40  H2_PROXYS_ST_IDLE, /* no streams to process */
41  H2_PROXYS_ST_BUSY, /* read/write without stop */
42  H2_PROXYS_ST_WAIT, /* waiting for tasks reporting back */
43  H2_PROXYS_ST_LOCAL_SHUTDOWN, /* we announced GOAWAY */
44  H2_PROXYS_ST_REMOTE_SHUTDOWN, /* client announced GOAWAY */
46 
47 typedef enum {
48  H2_PROXYS_EV_INIT, /* session was initialized */
49  H2_PROXYS_EV_LOCAL_GOAWAY, /* we send a GOAWAY */
50  H2_PROXYS_EV_REMOTE_GOAWAY, /* remote send us a GOAWAY */
51  H2_PROXYS_EV_CONN_ERROR, /* connection error */
52  H2_PROXYS_EV_PROTO_ERROR, /* protocol error */
53  H2_PROXYS_EV_CONN_TIMEOUT, /* connection timeout */
54  H2_PROXYS_EV_NO_IO, /* nothing has been read or written */
55  H2_PROXYS_EV_STREAM_SUBMITTED, /* stream has been submitted */
56  H2_PROXYS_EV_STREAM_DONE, /* stream has been finished */
57  H2_PROXYS_EV_STREAM_RESUMED, /* stream signalled availability of headers/data */
58  H2_PROXYS_EV_DATA_READ, /* connection data has been read */
59  H2_PROXYS_EV_NGH2_DONE, /* nghttp2 wants neither read nor write anything */
60  H2_PROXYS_EV_PRE_CLOSE, /* connection will close after this */
62 
63 
66  apr_status_t status, int touched);
67 
69  const char *id;
74  nghttp2_session *ngh2; /* the nghttp2 session itself */
75 
76  unsigned int aborted : 1;
77  unsigned int check_ping : 1;
78  unsigned int h2_front : 1; /* if front-end connection is HTTP/2 */
79 
81  void *user_data;
82 
83  unsigned char window_bits_stream;
84  unsigned char window_bits_connection;
85 
88 
92  int last_stream_id; /* last stream id processed by backend, or 0 */
94 
97 };
98 
101  int h2_front,
102  unsigned char window_bits_connection,
103  unsigned char window_bits_stream,
104  h2_proxy_request_done *done);
105 
107  request_rec *r, int standalone);
108 
118 
120 
122 
124  conn_rec *c, apr_off_t bytes);
125 
126 #define H2_PROXY_REQ_URL_NOTE "h2-proxy-req-url"
127 
128 #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:93
int last_stream_id
Definition: h2_proxy_session.h:92
void h2_proxy_session_cancel_all(h2_proxy_session *s)
Definition: h2_proxy_session.h:68
Definition: h2_proxy_session.h:56
h2_proxys_state state
Definition: h2_proxy_session.h:86
Definition: h2_proxy_session.h:43
struct h2_proxy_iqueue * suspended
Definition: h2_proxy_session.h:90
Definition: h2_proxy_session.h:49
h2_proxy_request_done * done
Definition: h2_proxy_session.h:80
unsigned char window_bits_stream
Definition: h2_proxy_session.h:83
Definition: h2_proxy_session.h:30
Definition: h2_proxy_session.h:59
Definition: h2_proxy_session.h:48
Definition: h2_proxy_session.h:34
void h2_proxy_request_done(h2_proxy_session *s, request_rec *r, apr_status_t status, int touched)
Definition: h2_proxy_session.h:65
Definition: h2_proxy_session.h:28
conn_rec * c
Definition: h2_proxy_session.h:70
apr_bucket_brigade * output
Definition: h2_proxy_session.h:96
Definition: apr_buckets.h:258
proxy_conn_rec * p_conn
Definition: h2_proxy_session.h:71
h2_proxys_state
Definition: h2_proxy_session.h:37
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
Definition: h2_proxy_session.h:40
Structure to store things which are per connection.
Definition: httpd.h:1124
unsigned int h2_front
Definition: h2_proxy_session.h:78
struct h2_proxy_ihash_t h2_proxy_ihash_t
Definition: h2_proxy_util.h:31
Definition: mod_proxy.h:146
Definition: h2_proxy_session.h:42
unsigned int check_ping
Definition: h2_proxy_session.h:77
h2_proxy_stream_state_t
Definition: h2_proxy_session.h:27
apr_int64_t apr_time_t
Definition: apr_time.h:45
unsigned char window_bits_connection
Definition: h2_proxy_session.h:84
Definition: h2_proxy_session.h:32
Definition: h2_proxy_util.h:66
void * user_data
Definition: h2_proxy_session.h:81
const char * id
Definition: h2_proxy_session.h:69
Definition: mod_proxy.h:254
Definition: h2_proxy_session.h:29
Definition: h2_proxy_session.h:55
Definition: h2_proxy_session.h:57
Definition: h2_proxy_session.h:50
apr_size_t remote_max_concurrent
Definition: h2_proxy_session.h:91
nghttp2_session * ngh2
Definition: h2_proxy_session.h:74
proxy_worker proxy_server_conf char * url
Definition: mod_proxy.h:611
proxy_server_conf * conf
Definition: h2_proxy_session.h:72
Definition: h2_proxy_session.h:39
Definition: h2_proxy_session.h:52
Definition: h2_proxy_session.h:38
apr_bucket_brigade * input
Definition: h2_proxy_session.h:95
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:811
apr_pool_t * pool
Definition: h2_proxy_session.h:73
Definition: h2_proxy_session.h:60
Definition: h2_proxy_session.h:44
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:76
int apr_status_t
Definition: apr_errno.h:44
request_rec * r
Definition: mod_dav.h:515
apr_status_t h2_proxy_session_process(h2_proxy_session *s)
Definition: h2_proxy_session.h:33
proxy_worker proxy_server_conf * conf
Definition: mod_proxy.h:611
Definition: h2_proxy_session.h:51
h2_proxys_event_t
Definition: h2_proxy_session.h:47
Definition: h2_proxy_session.h:31
struct h2_proxy_ihash_t * streams
Definition: h2_proxy_session.h:89
off_t apr_off_t
Definition: apr.h:377
apr_interval_time_t wait_timeout
Definition: h2_proxy_session.h:87
Definition: h2_proxy_session.h:54
Definition: h2_proxy_session.h:41
Definition: h2_proxy_session.h:58
Definition: h2_proxy_session.h:53