Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_mplx.h File Reference
#include <apr_queue.h>
Include dependency graph for h2_mplx.h:

Go to the source code of this file.

Data Structures

struct  h2_mplx
 

Macros

#define H2_MPLX_LIST_SENTINEL(b)   APR_RING_SENTINEL((b), h2_mplx, link)
 
#define H2_MPLX_LIST_EMPTY(b)   APR_RING_EMPTY((b), h2_mplx, link)
 
#define H2_MPLX_LIST_FIRST(b)   APR_RING_FIRST(b)
 
#define H2_MPLX_LIST_LAST(b)   APR_RING_LAST(b)
 
#define H2_MPLX_LIST_INSERT_HEAD(b, e)
 
#define H2_MPLX_LIST_INSERT_TAIL(b, e)
 
#define H2_MPLX_NEXT(e)   APR_RING_NEXT((e), link)
 
#define H2_MPLX_PREV(e)   APR_RING_PREV((e), link)
 
#define H2_MPLX_REMOVE(e)   APR_RING_REMOVE((e), link)
 

Typedefs

typedef struct h2_mplx h2_mplx
 
typedef void h2_mplx_consumed_cb (void *ctx, int stream_id, apr_off_t consumed)
 
typedef apr_status_t stream_ev_callback (void *ctx, struct h2_stream *stream)
 
typedef int h2_mplx_stream_cb (struct h2_stream *s, void *ctx)
 
typedef void h2_output_consumed (void *ctx, conn_rec *c, apr_off_t consumed)
 
typedef apr_status_t h2_mplx_req_engine_init (struct h2_req_engine *engine, const char *id, const char *type, apr_pool_t *pool, apr_size_t req_buffer_size, request_rec *r, h2_output_consumed **pconsumed, void **pbaton)
 

Functions

apr_status_t h2_mplx_child_init (apr_pool_t *pool, server_rec *s)
 
h2_mplxh2_mplx_create (conn_rec *c, apr_pool_t *master, const struct h2_config *conf, apr_interval_time_t stream_timeout, struct h2_workers *workers)
 
apr_status_t h2_mplx_release_and_join (h2_mplx *m, struct apr_thread_cond_t *wait)
 
void h2_mplx_abort (h2_mplx *mplx)
 
struct h2_taskh2_mplx_pop_task (h2_mplx *mplx, int *has_more)
 
void h2_mplx_task_done (h2_mplx *m, struct h2_task *task, struct h2_task **ptask)
 
int h2_mplx_shutdown (h2_mplx *m)
 
int h2_mplx_is_busy (h2_mplx *m)
 
struct h2_streamh2_mplx_stream_get (h2_mplx *m, int id)
 
apr_status_t h2_mplx_stream_done (h2_mplx *m, struct h2_stream *stream)
 
apr_status_t h2_mplx_out_trywait (h2_mplx *m, apr_interval_time_t timeout, struct apr_thread_cond_t *iowait)
 
apr_status_t h2_mplx_keep_active (h2_mplx *m, int stream_id)
 
apr_status_t h2_mplx_process (h2_mplx *m, struct h2_stream *stream, h2_stream_pri_cmp *cmp, void *ctx)
 
apr_status_t h2_mplx_reprioritize (h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)
 
void h2_mplx_set_consumed_cb (h2_mplx *m, h2_mplx_consumed_cb *cb, void *ctx)
 
apr_status_t h2_mplx_dispatch_master_events (h2_mplx *m, stream_ev_callback *on_resume, void *ctx)
 
int h2_mplx_awaits_data (h2_mplx *m)
 
apr_status_t h2_mplx_stream_do (h2_mplx *m, h2_mplx_stream_cb *cb, void *ctx)
 
apr_status_t h2_mplx_out_open (h2_mplx *mplx, int stream_id, struct h2_bucket_beam *beam)
 
apr_status_t h2_mplx_idle (h2_mplx *m)
 
apr_status_t h2_mplx_req_engine_push (const char *ngn_type, request_rec *r, h2_mplx_req_engine_init *einit)
 
apr_status_t h2_mplx_req_engine_pull (struct h2_req_engine *ngn, apr_read_type_e block, int capacity, request_rec **pr)
 
void h2_mplx_req_engine_done (struct h2_req_engine *ngn, conn_rec *r_conn, apr_status_t status)
 

Macro Definition Documentation

#define H2_MPLX_LIST_EMPTY (   b)    APR_RING_EMPTY((b), h2_mplx, link)

Determine if the mplx list is empty

Parameters
bThe list to check
Returns
true or false
#define H2_MPLX_LIST_FIRST (   b)    APR_RING_FIRST(b)

Return the first mplx in a list

Parameters
bThe list to query
Returns
The first mplx in the list
#define H2_MPLX_LIST_INSERT_HEAD (   b,
 
)
Value:
do { \
h2_mplx *ap__b = (e); \
APR_RING_INSERT_HEAD((b), ap__b, h2_mplx, link); \
} while (0)
Definition: h2_mplx.h:62
struct h2_mplx h2_mplx
Definition: h2_mplx.h:54
#define APR_RING_INSERT_HEAD(hp, nep, elem, link)
Definition: apr_ring.h:311

Insert a single mplx at the front of a list

Parameters
bThe list to add to
eThe mplx to insert
#define H2_MPLX_LIST_INSERT_TAIL (   b,
 
)
Value:
do { \
h2_mplx *ap__b = (e); \
APR_RING_INSERT_TAIL((b), ap__b, h2_mplx, link); \
} while (0)
#define APR_RING_INSERT_TAIL(hp, nep, elem, link)
Definition: apr_ring.h:322
Definition: h2_mplx.h:62
struct h2_mplx h2_mplx
Definition: h2_mplx.h:54

Insert a single mplx at the end of a list

Parameters
bThe list to add to
eThe mplx to insert
#define H2_MPLX_LIST_LAST (   b)    APR_RING_LAST(b)

Return the last mplx in a list

Parameters
bThe list to query
Returns
The last mplx int he list
#define H2_MPLX_LIST_SENTINEL (   b)    APR_RING_SENTINEL((b), h2_mplx, link)

The magic pointer value that indicates the head of a h2_mplx list

Parameters
bThe mplx list
Returns
The magic pointer value
#define H2_MPLX_NEXT (   e)    APR_RING_NEXT((e), link)

Get the next mplx in the list

Parameters
eThe current mplx
Returns
The next mplx
#define H2_MPLX_PREV (   e)    APR_RING_PREV((e), link)

Get the previous mplx in the list

Parameters
eThe current mplx
Returns
The previous mplx
#define H2_MPLX_REMOVE (   e)    APR_RING_REMOVE((e), link)

Remove a mplx from its list

Parameters
eThe mplx to remove

Typedef Documentation

typedef struct h2_mplx h2_mplx
typedef void h2_mplx_consumed_cb(void *ctx, int stream_id, apr_off_t consumed)

Callback invoked for every stream that had input data read since the last invocation.

typedef apr_status_t h2_mplx_req_engine_init(struct h2_req_engine *engine, const char *id, const char *type, apr_pool_t *pool, apr_size_t req_buffer_size, request_rec *r, h2_output_consumed **pconsumed, void **pbaton)
typedef int h2_mplx_stream_cb(struct h2_stream *s, void *ctx)
typedef void h2_output_consumed(void *ctx, conn_rec *c, apr_off_t consumed)
typedef apr_status_t stream_ev_callback(void *ctx, struct h2_stream *stream)

Function Documentation

void h2_mplx_abort ( h2_mplx mplx)

Aborts the multiplexer. It will answer all future invocation with APR_ECONNABORTED, leading to early termination of ongoing streams.

int h2_mplx_awaits_data ( h2_mplx m)
apr_status_t h2_mplx_child_init ( apr_pool_t pool,
server_rec s 
)
h2_mplx* h2_mplx_create ( conn_rec c,
apr_pool_t master,
const struct h2_config conf,
apr_interval_time_t  stream_timeout,
struct h2_workers workers 
)

Create the multiplexer for the given HTTP2 session. Implicitly has reference count 1.

apr_status_t h2_mplx_dispatch_master_events ( h2_mplx m,
stream_ev_callback on_resume,
void ctx 
)

Dispatch events for the master connection, such as ± 

Parameters
mthe multiplexer
on_resumenew output data has arrived for a suspended stream
ctxuser supplied argument to invocation.
apr_status_t h2_mplx_idle ( h2_mplx m)

Master connection has entered idle mode.

Parameters
mthe mplx instance of the master connection
Returns
!= SUCCESS iff connection should be terminated
int h2_mplx_is_busy ( h2_mplx m)
apr_status_t h2_mplx_keep_active ( h2_mplx m,
int  stream_id 
)
apr_status_t h2_mplx_out_open ( h2_mplx mplx,
int  stream_id,
struct h2_bucket_beam beam 
)

Opens the output for the given stream with the specified response.

apr_status_t h2_mplx_out_trywait ( h2_mplx m,
apr_interval_time_t  timeout,
struct apr_thread_cond_t iowait 
)

Waits on output data from any stream in this session to become available. Returns APR_TIMEUP if no data arrived in the given time.

struct h2_task* h2_mplx_pop_task ( h2_mplx mplx,
int has_more 
)
apr_status_t h2_mplx_process ( h2_mplx m,
struct h2_stream stream,
h2_stream_pri_cmp cmp,
void ctx 
)

Process a stream request.

Parameters
mthe multiplexer
streamthe identifier of the stream
rthe request to be processed
cmpthe stream priority compare function
ctxcontext data for the compare function
apr_status_t h2_mplx_release_and_join ( h2_mplx m,
struct apr_thread_cond_t wait 
)

Decreases the reference counter of this mplx and waits for it to reached 0, destroy the mplx afterwards. This is to be called from the thread that created the mplx in the first place.

Parameters
mthe mplx to be released and destroyed
waitcondition var to wait on for ref counter == 0
apr_status_t h2_mplx_reprioritize ( h2_mplx m,
h2_stream_pri_cmp cmp,
void ctx 
)

Stream priorities have changed, reschedule pending requests.

Parameters
mthe multiplexer
cmpthe stream priority compare function
ctxcontext data for the compare function
void h2_mplx_req_engine_done ( struct h2_req_engine ngn,
conn_rec r_conn,
apr_status_t  status 
)
apr_status_t h2_mplx_req_engine_pull ( struct h2_req_engine ngn,
apr_read_type_e  block,
int  capacity,
request_rec **  pr 
)
apr_status_t h2_mplx_req_engine_push ( const char *  ngn_type,
request_rec r,
h2_mplx_req_engine_init einit 
)
void h2_mplx_set_consumed_cb ( h2_mplx m,
h2_mplx_consumed_cb cb,
void ctx 
)

Register a callback for the amount of input data consumed per stream. The will only ever be invoked from the thread creating this h2_mplx, e.g. when calls from that thread into this h2_mplx are made.

Parameters
mthe multiplexer to register the callback at
cbthe function to invoke
ctxuser supplied argument to invocation.
int h2_mplx_shutdown ( h2_mplx m)

Shut down the multiplexer gracefully. Will no longer schedule new streams but let the ongoing ones finish normally.

Returns
the highest stream id being/been processed
apr_status_t h2_mplx_stream_do ( h2_mplx m,
h2_mplx_stream_cb cb,
void ctx 
)
apr_status_t h2_mplx_stream_done ( h2_mplx m,
struct h2_stream stream 
)

Notifies mplx that a stream has finished processing.

Parameters
mthe mplx itself
streamthe id of the stream being done
rst_errorif != 0, the stream was reset with the error given
struct h2_stream* h2_mplx_stream_get ( h2_mplx m,
int  id 
)
void h2_mplx_task_done ( h2_mplx m,
struct h2_task task,
struct h2_task **  ptask 
)