Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_task.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 __mod_h2__h2_task__
17 #define __mod_h2__h2_task__
18 
19 #include <http_core.h>
20 
40 struct apr_thread_cond_t;
41 struct h2_bucket_beam;
42 struct h2_conn;
43 struct h2_mplx;
44 struct h2_task;
45 struct h2_req_engine;
46 struct h2_request;
47 struct h2_response_parser;
48 struct h2_worker;
49 
50 typedef struct h2_task h2_task;
51 
52 struct h2_task {
53  const char *id;
54  int stream_id;
57 
58  const struct h2_request *request;
59  int rst_error; /* h2 related stream abort error */
60 
61  struct {
63  unsigned int eos : 1;
67  } input;
68  struct {
69  struct h2_bucket_beam *beam;
70  unsigned int opened : 1;
71  unsigned int sent_response : 1;
72  unsigned int copy_files : 1;
73  struct h2_response_parser *rparser;
75  } output;
76 
77  struct h2_mplx *mplx;
79 
80  unsigned int filters_set : 1;
81  unsigned int frozen : 1;
82  unsigned int thawed : 1;
83  unsigned int worker_started : 1; /* h2_worker started processing */
84  unsigned int worker_done : 1; /* h2_worker finished */
85 
86  apr_time_t started_at; /* when processing started */
87  apr_time_t done_at; /* when processing was done */
89 
90  struct h2_req_engine *engine; /* engine hosted by this task */
91  struct h2_req_engine *assigned; /* engine that task has been assigned to */
92 };
93 
94 h2_task *h2_task_create(conn_rec *c, int stream_id,
95  const struct h2_request *req,
96  struct h2_bucket_beam *input,
97  struct h2_bucket_beam *output,
98  struct h2_mplx *mplx);
99 
100 void h2_task_destroy(h2_task *task);
101 
102 apr_status_t h2_task_do(h2_task *task, apr_thread_t *thread, int worker_id);
103 
104 void h2_task_redo(h2_task *task);
105 int h2_task_can_redo(h2_task *task);
106 
110 void h2_task_rst(h2_task *task, int error);
111 
112 void h2_task_register_hooks(void);
113 /*
114  * One time, post config intialization.
115  */
117 
118 extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_in) *h2_task_logio_add_bytes_in;
119 extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *h2_task_logio_add_bytes_out;
120 
123 int h2_task_has_thawed(h2_task *task);
124 
125 #endif /* defined(__mod_h2__h2_task__) */
apr_status_t h2_task_freeze(h2_task *task)
apr_time_t started_at
Definition: h2_task.h:86
struct h2_req_engine h2_req_engine
Definition: mod_http2.h:37
struct h2_task::@5 output
void h2_task_destroy(h2_task *task)
struct h2_req_engine * engine
Definition: h2_task.h:90
unsigned int sent_response
Definition: h2_task.h:71
unsigned int copy_files
Definition: h2_task.h:72
Definition: h2_task.h:52
Definition: h2_mplx.h:62
unsigned int opened
Definition: h2_task.h:70
unsigned int frozen
Definition: h2_task.h:81
unsigned int worker_started
Definition: h2_task.h:83
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:556
struct h2_task::@4 input
apr_bucket * eor
Definition: h2_task.h:88
Definition: h2.h:118
CORE HTTP Daemon.
apr_bucket_brigade * bbchunk
Definition: h2_task.h:65
Definition: h2_bucket_beam.h:177
int h2_task_has_thawed(h2_task *task)
struct h2_mplx * mplx
Definition: h2_task.h:77
int stream_id
Definition: h2_task.h:54
void h2_task_rst(h2_task *task, int error)
Definition: apr_buckets.h:258
apr_time_t done_at
Definition: h2_task.h:87
Structure to store things which are per connection.
Definition: httpd.h:1110
unsigned int thawed
Definition: h2_task.h:82
void h2_task_register_hooks(void)
apr_int64_t apr_time_t
Definition: apr_time.h:45
struct apr_thread_cond_t * cond
Definition: h2_task.h:78
A structure to store information for each virtual server.
Definition: httpd.h:1302
Definition: apr_buckets.h:224
Definition: apr_arch_threadproc.h:42
int rst_error
Definition: h2_task.h:59
int h2_task_can_redo(h2_task *task)
Definition: h2_worker.h:40
struct h2_response_parser * rparser
Definition: h2_task.h:73
unsigned int filters_set
Definition: h2_task.h:80
void ap_logio_add_bytes_in(conn_rec *c, apr_off_t bytes)
apr_status_t h2_task_thaw(h2_task *task)
void ap_logio_add_bytes_out(conn_rec *c, apr_off_t bytes)
apr_off_t chunked_total
Definition: h2_task.h:66
h2_task * h2_task_create(conn_rec *c, int stream_id, const struct h2_request *req, struct h2_bucket_beam *input, struct h2_bucket_beam *output, struct h2_mplx *mplx)
const struct h2_request * request
Definition: h2_task.h:58
struct h2_req_engine * assigned
Definition: h2_task.h:91
unsigned int eos
Definition: h2_task.h:63
struct h2_bucket_beam * beam
Definition: h2_task.h:62
APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_in)*h2_task_logio_add_bytes_in
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_pool_t * pool
Definition: h2_task.h:56
int apr_status_t
Definition: apr_errno.h:44
apr_status_t h2_task_init(apr_pool_t *pool, server_rec *s)
conn_rec * c
Definition: h2_task.h:55
Definition: apr_arch_thread_cond.h:34
apr_bucket_brigade * bb
Definition: h2_task.h:64
void h2_task_redo(h2_task *task)
const char * id
Definition: h2_task.h:53
unsigned int worker_done
Definition: h2_task.h:84
apr_status_t h2_task_do(h2_task *task, apr_thread_t *thread, int worker_id)
off_t apr_off_t
Definition: apr.h:377