Apache2
h2_stream.h File Reference
#include <http_protocol.h>
#include "h2.h"
#include "h2_headers.h"
Include dependency graph for h2_stream.h:

Go to the source code of this file.

Data Structures

struct  h2_stream_monitor
 
struct  h2_stream
 

Macros

#define H2_STRM_ASSIGN_MAGIC(s, m)   ((void)0)
 
#define H2_STRM_ASSERT_MAGIC(s, m)   ((void)0)
 
#define H2_STREAM_RST(s, def)   (s->rst_error? s->rst_error : (def))
 
#define H2_STRM_MSG(s, msg)
 
#define H2_STRM_LOG(aplogno, s, msg)   aplogno H2_STRM_MSG(s, msg)
 

Typedefs

typedef struct h2_stream h2_stream
 
typedef void h2_stream_state_cb(void *ctx, h2_stream *stream)
 
typedef void h2_stream_event_cb(void *ctx, h2_stream *stream, h2_stream_event_t ev)
 
typedef struct h2_stream_monitor h2_stream_monitor
 

Functions

h2_streamh2_stream_create (int id, apr_pool_t *pool, struct h2_session *session, h2_stream_monitor *monitor, int initiated_on)
 
void h2_stream_destroy (h2_stream *stream)
 
apr_status_t h2_stream_prepare_processing (h2_stream *stream)
 
void h2_stream_set_monitor (h2_stream *stream, h2_stream_monitor *monitor)
 
void h2_stream_dispatch (h2_stream *stream, h2_stream_event_t ev)
 
int h2_stream_is_at (const h2_stream *stream, h2_stream_state_t state)
 
int h2_stream_is_at_or_past (const h2_stream *stream, h2_stream_state_t state)
 
void h2_stream_cleanup (h2_stream *stream)
 
apr_status_t h2_stream_in_consumed (h2_stream *stream, apr_off_t amount)
 
void h2_stream_set_request (h2_stream *stream, const h2_request *r)
 
apr_status_t h2_stream_set_request_rec (h2_stream *stream, request_rec *r, int eos)
 
apr_status_t h2_stream_add_header (h2_stream *stream, const char *name, size_t nlen, const char *value, size_t vlen)
 
apr_status_t h2_stream_end_headers (h2_stream *stream, int eos, size_t raw_bytes)
 
apr_status_t h2_stream_send_frame (h2_stream *stream, int frame_type, int flags, size_t frame_len)
 
apr_status_t h2_stream_recv_frame (h2_stream *stream, int frame_type, int flags, size_t frame_len)
 
apr_status_t h2_stream_recv_DATA (h2_stream *stream, uint8_t flags, const uint8_t *data, size_t len)
 
void h2_stream_rst (h2_stream *stream, int error_code)
 
void h2_stream_on_input_change (h2_stream *stream)
 
void h2_stream_on_output_change (h2_stream *stream)
 
apr_status_t h2_stream_read_to (h2_stream *stream, apr_bucket_brigade *bb, apr_off_t *plen, int *peos)
 
apr_table_th2_stream_get_trailers (h2_stream *stream)
 
apr_status_t h2_stream_submit_pushes (h2_stream *stream, struct h2_headers *response)
 
const struct h2_priorityh2_stream_get_priority (h2_stream *stream, struct h2_headers *response)
 
const char * h2_stream_state_str (const h2_stream *stream)
 
int h2_stream_is_ready (h2_stream *stream)
 
int h2_stream_wants_send_data (h2_stream *stream)
 

Macro Definition Documentation

◆ H2_STREAM_RST

#define H2_STREAM_RST (   s,
  def 
)    (s->rst_error? s->rst_error : (def))

◆ H2_STRM_ASSERT_MAGIC

#define H2_STRM_ASSERT_MAGIC (   s,
 
)    ((void)0)

◆ H2_STRM_ASSIGN_MAGIC

#define H2_STRM_ASSIGN_MAGIC (   s,
 
)    ((void)0)

◆ H2_STRM_LOG

#define H2_STRM_LOG (   aplogno,
  s,
  msg 
)    aplogno H2_STRM_MSG(s, msg)

◆ H2_STRM_MSG

#define H2_STRM_MSG (   s,
  msg 
)
Value:
"h2_stream(%d-%lu-%d,%s): "msg, s->session->child_num, \
(unsigned long)s->session->id, s->id, h2_stream_state_str(s)
const char * s
Definition: mod_dav.h:1327
const char * h2_stream_state_str(const h2_stream *stream)

Typedef Documentation

◆ h2_stream

typedef struct h2_stream h2_stream

◆ h2_stream_event_cb

typedef void h2_stream_event_cb(void *ctx, h2_stream *stream, h2_stream_event_t ev)

◆ h2_stream_monitor

Callback structure for events and stream state transisitions

◆ h2_stream_state_cb

typedef void h2_stream_state_cb(void *ctx, h2_stream *stream)

Function Documentation

◆ h2_stream_add_header()

apr_status_t h2_stream_add_header ( h2_stream stream,
const char *  name,
size_t  nlen,
const char *  value,
size_t  vlen 
)

◆ h2_stream_cleanup()

void h2_stream_cleanup ( h2_stream stream)

Cleanup references into requst processing.

Parameters
streamthe stream to cleanup

◆ h2_stream_create()

h2_stream* h2_stream_create ( int  id,
apr_pool_t pool,
struct h2_session session,
h2_stream_monitor monitor,
int  initiated_on 
)

Create a stream in H2_SS_IDLE state.

Parameters
idthe stream identifier
poolthe memory pool to use for this stream
sessionthe session this stream belongs to
monitoran optional monitor to be called for events and state transisitions
initiated_onthe id of the stream this one was initiated on (PUSH)
Returns
the newly opened stream

◆ h2_stream_destroy()

void h2_stream_destroy ( h2_stream stream)

Destroy memory pool if still owned by the stream.

◆ h2_stream_dispatch()

void h2_stream_dispatch ( h2_stream stream,
h2_stream_event_t  ev 
)

Dispatch (handle) an event on the given stream.

Parameters
streamthe streama the event happened on
evthe type of event

◆ h2_stream_end_headers()

apr_status_t h2_stream_end_headers ( h2_stream stream,
int  eos,
size_t  raw_bytes 
)

◆ h2_stream_get_priority()

const struct h2_priority* h2_stream_get_priority ( h2_stream stream,
struct h2_headers response 
)

Get priority information set for this stream.

◆ h2_stream_get_trailers()

apr_table_t* h2_stream_get_trailers ( h2_stream stream)

Get optional trailers for this stream, may be NULL. Meaningful results can only be expected when the end of the response body has been reached.

Parameters
streamto ask for trailers
Returns
trailers for NULL

◆ h2_stream_in_consumed()

apr_status_t h2_stream_in_consumed ( h2_stream stream,
apr_off_t  amount 
)

Notify the stream that amount bytes have been consumed of its input since the last invocation of this method (delta amount).

◆ h2_stream_is_at()

int h2_stream_is_at ( const h2_stream stream,
h2_stream_state_t  state 
)

Determine if stream is at given state.

Parameters
streamthe stream to check
statethe state to look for
Returns
!= 0 iff stream is at given state.

◆ h2_stream_is_at_or_past()

int h2_stream_is_at_or_past ( const h2_stream stream,
h2_stream_state_t  state 
)

Determine if stream is reached given state or is past this state.

Parameters
streamthe stream to check
statethe state to look for
Returns
!= 0 iff stream is at or past given state.

◆ h2_stream_is_ready()

int h2_stream_is_ready ( h2_stream stream)

Determine if stream is ready for submitting a response or a RST

Parameters
streamthe stream to check

◆ h2_stream_on_input_change()

void h2_stream_on_input_change ( h2_stream stream)

Stream input signals change. Take necessary actions.

Parameters
streamthe stream to read output for

◆ h2_stream_on_output_change()

void h2_stream_on_output_change ( h2_stream stream)

Stream output signals change. Take necessary actions.

Parameters
streamthe stream to read output for

◆ h2_stream_prepare_processing()

apr_status_t h2_stream_prepare_processing ( h2_stream stream)

Perform any late initialization before stream starts processing.

◆ h2_stream_read_to()

apr_status_t h2_stream_read_to ( h2_stream stream,
apr_bucket_brigade bb,
apr_off_t plen,
int peos 
)

Read a maximum number of bytes into the bucket brigade.

Parameters
streamthe stream to read from
bbthe brigade to append output to
plen(in-/out) max. number of bytes to append and on return actual number of bytes appended to brigade
peos(out) != 0 iff end of stream has been reached while reading
Returns
APR_SUCCESS if out information was computed successfully. APR_EAGAIN if not data is available and end of stream has not been reached yet.

◆ h2_stream_recv_DATA()

apr_status_t h2_stream_recv_DATA ( h2_stream stream,
uint8_t  flags,
const uint8_t *  data,
size_t  len 
)

◆ h2_stream_recv_frame()

apr_status_t h2_stream_recv_frame ( h2_stream stream,
int  frame_type,
int  flags,
size_t  frame_len 
)

◆ h2_stream_rst()

void h2_stream_rst ( h2_stream stream,
int  error_code 
)

Reset the stream. Stream write/reads will return errors afterwards.

Parameters
streamthe stream to reset
error_codethe HTTP/2 error code

◆ h2_stream_send_frame()

apr_status_t h2_stream_send_frame ( h2_stream stream,
int  frame_type,
int  flags,
size_t  frame_len 
)

◆ h2_stream_set_monitor()

void h2_stream_set_monitor ( h2_stream stream,
h2_stream_monitor monitor 
)

◆ h2_stream_set_request()

void h2_stream_set_request ( h2_stream stream,
const h2_request r 
)

Set complete stream headers from given h2_request.

Parameters
streamstream to write request to
rthe request with all the meta data
eos!= 0 iff stream input is closed

◆ h2_stream_set_request_rec()

apr_status_t h2_stream_set_request_rec ( h2_stream stream,
request_rec r,
int  eos 
)

Set complete stream header from given request_rec.

Parameters
streamstream to write request to
rthe request with all the meta data
eos!= 0 iff stream input is closed

◆ h2_stream_state_str()

const char* h2_stream_state_str ( const h2_stream stream)

Return a textual representation of the stream state as in RFC 7540 nomenclator, all caps, underscores.

◆ h2_stream_submit_pushes()

apr_status_t h2_stream_submit_pushes ( h2_stream stream,
struct h2_headers response 
)

Submit any server push promises on this stream and schedule the streams for these.

Parameters
streamthe stream for which to submit

◆ h2_stream_wants_send_data()

int h2_stream_wants_send_data ( h2_stream stream)