Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
stream.h File Reference

QUIC STREAM abstraction (headers) More...

#include <stdint.h>
#include <glib.h>
#include "buffer.h"
#include "refcount.h"
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  imquic_stream
 QUIC stream. More...
 

Typedefs

typedef enum imquic_stream_state imquic_stream_state
 Stream states.
 
typedef struct imquic_stream imquic_stream
 QUIC stream.
 

Enumerations

enum  imquic_stream_state {
  IMQUIC_STREAM_INACTIVE , IMQUIC_STREAM_READY , IMQUIC_STREAM_BLOCKED , IMQUIC_STREAM_RESET ,
  IMQUIC_STREAM_COMPLETE
}
 Stream states. More...
 

Functions

const char * imquic_stream_state_str (imquic_stream_state state)
 Helper function to serialize to string the name of a imquic_stream_state value.
 
imquic_streamimquic_stream_create (uint64_t stream_id, gboolean is_server)
 Helper method to create a new stream.
 
gboolean imquic_stream_can_send (imquic_stream *stream, uint64_t offset, uint64_t length, gboolean verbose)
 Helper method to check whether an endpoint can send data on this stream.
 
gboolean imquic_stream_can_receive (imquic_stream *stream, uint64_t offset, uint64_t length, gboolean verbose)
 Helper method to check whether an endpoint can receive data on this stream.
 
gboolean imquic_stream_mark_complete (imquic_stream *stream, gboolean incoming)
 Helper method to mark a stream as complete in one direction.
 
gboolean imquic_stream_is_done (imquic_stream *stream)
 Helper method to check whether an existing stream is now done.
 
void imquic_stream_destroy (imquic_stream *stream)
 Helper method to destroy an existing imquic_stream instance.
 
Stream utilities
void imquic_parse_stream_id (uint64_t stream_id, uint64_t *id, gboolean *client_initiated, gboolean *bidirectional)
 Parse a QUIC stream ID to its actual ID and its other properties.
 
uint64_t imquic_build_stream_id (uint64_t id, gboolean client_initiated, gboolean bidirectional)
 Build a QUIC stream ID out of its actual ID and its other properties.
 

Detailed Description

QUIC STREAM abstraction (headers)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Abstraction of QUIC STREAMs, to facilitate the management of client/server unidirectional/bidirectional streams created within the contect of a QUIC connection.

Typedef Documentation

◆ imquic_stream

typedef struct imquic_stream imquic_stream

QUIC stream.

◆ imquic_stream_state

Stream states.

Enumeration Type Documentation

◆ imquic_stream_state

Stream states.

Enumerator
IMQUIC_STREAM_INACTIVE 

Inactive.

IMQUIC_STREAM_READY 

Ready.

IMQUIC_STREAM_BLOCKED 

Blocked.

IMQUIC_STREAM_RESET 

Reset.

IMQUIC_STREAM_COMPLETE 

Complete.

Function Documentation

◆ imquic_build_stream_id()

uint64_t imquic_build_stream_id ( uint64_t id,
gboolean client_initiated,
gboolean bidirectional )

Build a QUIC stream ID out of its actual ID and its other properties.

Parameters
[in]idThe actual client/server uni/bidirectional ID
[in]client_initiatedWhether this stream is client initiated
[in]bidirectionalWhether this stream is bidirectional
Returns
The QUIC stream ID

◆ imquic_parse_stream_id()

void imquic_parse_stream_id ( uint64_t stream_id,
uint64_t * id,
gboolean * client_initiated,
gboolean * bidirectional )

Parse a QUIC stream ID to its actual ID and its other properties.

Parameters
[in]stream_idThe QUIC stream ID to parse
[out]idThe actual client/server uni/bidirectional ID
[out]client_initiatedWhether this stream is client initiated
[out]bidirectionalWhether this stream is bidirectional

◆ imquic_stream_can_receive()

gboolean imquic_stream_can_receive ( imquic_stream * stream,
uint64_t offset,
uint64_t length,
gboolean verbose )

Helper method to check whether an endpoint can receive data on this stream.

Note
This checks characteristics of the stream (e.g., client-originated, bidirectional, etc.), the stream state, and whether a stream is complete
Parameters
streamThe imquic_stream instance to check
offsetOffset in the stream from where the new data would be received
lengthLength of the data that would be received
verboseWhether details on the checks should be logged in a verbose way with warnings
Returns
TRUE if data can be received, FALSE otherwise

◆ imquic_stream_can_send()

gboolean imquic_stream_can_send ( imquic_stream * stream,
uint64_t offset,
uint64_t length,
gboolean verbose )

Helper method to check whether an endpoint can send data on this stream.

Note
This checks characteristics of the stream (e.g., client-originated, bidirectional, etc.), the stream state, and whether a stream is complete
Parameters
streamThe imquic_stream instance to check
offsetOffset in the stream from where the new data would be sent
lengthLength of the data that would be sent
verboseWhether details on the checks should be logged in a verbose way with warnings
Returns
TRUE if data can be sent, FALSE otherwise

◆ imquic_stream_create()

imquic_stream * imquic_stream_create ( uint64_t stream_id,
gboolean is_server )

Helper method to create a new stream.

Parameters
stream_idThe stream ID
is_serverWhether the endpoint this stream is added to is a server
Returns
A pointer to a new imquic_stream instance, if successful, or NULL otherwise

◆ imquic_stream_destroy()

void imquic_stream_destroy ( imquic_stream * stream)

Helper method to destroy an existing imquic_stream instance.

Parameters
streamThe imquic_stream instance to destroy

◆ imquic_stream_is_done()

gboolean imquic_stream_is_done ( imquic_stream * stream)

Helper method to check whether an existing stream is now done.

Parameters
streamThe imquic_stream instance to check
Returns
TRUE if the stream is now done, FALSE otherwise

◆ imquic_stream_mark_complete()

gboolean imquic_stream_mark_complete ( imquic_stream * stream,
gboolean incoming )

Helper method to mark a stream as complete in one direction.

Note
This may end up marking the stream as complete in general, depending on the stream state or the unidirectional nature of the stream
Parameters
streamThe imquic_stream instance to update
incomingWhether the stream is now complete on the way in or on the way out
Returns
TRUE in case of success, or FALSE otherwise

◆ imquic_stream_state_str()

const char * imquic_stream_state_str ( imquic_stream_state state)

Helper function to serialize to string the name of a imquic_stream_state value.

Parameters
stateThe imquic_stream_state value
Returns
The state name as a string, if valid, or NULL otherwise