Apache2
|
Go to the source code of this file.
Data Structures | |
struct | h2_iqueue |
struct | h2_ngheader |
Macros | |
#define | H2_HD_MATCH_LIT(l, name, nlen) ((nlen == sizeof(l) - 1) && !ap_cstr_casecmp(l, name)) |
#define | h2_util_bb_log(c, sid, level, tag, bb) |
Typedefs | |
typedef struct h2_ihash_t | h2_ihash_t |
typedef int | h2_ihash_iter_t(void *ctx, void *val) |
typedef struct h2_iqueue | h2_iqueue |
typedef int | h2_iq_cmp(int i1, int i2, void *ctx) |
typedef struct h2_fifo | h2_fifo |
typedef h2_fifo_op_t | h2_fifo_peek_fn(void *head, void *ctx) |
typedef struct h2_ififo | h2_ififo |
typedef h2_fifo_op_t | h2_ififo_peek_fn(int head, void *ctx) |
typedef struct h2_ngheader | h2_ngheader |
typedef apr_status_t | h2_util_pass_cb(void *ctx, const char *data, apr_off_t len) |
typedef int | h2_bucket_gate(apr_bucket *b) |
Enumerations | |
enum | h2_fifo_op_t { H2_FIFO_OP_PULL , H2_FIFO_OP_REPUSH } |
#define H2_HD_MATCH_LIT | ( | l, | |
name, | |||
nlen | |||
) | ((nlen == sizeof(l) - 1) && !ap_cstr_casecmp(l, name)) |
Match a header value against a string constance, case insensitive
#define h2_util_bb_log | ( | c, | |
sid, | |||
level, | |||
tag, | |||
bb | |||
) |
Logs the bucket brigade (which bucket types with what length) to the log at the given level.
c | the connection to log for |
sid | the stream identifier this brigade belongs to |
level | the log level (as in APLOG_*) |
tag | a short message text about the context |
bb | the brigade to log |
typedef int h2_bucket_gate(apr_bucket *b) |
A thread-safe FIFO queue with some extra bells and whistles, if you do not need anything special, better use 'apr_queue'.
typedef h2_fifo_op_t h2_fifo_peek_fn(void *head, void *ctx) |
A thread-safe FIFO queue with some extra bells and whistles, if you do not need anything special, better use 'apr_queue'.
typedef h2_fifo_op_t h2_ififo_peek_fn(int head, void *ctx) |
typedef int h2_ihash_iter_t(void *ctx, void *val) |
typedef struct h2_ihash_t h2_ihash_t |
Comparator for two int to determine their order.
i1 | first int to compare |
i2 | second int to compare |
ctx | provided user data |
typedef struct h2_ngheader h2_ngheader |
typedef apr_status_t h2_util_pass_cb(void *ctx, const char *data, apr_off_t len) |
enum h2_fifo_op_t |
apr_status_t h2_append_brigade | ( | apr_bucket_brigade * | to, |
apr_bucket_brigade * | from, | ||
apr_off_t * | plen, | ||
int * | peos, | ||
h2_bucket_gate * | should_append | ||
) |
Transfer buckets from one brigade to another with a limit on the maximum amount of bytes transferred. Does no setaside magic, lifetime of brigades must fit.
to | brigade to transfer buckets to |
from | brigades to remove buckets from |
plen | maximum bytes to transfer, actual bytes transferred |
peos | if an EOS bucket was transferred |
apr_status_t h2_brigade_concat_length | ( | apr_bucket_brigade * | dest, |
apr_bucket_brigade * | src, | ||
apr_off_t | length | ||
) |
Concatenate at most length bytes from src to dest brigade, splitting buckets if necessary and reading buckets of indeterminate length.
apr_status_t h2_brigade_copy_length | ( | apr_bucket_brigade * | dest, |
apr_bucket_brigade * | src, | ||
apr_off_t | length | ||
) |
Copy at most length bytes from src to dest brigade, splitting buckets if necessary and reading buckets of indeterminate length.
apr_off_t h2_brigade_mem_size | ( | apr_bucket_brigade * | bb | ) |
Get an approximnation of the memory footprint of the given brigade. This varies from apr_brigade_length as
apr_status_t h2_fifo_create | ( | h2_fifo ** | pfifo, |
apr_pool_t * | pool, | ||
int | capacity | ||
) |
Create a FIFO queue that can hold up to capacity elements. Elements can appear several times.
apr_status_t h2_fifo_peek | ( | h2_fifo * | fifo, |
h2_fifo_peek_fn * | fn, | ||
void * | ctx | ||
) |
Call given function on the head of the queue, once it exists, and perform the returned operation on it. The queue will hold its lock during this time, so no other operations on the queue are possible.
fifo | the queue to peek at |
fn | the function to call on the head, once available |
ctx | context to pass in call to function |
apr_status_t h2_fifo_pull | ( | h2_fifo * | fifo, |
void ** | pelem | ||
) |
apr_status_t h2_fifo_push | ( | h2_fifo * | fifo, |
void * | elem | ||
) |
Push en element into the queue. Blocks if there is no capacity left.
fifo | the FIFO queue |
elem | the element to push |
apr_status_t h2_fifo_remove | ( | h2_fifo * | fifo, |
void * | elem | ||
) |
Remove the elem from the queue, will remove multiple appearances.
elem | the element to remove |
apr_status_t h2_fifo_set_create | ( | h2_fifo ** | pfifo, |
apr_pool_t * | pool, | ||
int | capacity | ||
) |
Create a FIFO set that can hold up to capacity elements. Elements only appear once. Pushing an element already present does not change the queue and is successful.
apr_status_t h2_fifo_term | ( | h2_fifo * | fifo | ) |
apr_status_t h2_fifo_try_peek | ( | h2_fifo * | fifo, |
h2_fifo_peek_fn * | fn, | ||
void * | ctx | ||
) |
Non-blocking version of h2_fifo_peek.
apr_status_t h2_fifo_try_pull | ( | h2_fifo * | fifo, |
void ** | pelem | ||
) |
apr_status_t h2_fifo_try_push | ( | h2_fifo * | fifo, |
void * | elem | ||
) |
apr_status_t h2_ififo_create | ( | h2_ififo ** | pfifo, |
apr_pool_t * | pool, | ||
int | capacity | ||
) |
Create a FIFO queue that can hold up to capacity int. ints can appear several times.
apr_status_t h2_ififo_peek | ( | h2_ififo * | fifo, |
h2_ififo_peek_fn * | fn, | ||
void * | ctx | ||
) |
Call given function on the head of the queue, once it exists, and perform the returned operation on it. The queue will hold its lock during this time, so no other operations on the queue are possible.
fifo | the queue to peek at |
fn | the function to call on the head, once available |
ctx | context to pass in call to function |
apr_status_t h2_ififo_pull | ( | h2_ififo * | fifo, |
int * | pi | ||
) |
apr_status_t h2_ififo_push | ( | h2_ififo * | fifo, |
int | id | ||
) |
Push an int into the queue. Blocks if there is no capacity left.
fifo | the FIFO queue |
id | the int to push |
apr_status_t h2_ififo_remove | ( | h2_ififo * | fifo, |
int | id | ||
) |
Remove the integer from the queue, will remove multiple appearances.
id | the integer to remove |
apr_status_t h2_ififo_set_create | ( | h2_ififo ** | pfifo, |
apr_pool_t * | pool, | ||
int | capacity | ||
) |
Create a FIFO set that can hold up to capacity integers. Ints only appear once. Pushing an int already present does not change the queue and is successful.
apr_status_t h2_ififo_term | ( | h2_ififo * | fifo | ) |
apr_status_t h2_ififo_try_peek | ( | h2_ififo * | fifo, |
h2_ififo_peek_fn * | fn, | ||
void * | ctx | ||
) |
Non-blocking version of h2_fifo_peek.
apr_status_t h2_ififo_try_pull | ( | h2_ififo * | fifo, |
int * | pi | ||
) |
apr_status_t h2_ififo_try_push | ( | h2_ififo * | fifo, |
int | id | ||
) |
int h2_ignore_req_trailer | ( | const char * | name, |
size_t | len | ||
) |
int h2_ignore_resp_trailer | ( | const char * | name, |
size_t | len | ||
) |
void h2_ihash_add | ( | h2_ihash_t * | ih, |
void * | val | ||
) |
void h2_ihash_clear | ( | h2_ihash_t * | ih | ) |
unsigned int h2_ihash_count | ( | h2_ihash_t * | ih | ) |
h2_ihash_t* h2_ihash_create | ( | apr_pool_t * | pool, |
size_t | offset_of_int | ||
) |
Create a hash for structures that have an identifying int member.
pool | the pool to use |
offset_of_int | the offsetof() the int member in the struct |
int h2_ihash_empty | ( | h2_ihash_t * | ih | ) |
void* h2_ihash_get | ( | h2_ihash_t * | ih, |
int | id | ||
) |
int h2_ihash_iter | ( | h2_ihash_t * | ih, |
h2_ihash_iter_t * | fn, | ||
void * | ctx | ||
) |
Iterate over the hash members (without defined order) and invoke fn for each member until 0 is returned.
ih | the hash to iterate over |
fn | the function to invoke on each member |
ctx | user supplied data passed into each iteration call |
void h2_ihash_remove | ( | h2_ihash_t * | ih, |
int | id | ||
) |
void h2_ihash_remove_val | ( | h2_ihash_t * | ih, |
void * | val | ||
) |
size_t h2_ihash_shift | ( | h2_ihash_t * | ih, |
void ** | buffer, | ||
size_t | max | ||
) |
Add a stream id to the queue.
q | the queue to append the id to |
sid | the stream id to add |
cmp | the comparator for sorting |
ctx | user data for comparator |
Append the id to the queue if not already present.
q | the queue to append the id to |
sid | the id to append |
void h2_iq_clear | ( | h2_iqueue * | q | ) |
Remove all entries in the queue.
Determine if int is in the queue already
q | the queue |
sid | the integer id to check for |
Return the number of int in the queue.
q | the queue to get size on |
h2_iqueue* h2_iq_create | ( | apr_pool_t * | pool, |
int | capacity | ||
) |
Allocate a new queue from the pool and initialize.
pool | the memory pool |
capacity | the initial capacity of the queue |
Return != 0 iff there are no ints in the queue.
q | the queue to check |
Get the first max ids from the queue. All these ids will be removed.
q | the queue to get the first ids from |
pint | the int array to receive the values |
max | the maximum number of ids to shift |
Remove the int from the queue. Return != 0 iff it was found.
q | the queue |
sid | the stream id to remove |
Get the first id from the queue or 0 if the queue is empty. The id is being removed.
q | the queue to get the first id from |
Sort the stream idqueue again. Call if the int ordering has changed.
q | the queue to sort |
cmp | the comparator for sorting |
ctx | user data for the comparator |
unsigned char h2_log2 | ( | int | n | ) |
int h2_push_policy_determine | ( | apr_table_t * | headers, |
apr_pool_t * | p, | ||
int | push_enabled | ||
) |
Set the push policy for the given request. Takes request headers into account, see draft https://tools.ietf.org/html/draft-ruellan-http-accept-push-policy-00 for details.
headers | the http headers to inspect |
p | the pool to use |
push_enabled | if HTTP/2 server push is generally enabled for this request |
apr_status_t h2_req_add_header | ( | apr_table_t * | headers, |
apr_pool_t * | pool, | ||
const char * | name, | ||
size_t | nlen, | ||
const char * | value, | ||
size_t | vlen, | ||
size_t | max_field_len, | ||
int * | pwas_added | ||
) |
Add a HTTP/2 header and return the table key if it really was added and not ignored.
apr_status_t h2_req_create_ngheader | ( | h2_ngheader ** | ph, |
apr_pool_t * | p, | ||
const struct h2_request * | req | ||
) |
apr_status_t h2_res_create_ngheader | ( | h2_ngheader ** | ph, |
apr_pool_t * | p, | ||
struct h2_headers * | headers | ||
) |
apr_status_t h2_res_create_ngtrailer | ( | h2_ngheader ** | ph, |
apr_pool_t * | p, | ||
struct h2_headers * | headers | ||
) |
apr_size_t h2_util_base64url_decode | ( | const char ** | decoded, |
const char * | encoded, | ||
apr_pool_t * | pool | ||
) |
I always wanted to write my own base64url decoder...not. See https://tools.ietf.org/html/rfc4648#section-5 for description.
const char* h2_util_base64url_encode | ( | const char * | data, |
apr_size_t | len, | ||
apr_pool_t * | pool | ||
) |
apr_size_t h2_util_bb_print | ( | char * | buffer, |
apr_size_t | bmax, | ||
const char * | tag, | ||
const char * | sep, | ||
apr_bucket_brigade * | bb | ||
) |
Prints the brigade bucket types and lengths into the given buffer up to bmax.
apr_size_t h2_util_bucket_print | ( | char * | buffer, |
apr_size_t | bmax, | ||
apr_bucket * | b, | ||
const char * | sep | ||
) |
Print a bucket's meta data (type and length) to the buffer.
void h2_util_camel_case_header | ( | char * | s, |
size_t | len | ||
) |
void h2_util_drain_pipe | ( | apr_file_t * | pipe | ) |
Drain a pipe used for notification.
int h2_util_frame_print | ( | const nghttp2_frame * | frame, |
char * | buffer, | ||
size_t | maxlen | ||
) |
size_t h2_util_hex_dump | ( | char * | buffer, |
size_t | maxlen, | ||
const char * | data, | ||
size_t | datalen | ||
) |
int h2_util_ignore_resp_header | ( | const char * | name | ) |
apr_size_t h2_util_table_bytes | ( | apr_table_t * | t, |
apr_size_t | pair_extra | ||
) |
Count the bytes that all key/value pairs in a table have in length (exlucding terminating 0s), plus additional extra per pair.
t | the table to inspect |
pair_extra | the extra amount to add per pair |
apr_status_t h2_util_wait_on_pipe | ( | apr_file_t * | pipe | ) |
Wait on data arriving on a pipe.