Apache2
h2_conn_ctx.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 __mod_h2__h2_conn_ctx__
18 #define __mod_h2__h2_conn_ctx__
19 
20 #include "h2.h"
21 
22 struct h2_session;
23 struct h2_stream;
24 struct h2_mplx;
25 struct h2_bucket_beam;
26 struct h2_response_parser;
27 struct h2_c2_transit;
28 
29 #define H2_PIPE_OUT 0
30 #define H2_PIPE_IN 1
31 
40 struct h2_conn_ctx_t {
41  const char *id; /* c*: our identifier of this connection */
42  server_rec *server; /* c*: httpd server selected. */
43  const char *protocol; /* c1: the protocol negotiated */
44  struct h2_session *session; /* c1: the h2 session established */
45  struct h2_mplx *mplx; /* c2: the multiplexer */
46  struct h2_c2_transit *transit; /* c2: transit pool and bucket_alloc */
47 
48 #if !AP_HAS_RESPONSE_BUCKETS
49  int pre_conn_done; /* has pre_connection setup run? */
50 #endif
51  int stream_id; /* c1: 0, c2: stream id processed */
52  apr_pool_t *req_pool; /* c2: a c2 child pool for a request */
53  const struct h2_request *request; /* c2: the request to process */
54  struct h2_bucket_beam *beam_out; /* c2: data out, created from req_pool */
55  struct h2_bucket_beam *beam_in; /* c2: data in or NULL, borrowed from request stream */
56  unsigned input_chunked:1; /* c2: if input needs HTTP/1.1 chunking applied */
57  unsigned is_upgrade:1; /* c2: if requst is a HTTP Upgrade */
58 
59  apr_file_t *pipe_in[2]; /* c2: input produced notification pipe */
60  apr_pollfd_t pfd; /* c1: poll socket input, c2: NUL */
61 
62  int has_final_response; /* final HTTP response passed on out */
63  apr_status_t last_err; /* APR_SUCCES or last error encountered in filters */
64 
65  apr_off_t bytes_sent; /* c2: bytes acutaly sent via c1 */
66  /* atomic */ apr_uint32_t started; /* c2: processing was started */
67  apr_time_t started_at; /* c2: when processing started */
68  /* atomic */ apr_uint32_t done; /* c2: processing has finished */
69  apr_time_t done_at; /* c2: when processing was done */
70 };
71 typedef struct h2_conn_ctx_t h2_conn_ctx_t;
72 
78 #define h2_conn_ctx_get(c) \
79  ((c)? (h2_conn_ctx_t*)ap_get_module_config((c)->conn_config, &http2_module) : NULL)
80 
89 
91 
93  struct h2_mplx *mplx, struct h2_stream *stream,
94  struct h2_c2_transit *transit);
95 
97 
99 
100 #endif /* defined(__mod_h2__h2_conn_ctx__) */
const char * s
Definition: mod_dav.h:1327
int apr_status_t
Definition: apr_errno.h:44
unsigned int apr_uint32_t
Definition: apr.h:348
off_t apr_off_t
Definition: apr.h:396
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_int64_t apr_time_t
Definition: apr_time.h:45
void h2_conn_ctx_set_timeout(h2_conn_ctx_t *conn_ctx, apr_interval_time_t timeout)
void h2_conn_ctx_assign_session(h2_conn_ctx_t *ctx, struct h2_session *session)
h2_conn_ctx_t * h2_conn_ctx_create_for_c1(conn_rec *c, server_rec *s, const char *protocol)
apr_status_t h2_conn_ctx_init_for_c2(h2_conn_ctx_t **pctx, conn_rec *c, struct h2_mplx *mplx, struct h2_stream *stream, struct h2_c2_transit *transit)
void h2_conn_ctx_detach(conn_rec *c)
Definition: apr_arch_file_io.h:107
Definition: apr_poll.h:109
Structure to store things which are per connection.
Definition: httpd.h:1193
Definition: h2_bucket_beam.h:44
Definition: h2_mplx.h:51
Definition: h2_conn_ctx.h:40
struct h2_mplx * mplx
Definition: h2_conn_ctx.h:45
unsigned input_chunked
Definition: h2_conn_ctx.h:56
apr_pollfd_t pfd
Definition: h2_conn_ctx.h:60
apr_uint32_t done
Definition: h2_conn_ctx.h:68
struct h2_session * session
Definition: h2_conn_ctx.h:44
int pre_conn_done
Definition: h2_conn_ctx.h:49
apr_file_t * pipe_in[2]
Definition: h2_conn_ctx.h:59
unsigned is_upgrade
Definition: h2_conn_ctx.h:57
const struct h2_request * request
Definition: h2_conn_ctx.h:53
struct h2_c2_transit * transit
Definition: h2_conn_ctx.h:46
const char * id
Definition: h2_conn_ctx.h:41
server_rec * server
Definition: h2_conn_ctx.h:42
apr_pool_t * req_pool
Definition: h2_conn_ctx.h:52
const char * protocol
Definition: h2_conn_ctx.h:43
apr_time_t done_at
Definition: h2_conn_ctx.h:69
apr_uint32_t started
Definition: h2_conn_ctx.h:66
apr_time_t started_at
Definition: h2_conn_ctx.h:67
apr_status_t last_err
Definition: h2_conn_ctx.h:63
struct h2_bucket_beam * beam_out
Definition: h2_conn_ctx.h:54
int stream_id
Definition: h2_conn_ctx.h:51
int has_final_response
Definition: h2_conn_ctx.h:62
struct h2_bucket_beam * beam_in
Definition: h2_conn_ctx.h:55
apr_off_t bytes_sent
Definition: h2_conn_ctx.h:65
Definition: h2_mplx.h:58
Definition: h2.h:169
Definition: h2_session.h:64
Definition: h2_stream.h:78
A structure to store information for each virtual server.
Definition: httpd.h:1382