Apache2
h2_bucket_beam.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_bucket_beam_h
18 #define h2_bucket_beam_h
19 
20 #include "h2_conn_ctx.h"
21 
22 struct apr_thread_mutex_t;
23 struct apr_thread_cond_t;
24 
30 typedef struct h2_bucket_beam h2_bucket_beam;
31 
32 typedef void h2_beam_io_callback(void *ctx, h2_bucket_beam *beam,
33  apr_off_t bytes);
34 typedef void h2_beam_ev_callback(void *ctx, h2_bucket_beam *beam);
35 
40 typedef struct {
41  APR_RING_HEAD(h2_bucket_list, apr_bucket) list;
42 } h2_blist;
43 
45  int id;
46  const char *name;
52 
55 
56  int aborted;
57  int closed;
58  int tx_mem_limits; /* only memory size counts on transfers */
60 
63 
64  h2_beam_ev_callback *was_empty_cb; /* event: beam changed to non-empty in h2_beam_send() */
66  h2_beam_ev_callback *recv_cb; /* event: buckets were transfered in h2_beam_receive() */
67  void *recv_ctx;
68  h2_beam_ev_callback *send_cb; /* event: buckets were added in h2_beam_send() */
69  void *send_ctx;
70  h2_beam_ev_callback *eagain_cb; /* event: a receive results in ARP_EAGAIN */
71  void *eagain_ctx;
72 
73  apr_off_t recv_bytes; /* amount of bytes transferred in h2_beam_receive() */
74  apr_off_t recv_bytes_reported; /* amount of bytes reported as received via callback */
75  h2_beam_io_callback *cons_io_cb; /* report: recv_bytes deltas for sender */
76  void *cons_ctx;
77 };
78 
96  conn_rec *from,
97  apr_pool_t *pool,
98  int id, const char *tag,
99  apr_size_t buffer_size,
100  apr_interval_time_t timeout);
101 
106 
110 void h2_beam_set_copy_files(h2_bucket_beam * beam, int enabled);
111 
130  apr_off_t *pwritten);
131 
149 
154 
162 
170 
175  apr_interval_time_t timeout);
176 
178 
183  apr_size_t buffer_size);
185 
198  h2_beam_io_callback *io_cb, void *ctx);
199 
208  h2_beam_ev_callback *recv_cb, void *ctx);
209 
218  h2_beam_ev_callback *eagain_cb, void *ctx);
219 
229  h2_beam_ev_callback *on_send_cb, void *ctx);
230 
240  h2_beam_ev_callback *was_empty_cb, void *ctx);
241 
250 
255 
260 
266 
267 #endif /* h2_bucket_beam_h */
apr_read_type_e
Definition: apr_buckets.h:62
apr_bucket_brigade ap_input_mode_t apr_read_type_e apr_off_t readbytes
Definition: mod_dav.h:2664
apr_bucket_brigade * bb
Definition: mod_dav.h:555
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
apr_bucket_brigade ap_input_mode_t apr_read_type_e block
Definition: mod_dav.h:2663
int apr_status_t
Definition: apr_errno.h:44
off_t apr_off_t
Definition: apr.h:396
size_t apr_size_t
Definition: apr.h:394
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
void h2_beam_ev_callback(void *ctx, h2_bucket_beam *beam)
Definition: h2_bucket_beam.h:34
apr_status_t h2_beam_create(h2_bucket_beam **pbeam, conn_rec *from, apr_pool_t *pool, int id, const char *tag, apr_size_t buffer_size, apr_interval_time_t timeout)
void h2_beam_abort(h2_bucket_beam *beam, conn_rec *c)
apr_size_t h2_beam_buffer_size_get(h2_bucket_beam *beam)
void h2_beam_on_received(h2_bucket_beam *beam, h2_beam_ev_callback *recv_cb, void *ctx)
apr_interval_time_t h2_beam_timeout_get(h2_bucket_beam *beam)
void h2_beam_on_eagain(h2_bucket_beam *beam, h2_beam_ev_callback *eagain_cb, void *ctx)
apr_status_t h2_beam_destroy(h2_bucket_beam *beam, conn_rec *c)
void h2_beam_on_send(h2_bucket_beam *beam, h2_beam_ev_callback *on_send_cb, void *ctx)
void h2_beam_on_was_empty(h2_bucket_beam *beam, h2_beam_ev_callback *was_empty_cb, void *ctx)
int h2_beam_empty(h2_bucket_beam *beam)
void h2_beam_timeout_set(h2_bucket_beam *beam, apr_interval_time_t timeout)
void h2_beam_close(h2_bucket_beam *beam, conn_rec *c)
apr_off_t h2_beam_get_mem_used(h2_bucket_beam *beam)
int h2_beam_is_complete(h2_bucket_beam *beam)
apr_status_t h2_beam_send(h2_bucket_beam *beam, conn_rec *from, apr_bucket_brigade *bb, apr_read_type_e block, apr_off_t *pwritten)
void h2_beam_set_copy_files(h2_bucket_beam *beam, int enabled)
int h2_beam_report_consumption(h2_bucket_beam *beam)
void h2_beam_on_consumed(h2_bucket_beam *beam, h2_beam_io_callback *io_cb, void *ctx)
void h2_beam_io_callback(void *ctx, h2_bucket_beam *beam, apr_off_t bytes)
Definition: h2_bucket_beam.h:32
apr_off_t h2_beam_get_buffered(h2_bucket_beam *beam)
void h2_beam_buffer_size_set(h2_bucket_beam *beam, apr_size_t buffer_size)
apr_status_t h2_beam_receive(h2_bucket_beam *beam, conn_rec *to, apr_bucket_brigade *bb, apr_read_type_e block, apr_off_t readbytes)
Definition: apr_buckets.h:263
Definition: apr_buckets.h:229
Definition: apr_arch_thread_cond.h:34
Definition: apr_arch_thread_mutex.h:28
Structure to store things which are per connection.
Definition: httpd.h:1193
Definition: h2_bucket_beam.h:40
APR_RING_HEAD(h2_bucket_list, apr_bucket) list
Definition: h2_bucket_beam.h:44
h2_blist buckets_consumed
Definition: h2_bucket_beam.h:50
void * eagain_ctx
Definition: h2_bucket_beam.h:71
apr_pool_t * pool
Definition: h2_bucket_beam.h:48
void * cons_ctx
Definition: h2_bucket_beam.h:76
const char * name
Definition: h2_bucket_beam.h:46
int id
Definition: h2_bucket_beam.h:45
int copy_files
Definition: h2_bucket_beam.h:59
h2_blist buckets_eor
Definition: h2_bucket_beam.h:51
struct apr_thread_cond_t * change
Definition: h2_bucket_beam.h:62
h2_beam_ev_callback * eagain_cb
Definition: h2_bucket_beam.h:70
int tx_mem_limits
Definition: h2_bucket_beam.h:58
int aborted
Definition: h2_bucket_beam.h:56
h2_beam_ev_callback * recv_cb
Definition: h2_bucket_beam.h:66
void * send_ctx
Definition: h2_bucket_beam.h:69
apr_off_t recv_bytes_reported
Definition: h2_bucket_beam.h:74
h2_beam_ev_callback * send_cb
Definition: h2_bucket_beam.h:68
int closed
Definition: h2_bucket_beam.h:57
apr_size_t max_buf_size
Definition: h2_bucket_beam.h:53
apr_off_t recv_bytes
Definition: h2_bucket_beam.h:73
void * was_empty_ctx
Definition: h2_bucket_beam.h:65
h2_blist buckets_to_send
Definition: h2_bucket_beam.h:49
apr_interval_time_t timeout
Definition: h2_bucket_beam.h:54
h2_beam_io_callback * cons_io_cb
Definition: h2_bucket_beam.h:75
void * recv_ctx
Definition: h2_bucket_beam.h:67
struct apr_thread_mutex_t * lock
Definition: h2_bucket_beam.h:61
h2_beam_ev_callback * was_empty_cb
Definition: h2_bucket_beam.h:64
conn_rec * from
Definition: h2_bucket_beam.h:47