|
Apache HTTPD
|
#include <apr_lib.h>#include <apr_atomic.h>#include <apr_strings.h>#include <apr_time.h>#include <apr_buckets.h>#include <apr_thread_mutex.h>#include <apr_thread_cond.h>#include <httpd.h>#include <http_protocol.h>#include <http_request.h>#include <http_log.h>#include "h2_private.h"#include "h2_conn_ctx.h"#include "h2_headers.h"#include "h2_util.h"#include "h2_bucket_beam.h"Go to the source code of this file.
Macros | |
| #define | H2_BLIST_INIT(b) APR_RING_INIT(&(b)->list, apr_bucket, link); |
| #define | H2_BLIST_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link) |
| #define | H2_BLIST_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link) |
| #define | H2_BLIST_FIRST(b) APR_RING_FIRST(&(b)->list) |
| #define | H2_BLIST_LAST(b) APR_RING_LAST(&(b)->list) |
| #define | H2_BLIST_INSERT_HEAD(b, e) |
| #define | H2_BLIST_INSERT_TAIL(b, e) |
| #define | H2_BLIST_CONCAT(a, b) |
| #define | H2_BLIST_PREPEND(a, b) |
| #define | H2_BEAM_LOG(beam, c, level, rv, msg, bb) |
Definition at line 73 of file h2_bucket_beam.c.
Definition at line 50 of file h2_bucket_beam.c.
| #define H2_BLIST_EMPTY | ( | b | ) | APR_RING_EMPTY(&(b)->list, apr_bucket, link) |
Definition at line 39 of file h2_bucket_beam.c.
| #define H2_BLIST_FIRST | ( | b | ) | APR_RING_FIRST(&(b)->list) |
Definition at line 40 of file h2_bucket_beam.c.
| #define H2_BLIST_INIT | ( | b | ) | APR_RING_INIT(&(b)->list, apr_bucket, link); |
Definition at line 37 of file h2_bucket_beam.c.
Definition at line 42 of file h2_bucket_beam.c.
Definition at line 46 of file h2_bucket_beam.c.
| #define H2_BLIST_LAST | ( | b | ) | APR_RING_LAST(&(b)->list) |
Definition at line 41 of file h2_bucket_beam.c.
Definition at line 53 of file h2_bucket_beam.c.
| #define H2_BLIST_SENTINEL | ( | b | ) | APR_RING_SENTINEL(&(b)->list, apr_bucket, link) |
Definition at line 38 of file h2_bucket_beam.c.
|
static |
Definition at line 420 of file h2_bucket_beam.c.
|
static |
Definition at line 281 of file h2_bucket_beam.c.
|
static |
Definition at line 260 of file h2_bucket_beam.c.
|
static |
Definition at line 92 of file h2_bucket_beam.c.
|
static |
Definition at line 102 of file h2_bucket_beam.c.
|
static |
Definition at line 190 of file h2_bucket_beam.c.
|
static |
Definition at line 133 of file h2_bucket_beam.c.
|
static |
Definition at line 181 of file h2_bucket_beam.c.
|
static |
Definition at line 804 of file h2_bucket_beam.c.
| void h2_beam_abort | ( | h2_bucket_beam * | beam, |
| conn_rec * | c | ||
| ) |
Abort the beam, either from receiving or sending side.
| beam | the beam to abort |
| c | the connection the caller is working with |
Definition at line 376 of file h2_bucket_beam.c.
| apr_size_t h2_beam_buffer_size_get | ( | h2_bucket_beam * | beam | ) |
Definition at line 349 of file h2_bucket_beam.c.
| void h2_beam_buffer_size_set | ( | h2_bucket_beam * | beam, |
| apr_size_t | buffer_size | ||
| ) |
Set/get the maximum buffer size for beam data (memory footprint).
Definition at line 335 of file h2_bucket_beam.c.
| void h2_beam_close | ( | h2_bucket_beam * | beam, |
| conn_rec * | c | ||
| ) |
Close the beam. Make certain an EOS is sent.
| beam | the beam to abort |
| c | the connection the caller is working with |
Definition at line 402 of file h2_bucket_beam.c.
| 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 | ||
| ) |
Creates a new bucket beam for transfer of buckets across threads.
The pool the beam is created with will be protected by the given mutex and will be used in multiple threads. It needs a pool allocator that is only used inside that same mutex.
| pbeam | will hold the created beam on return |
| c_from | connection from which buchets are sent |
| pool | pool owning the beam, beam will cleanup when pool released |
| id | identifier of the beam |
| tag | tag identifying beam for logging |
| buffer_size | maximum memory footprint of buckets buffered in beam, or 0 for no limitation |
| timeout | timeout for blocking operations |
Definition at line 300 of file h2_bucket_beam.c.
| apr_status_t h2_beam_destroy | ( | h2_bucket_beam * | beam, |
| conn_rec * | c | ||
| ) |
Destroys the beam immediately without cleanup.
Definition at line 290 of file h2_bucket_beam.c.
| int h2_beam_empty | ( | h2_bucket_beam * | beam | ) |
Determine if beam is empty.
Definition at line 843 of file h2_bucket_beam.c.
| apr_off_t h2_beam_get_buffered | ( | h2_bucket_beam * | beam | ) |
Get the amount of bytes currently buffered in the beam (unread).
Definition at line 818 of file h2_bucket_beam.c.
| apr_off_t h2_beam_get_mem_used | ( | h2_bucket_beam * | beam | ) |
Get the memory used by the buffered buckets, approximately.
Definition at line 828 of file h2_bucket_beam.c.
| int h2_beam_is_complete | ( | h2_bucket_beam * | beam | ) |
Definition at line 863 of file h2_bucket_beam.c.
| void h2_beam_on_consumed | ( | h2_bucket_beam * | beam, |
| h2_beam_io_callback * | io_cb, | ||
| void * | ctx | ||
| ) |
Register a callback to be invoked on the sender side with the amount of bytes that have been consumed by the receiver, since the last callback invocation or reset.
| beam | the beam to set the callback on |
| io_cb | the callback or NULL, called on sender with bytes consumed |
| ctx | the context to use in callback invocation |
Call from the sender side, io callbacks invoked on sender side, ev callback from any side.
Definition at line 758 of file h2_bucket_beam.c.
| void h2_beam_on_eagain | ( | h2_bucket_beam * | beam, |
| h2_beam_ev_callback * | eagain_cb, | ||
| void * | ctx | ||
| ) |
Register a callback to be invoked on the receiver side whenever APR_EAGAIN is being returned in h2_beam_receive().
| beam | the beam to set the callback on |
| egain_cb | the callback or NULL, called before APR_EAGAIN is returned |
| ctx | the context to use in callback invocation |
Definition at line 776 of file h2_bucket_beam.c.
| void h2_beam_on_received | ( | h2_bucket_beam * | beam, |
| h2_beam_ev_callback * | recv_cb, | ||
| void * | ctx | ||
| ) |
Register a callback to be invoked on the receiver side whenever buckets have been transfered in a h2_beam_receive() call.
| beam | the beam to set the callback on |
| recv_cb | the callback or NULL, called when buckets are received |
| ctx | the context to use in callback invocation |
Definition at line 767 of file h2_bucket_beam.c.
| void h2_beam_on_send | ( | h2_bucket_beam * | beam, |
| h2_beam_ev_callback * | on_send_cb, | ||
| void * | ctx | ||
| ) |
Register a call back from the sender side to be invoked when send has added buckets to the beam. Unregister by passing a NULL on_send_cb.
| beam | the beam to set the callback on |
| on_send_cb | the callback to invoke after buckets were added |
| ctx | the context to use in callback invocation |
Definition at line 785 of file h2_bucket_beam.c.
| void h2_beam_on_was_empty | ( | h2_bucket_beam * | beam, |
| h2_beam_ev_callback * | was_empty_cb, | ||
| void * | ctx | ||
| ) |
Register a call back from the sender side to be invoked when send has added to a previously empty beam. Unregister by passing a NULL was_empty_cb.
| beam | the beam to set the callback on |
| was_empty_cb | the callback to invoke on blocked send |
| ctx | the context to use in callback invocation |
Definition at line 794 of file h2_bucket_beam.c.
| 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 | ||
| ) |
Receive buckets from the beam into the given brigade. The caller is operating on connection to.
| beam | the beam to receive buckets from |
| to | the connection the receiver is working with |
| bb | the bucket brigade to append to |
| block | if the read should block when buckets are unavailable |
| readbytes | the amount of data the receiver wants |
Definition at line 596 of file h2_bucket_beam.c.
| int h2_beam_report_consumption | ( | h2_bucket_beam * | beam | ) |
Call any registered consumed handler, if any changes have happened since the last invocation.
Needs to be invoked from the sending side.
Definition at line 853 of file h2_bucket_beam.c.
| 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 | ||
| ) |
Send buckets from the given brigade through the beam. This can block of the amount of bucket data is above the buffer limit.
| beam | the beam to add buckets to |
| from | the connection the sender operates on, must be the same as used to create the beam |
| bb | the brigade to take buckets from |
| block | if the sending should block when the buffer is full |
| pwritten | on return, contains the number of data bytes sent |
Definition at line 530 of file h2_bucket_beam.c.
| void h2_beam_set_copy_files | ( | h2_bucket_beam * | beam, |
| int | enabled | ||
| ) |
Switch copying of file buckets on/off.
Definition at line 342 of file h2_bucket_beam.c.
| apr_interval_time_t h2_beam_timeout_get | ( | h2_bucket_beam * | beam | ) |
Definition at line 359 of file h2_bucket_beam.c.
| void h2_beam_timeout_set | ( | h2_bucket_beam * | beam, |
| apr_interval_time_t | timeout | ||
| ) |
Set/get the timeout for blocking sebd/receive operations.
Definition at line 369 of file h2_bucket_beam.c.
Definition at line 250 of file h2_bucket_beam.c.
Definition at line 61 of file h2_bucket_beam.c.
|
static |
Definition at line 153 of file h2_bucket_beam.c.
|
static |
Definition at line 170 of file h2_bucket_beam.c.
|
static |
Definition at line 113 of file h2_bucket_beam.c.
|
static |
Definition at line 195 of file h2_bucket_beam.c.
|
static |
Definition at line 221 of file h2_bucket_beam.c.