Loading...
Searching...
No Matches
moq.c File Reference

Media Over QUIC (MoQ) stack. More...

#include <arpa/inet.h>
#include "internal/moq.h"
#include "internal/quic.h"
#include "internal/connection.h"
#include "imquic/debug.h"
Include dependency graph for moq.c:

Macros

#define IMQUIC_MOQ_LOG_VERB   IMQUIC_LOG_HUGE
 
#define IMQUIC_MOQ_LOG_HUGE   IMQUIC_LOG_VERB
 
#define IMQUIC_MOQ_CHECK_ERR(cond, error, code, res, reason)
 

Functions

void imquic_moq_init (void)
 Initialize the native MoQ stack at startup.
 
void imquic_moq_deinit (void)
 Uninitialize the native MoQ stack.
 
void imquic_moq_new_connection (imquic_connection *conn, void *user_data)
 Callback the core invokes when a new QUIC connection using MoQ is available.
 
void imquic_moq_stream_incoming (imquic_connection *conn, uint64_t stream_id, uint8_t *bytes, uint64_t offset, uint64_t length, gboolean complete)
 Callback the core invokes when there's new incoming data on a STREAM.
 
void imquic_moq_datagram_incoming (imquic_connection *conn, uint8_t *bytes, uint64_t length)
 Callback the core invokes when there's new incoming data on a DATAGRAM.
 
void imquic_moq_connection_gone (imquic_connection *conn)
 Callback the core invokes when an existing MoQ connection is not available anymore.
 
const char * imquic_moq_error_code_str (imquic_moq_error_code code)
 Helper function to serialize to string the name of a imquic_moq_error_code value.
 
const char * imquic_moq_announce_error_code_str (imquic_moq_announce_error_code code)
 Helper function to serialize to string the name of a imquic_moq_announce_error_code value.
 
const char * imquic_moq_sub_error_code_str (imquic_moq_sub_error_code code)
 Helper function to serialize to string the name of a imquic_moq_sub_error_code value.
 
const char * imquic_moq_subannc_error_code_str (imquic_moq_subannc_error_code code)
 Helper function to serialize to string the name of a imquic_moq_subannc_error_code value.
 
const char * imquic_moq_fetch_error_code_str (imquic_moq_fetch_error_code code)
 Helper function to serialize to string the name of a imquic_moq_fetch_error_code value.
 
const char * imquic_moq_sub_done_code_str (imquic_moq_sub_done_code code)
 Helper function to serialize to string the name of a imquic_moq_sub_done_code value.
 
const char * imquic_moq_track_status_code_str (imquic_moq_track_status_code code)
 Helper function to serialize to string the name of a imquic_moq_track_status_code value.
 
const char * imquic_moq_message_type_str (imquic_moq_message_type type)
 Helper function to serialize to string the name of a imquic_moq_message_type value.
 
const char * imquic_moq_data_message_type_str (imquic_moq_data_message_type type, imquic_moq_version version)
 Helper function to serialize to string the name of a imquic_moq_data_message_type value.
 
imquic_moq_delivery imquic_moq_data_message_type_to_delivery (imquic_moq_data_message_type type, imquic_moq_version version)
 Helper function to return the imquic_moq_delivery mode associated to a imquic_moq_data_message_type type.
 
const char * imquic_moq_setup_parameter_type_str (imquic_moq_setup_parameter_type type)
 Helper function to serialize to string the name of a imquic_moq_setup_parameter_type value.
 
const char * imquic_moq_subscribe_parameter_type_str (imquic_moq_subscribe_parameter_type type)
 Helper function to serialize to string the name of a imquic_moq_subscribe_parameter_type value.
 
const char * imquic_moq_role_type_str (imquic_moq_role_type type)
 Helper function to serialize to string the name of a imquic_moq_role_type value.
 
const char * imquic_moq_filter_type_str (imquic_moq_filter_type type)
 Helper function to serialize to string the name of a imquic_moq_filter_type value.
 
const char * imquic_moq_group_order_str (imquic_moq_group_order type)
 Helper function to serialize to string the name of a imquic_moq_group_order value.
 
const char * imquic_moq_fetch_type_str (imquic_moq_fetch_type type)
 Helper function to serialize to string the name of a imquic_moq_fetch_type value.
 
const char * imquic_moq_auth_token_alias_type_str (imquic_moq_auth_token_alias_type type)
 Helper function to serialize to string the name of a imquic_moq_auth_token_alias_type property.
 
size_t imquic_moq_setup_parameters_serialize (imquic_moq_context *moq, imquic_moq_setup_parameters *parameters, uint8_t *bytes, size_t blen, uint8_t *params_num)
 Helper to serialize a imquic_moq_setup_parameters set to a buffer.
 
size_t imquic_moq_subscribe_parameters_serialize (imquic_moq_context *moq, imquic_moq_subscribe_parameters *parameters, uint8_t *bytes, size_t blen, uint8_t *params_num)
 Helper to serialize a imquic_moq_subscribe_parameters set to a buffer.
 
gboolean imquic_moq_buffer_resize (imquic_moq_buffer *buffer, uint64_t new_size)
 Resize an existing buffer.
 
void imquic_moq_buffer_append (imquic_moq_buffer *buffer, uint8_t *bytes, uint64_t length)
 Append data at the end of the buffer.
 
void imquic_moq_buffer_shift (imquic_moq_buffer *buffer, uint64_t length)
 Move the data in the buffer back of a specific number of bytes.
 
void imquic_moq_buffer_destroy (imquic_moq_buffer *buffer)
 Destroy an existing buffer.
 
imquic_moq_subscriptionimquic_moq_subscription_create (uint64_t request_id, uint64_t track_alias)
 Helper to create a new subscription instance.
 
void imquic_moq_subscription_destroy (imquic_moq_subscription *moq_sub)
 Destroy an existing MoQ subscription.
 
void imquic_moq_stream_destroy (imquic_moq_stream *moq_stream)
 Destroy an existing MoQ stream.
 
int imquic_moq_parse_message (imquic_moq_context *moq, uint64_t stream_id, uint8_t *bytes, size_t blen, gboolean complete, gboolean datagram)
 Parse an incoming MoQ message.
 
size_t imquic_moq_parse_client_setup (imquic_moq_context *moq, uint8_t *bytes, size_t blen, gboolean legacy, uint8_t *error)
 Helper to parse a CLIENT_SETUP message.
 
size_t imquic_moq_parse_server_setup (imquic_moq_context *moq, uint8_t *bytes, size_t blen, gboolean legacy, uint8_t *error)
 Helper to parse a SERVER_SETUP message.
 
size_t imquic_moq_parse_max_request_id (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a MAX_REQUEST_ID message.
 
size_t imquic_moq_parse_requests_blocked (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a REQUESTS_BLOCKED message.
 
size_t imquic_moq_parse_announce (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an ANNOUNCE message.
 
size_t imquic_moq_parse_announce_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an ANNOUNCE_OK message.
 
size_t imquic_moq_parse_announce_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an ANNOUNCE_ERROR message.
 
size_t imquic_moq_parse_unannounce (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an UNANNOUNCE message.
 
size_t imquic_moq_parse_announce_cancel (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an ANNOUNCE_CANCEL message.
 
size_t imquic_moq_parse_subscribe (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE message.
 
size_t imquic_moq_parse_subscribe_update (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_UPDATE message.
 
size_t imquic_moq_parse_subscribe_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_OK message.
 
size_t imquic_moq_parse_subscribe_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_ERROR message.
 
size_t imquic_moq_parse_unsubscribe (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an UNSUBSCRIBE message.
 
size_t imquic_moq_parse_subscribe_done (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_DONE message.
 
size_t imquic_moq_parse_subscribe_announces (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_ANNOUNCES message.
 
size_t imquic_moq_parse_subscribe_announces_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_ANNOUNCES_OK message.
 
size_t imquic_moq_parse_subscribe_announces_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a SUBSCRIBE_ANNOUNCES_ERROR message.
 
size_t imquic_moq_parse_unsubscribe_announces (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse an UNSUBSCRIBE_ANNOUNCES message.
 
size_t imquic_moq_parse_fetch (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a FETCH message.
 
size_t imquic_moq_parse_fetch_cancel (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a FETCH_CANCEL message.
 
size_t imquic_moq_parse_fetch_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a FETCH_OK message.
 
size_t imquic_moq_parse_fetch_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a FETCH_ERROR message.
 
size_t imquic_moq_parse_track_status_request (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a TRACK_STATUS_REQUEST message.
 
size_t imquic_moq_parse_track_status (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a TRACK_STATUS message.
 
size_t imquic_moq_parse_object_datagram (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_data_message_type dtype, uint8_t *error)
 Helper to parse an OBJECT_DATAGRAM message.
 
size_t imquic_moq_parse_object_datagram_status (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_data_message_type dtype, uint8_t *error)
 Helper to parse an OBJECT_DATAGRAM_STATUS message.
 
size_t imquic_moq_parse_stream_header_track (imquic_moq_context *moq, imquic_moq_stream *moq_stream, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a STREAM_HEADER_TRACK message.
 
int imquic_moq_parse_stream_header_track_object (imquic_moq_context *moq, imquic_moq_stream *moq_stream, gboolean complete)
 Helper to parse a STREAM_HEADER_TRACK object.
 
size_t imquic_moq_parse_subgroup_header (imquic_moq_context *moq, imquic_moq_stream *moq_stream, uint8_t *bytes, size_t blen, imquic_moq_data_message_type dtype, uint8_t *error)
 Helper to parse a SUBGROUP_HEADER message.
 
int imquic_moq_parse_subgroup_header_object (imquic_moq_context *moq, imquic_moq_stream *moq_stream, gboolean complete)
 Helper to parse a SUBGROUP_HEADER object.
 
size_t imquic_moq_parse_fetch_header (imquic_moq_context *moq, imquic_moq_stream *moq_stream, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a FETCH_HEADER message.
 
int imquic_moq_parse_fetch_header_object (imquic_moq_context *moq, imquic_moq_stream *moq_stream, gboolean complete)
 Helper to parse a FETCH_HEADER object.
 
size_t imquic_moq_parse_goaway (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint8_t *error)
 Helper to parse a GOAWAY message.
 
size_t imquic_moq_add_control_message (imquic_moq_context *moq, imquic_moq_message_type type, uint8_t *bytes, size_t blen, size_t poffset, size_t plen, size_t *start)
 Helper method to put a message header and a payload together.
 
size_t imquic_moq_add_client_setup (imquic_moq_context *moq, uint8_t *bytes, size_t blen, GList *supported_versions, imquic_moq_setup_parameters *parameters)
 Helper method to add a CLIENT_SETUP message to a buffer.
 
size_t imquic_moq_add_server_setup (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint32_t version, imquic_moq_setup_parameters *parameters)
 Helper method to add a SERVER_SETUP message to a buffer.
 
size_t imquic_moq_add_max_request_id (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t max_request_id)
 Helper method to add a MAX_REQUEST_ID message to a buffer.
 
size_t imquic_moq_add_requests_blocked (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t max_request_id)
 Helper method to add a REQUESTS_BLOCKED message to a buffer.
 
size_t imquic_moq_add_announce (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_subscribe_parameters *parameters)
 Helper method to add an ANNOUNCE message to a buffer.
 
size_t imquic_moq_add_announce_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace)
 Helper method to add an ANNOUNCE_OK message to a buffer.
 
size_t imquic_moq_add_announce_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_announce_error_code error, const char *reason)
 Helper method to add an ANNOUNCE_ERROR message to a buffer.
 
size_t imquic_moq_add_unannounce (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_namespace *track_namespace)
 Helper method to add an UNANNOUNCE message to a buffer.
 
size_t imquic_moq_add_announce_cancel (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_namespace *track_namespace, imquic_moq_announce_error_code error, const char *reason)
 Helper method to add aN ANNOUNCE_CANCEL message to a buffer.
 
size_t imquic_moq_add_subscribe (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t track_alias, imquic_moq_namespace *track_namespace, imquic_moq_name *track_name, uint8_t priority, uint8_t group_order, gboolean forward, imquic_moq_filter_type filter, uint64_t start_group, uint64_t start_object, uint64_t end_group, uint64_t end_object, imquic_moq_subscribe_parameters *parameters)
 Helper to add a SUBSCRIBE message to a buffer.
 
size_t imquic_moq_add_subscribe_update (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t start_group, uint64_t start_object, uint64_t end_group, uint64_t end_object, uint8_t priority, gboolean forward, imquic_moq_subscribe_parameters *parameters)
 Helper method to add a SUBSCRIBE_UPDATE message to a buffer.
 
size_t imquic_moq_add_subscribe_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t expires, imquic_moq_group_order group_order, gboolean content_exists, uint64_t largest_group_id, uint64_t largest_object_id, imquic_moq_subscribe_parameters *parameters)
 Helper method to add a SUBSCRIBE_OK message to a buffer.
 
size_t imquic_moq_add_subscribe_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_sub_error_code error, const char *reason, uint64_t track_alias)
 Helper method to add a SUBSCRIBE_ERRROR message to a buffer.
 
size_t imquic_moq_add_unsubscribe (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id)
 Helper method to add an UNSUBSCRIBE message to a buffer.
 
size_t imquic_moq_add_subscribe_done (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_sub_done_code status, uint64_t streams_count, const char *reason, gboolean content_exists, uint64_t final_group, uint64_t final_object)
 Helper method to add a SUBSCRIBE_DONE message to a buffer.
 
size_t imquic_moq_add_subscribe_announces (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_subscribe_parameters *parameters)
 Helper to add a SUBSCRIBE_ANNOUNCES message to a buffer.
 
size_t imquic_moq_add_subscribe_announces_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace)
 Helper method to add a SUBSCRIBE_ANNOUNCES_OK message to a buffer.
 
size_t imquic_moq_add_subscribe_announces_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_subannc_error_code error, const char *reason)
 Helper method to add a SUBSCRIBE_ANNOUNCES_ERRROR message to a buffer.
 
size_t imquic_moq_add_unsubscribe_announces (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_namespace *track_namespace)
 Helper method to add an UNSUBSCRIBE_ANNOUNCES message to a buffer.
 
size_t imquic_moq_add_fetch (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_fetch_type type, uint64_t request_id, uint64_t joining_request_id, uint64_t preceding_group_offset, imquic_moq_namespace *track_namespace, imquic_moq_name *track_name, uint8_t priority, imquic_moq_group_order group_order, uint64_t start_group, uint64_t start_object, uint64_t end_group, uint64_t end_object, imquic_moq_subscribe_parameters *parameters)
 Helper to add a FETCH message to a buffer.
 
size_t imquic_moq_add_fetch_cancel (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id)
 Helper method to add an FETCH_CANCEL message to a buffer.
 
size_t imquic_moq_add_fetch_ok (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint8_t group_order, uint8_t end_of_track, uint64_t largest_group_id, uint64_t largest_object_id, imquic_moq_subscribe_parameters *parameters)
 Helper method to add a FETCH_OK message to a buffer.
 
size_t imquic_moq_add_fetch_error (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_fetch_error_code error, const char *reason)
 Helper method to add a FETCH_ERRROR message to a buffer.
 
size_t imquic_moq_add_track_status_request (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_name *track_name, imquic_moq_subscribe_parameters *parameters)
 Helper to add a TRACK_STATUS_REQUEST message to a buffer.
 
size_t imquic_moq_add_track_status (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, imquic_moq_namespace *track_namespace, imquic_moq_name *track_name, uint64_t status_code, uint64_t last_group_id, uint64_t last_object_id, imquic_moq_subscribe_parameters *parameters)
 Helper to add a TRACK_STATUS message to a buffer.
 
size_t imquic_moq_add_object_datagram (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t track_alias, uint64_t group_id, uint64_t object_id, uint64_t object_status, uint8_t priority, uint8_t *payload, size_t plen, size_t extensions_count, uint8_t *extensions, size_t elen)
 Helper to add an OBJECT_DATAGRAM message to a buffer.
 
size_t imquic_moq_add_object_datagram_status (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t track_alias, uint64_t group_id, uint64_t object_id, uint8_t priority, uint64_t object_status, uint8_t *extensions, size_t elen)
 Helper to add an OBJECT_DATAGRAM_STATUS message to a buffer.
 
size_t imquic_moq_add_stream_header_track (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t track_alias, uint8_t priority)
 Helper to add a STREAM_HEADER_TRACK message to a buffer (only before v06)
 
size_t imquic_moq_add_stream_header_track_object (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t group_id, uint64_t object_id, uint64_t object_status, uint8_t *payload, size_t plen)
 Helper to add an object to a buffer, formatted as expected for STREAM_HEADER_TRACK objects (so not all IDs) (only before v06)
 
size_t imquic_moq_add_subgroup_header (imquic_moq_context *moq, imquic_moq_stream *moq_stream, uint8_t *bytes, size_t blen, uint64_t request_id, uint64_t track_alias, uint64_t group_id, uint64_t subgroup_id, uint8_t priority)
 Helper to add a SUBGROUP_HEADER message to a buffer (only after v06)
 
size_t imquic_moq_add_subgroup_header_object (imquic_moq_context *moq, imquic_moq_stream *moq_stream, uint8_t *bytes, size_t blen, uint64_t object_id, uint64_t object_status, uint8_t *payload, size_t plen, size_t extensions_count, uint8_t *extensions, size_t elen)
 Helper to add an object to a buffer, formatted as expected for SUBGROUP_HEADER objects (so not all IDs) (only after v06)
 
size_t imquic_moq_add_fetch_header (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t request_id)
 Helper to add a FETCH_HEADER message to a buffer (only after v07)
 
size_t imquic_moq_add_fetch_header_object (imquic_moq_context *moq, uint8_t *bytes, size_t blen, uint64_t group_id, uint64_t subgroup_id, uint64_t object_id, uint8_t priority, uint64_t object_status, uint8_t *payload, size_t plen, size_t extensions_count, uint8_t *extensions, size_t elen)
 Helper to add an object to a buffer, formatted as expected for FETCH_HEADER objects (so not all IDs) (only before v06)
 
size_t imquic_moq_add_goaway (imquic_moq_context *moq, uint8_t *bytes, size_t blen, const char *new_session_uri)
 Helper method to add a GOAWAY message to a buffer.
 
size_t imquic_moq_add_object_extensions (imquic_moq_context *moq, uint8_t *bytes, size_t blen, size_t extensions_count, uint8_t *extensions, size_t elen)
 Helper method to add object extensions to a buffer.
 
size_t imquic_moq_parameter_add_int (imquic_moq_context *moq, uint8_t *bytes, size_t blen, int param, uint64_t number)
 Helper to add a MoQ (setup or subscribe) parameter with a numeric value to a buffer.
 
size_t imquic_moq_parameter_add_data (imquic_moq_context *moq, uint8_t *bytes, size_t blen, int param, uint8_t *buf, size_t buflen)
 Helper to add a MoQ (setup or subscribe) parameter with generic data to a buffer.
 
size_t imquic_moq_parse_setup_parameter (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_setup_parameters *params, uint8_t *error)
 Helper method to parse a MoQ setup parameter.
 
size_t imquic_moq_parse_subscribe_parameter (imquic_moq_context *moq, uint8_t *bytes, size_t blen, imquic_moq_subscribe_parameters *params, uint8_t *error)
 Helper method to parse a MoQ subscribe parameter.
 
int imquic_moq_set_role (imquic_connection *conn, imquic_moq_role role)
 Method to set the MoQ role on a connection. Must be done as soon as the connection is established, and before sending any MoQ message. A good place to do that is the callback fired when a new connection is available.
 
imquic_moq_role imquic_moq_get_role (imquic_connection *conn)
 Helper function to get the MoQ role associated with a connection.
 
int imquic_moq_set_version (imquic_connection *conn, imquic_moq_version version)
 Method to set the MoQ version on a connection. Must be done as soon as the connection is established, and before sending any MoQ message. A good place to do that is the callback fired when a new connection is available.
 
imquic_moq_version imquic_moq_get_version (imquic_connection *conn)
 Helper function to get the MoQ version associated with a connection.
 
int imquic_moq_set_max_request_id (imquic_connection *conn, uint64_t max_request_id)
 Helper function to set the Maximum Request ID a subscriber can send.
 
uint64_t imquic_moq_get_next_request_id (imquic_connection *conn)
 Helper function to get the next Request ID we can use.
 
GList * imquic_moq_parse_object_extensions (uint8_t *extensions, size_t elen)
 Helper mode to parse an extensions buffer to a GList of imquic_moq_object_extension.
 
size_t imquic_moq_build_object_extensions (GList *extensions, uint8_t *bytes, size_t blen)
 Helper mode to craft an extensions buffer out of a GList of imquic_moq_object_extension.
 
int imquic_moq_parse_auth_token (uint8_t *bytes, size_t blen, imquic_moq_auth_token *token)
 Helper mode to parse an auth token buffer to a imquic_moq_auth_token instance.
 
size_t imquic_moq_build_auth_token (imquic_moq_auth_token *token, uint8_t *bytes, size_t blen)
 Helper mode to craft an auth token buffer out of a imquic_moq_auth_token instance.
 
int imquic_moq_announce (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns)
 Function to send an ANNOUNCE request.
 
int imquic_moq_accept_announce (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns)
 Function to accept an incoming ANNOUNCE request.
 
int imquic_moq_reject_announce (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, imquic_moq_announce_error_code error_code, const char *reason)
 Function to reject an incoming ANNOUNCE request.
 
int imquic_moq_unannounce (imquic_connection *conn, imquic_moq_namespace *tns)
 Function to send an UNANNOUNCE request.
 
int imquic_moq_subscribe (imquic_connection *conn, uint64_t request_id, uint64_t track_alias, imquic_moq_namespace *tns, imquic_moq_name *tn, uint8_t priority, gboolean descending, gboolean forward, imquic_moq_filter_type filter_type, imquic_moq_location *start_location, imquic_moq_location *end_location, uint8_t *auth, size_t authlen)
 Function to send a SUBSCRIBE request.
 
int imquic_moq_accept_subscribe (imquic_connection *conn, uint64_t request_id, uint64_t expires, gboolean descending, imquic_moq_location *largest)
 Function to accept an incoming SUBSCRIBE request.
 
int imquic_moq_reject_subscribe (imquic_connection *conn, uint64_t request_id, imquic_moq_sub_error_code error_code, const char *reason, uint64_t track_alias)
 Function to reject an incoming SUBSCRIBE request.
 
int imquic_moq_update_subscribe (imquic_connection *conn, uint64_t request_id, imquic_moq_location *start_location, uint64_t end_group, uint8_t priority, gboolean forward)
 Function to send a SUBSCRIBE_UPDATE request.
 
int imquic_moq_unsubscribe (imquic_connection *conn, uint64_t request_id)
 Function to send a UNSUBSCRIBE request.
 
int imquic_moq_subscribe_done (imquic_connection *conn, uint64_t request_id, imquic_moq_sub_done_code status_code, const char *reason)
 Function to send a SUBSCRIBE_DONE request.
 
int imquic_moq_subscribe_announces (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, uint8_t *auth, size_t authlen)
 Function to send a SUBSCRIBE_ANNOUNCES request.
 
int imquic_moq_accept_subscribe_announces (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns)
 Function to accept an incoming SUBSCRIBE_ANNOUNCES request.
 
int imquic_moq_reject_subscribe_announces (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, imquic_moq_subannc_error_code error_code, const char *reason)
 Function to reject an incoming SUBSCRIBE_ANNOUNCES request.
 
int imquic_moq_unsubscribe_announces (imquic_connection *conn, imquic_moq_namespace *tns)
 Function to send a UNSUBSCRIBE_ANNOUNCES request.
 
int imquic_moq_standalone_fetch (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, imquic_moq_name *tn, gboolean descending, imquic_moq_fetch_range *range, uint8_t *auth, size_t authlen)
 Function to send a standalone FETCH request.
 
int imquic_moq_joining_fetch (imquic_connection *conn, uint64_t request_id, uint64_t joining_request_id, gboolean absolute, uint64_t joining_start, gboolean descending, uint8_t *auth, size_t authlen)
 Function to send a joining FETCH request.
 
int imquic_moq_accept_fetch (imquic_connection *conn, uint64_t request_id, gboolean descending, imquic_moq_location *largest)
 Function to accept an incoming FETCH request.
 
int imquic_moq_reject_fetch (imquic_connection *conn, uint64_t request_id, imquic_moq_fetch_error_code error_code, const char *reason)
 Function to reject an incoming FETCH request.
 
int imquic_moq_cancel_fetch (imquic_connection *conn, uint64_t request_id)
 Function to send a FETCH_CANCEL request.
 
int imquic_moq_track_status_request (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, imquic_moq_name *tn)
 Function to send a TRACK_STATUS_REQUEST request.
 
int imquic_moq_track_status (imquic_connection *conn, uint64_t request_id, imquic_moq_namespace *tns, imquic_moq_name *tn, imquic_moq_track_status_code status_code, imquic_moq_location *largest)
 Function to send a TRACK_STATUS request.
 
int imquic_moq_requests_blocked (imquic_connection *conn)
 Function to send a REQUESTS_BLOCKED request.
 
int imquic_moq_goaway (imquic_connection *conn, const char *uri)
 Function to send a GOAWAY request.
 
int imquic_moq_send_object (imquic_connection *conn, imquic_moq_object *object)
 Function to send a MoQ object.
 
json_t * imquic_qlog_moq_message_prepare (const char *type)
 Helper to create a new QLOG MoQT message.
 
void imquic_qlog_moq_message_add_namespace (json_t *message, imquic_moq_namespace *track_namespace)
 Helper to add a stringified namespace tuple array to a message.
 
void imquic_qlog_moq_message_add_track (json_t *message, imquic_moq_name *track_name)
 Helper to add a stringified track name to a message.
 
void imquic_qlog_moq_message_add_setup_parameters (json_t *message, imquic_moq_setup_parameters *parameters, const char *name)
 Helper to add a stringified array of setup parameters to a message.
 
void imquic_qlog_moq_message_add_subscribe_parameters (json_t *message, imquic_moq_subscribe_parameters *parameters, const char *name)
 Helper to add a stringified array of subscribe parameters to a message.
 
void imquic_moq_qlog_control_message_created (imquic_qlog *qlog, uint64_t stream_id, size_t length, json_t *message)
 Add a control_message_created event.
 
void imquic_moq_qlog_control_message_parsed (imquic_qlog *qlog, uint64_t stream_id, size_t length, json_t *message)
 Add a control_message_parsed event.
 
void imquic_moq_qlog_stream_type_set (imquic_qlog *qlog, gboolean local, uint64_t stream_id, const char *type)
 Add a stream_type_set event.
 
void imquic_moq_qlog_object_datagram_created (imquic_qlog *qlog, imquic_moq_object *object)
 Add a object_datagram_created event.
 
void imquic_moq_qlog_object_datagram_parsed (imquic_qlog *qlog, imquic_moq_object *object)
 Add a object_datagram_parsed event.
 
void imquic_moq_qlog_object_datagram_status_created (imquic_qlog *qlog, imquic_moq_object *object)
 Add a object_datagram_status_created event.
 
void imquic_moq_qlog_object_datagram_status_parsed (imquic_qlog *qlog, imquic_moq_object *object)
 Add a object_datagram_status_parsed event.
 
void imquic_moq_qlog_subgroup_header_created (imquic_qlog *qlog, imquic_moq_stream *stream)
 Add a subgroup_header_created event.
 
void imquic_moq_qlog_subgroup_header_parsed (imquic_qlog *qlog, imquic_moq_stream *stream)
 Add a subgroup_header_parsed event.
 
void imquic_moq_qlog_subgroup_object_created (imquic_qlog *qlog, uint64_t stream_id, imquic_moq_object *object)
 Add a subgroup_object_created event.
 
void imquic_moq_qlog_subgroup_object_parsed (imquic_qlog *qlog, uint64_t stream_id, imquic_moq_object *object)
 Add a subgroup_object_parsed event.
 
void imquic_moq_qlog_fetch_header_created (imquic_qlog *qlog, imquic_moq_stream *stream)
 Add a fetch_header_created event.
 
void imquic_moq_qlog_fetch_header_parsed (imquic_qlog *qlog, imquic_moq_stream *stream)
 Add a fetch_header_parsed event.
 
void imquic_moq_qlog_fetch_object_created (imquic_qlog *qlog, uint64_t stream_id, imquic_moq_object *object)
 Add a fetch_object_created event.
 
void imquic_moq_qlog_fetch_object_parsed (imquic_qlog *qlog, uint64_t stream_id, imquic_moq_object *object)
 Add a fetch_object_parsed event.
 

Detailed Description

Media Over QUIC (MoQ) stack.

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

Implementation of the Media Over QUIC (MoQ) stack as part of the library itself. At the time of writing, this implements (most of) versions from -06 to to -11 of the protocol.

Note
This is the internal implementation of MoQ in the library. You're still free to only use imquic as the underlying QUIC/WebTransport library, and take care of the MoQ implementation on your own instead: in order to do that, use the generic imquic client/server creation utilities, rather than the MoQ specific ones.

Macro Definition Documentation

◆ IMQUIC_MOQ_CHECK_ERR

#define IMQUIC_MOQ_CHECK_ERR ( cond,
error,
code,
res,
reason )
Value:
if(cond) { \
IMQUIC_LOG(IMQUIC_LOG_ERR, "%s\n", reason); \
if(error) \
*(uint8_t *)error = code; \
return res; \
}
#define IMQUIC_LOG_ERR
Non-fatal error.
Definition debug.h:44

◆ IMQUIC_MOQ_LOG_HUGE

#define IMQUIC_MOQ_LOG_HUGE   IMQUIC_LOG_VERB

◆ IMQUIC_MOQ_LOG_VERB

#define IMQUIC_MOQ_LOG_VERB   IMQUIC_LOG_HUGE

Function Documentation

◆ imquic_moq_accept_announce()

int imquic_moq_accept_announce ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns )

Function to accept an incoming ANNOUNCE request.

Parameters
connThe imquic_connection to send the request on
request_idThe request ID of the original ANNOUNCE request (only v11 and later)
tnsThe imquic_moq_namespace namespace to accept (only before v11)
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_accept_fetch()

int imquic_moq_accept_fetch ( imquic_connection * conn,
uint64_t request_id,
gboolean descending,
imquic_moq_location * largest )

Function to accept an incoming FETCH request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to accept
descendingWhether objects will be delivered in descending group order
largestThe largest group/object IDs
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_accept_subscribe()

int imquic_moq_accept_subscribe ( imquic_connection * conn,
uint64_t request_id,
uint64_t expires,
gboolean descending,
imquic_moq_location * largest )

Function to accept an incoming SUBSCRIBE request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to accept
expiresValue of expires to send back
descendingWhether objects will be delivered in descending group order
largestThe largest group/object IDs, in case content exists
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_accept_subscribe_announces()

int imquic_moq_accept_subscribe_announces ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns )

Function to accept an incoming SUBSCRIBE_ANNOUNCES request.

Parameters
connThe imquic_connection to send the request on
request_idThe request ID of the original SUBSCRIBE_ANNOUNCES request (only v11 and later)
tnsThe imquic_moq_namespace namespace to accept notifications for (only before v11)
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_add_announce()

size_t imquic_moq_add_announce ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_subscribe_parameters * parameters )

Helper method to add an ANNOUNCE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceNamespace to announce
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_announce_cancel()

size_t imquic_moq_add_announce_cancel ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_namespace * track_namespace,
imquic_moq_announce_error_code error,
const char * reason )

Helper method to add aN ANNOUNCE_CANCEL message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
track_namespaceNamespace for which to cancel the announcement
errorError code associated to the message
reasonVerbose description of the error, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_announce_error()

size_t imquic_moq_add_announce_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_announce_error_code error,
const char * reason )

Helper method to add an ANNOUNCE_ERROR message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceNamespace for which the announcement caused an error (only before v11)
errorError code associated to the message
reasonVerbose description of the error, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_announce_ok()

size_t imquic_moq_add_announce_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace )

Helper method to add an ANNOUNCE_OK message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceNamespace for which the announcement succeeded (only before v11)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_client_setup()

size_t imquic_moq_add_client_setup ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
GList * supported_versions,
imquic_moq_setup_parameters * parameters )

Helper method to add a CLIENT_SETUP message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
supported_versionsList of supported versions
parametersThe setup parameters to send
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_control_message()

size_t imquic_moq_add_control_message ( imquic_moq_context * moq,
imquic_moq_message_type type,
uint8_t * bytes,
size_t blen,
size_t poffset,
size_t plen,
size_t * start )

Helper method to put a message header and a payload together.

Note
All the "add" functions for control messages don't set the type in the buffer, since versions of MoQ later than v06 also envision a payload length varint: as such, we prepare the payload first, and prefix the message type (and optionally the payload length) later.
Parameters
[in]moqThe imquic_moq_context generating the message
[in]typeThe ID of the control message to send
[in]bytesThe buffer to add the control message to
[in]blenThe size of the buffer
[in]poffsetWhere in the provided buffer we already have the payload
[in]plenSize of the payload in the buffer
[out]startWhere the final control message starts, in the buffer
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_fetch()

size_t imquic_moq_add_fetch ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_fetch_type type,
uint64_t request_id,
uint64_t joining_request_id,
uint64_t preceding_group_offset,
imquic_moq_namespace * track_namespace,
imquic_moq_name * track_name,
uint8_t priority,
imquic_moq_group_order group_order,
uint64_t start_group,
uint64_t start_object,
uint64_t end_group,
uint64_t end_object,
imquic_moq_subscribe_parameters * parameters )

Helper to add a FETCH message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
typeThe FETCH type
request_idThe request ID to put in the message
joining_request_idThe joining request ID to put in the message, if any
preceding_group_offsetThe preceding group offset for joining fetches, if any
track_namespaceThe namespace to put in the message
track_nameThe track name to put in the message
priorityThe fetchr priority to put in the message
group_orderThe group order to put in the message
start_groupThe start group ID to put in the message
start_objectThe start object ID to put in the message
end_groupThe end group ID to put in the message
end_objectThe end object ID to put in the message
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_fetch_cancel()

size_t imquic_moq_add_fetch_cancel ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id )

Helper method to add an FETCH_CANCEL message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_fetch_error()

size_t imquic_moq_add_fetch_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_fetch_error_code error,
const char * reason )

Helper method to add a FETCH_ERRROR message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
errorError code associated to the message
reasonVerbose description of the error, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_fetch_header()

size_t imquic_moq_add_fetch_header ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id )

Helper to add a FETCH_HEADER message to a buffer (only after v07)

Note
This will create a new STREAM and send the header: after that, imquic_moq_add_fetch_header_object is used to send all objects that belong to this track.
Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_fetch_header_object()

size_t imquic_moq_add_fetch_header_object ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t group_id,
uint64_t subgroup_id,
uint64_t object_id,
uint8_t priority,
uint64_t object_status,
uint8_t * payload,
size_t plen,
size_t extensions_count,
uint8_t * extensions,
size_t elen )

Helper to add an object to a buffer, formatted as expected for FETCH_HEADER objects (so not all IDs) (only before v06)

Parameters
moqThe imquic_moq_context generating the object
bytesThe buffer to add the object to
blenThe size of the buffer
group_idThe group ID
subgroup_idThe subgroup ID
object_idThe object ID
priorityThe publisher priority to put in the message
object_statusThe object status (only added if the payload length is 0)
payloadThe buffer containing the payload of the object
plenThe size of the payload buffer
extensions_countThe number of object extensions, if any (only in v08, deprecated in v09)
extensionsThe buffer containing the object extensions, if any (only since v08)
elenThe size of the object extensions buffer (only since v08)
Returns
The size of the generated object, if successful, or 0 otherwise

◆ imquic_moq_add_fetch_ok()

size_t imquic_moq_add_fetch_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint8_t group_order,
uint8_t end_of_track,
uint64_t largest_group_id,
uint64_t largest_object_id,
imquic_moq_subscribe_parameters * parameters )

Helper method to add a FETCH_OK message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
group_orderThe group order to put in the message
end_of_trackWhether all objects have been published
largest_group_idLargest group ID to add to the message, if needed
largest_object_idLargest object ID to add to the message, if needed
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_goaway()

size_t imquic_moq_add_goaway ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
const char * new_session_uri )

Helper method to add a GOAWAY message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
new_session_uriNew uri value to put in the message, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_max_request_id()

size_t imquic_moq_add_max_request_id ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t max_request_id )

Helper method to add a MAX_REQUEST_ID message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
max_request_idMaximum request ID to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_object_datagram()

size_t imquic_moq_add_object_datagram ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t track_alias,
uint64_t group_id,
uint64_t object_id,
uint64_t object_status,
uint8_t priority,
uint8_t * payload,
size_t plen,
size_t extensions_count,
uint8_t * extensions,
size_t elen )

Helper to add an OBJECT_DATAGRAM message to a buffer.

Note
This assumes the connection negotiated DATAGRAM support
Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
track_aliasThe track alias to put in the message
group_idThe group ID to put in the message
object_idThe object ID to put in the message
object_statusThe object status (only added if the payload length is 0)
priorityThe publisher priority to put in the message
payloadThe buffer containing the payload of the object
plenThe size of the payload buffer
extensions_countThe number of object extensions, if any (only in v08, deprecated in v09)
extensionsThe buffer containing the object extensions, if any (only since v08)
elenThe size of the object extensions buffer (only since v08)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_object_datagram_status()

size_t imquic_moq_add_object_datagram_status ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t track_alias,
uint64_t group_id,
uint64_t object_id,
uint8_t priority,
uint64_t object_status,
uint8_t * extensions,
size_t elen )

Helper to add an OBJECT_DATAGRAM_STATUS message to a buffer.

Note
This assumes the connection negotiated DATAGRAM support
Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
track_aliasThe track alias to put in the message
group_idThe group ID to put in the message
object_idThe object ID to put in the message
priorityThe publisher priority to put in the message
object_statusThe object status (only added if the payload length is 0)
extensionsThe buffer containing the object extensions, if any (only since v09)
elenThe size of the object extensions buffer (only since v09)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_object_extensions()

size_t imquic_moq_add_object_extensions ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
size_t extensions_count,
uint8_t * extensions,
size_t elen )

Helper method to add object extensions to a buffer.

Note
Object extensions were only added in v08, so this method does nothing when used on a connection that negotiated an older version
Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the extensions to
blenThe size of the buffer
extensions_countThe number of object extensions, if any (ignored after v08, since v09 deprecated it)
extensionsThe buffer containing the object extensions, if any
elenThe size of the object extensions buffer
Returns
The size of the generated extensions block, if successful, or 0 otherwise

◆ imquic_moq_add_requests_blocked()

size_t imquic_moq_add_requests_blocked ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t max_request_id )

Helper method to add a REQUESTS_BLOCKED message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
max_request_idMaximum request ID to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_server_setup()

size_t imquic_moq_add_server_setup ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint32_t version,
imquic_moq_setup_parameters * parameters )

Helper method to add a SERVER_SETUP message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
versionNegotiated version
parametersThe setup parameters to send
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_stream_header_track()

size_t imquic_moq_add_stream_header_track ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t track_alias,
uint8_t priority )

Helper to add a STREAM_HEADER_TRACK message to a buffer (only before v06)

Note
This will create a new STREAM and send the header: after that, imquic_moq_add_stream_header_track_object is used to send all objects that belong to this track.
Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
track_aliasThe track alias to put in the message
priorityThe publisher priority to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_stream_header_track_object()

size_t imquic_moq_add_stream_header_track_object ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t group_id,
uint64_t object_id,
uint64_t object_status,
uint8_t * payload,
size_t plen )

Helper to add an object to a buffer, formatted as expected for STREAM_HEADER_TRACK objects (so not all IDs) (only before v06)

Parameters
moqThe imquic_moq_context generating the object
bytesThe buffer to add the object to
blenThe size of the buffer
group_idThe group ID
object_idThe object ID
object_statusThe object status (only added if the payload length is 0)
payloadThe buffer containing the payload of the object
plenThe size of the payload buffer
Returns
The size of the generated object, if successful, or 0 otherwise

◆ imquic_moq_add_subgroup_header()

size_t imquic_moq_add_subgroup_header ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t track_alias,
uint64_t group_id,
uint64_t subgroup_id,
uint8_t priority )

Helper to add a SUBGROUP_HEADER message to a buffer (only after v06)

Note
This will create a new STREAM and send the header: after that, imquic_moq_add_stream_header_subgroup_object is used to send all objects that belong to this subgroup.
Parameters
moqThe imquic_moq_context generating the message
moq_streamThe imquic_moq_context instance the object is for
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
track_aliasThe track alias to put in the message
group_idThe group ID to put in the message
subgroup_idThe subgroup ID to put in the message
priorityThe publisher priority to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subgroup_header_object()

size_t imquic_moq_add_subgroup_header_object ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
uint8_t * bytes,
size_t blen,
uint64_t object_id,
uint64_t object_status,
uint8_t * payload,
size_t plen,
size_t extensions_count,
uint8_t * extensions,
size_t elen )

Helper to add an object to a buffer, formatted as expected for SUBGROUP_HEADER objects (so not all IDs) (only after v06)

Parameters
moqThe imquic_moq_context generating the object
moq_streamThe imquic_moq_context instance the object is for
bytesThe buffer to add the object to
blenThe size of the buffer
object_idThe object ID
object_statusThe object status (only added if the payload length is 0)
payloadThe buffer containing the payload of the object
plenThe size of the payload buffer
extensions_countThe number of object extensions, if any (only in v08, deprecated in v09)
extensionsThe buffer containing the object extensions, if any (only since v08)
elenThe size of the object extensions buffer (only since v08)
Returns
The size of the generated object, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe()

size_t imquic_moq_add_subscribe ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t track_alias,
imquic_moq_namespace * track_namespace,
imquic_moq_name * track_name,
uint8_t priority,
uint8_t group_order,
gboolean forward,
imquic_moq_filter_type filter,
uint64_t start_group,
uint64_t start_object,
uint64_t end_group,
uint64_t end_object,
imquic_moq_subscribe_parameters * parameters )

Helper to add a SUBSCRIBE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
track_aliasThe track alias to put in the message
track_namespaceThe namespace to put in the message
track_nameThe track name to put in the message
priorityThe subscriber priority to put in the message
group_orderThe group order to put in the message
forwardThe forward value to put in the message (only starting from v11)
filterThe filter as a imquic_moq_filter_type value
start_groupThe start group ID to put in the message
start_objectThe start object ID to put in the message
end_groupThe end group ID to put in the message
end_objectThe end object ID to put in the message
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_announces()

size_t imquic_moq_add_subscribe_announces ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_subscribe_parameters * parameters )

Helper to add a SUBSCRIBE_ANNOUNCES message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceThe namespace to put in the message
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_announces_error()

size_t imquic_moq_add_subscribe_announces_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_subannc_error_code error,
const char * reason )

Helper method to add a SUBSCRIBE_ANNOUNCES_ERRROR message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceThe namespace to put in the message (only before v11)
errorError code associated to the message
reasonVerbose description of the error, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_announces_ok()

size_t imquic_moq_add_subscribe_announces_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace )

Helper method to add a SUBSCRIBE_ANNOUNCES_OK message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceThe namespace to put in the message (only before v11)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_done()

size_t imquic_moq_add_subscribe_done ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_sub_done_code status,
uint64_t streams_count,
const char * reason,
gboolean content_exists,
uint64_t final_group,
uint64_t final_object )

Helper method to add a SUBSCRIBE_DONE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
statusThe status of the subscrption
streams_countThe streams count (only after v07)
reasonVerbose description of the status
content_existsWhether the following two properties should be added to the message (only before v08)
final_groupFinal group ID to add to the message, if needed (only before v08)
final_objectFinal object ID to add to the message, if needed (only before v08)
Returns
The size of the generated message, if successful, or 0 otherwise (only before v08)

◆ imquic_moq_add_subscribe_error()

size_t imquic_moq_add_subscribe_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_sub_error_code error,
const char * reason,
uint64_t track_alias )

Helper method to add a SUBSCRIBE_ERRROR message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
errorError code associated to the message
reasonVerbose description of the error, if any
track_aliasThe track alias to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_ok()

size_t imquic_moq_add_subscribe_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t expires,
imquic_moq_group_order group_order,
gboolean content_exists,
uint64_t largest_group_id,
uint64_t largest_object_id,
imquic_moq_subscribe_parameters * parameters )

Helper method to add a SUBSCRIBE_OK message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
expiresThe expires value to put in the message
group_orderThe group order to put in the message
content_existsWhether the following two properties should be added to the message
largest_group_idLargest group ID to add to the message, if needed
largest_object_idLargest object ID to add to the message, if needed
parametersThe parameters to add, if any (only after v06)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_subscribe_update()

size_t imquic_moq_add_subscribe_update ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
uint64_t start_group,
uint64_t start_object,
uint64_t end_group,
uint64_t end_object,
uint8_t priority,
gboolean forward,
imquic_moq_subscribe_parameters * parameters )

Helper method to add a SUBSCRIBE_UPDATE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
start_groupThe start group ID to put in the message
start_objectThe start object ID to put in the message
end_groupThe end group ID to put in the message
end_objectThe end object ID to put in the message
priorityThe subscriber priority to put in the message
forwardThe forward value to put in the message (only starting from v11)
parametersThe parameters to add, if any
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_track_status()

size_t imquic_moq_add_track_status ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_name * track_name,
uint64_t status_code,
uint64_t last_group_id,
uint64_t last_object_id,
imquic_moq_subscribe_parameters * parameters )

Helper to add a TRACK_STATUS message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceThe namespace to put in the message (only before v11)
track_nameThe track name to put in the message (only before v11)
status_codeThe status code to put in the message
last_group_idThe last group ID to put in the message
last_object_idThe last object ID to put in the message
parametersThe parameters to add, if any (only v11 and later)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_track_status_request()

size_t imquic_moq_add_track_status_request ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id,
imquic_moq_namespace * track_namespace,
imquic_moq_name * track_name,
imquic_moq_subscribe_parameters * parameters )

Helper to add a TRACK_STATUS_REQUEST message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message (only v11 and later)
track_namespaceThe namespace to put in the message
track_nameThe track name to put in the message
parametersThe parameters to add, if any (only v11 and later)
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_unannounce()

size_t imquic_moq_add_unannounce ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_namespace * track_namespace )

Helper method to add an UNANNOUNCE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
track_namespaceNamespace to unannounce
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_unsubscribe()

size_t imquic_moq_add_unsubscribe ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint64_t request_id )

Helper method to add an UNSUBSCRIBE message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
request_idThe request ID to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_add_unsubscribe_announces()

size_t imquic_moq_add_unsubscribe_announces ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_namespace * track_namespace )

Helper method to add an UNSUBSCRIBE_ANNOUNCES message to a buffer.

Parameters
moqThe imquic_moq_context generating the message
bytesThe buffer to add the message to
blenThe size of the buffer
track_namespaceThe namespace to put in the message
Returns
The size of the generated message, if successful, or 0 otherwise

◆ imquic_moq_announce()

int imquic_moq_announce ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns )

Function to send an ANNOUNCE request.

Parameters
connThe imquic_connection to send the request on
request_idA unique request ID (only v11 and later)
tnsThe imquic_moq_namespace namespace to announce
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_announce_error_code_str()

const char * imquic_moq_announce_error_code_str ( imquic_moq_announce_error_code code)

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

Parameters
codeThe imquic_moq_announce_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_auth_token_alias_type_str()

const char * imquic_moq_auth_token_alias_type_str ( imquic_moq_auth_token_alias_type type)

Helper function to serialize to string the name of a imquic_moq_auth_token_alias_type property.

Parameters
typeThe imquic_moq_auth_token_alias_type property
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_buffer_append()

void imquic_moq_buffer_append ( imquic_moq_buffer * buffer,
uint8_t * bytes,
uint64_t length )

Append data at the end of the buffer.

Note
This automatically resizes the buffer with imquic_moq_buffer_resize, if appending the new data would exceeds the buffer size.
Parameters
bufferBuffer to append the new data to
bytesData to append
lengthSize of the data to append

◆ imquic_moq_buffer_destroy()

void imquic_moq_buffer_destroy ( imquic_moq_buffer * buffer)

Destroy an existing buffer.

Parameters
bufferBuffer to destroy

◆ imquic_moq_buffer_resize()

gboolean imquic_moq_buffer_resize ( imquic_moq_buffer * buffer,
uint64_t new_size )

Resize an existing buffer.

Note
We can only increase the size of the buffer, not reduce it.
Parameters
bufferBuffer to resize
new_sizeNew size of the buffer
Returns
TRUE if successful, a negative integer otherwise

◆ imquic_moq_buffer_shift()

void imquic_moq_buffer_shift ( imquic_moq_buffer * buffer,
uint64_t length )

Move the data in the buffer back of a specific number of bytes.

Note
This automatically updates the buffer length accordingly.
Parameters
bufferBuffer to update
lengthHow many bytes back the buffer should be moved

◆ imquic_moq_build_auth_token()

size_t imquic_moq_build_auth_token ( imquic_moq_auth_token * token,
uint8_t * bytes,
size_t blen )

Helper mode to craft an auth token buffer out of a imquic_moq_auth_token instance.

Parameters
[in]tokenThe imquic_moq_auth_token instance to serialize
[out]bytesThe buffer to write the auth token to
[in]blenThe size of the buffer to write to
Returns
How many bytes were written, if successful

◆ imquic_moq_build_object_extensions()

size_t imquic_moq_build_object_extensions ( GList * extensions,
uint8_t * bytes,
size_t blen )

Helper mode to craft an extensions buffer out of a GList of imquic_moq_object_extension.

Parameters
[in]extensionsThe list of extensions to serialize
[out]bytesThe buffer to write the extensions data to
[in]blenThe size of the buffer to write to
Returns
How many bytes were written, if successful

◆ imquic_moq_cancel_fetch()

int imquic_moq_cancel_fetch ( imquic_connection * conn,
uint64_t request_id )

Function to send a FETCH_CANCEL request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to cancel_fetch from
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_connection_gone()

void imquic_moq_connection_gone ( imquic_connection * conn)

Callback the core invokes when an existing MoQ connection is not available anymore.

Parameters
connThe imquic_connection instance that is now gone

◆ imquic_moq_data_message_type_str()

const char * imquic_moq_data_message_type_str ( imquic_moq_data_message_type type,
imquic_moq_version version )

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

Parameters
typeThe imquic_data_moq_message_type value
versionThe version of the connection
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_data_message_type_to_delivery()

imquic_moq_delivery imquic_moq_data_message_type_to_delivery ( imquic_moq_data_message_type type,
imquic_moq_version version )

Helper function to return the imquic_moq_delivery mode associated to a imquic_moq_data_message_type type.

Parameters
typeThe imquic_data_moq_message_type value
versionThe version of the connection
Returns
The associated imquic_moq_delivery mode, if successful, or -1 otherwise

◆ imquic_moq_datagram_incoming()

void imquic_moq_datagram_incoming ( imquic_connection * conn,
uint8_t * bytes,
uint64_t length )

Callback the core invokes when there's new incoming data on a DATAGRAM.

Parameters
connThe imquic_connection instance for which new DATAGRAM data is available
bytesThe new data that is available
lengthSize of the new data

◆ imquic_moq_deinit()

void imquic_moq_deinit ( void )

Uninitialize the native MoQ stack.

◆ imquic_moq_error_code_str()

const char * imquic_moq_error_code_str ( imquic_moq_error_code code)

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

Parameters
codeThe imquic_moq_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_fetch_error_code_str()

const char * imquic_moq_fetch_error_code_str ( imquic_moq_fetch_error_code code)

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

Parameters
codeThe imquic_moq_fetch_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_fetch_type_str()

const char * imquic_moq_fetch_type_str ( imquic_moq_fetch_type type)

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

Parameters
typeThe imquic_moq_fetch_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_filter_type_str()

const char * imquic_moq_filter_type_str ( imquic_moq_filter_type type)

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

Parameters
typeThe imquic_moq_filter_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_get_next_request_id()

uint64_t imquic_moq_get_next_request_id ( imquic_connection * conn)

Helper function to get the next Request ID we can use.

Parameters
connThe imquic_connection to query
Returns
The next Request ID

◆ imquic_moq_get_role()

imquic_moq_role imquic_moq_get_role ( imquic_connection * conn)

Helper function to get the MoQ role associated with a connection.

Parameters
connThe imquic_connection to query
Returns
The imquic_moq_role value

◆ imquic_moq_get_version()

imquic_moq_version imquic_moq_get_version ( imquic_connection * conn)

Helper function to get the MoQ version associated with a connection.

Parameters
connThe imquic_connection to query
Returns
The imquic_moq_version value

◆ imquic_moq_goaway()

int imquic_moq_goaway ( imquic_connection * conn,
const char * uri )

Function to send a GOAWAY request.

Parameters
connThe imquic_connection to send the request on
uriWhere the client can connect to continue the session
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_group_order_str()

const char * imquic_moq_group_order_str ( imquic_moq_group_order type)

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

Parameters
typeThe imquic_moq_group_order value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_init()

void imquic_moq_init ( void )

Initialize the native MoQ stack at startup.

◆ imquic_moq_joining_fetch()

int imquic_moq_joining_fetch ( imquic_connection * conn,
uint64_t request_id,
uint64_t joining_request_id,
gboolean absolute,
uint64_t joining_start,
gboolean descending,
uint8_t * auth,
size_t authlen )

Function to send a joining FETCH request.

Parameters
connThe imquic_connection to send the request on
request_idA unique numeric identifier to associate to this subscription
joining_request_idExisting subscription to join
absoluteWhether this is an absolute or relative joining FETCH
joining_startHow many groups to retrieve before the current one, for relative joins, or starting group ID for absolute joins
descendingWhether objects should be fetched in descending group order
authThe authentication info, if any
authlenThe size of the authentication info, if any
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_message_type_str()

const char * imquic_moq_message_type_str ( imquic_moq_message_type type)

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

Parameters
typeThe imquic_moq_message_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_new_connection()

void imquic_moq_new_connection ( imquic_connection * conn,
void * user_data )

Callback the core invokes when a new QUIC connection using MoQ is available.

Parameters
connThe imquic_connection instance that is now available
user_dataOptional user data the user/application may have associated to the endpoint this connection belongs to

◆ imquic_moq_parameter_add_data()

size_t imquic_moq_parameter_add_data ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
int param,
uint8_t * buf,
size_t buflen )

Helper to add a MoQ (setup or subscribe) parameter with generic data to a buffer.

Parameters
moqThe imquic_moq_context instance the parameter is for
bytesBuffer to add the parameter to
blenSize of the buffer
paramID of the parameter to add
bufThe data acting as a value for the parameter to add
buflenThe size of the data value
Returns
The size of the parameter, if successful, or 0 otherwise

◆ imquic_moq_parameter_add_int()

size_t imquic_moq_parameter_add_int ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
int param,
uint64_t number )

Helper to add a MoQ (setup or subscribe) parameter with a numeric value to a buffer.

Parameters
moqThe imquic_moq_context instance the parameter is for
bytesBuffer to add the parameter to
blenSize of the buffer
paramID of the parameter to add
numberThe numeric value of the parameter to add
Returns
The size of the parameter, if successful, or 0 otherwise

◆ imquic_moq_parse_announce()

size_t imquic_moq_parse_announce ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an ANNOUNCE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_announce_cancel()

size_t imquic_moq_parse_announce_cancel ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an ANNOUNCE_CANCEL message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_announce_error()

size_t imquic_moq_parse_announce_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an ANNOUNCE_ERROR message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_announce_ok()

size_t imquic_moq_parse_announce_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an ANNOUNCE_OK message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_auth_token()

int imquic_moq_parse_auth_token ( uint8_t * bytes,
size_t blen,
imquic_moq_auth_token * token )

Helper mode to parse an auth token buffer to a imquic_moq_auth_token instance.

Note
The buffer in the value property will point to data in the original bytes buffer, which means that no allocation will be performed by this method. If you need to store the token value somewhere, it's up to you to copy it before bytes is invalidated by the application
Parameters
[in]bytesThe buffer containing the auth token data
[in]blenThe size of the buffer containing the auth token data data
[out]tokenThe imquic_moq_auth_token to put the parsed token info to
Returns
0 in case of success, or a negative integer otherwise

◆ imquic_moq_parse_client_setup()

size_t imquic_moq_parse_client_setup ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
gboolean legacy,
uint8_t * error )

Helper to parse a CLIENT_SETUP message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[in]legacyWhether this is a legacy CLIENT_SETUP message (before v11)
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_fetch()

size_t imquic_moq_parse_fetch ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a FETCH message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_fetch_cancel()

size_t imquic_moq_parse_fetch_cancel ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a FETCH_CANCEL message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_fetch_error()

size_t imquic_moq_parse_fetch_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a FETCH_ERROR message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_fetch_header()

size_t imquic_moq_parse_fetch_header ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a FETCH_HEADER message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]moq_streamThe imquic_moq_context instance the object is from
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_fetch_header_object()

int imquic_moq_parse_fetch_header_object ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
gboolean complete )

Helper to parse a FETCH_HEADER object.

Note
A negative response doesn't mean there's an error, but just that the object isn't complete yet and we need to wait for more data.
Parameters
[in]moqThe imquic_moq_context instance the object is for
[in]moq_streamThe imquic_moq_context instance the object is from
[in]completeWhether this data marks the completion of the QUIC stream it came from
Returns
0 in case of success, or a negative integer otherwise

◆ imquic_moq_parse_fetch_ok()

size_t imquic_moq_parse_fetch_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a FETCH_OK message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_goaway()

size_t imquic_moq_parse_goaway ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a GOAWAY message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_max_request_id()

size_t imquic_moq_parse_max_request_id ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a MAX_REQUEST_ID message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_message()

int imquic_moq_parse_message ( imquic_moq_context * moq,
uint64_t stream_id,
uint8_t * bytes,
size_t blen,
gboolean complete,
gboolean datagram )

Parse an incoming MoQ message.

Note
This will iterate on a buffer, trying to parse as many messages as possible in a sequential way. In case a message is incomplete (e.g., because we're still waiting on STREAM data), we move back to the beginning of the buffer and return, waiting for more data to arrive.
Parameters
moqThe imquic_moq_context instance the message is for
stream_idThe QUIC stream ID the message came from
bytesThe buffer containing the message to parse
blenSize of the buffer to parse
completeWhether this data marks the completion of the QUIC stream it came from
datagramWhether this is not coming from a STREAM but a DATAGRAM
Returns
0 in case of success, or a negative integer otherwise

◆ imquic_moq_parse_object_datagram()

size_t imquic_moq_parse_object_datagram ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_data_message_type dtype,
uint8_t * error )

Helper to parse an OBJECT_DATAGRAM message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[in]dtypeType of OBJECT_DATAGRAM (only relevant starting from v11)
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_object_datagram_status()

size_t imquic_moq_parse_object_datagram_status ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_data_message_type dtype,
uint8_t * error )

Helper to parse an OBJECT_DATAGRAM_STATUS message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[in]dtypeType of OBJECT_DATAGRAM_STATUS (only relevant starting from v11)
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_object_extensions()

GList * imquic_moq_parse_object_extensions ( uint8_t * extensions,
size_t elen )

Helper mode to parse an extensions buffer to a GList of imquic_moq_object_extension.

Note
The caller owns the list, and is responsible of freeing it and its content
Parameters
extensionsThe buffer containing the extensions data
elenThe size of the buffer containing the extensions data
Returns
A GList instance containing a set of imquic_moq_object_extension, if successful, or NULL if no extensions were found

◆ imquic_moq_parse_requests_blocked()

size_t imquic_moq_parse_requests_blocked ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a REQUESTS_BLOCKED message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_server_setup()

size_t imquic_moq_parse_server_setup ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
gboolean legacy,
uint8_t * error )

Helper to parse a SERVER_SETUP message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[in]legacyWhether this is a legacy SERVER_SETUP message (before v11)
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_setup_parameter()

size_t imquic_moq_parse_setup_parameter ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_setup_parameters * params,
uint8_t * error )

Helper method to parse a MoQ setup parameter.

Note
This method does nothing at the moment
Parameters
[in]moqThe imquic_moq_context instance to update with the new parameter
[in]bytesBuffer containing the parameter to parse
[in]blenSize of the buffer to parse
[out]paramsimquic_moq_setup_parameters instance to put the parsed parameter in
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parameter, if successful, or 0 otherwise

◆ imquic_moq_parse_stream_header_track()

size_t imquic_moq_parse_stream_header_track ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a STREAM_HEADER_TRACK message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]moq_streamThe imquic_moq_context instance the object is from
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_stream_header_track_object()

int imquic_moq_parse_stream_header_track_object ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
gboolean complete )

Helper to parse a STREAM_HEADER_TRACK object.

Note
A negative response doesn't mean there's an error, but just that the object isn't complete yet and we need to wait for more data.
Parameters
[in]moqThe imquic_moq_context instance the object is for
[in]moq_streamThe imquic_moq_context instance the object is from
[in]completeWhether this data marks the completion of the QUIC stream it came from
Returns
0 in case of success, or a negative integer otherwise

◆ imquic_moq_parse_subgroup_header()

size_t imquic_moq_parse_subgroup_header ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
uint8_t * bytes,
size_t blen,
imquic_moq_data_message_type dtype,
uint8_t * error )

Helper to parse a SUBGROUP_HEADER message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]moq_streamThe imquic_moq_context instance the message came from
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[in]dtypeType of SUBGROUP_HEADER (only relevant starting from v11)
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subgroup_header_object()

int imquic_moq_parse_subgroup_header_object ( imquic_moq_context * moq,
imquic_moq_stream * moq_stream,
gboolean complete )

Helper to parse a SUBGROUP_HEADER object.

Note
A negative response doesn't mean there's an error, but just that the object isn't complete yet and we need to wait for more data.
Parameters
[in]moqThe imquic_moq_context instance the object is for
[in]moq_streamThe imquic_moq_context instance the object is from
[in]completeWhether this data marks the completion of the QUIC stream it came from
Returns
0 in case of success, or a negative integer otherwise

◆ imquic_moq_parse_subscribe()

size_t imquic_moq_parse_subscribe ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_announces()

size_t imquic_moq_parse_subscribe_announces ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_ANNOUNCES message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_announces_error()

size_t imquic_moq_parse_subscribe_announces_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_ANNOUNCES_ERROR message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_announces_ok()

size_t imquic_moq_parse_subscribe_announces_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_ANNOUNCES_OK message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_done()

size_t imquic_moq_parse_subscribe_done ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_DONE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_error()

size_t imquic_moq_parse_subscribe_error ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_ERROR message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_ok()

size_t imquic_moq_parse_subscribe_ok ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_OK message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_parameter()

size_t imquic_moq_parse_subscribe_parameter ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
imquic_moq_subscribe_parameters * params,
uint8_t * error )

Helper method to parse a MoQ subscribe parameter.

Note
This method does nothing at the moment
Parameters
[in]moqThe imquic_moq_context instance to update with the new parameter
[in]bytesBuffer containing the parameter to parse
[in]blenSize of the buffer to parse
[out]paramsimquic_moq_subscribe_parameters instance to put the parsed parameter in
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parameter, if successful, or 0 otherwise

◆ imquic_moq_parse_subscribe_update()

size_t imquic_moq_parse_subscribe_update ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a SUBSCRIBE_UPDATE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_track_status()

size_t imquic_moq_parse_track_status ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a TRACK_STATUS message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_track_status_request()

size_t imquic_moq_parse_track_status_request ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse a TRACK_STATUS_REQUEST message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_unannounce()

size_t imquic_moq_parse_unannounce ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an UNANNOUNCE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_unsubscribe()

size_t imquic_moq_parse_unsubscribe ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an UNSUBSCRIBE message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_parse_unsubscribe_announces()

size_t imquic_moq_parse_unsubscribe_announces ( imquic_moq_context * moq,
uint8_t * bytes,
size_t blen,
uint8_t * error )

Helper to parse an UNSUBSCRIBE_ANNOUNCES message.

Parameters
[in]moqThe imquic_moq_context instance the message is for
[in]bytesThe buffer containing the message to parse
[in]blenSize of the buffer to parse
[out]errorIn/out property, initialized to 0 and set to 1 in case of parsing errors
Returns
The size of the parsed message, if successful, or 0 otherwise

◆ imquic_moq_qlog_control_message_created()

void imquic_moq_qlog_control_message_created ( imquic_qlog * qlog,
uint64_t stream_id,
size_t length,
json_t * message )

Add a control_message_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this message
lengthThe length of the message
messageThe message content

◆ imquic_moq_qlog_control_message_parsed()

void imquic_moq_qlog_control_message_parsed ( imquic_qlog * qlog,
uint64_t stream_id,
size_t length,
json_t * message )

Add a control_message_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this message
lengthThe length of the message
messageThe message content

◆ imquic_moq_qlog_fetch_header_created()

void imquic_moq_qlog_fetch_header_created ( imquic_qlog * qlog,
imquic_moq_stream * stream )

Add a fetch_header_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
streamThe stream used for this header

◆ imquic_moq_qlog_fetch_header_parsed()

void imquic_moq_qlog_fetch_header_parsed ( imquic_qlog * qlog,
imquic_moq_stream * stream )

Add a fetch_header_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
streamThe stream used for this header

◆ imquic_moq_qlog_fetch_object_created()

void imquic_moq_qlog_fetch_object_created ( imquic_qlog * qlog,
uint64_t stream_id,
imquic_moq_object * object )

Add a fetch_object_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this object
objectThe object instance

◆ imquic_moq_qlog_fetch_object_parsed()

void imquic_moq_qlog_fetch_object_parsed ( imquic_qlog * qlog,
uint64_t stream_id,
imquic_moq_object * object )

Add a fetch_object_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this object
objectThe object instance

◆ imquic_moq_qlog_object_datagram_created()

void imquic_moq_qlog_object_datagram_created ( imquic_qlog * qlog,
imquic_moq_object * object )

Add a object_datagram_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
objectThe object instance

◆ imquic_moq_qlog_object_datagram_parsed()

void imquic_moq_qlog_object_datagram_parsed ( imquic_qlog * qlog,
imquic_moq_object * object )

Add a object_datagram_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
objectThe object instance

◆ imquic_moq_qlog_object_datagram_status_created()

void imquic_moq_qlog_object_datagram_status_created ( imquic_qlog * qlog,
imquic_moq_object * object )

Add a object_datagram_status_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
objectThe object instance

◆ imquic_moq_qlog_object_datagram_status_parsed()

void imquic_moq_qlog_object_datagram_status_parsed ( imquic_qlog * qlog,
imquic_moq_object * object )

Add a object_datagram_status_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
objectThe object instance

◆ imquic_moq_qlog_stream_type_set()

void imquic_moq_qlog_stream_type_set ( imquic_qlog * qlog,
gboolean local,
uint64_t stream_id,
const char * type )

Add a stream_type_set event.

Parameters
qlogThe imquic_qlog instance to add the event to
localWhether this is a local or remote stream
stream_idThe Stream ID used for this message
typeThe stream type

◆ imquic_moq_qlog_subgroup_header_created()

void imquic_moq_qlog_subgroup_header_created ( imquic_qlog * qlog,
imquic_moq_stream * stream )

Add a subgroup_header_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
streamThe stream used for this header

◆ imquic_moq_qlog_subgroup_header_parsed()

void imquic_moq_qlog_subgroup_header_parsed ( imquic_qlog * qlog,
imquic_moq_stream * stream )

Add a subgroup_header_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
streamThe stream used for this header

◆ imquic_moq_qlog_subgroup_object_created()

void imquic_moq_qlog_subgroup_object_created ( imquic_qlog * qlog,
uint64_t stream_id,
imquic_moq_object * object )

Add a subgroup_object_created event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this object
objectThe object instance

◆ imquic_moq_qlog_subgroup_object_parsed()

void imquic_moq_qlog_subgroup_object_parsed ( imquic_qlog * qlog,
uint64_t stream_id,
imquic_moq_object * object )

Add a subgroup_object_parsed event.

Parameters
qlogThe imquic_qlog instance to add the event to
stream_idThe Stream ID used for this object
objectThe object instance

◆ imquic_moq_reject_announce()

int imquic_moq_reject_announce ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
imquic_moq_announce_error_code error_code,
const char * reason )

Function to reject an incoming ANNOUNCE request.

Parameters
connThe imquic_connection to send the request on
request_idThe request ID of the original ANNOUNCE request (only v11 and later)
tnsThe imquic_moq_namespace namespace to reject (only before v11)
error_codeThe error code to send back
reasonA string representation of the error, if needed
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_reject_fetch()

int imquic_moq_reject_fetch ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_fetch_error_code error_code,
const char * reason )

Function to reject an incoming FETCH request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to reject
error_codeThe error code to send back
reasonA string representation of the error, if needed
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_reject_subscribe()

int imquic_moq_reject_subscribe ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_sub_error_code error_code,
const char * reason,
uint64_t track_alias )

Function to reject an incoming SUBSCRIBE request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to reject
error_codeThe error code to send back
reasonA string representation of the error, if needed
track_aliasThe unique track_alias value associated to the subscription to reject
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_reject_subscribe_announces()

int imquic_moq_reject_subscribe_announces ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
imquic_moq_subannc_error_code error_code,
const char * reason )

Function to reject an incoming SUBSCRIBE_ANNOUNCES request.

Parameters
connThe imquic_connection to send the request on
request_idThe request ID of the original SUBSCRIBE_ANNOUNCES request (only v11 and later)
tnsThe imquic_moq_namespace namespace to reject notifications for (only before v11)
error_codeThe error code to send back
reasonA string representation of the error, if needed
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_requests_blocked()

int imquic_moq_requests_blocked ( imquic_connection * conn)

Function to send a REQUESTS_BLOCKED request.

Parameters
connThe imquic_connection to send the request on
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_role_type_str()

const char * imquic_moq_role_type_str ( imquic_moq_role_type type)

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

Parameters
typeThe imquic_moq_role_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_send_object()

int imquic_moq_send_object ( imquic_connection * conn,
imquic_moq_object * object )

Function to send a MoQ object.

Note
Depending on the delivery mode, to close the stream set the end_of_stream property to TRUE in the object. There's no need to do that when using OBJECT_STREAM or OBJECT_DATAGRAM . You can also close the stream when you don't have any object to send: just set the relevant properties (e.g., request_id, group_id and subgroup_id) without any payload, and the stack will find the right stream to close it.
Parameters
connThe imquic_connection to send the object on
objectThe imquic_moq_object object to send, including all relevant identifiers and the payload
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_set_max_request_id()

int imquic_moq_set_max_request_id ( imquic_connection * conn,
uint64_t max_request_id )

Helper function to set the Maximum Request ID a subscriber can send.

Note
If invoked before the MoQ connection setup, it will be put in the setup parameter, otherwise it's sent in a MAX_REQUEST_ID request
Parameters
connThe imquic_connection to update
max_request_idThe Maximum Request ID to enforce
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_set_role()

int imquic_moq_set_role ( imquic_connection * conn,
imquic_moq_role role )

Method to set the MoQ role on a connection. Must be done as soon as the connection is established, and before sending any MoQ message. A good place to do that is the callback fired when a new connection is available.

Note
The role can only be set once: it's an error to try and change it later, since the MoQ handshake will already have taken place.
Parameters
connThe imquic_connection to set the role on
roleThe imquic_moq_role to take
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_set_version()

int imquic_moq_set_version ( imquic_connection * conn,
imquic_moq_version version )

Method to set the MoQ version on a connection. Must be done as soon as the connection is established, and before sending any MoQ message. A good place to do that is the callback fired when a new connection is available.

Note
The version can only be set once: it's an error to try and change it later, since the MoQ handshake will already have taken place.
Parameters
connThe imquic_connection to set the version on
versionThe imquic_moq_version to use/offer
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_setup_parameter_type_str()

const char * imquic_moq_setup_parameter_type_str ( imquic_moq_setup_parameter_type type)

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

Parameters
typeThe imquic_moq_setup_parameter_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_setup_parameters_serialize()

size_t imquic_moq_setup_parameters_serialize ( imquic_moq_context * moq,
imquic_moq_setup_parameters * parameters,
uint8_t * bytes,
size_t blen,
uint8_t * params_num )

Helper to serialize a imquic_moq_setup_parameters set to a buffer.

Parameters
[in]moqThe imquic_moq_context instance the parameter is for
[in]parametersThe imquic_moq_setup_parameters to serialize
[out]bytesThe buffer to add paramerers to
[in]blenThe size of the buffer
[out]params_numThe number of parameters added to the buffer
Returns
The size of the serialized parameters, if successful, or 0 otherwise

◆ imquic_moq_standalone_fetch()

int imquic_moq_standalone_fetch ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
imquic_moq_name * tn,
gboolean descending,
imquic_moq_fetch_range * range,
uint8_t * auth,
size_t authlen )

Function to send a standalone FETCH request.

Parameters
connThe imquic_connection to send the request on
request_idA unique numeric identifier to associate to this subscription
tnsThe imquic_moq_namespace namespace the track to fetch to belongs to
tnThe imquic_moq_name track name to fetch to
descendingWhether objects should be fetched in descending group order
rangeThe range of groups/objects to fetch
authThe authentication info, if any
authlenThe size of the authentication info, if any
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_stream_destroy()

void imquic_moq_stream_destroy ( imquic_moq_stream * moq_stream)

Destroy an existing MoQ stream.

Parameters
moq_streamMoQ stream to destroy

◆ imquic_moq_stream_incoming()

void imquic_moq_stream_incoming ( imquic_connection * conn,
uint64_t stream_id,
uint8_t * bytes,
uint64_t offset,
uint64_t length,
gboolean complete )

Callback the core invokes when there's new incoming data on a STREAM.

Parameters
connThe imquic_connection instance for which new STREAM data is available
stream_idThe QUIC Stream ID for which new data is available
bytesThe new data that is available
offsetThe offset in the stream this new data should be put in
lengthSize of the new data
completeWhether this data marks the end of this STREAM

◆ imquic_moq_sub_done_code_str()

const char * imquic_moq_sub_done_code_str ( imquic_moq_sub_done_code code)

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

Parameters
codeThe imquic_moq_sub_done_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_sub_error_code_str()

const char * imquic_moq_sub_error_code_str ( imquic_moq_sub_error_code code)

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

Parameters
codeThe imquic_moq_sub_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_subannc_error_code_str()

const char * imquic_moq_subannc_error_code_str ( imquic_moq_subannc_error_code code)

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

Parameters
codeThe imquic_moq_subannc_error_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_subscribe()

int imquic_moq_subscribe ( imquic_connection * conn,
uint64_t request_id,
uint64_t track_alias,
imquic_moq_namespace * tns,
imquic_moq_name * tn,
uint8_t priority,
gboolean descending,
gboolean forward,
imquic_moq_filter_type filter_type,
imquic_moq_location * start_location,
imquic_moq_location * end_location,
uint8_t * auth,
size_t authlen )

Function to send a SUBSCRIBE request.

Parameters
connThe imquic_connection to send the request on
request_idA unique request ID to associate to this subscription
track_aliasA unique numeric identifier to associate to the track in this subscription
tnsThe imquic_moq_namespace namespace the track to subscribe to belongs to
tnThe imquic_moq_name track name to subscribe to
priorityThe subscriber priority
descendingWhether objects should be fetched in descending order, per each group
forwardWhether objects should be forwarded, when this subscription is accepted (ignored before v11)
filter_typeThe subscription filter type
start_locationThe group and object to start from (ignored if the filter is not AbsoluteStart or AbsoluteRange)
end_locationThe group (and for v06/v07 the object) to end at (ignored if the filter is not AbsoluteRange)
authThe authentication info, if any
authlenThe size of the authentication info, if any
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_subscribe_announces()

int imquic_moq_subscribe_announces ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
uint8_t * auth,
size_t authlen )

Function to send a SUBSCRIBE_ANNOUNCES request.

Parameters
connThe imquic_connection to send the request on
request_idA unique request ID (only v11 and later)
tnsThe imquic_moq_namespace namespace the track to subscribe to belongs to
authThe authentication info, if any
authlenThe size of the authentication info, if any
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_subscribe_done()

int imquic_moq_subscribe_done ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_sub_done_code status_code,
const char * reason )

Function to send a SUBSCRIBE_DONE request.

Note
The streams count is handled by the library internally
Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription that's now done
status_codeThe status code
reasonA reason phrase, if needed
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_subscribe_parameter_type_str()

const char * imquic_moq_subscribe_parameter_type_str ( imquic_moq_subscribe_parameter_type type)

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

Parameters
typeThe imquic_moq_subscribe_parameter_type value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_subscribe_parameters_serialize()

size_t imquic_moq_subscribe_parameters_serialize ( imquic_moq_context * moq,
imquic_moq_subscribe_parameters * parameters,
uint8_t * bytes,
size_t blen,
uint8_t * params_num )

Helper to serialize a imquic_moq_subscribe_parameters set to a buffer.

Parameters
[in]moqThe imquic_moq_context instance the parameter is for
[in]parametersThe imquic_moq_subscribe_parameters to serialize
[out]bytesThe buffer to add paramerers to
[in]blenThe size of the buffer
[out]params_numThe number of parameters added to the buffer
Returns
The size of the serialized parameters, if successful, or 0 otherwise

◆ imquic_moq_subscription_create()

imquic_moq_subscription * imquic_moq_subscription_create ( uint64_t request_id,
uint64_t track_alias )

Helper to create a new subscription instance.

Parameters
request_idThe request ID
track_aliasThe track alias
Returns
A pointer to a imquic_moq_subscription, if successful, or NULL otherwise

◆ imquic_moq_subscription_destroy()

void imquic_moq_subscription_destroy ( imquic_moq_subscription * moq_sub)

Destroy an existing MoQ subscription.

Parameters
moq_subMoQ subscription to destroy

◆ imquic_moq_track_status()

int imquic_moq_track_status ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
imquic_moq_name * tn,
imquic_moq_track_status_code status_code,
imquic_moq_location * largest )

Function to send a TRACK_STATUS request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the original TRACK_STATUS_REQUEST request (only v11 and after)
tnsThe imquic_moq_namespace namespace to address in the request (deprecated in v11)
tnThe imquic_moq_name track name to address in the request (deprecated in v11)
status_codeThe status of the track
largestThe largest group/object IDs
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_track_status_code_str()

const char * imquic_moq_track_status_code_str ( imquic_moq_track_status_code code)

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

Parameters
codeThe imquic_moq_track_status_code value
Returns
The type name as a string, if valid, or NULL otherwise

◆ imquic_moq_track_status_request()

int imquic_moq_track_status_request ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_namespace * tns,
imquic_moq_name * tn )

Function to send a TRACK_STATUS_REQUEST request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the request (only v11 and after)
tnsThe imquic_moq_namespace namespace to address in the request
tnThe imquic_moq_name track name to address in the request
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_unannounce()

int imquic_moq_unannounce ( imquic_connection * conn,
imquic_moq_namespace * tns )

Function to send an UNANNOUNCE request.

Parameters
connThe imquic_connection to send the request on
tnsThe imquic_moq_namespace namespace to unannounce
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_unsubscribe()

int imquic_moq_unsubscribe ( imquic_connection * conn,
uint64_t request_id )

Function to send a UNSUBSCRIBE request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to unsubscribe from
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_unsubscribe_announces()

int imquic_moq_unsubscribe_announces ( imquic_connection * conn,
imquic_moq_namespace * tns )

Function to send a UNSUBSCRIBE_ANNOUNCES request.

Parameters
connThe imquic_connection to send the request on
tnsThe imquic_moq_namespace namespace to unsubscribe notifications from
Returns
0 in case of success, a negative integer otherwise

◆ imquic_moq_update_subscribe()

int imquic_moq_update_subscribe ( imquic_connection * conn,
uint64_t request_id,
imquic_moq_location * start_location,
uint64_t end_group,
uint8_t priority,
gboolean forward )

Function to send a SUBSCRIBE_UPDATE request.

Parameters
connThe imquic_connection to send the request on
request_idThe unique request_id value associated to the subscription to update
start_locationThe group and object to start from
end_groupThe group to end at
priorityThe subscriber priority
forwardWhether objects should be forwarded, when this subscription is updated (ignored before v11)
Returns
0 in case of success, a negative integer otherwise

◆ imquic_qlog_moq_message_add_namespace()

void imquic_qlog_moq_message_add_namespace ( json_t * message,
imquic_moq_namespace * track_namespace )

Helper to add a stringified namespace tuple array to a message.

Note
This automatically fills in the track_namespace property
Parameters
messageThe message object to update
track_namespaceThe namespace to serialize to an array

◆ imquic_qlog_moq_message_add_setup_parameters()

void imquic_qlog_moq_message_add_setup_parameters ( json_t * message,
imquic_moq_setup_parameters * parameters,
const char * name )

Helper to add a stringified array of setup parameters to a message.

Note
This automatically fills in a property with the specified name
Parameters
messageThe message object to update
parametersThe setup parameters to convert
nameThe name the array should have in the message object

◆ imquic_qlog_moq_message_add_subscribe_parameters()

void imquic_qlog_moq_message_add_subscribe_parameters ( json_t * message,
imquic_moq_subscribe_parameters * parameters,
const char * name )

Helper to add a stringified array of subscribe parameters to a message.

Note
This automatically fills in a property with the specified name
Parameters
messageThe message object to update
parametersThe subscribe parameters to convert
nameThe name the array should have in the message object

◆ imquic_qlog_moq_message_add_track()

void imquic_qlog_moq_message_add_track ( json_t * message,
imquic_moq_name * track_name )

Helper to add a stringified track name to a message.

Note
This automatically fills in the track_name property
Parameters
messageThe message object to update
track_nameThe track name to add

◆ imquic_qlog_moq_message_prepare()

json_t * imquic_qlog_moq_message_prepare ( const char * type)

Helper to create a new QLOG MoQT message.

Note
This automatically fills in the type property
Parameters
typeThe name of the message
Returns
A message instance to fill in before using it it, if successful, or NULL otherwise