Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_stream.h File Reference
#include "h2.h"
Include dependency graph for h2_stream.h:

Go to the source code of this file.

Data Structures

struct  h2_stream
 

Macros

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

Typedefs

typedef struct h2_stream h2_stream
 

Functions

h2_streamh2_stream_open (int id, apr_pool_t *pool, struct h2_session *session, int initiated_on)
 
void h2_stream_eos_destroy (h2_stream *stream)
 
void h2_stream_destroy (h2_stream *stream)
 
void h2_stream_cleanup (h2_stream *stream)
 
apr_pool_th2_stream_detach_pool (h2_stream *stream)
 
apr_status_t 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)
 
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_close_input (h2_stream *stream)
 
apr_status_t h2_stream_write_data (h2_stream *stream, const char *data, size_t len, int eos)
 
void h2_stream_rst (h2_stream *stream, int error_code)
 
apr_status_t h2_stream_schedule (h2_stream *stream, int eos, int push_enabled, h2_stream_pri_cmp *cmp, void *ctx)
 
int h2_stream_is_scheduled (const h2_stream *stream)
 
apr_status_t h2_stream_set_error (h2_stream *stream, int http_status)
 
apr_status_t h2_stream_out_prepare (h2_stream *stream, apr_off_t *plen, int *peos, h2_headers **presponse)
 
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)
 
int h2_stream_input_is_open (const h2_stream *stream)
 
apr_status_t h2_stream_submit_pushes (h2_stream *stream, h2_headers *response)
 
const struct h2_priorityh2_stream_get_priority (h2_stream *stream, h2_headers *response)
 
const char * h2_stream_state_str (h2_stream *stream)
 
int h2_stream_is_ready (h2_stream *stream)
 

Macro Definition Documentation

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

Typedef Documentation

typedef struct h2_stream h2_stream

Function Documentation

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

Cleanup references into requst processing.

Parameters
streamthe stream to cleanup
apr_status_t h2_stream_close_input ( h2_stream stream)

Closes the stream's input.

Parameters
streamstream to close intput of
void h2_stream_destroy ( h2_stream stream)

Destroy memory pool if still owned by the stream.

apr_pool_t* h2_stream_detach_pool ( h2_stream stream)

Detach the memory pool from the stream. Will prevent stream destruction to take the pool with it.

Parameters
streamthe stream to detach the pool from
Returns
the detached memory pool or NULL if stream no longer has one
void h2_stream_eos_destroy ( h2_stream stream)

Cleanup any resources still held by the stream, called by last bucket.

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

Get priority information set for this stream.

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
int h2_stream_input_is_open ( const h2_stream stream)

Check if the stream has open input.

Parameters
streamthe stream to check
Returns
!= 0 iff stream has open input.
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
int h2_stream_is_scheduled ( const h2_stream stream)

Determine if stream has been scheduled already.

Parameters
streamthe stream to check on
Returns
!= 0 iff stream has been scheduled
h2_stream* h2_stream_open ( int  id,
apr_pool_t pool,
struct h2_session session,
int  initiated_on 
)

Create a stream in OPEN state.

Parameters
idthe stream identifier
poolthe memory pool to use for this stream
sessionthe session this stream belongs to
Returns
the newly opened stream
apr_status_t h2_stream_out_prepare ( h2_stream stream,
apr_off_t plen,
int peos,
h2_headers **  presponse 
)

Do a speculative read on the stream output to determine the amount of data that can be read.

Parameters
streamthe stream to speculatively read from
plen(in-/out) number of bytes requested and on return amount of bytes that may be read without blocking
peos(out) != 0 iff end of stream will be reached when reading plen bytes (out value).
presponse(out) the response of one became available
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.
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.
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
apr_status_t h2_stream_schedule ( h2_stream stream,
int  eos,
int  push_enabled,
h2_stream_pri_cmp cmp,
void ctx 
)

Schedule the stream for execution. All header information must be present. Use the given priority comparison callback to determine order in queued streams.

Parameters
streamthe stream to schedule
eos!= 0 iff no more input will arrive
cmppriority comparison
ctxcontext for comparison
apr_status_t h2_stream_set_error ( h2_stream stream,
int  http_status 
)

Set the HTTP error status as response.

apr_status_t h2_stream_set_request ( h2_stream stream,
const h2_request r 
)

Initialize stream->request with the given h2_request.

Parameters
streamstream to write request to
rthe request with all the meta data
apr_status_t h2_stream_set_request_rec ( h2_stream stream,
request_rec r 
)

Initialize stream->request with the given request_rec.

Parameters
streamstream to write request to
rthe request with all the meta data
const char* h2_stream_state_str ( h2_stream stream)

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

apr_status_t h2_stream_submit_pushes ( h2_stream stream,
h2_headers response 
)

Submit any server push promises on this stream and schedule the tasks connection with these.

Parameters
streamthe stream for which to submit
apr_status_t h2_stream_write_data ( h2_stream stream,
const char *  data,
size_t  len,
int  eos 
)