Apache HTTPD
Classes | Typedefs | Functions
h2_proxy_util.h File Reference

Go to the source code of this file.

Classes

struct  h2_proxy_iqueue
 
struct  h2_proxy_ngheader
 
struct  h2_proxy_request
 

Typedefs

typedef struct h2_proxy_ihash_t h2_proxy_ihash_t
 
typedef int h2_proxy_ihash_iter_t(void *ctx, void *val)
 
typedef struct h2_proxy_iqueue h2_proxy_iqueue
 
typedef int h2_proxy_iq_cmp(int i1, int i2, void *ctx)
 
typedef struct h2_proxy_ngheader h2_proxy_ngheader
 
typedef struct h2_proxy_request h2_proxy_request
 
typedef struct h2_proxy_fifo h2_proxy_fifo
 

Functions

int h2_proxy_util_frame_print (const nghttp2_frame *frame, char *buffer, size_t maxlen)
 
h2_proxy_ihash_th2_proxy_ihash_create (apr_pool_t *pool, size_t offset_of_int)
 
size_t h2_proxy_ihash_count (h2_proxy_ihash_t *ih)
 
int h2_proxy_ihash_empty (h2_proxy_ihash_t *ih)
 
void * h2_proxy_ihash_get (h2_proxy_ihash_t *ih, int id)
 
int h2_proxy_ihash_iter (h2_proxy_ihash_t *ih, h2_proxy_ihash_iter_t *fn, void *ctx)
 
void h2_proxy_ihash_add (h2_proxy_ihash_t *ih, void *val)
 
void h2_proxy_ihash_remove (h2_proxy_ihash_t *ih, int id)
 
void h2_proxy_ihash_remove_val (h2_proxy_ihash_t *ih, void *val)
 
void h2_proxy_ihash_clear (h2_proxy_ihash_t *ih)
 
size_t h2_proxy_ihash_shift (h2_proxy_ihash_t *ih, void **buffer, size_t max)
 
size_t h2_proxy_ihash_ishift (h2_proxy_ihash_t *ih, int *buffer, size_t max)
 
h2_proxy_iqueueh2_proxy_iq_create (apr_pool_t *pool, int capacity)
 
int h2_proxy_iq_empty (h2_proxy_iqueue *q)
 
int h2_proxy_iq_count (h2_proxy_iqueue *q)
 
void h2_proxy_iq_add (h2_proxy_iqueue *q, int sid, h2_proxy_iq_cmp *cmp, void *ctx)
 
int h2_proxy_iq_remove (h2_proxy_iqueue *q, int sid)
 
void h2_proxy_iq_clear (h2_proxy_iqueue *q)
 
void h2_proxy_iq_sort (h2_proxy_iqueue *q, h2_proxy_iq_cmp *cmp, void *ctx)
 
int h2_proxy_iq_shift (h2_proxy_iqueue *q)
 
unsigned char h2_proxy_log2 (int n)
 
void h2_proxy_util_camel_case_header (char *s, size_t len)
 
int h2_proxy_res_ignore_header (const char *name, size_t len)
 
h2_proxy_ngheaderh2_proxy_util_nghd_make_req (apr_pool_t *p, const struct h2_proxy_request *req)
 
h2_proxy_ngheaderh2_proxy_util_nghd_make (apr_pool_t *p, apr_table_t *headers)
 
h2_proxy_requesth2_proxy_req_create (int id, apr_pool_t *pool)
 
apr_status_t h2_proxy_req_make (h2_proxy_request *req, apr_pool_t *pool, const char *method, const char *scheme, const char *authority, const char *path, apr_table_t *headers)
 
const charh2_proxy_link_reverse_map (request_rec *r, proxy_dir_conf *conf, const char *real_server_uri, const char *proxy_server_uri, const char *s)
 
apr_status_t h2_proxy_fifo_create (h2_proxy_fifo **pfifo, apr_pool_t *pool, int capacity)
 
apr_status_t h2_proxy_fifo_set_create (h2_proxy_fifo **pfifo, apr_pool_t *pool, int capacity)
 
apr_status_t h2_proxy_fifo_term (h2_proxy_fifo *fifo)
 
apr_status_t h2_proxy_fifo_interrupt (h2_proxy_fifo *fifo)
 
int h2_proxy_fifo_capacity (h2_proxy_fifo *fifo)
 
int h2_proxy_fifo_count (h2_proxy_fifo *fifo)
 
apr_status_t h2_proxy_fifo_push (h2_proxy_fifo *fifo, void *elem)
 
apr_status_t h2_proxy_fifo_try_push (h2_proxy_fifo *fifo, void *elem)
 
apr_status_t h2_proxy_fifo_pull (h2_proxy_fifo *fifo, void **pelem)
 
apr_status_t h2_proxy_fifo_try_pull (h2_proxy_fifo *fifo, void **pelem)
 
apr_status_t h2_proxy_fifo_remove (h2_proxy_fifo *fifo, void *elem)
 

Typedef Documentation

◆ h2_proxy_fifo

A thread-safe FIFO queue with some extra bells and whistles, if you do not need anything special, better use 'apr_queue'.

Definition at line 214 of file h2_proxy_util.h.

◆ h2_proxy_ihash_iter_t

typedef int h2_proxy_ihash_iter_t(void *ctx, void *val)

Definition at line 32 of file h2_proxy_util.h.

◆ h2_proxy_ihash_t

Definition at line 31 of file h2_proxy_util.h.

◆ h2_proxy_iq_cmp

typedef int h2_proxy_iq_cmp(int i1, int i2, void *ctx)

Comparator for two int to determine their order.

Parameters
i1first int to compare
i2second int to compare
ctxprovided user data
Returns
value is the same as for strcmp() and has the effect: == 0: s1 and s2 are treated equal in ordering < 0: s1 should be sorted before s2 > 0: s2 should be sorted before s1

Definition at line 85 of file h2_proxy_util.h.

◆ h2_proxy_iqueue

◆ h2_proxy_ngheader

◆ h2_proxy_request

Definition at line 176 of file h2_proxy_util.h.

Function Documentation

◆ h2_proxy_fifo_capacity()

int h2_proxy_fifo_capacity ( h2_proxy_fifo fifo)

Definition at line 1198 of file h2_proxy_util.c.

◆ h2_proxy_fifo_count()

int h2_proxy_fifo_count ( h2_proxy_fifo fifo)

Definition at line 1193 of file h2_proxy_util.c.

◆ h2_proxy_fifo_create()

apr_status_t h2_proxy_fifo_create ( h2_proxy_fifo **  pfifo,
apr_pool_t pool,
int  capacity 
)

Create a FIFO queue that can hold up to capacity elements. Elements can appear several times.

Definition at line 1162 of file h2_proxy_util.c.

◆ h2_proxy_fifo_interrupt()

apr_status_t h2_proxy_fifo_interrupt ( h2_proxy_fifo fifo)

Definition at line 1182 of file h2_proxy_util.c.

◆ h2_proxy_fifo_pull()

apr_status_t h2_proxy_fifo_pull ( h2_proxy_fifo fifo,
void **  pelem 
)

Definition at line 1309 of file h2_proxy_util.c.

◆ h2_proxy_fifo_push()

apr_status_t h2_proxy_fifo_push ( h2_proxy_fifo fifo,
void *  elem 
)

Push en element into the queue. Blocks if there is no capacity left.

Parameters
fifothe FIFO queue
elemthe element to push
Returns
APR_SUCCESS on push, APR_EAGAIN on try_push on a full queue, APR_EEXIST when in set mode and elem already there.

Definition at line 1260 of file h2_proxy_util.c.

◆ h2_proxy_fifo_remove()

apr_status_t h2_proxy_fifo_remove ( h2_proxy_fifo fifo,
void *  elem 
)

Remove the elem from the queue, will remove multiple appearances.

Parameters
elemthe element to remove
Returns
APR_SUCCESS iff > 0 elems were removed, APR_EAGAIN otherwise.

Definition at line 1319 of file h2_proxy_util.c.

◆ h2_proxy_fifo_set_create()

apr_status_t h2_proxy_fifo_set_create ( h2_proxy_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.

Definition at line 1167 of file h2_proxy_util.c.

◆ h2_proxy_fifo_term()

apr_status_t h2_proxy_fifo_term ( h2_proxy_fifo fifo)

Definition at line 1172 of file h2_proxy_util.c.

◆ h2_proxy_fifo_try_pull()

apr_status_t h2_proxy_fifo_try_pull ( h2_proxy_fifo fifo,
void **  pelem 
)

Definition at line 1314 of file h2_proxy_util.c.

◆ h2_proxy_fifo_try_push()

apr_status_t h2_proxy_fifo_try_push ( h2_proxy_fifo fifo,
void *  elem 
)

Definition at line 1265 of file h2_proxy_util.c.

◆ h2_proxy_ihash_add()

void h2_proxy_ihash_add ( h2_proxy_ihash_t ih,
void *  val 
)

Definition at line 122 of file h2_proxy_util.c.

◆ h2_proxy_ihash_clear()

void h2_proxy_ihash_clear ( h2_proxy_ihash_t ih)

Definition at line 139 of file h2_proxy_util.c.

◆ h2_proxy_ihash_count()

size_t h2_proxy_ihash_count ( h2_proxy_ihash_t ih)

Definition at line 87 of file h2_proxy_util.c.

◆ h2_proxy_ihash_create()

h2_proxy_ihash_t * h2_proxy_ihash_create ( apr_pool_t pool,
size_t  offset_of_int 
)

Create a hash for structures that have an identifying int member.

Parameters
poolthe pool to use
offset_of_intthe offsetof() the int member in the struct

Definition at line 79 of file h2_proxy_util.c.

◆ h2_proxy_ihash_empty()

int h2_proxy_ihash_empty ( h2_proxy_ihash_t ih)

Definition at line 92 of file h2_proxy_util.c.

◆ h2_proxy_ihash_get()

void * h2_proxy_ihash_get ( h2_proxy_ihash_t ih,
int  id 
)

Definition at line 97 of file h2_proxy_util.c.

◆ h2_proxy_ihash_ishift()

size_t h2_proxy_ihash_ishift ( h2_proxy_ihash_t ih,
int buffer,
size_t  max 
)

Definition at line 194 of file h2_proxy_util.c.

◆ h2_proxy_ihash_iter()

int h2_proxy_ihash_iter ( h2_proxy_ihash_t ih,
h2_proxy_ihash_iter_t fn,
void *  ctx 
)

Iterate over the hash members (without defined order) and invoke fn for each member until 0 is returned.

Parameters
ihthe hash to iterate over
fnthe function to invoke on each member
ctxuser supplied data passed into each iteration call
Returns
0 if one iteration returned 0, otherwise != 0

Definition at line 114 of file h2_proxy_util.c.

◆ h2_proxy_ihash_remove()

void h2_proxy_ihash_remove ( h2_proxy_ihash_t ih,
int  id 
)

Definition at line 127 of file h2_proxy_util.c.

◆ h2_proxy_ihash_remove_val()

void h2_proxy_ihash_remove_val ( h2_proxy_ihash_t ih,
void *  val 
)

Definition at line 132 of file h2_proxy_util.c.

◆ h2_proxy_ihash_shift()

size_t h2_proxy_ihash_shift ( h2_proxy_ihash_t ih,
void **  buffer,
size_t  max 
)

Definition at line 161 of file h2_proxy_util.c.

◆ h2_proxy_iq_add()

void h2_proxy_iq_add ( h2_proxy_iqueue q,
int  sid,
h2_proxy_iq_cmp cmp,
void *  ctx 
)

Add a stream id to the queue.

Parameters
qthe queue to append the task to
sidthe stream id to add
cmpthe comparator for sorting
ctxuser data for comparator

Definition at line 243 of file h2_proxy_util.c.

◆ h2_proxy_iq_clear()

void h2_proxy_iq_clear ( h2_proxy_iqueue q)

Remove all entries in the queue.

Definition at line 281 of file h2_proxy_util.c.

◆ h2_proxy_iq_count()

int h2_proxy_iq_count ( h2_proxy_iqueue q)

Return the number of int in the queue.

Parameters
qthe queue to get size on

Definition at line 237 of file h2_proxy_util.c.

◆ h2_proxy_iq_create()

h2_proxy_iqueue * h2_proxy_iq_create ( apr_pool_t pool,
int  capacity 
)

Allocate a new queue from the pool and initialize.

Parameters
idthe identifier of the queue
poolthe memory pool

Definition at line 221 of file h2_proxy_util.c.

◆ h2_proxy_iq_empty()

int h2_proxy_iq_empty ( h2_proxy_iqueue q)

Return != 0 iff there are no tasks in the queue.

Parameters
qthe queue to check

Definition at line 232 of file h2_proxy_util.c.

◆ h2_proxy_iq_remove()

int h2_proxy_iq_remove ( h2_proxy_iqueue q,
int  sid 
)

Remove the stream id from the queue. Return != 0 iff task was found in queue.

Parameters
qthe task queue
sidthe stream id to remove
Returns
!= 0 iff task was found in queue

Definition at line 261 of file h2_proxy_util.c.

◆ h2_proxy_iq_shift()

int h2_proxy_iq_shift ( h2_proxy_iqueue q)

Get the first stream id from the queue or NULL if the queue is empty. The task will be removed.

Parameters
qthe queue to get the first task from
Returns
the first stream id of the queue, 0 if empty

Definition at line 314 of file h2_proxy_util.c.

◆ h2_proxy_iq_sort()

void h2_proxy_iq_sort ( h2_proxy_iqueue q,
h2_proxy_iq_cmp cmp,
void *  ctx 
)

Sort the stream idqueue again. Call if the task ordering has changed.

Parameters
qthe queue to sort
cmpthe comparator for sorting
ctxuser data for the comparator

Definition at line 286 of file h2_proxy_util.c.

◆ h2_proxy_link_reverse_map()

const char * h2_proxy_link_reverse_map ( request_rec r,
proxy_dir_conf conf,
const char real_server_uri,
const char proxy_server_uri,
const char s 
)

< Reverse proxy

Definition at line 1043 of file h2_proxy_util.c.

◆ h2_proxy_log2()

unsigned char h2_proxy_log2 ( int  n)

Definition at line 37 of file h2_proxy_util.c.

◆ h2_proxy_req_create()

h2_proxy_request * h2_proxy_req_create ( int  id,
apr_pool_t pool 
)

Definition at line 600 of file h2_proxy_util.c.

◆ h2_proxy_req_make()

apr_status_t h2_proxy_req_make ( h2_proxy_request req,
apr_pool_t pool,
const char method,
const char scheme,
const char authority,
const char path,
apr_table_t headers 
)

Definition at line 620 of file h2_proxy_util.c.

◆ h2_proxy_res_ignore_header()

int h2_proxy_res_ignore_header ( const char name,
size_t  len 
)

Definition at line 515 of file h2_proxy_util.c.

◆ h2_proxy_util_camel_case_header()

void h2_proxy_util_camel_case_header ( char s,
size_t  len 
)

Definition at line 521 of file h2_proxy_util.c.

◆ h2_proxy_util_frame_print()

int h2_proxy_util_frame_print ( const nghttp2_frame frame,
char buffer,
size_t  maxlen 
)

Definition at line 653 of file h2_proxy_util.c.

◆ h2_proxy_util_nghd_make()

h2_proxy_ngheader * h2_proxy_util_nghd_make ( apr_pool_t p,
apr_table_t headers 
)

Definition at line 455 of file h2_proxy_util.c.

◆ h2_proxy_util_nghd_make_req()

h2_proxy_ngheader * h2_proxy_util_nghd_make_req ( apr_pool_t p,
const struct h2_proxy_request req 
)