LibQuicR
quicr::Session::ClientCallbacks Struct Reference

Callback interface for session events specific to client mode. More...

#include <session_callbacks.h>

Inheritance diagram for quicr::Session::ClientCallbacks:
quicr::Session::Callbacks

Public Member Functions

virtual ~ClientCallbacks ()=default
 Destroy the client callback interface. More...
 
virtual Reply< void, ErrorCode > UnpublishedSubscribeReceived (const std::shared_ptr< Session > &session, const FullTrackName &track_full_name, const SubscribeAttributes &subscribe_attributes)
 Callback notification for new subscribe received that doesn't match an existing publish track. More...
 
virtual Expected< void, Error< ErrorCode > > SetupReceived (const std::shared_ptr< Session > &session, const SetupAttributes &setup_attributes)
 Callback on receipt of the peer's SETUP message. More...
 
virtual void OnStreamClosed (std::uint64_t stream_id, StreamClosedFlag flag)
 Notify that a QUIC stream closed. More...
 
virtual void StatusChanged (const std::shared_ptr< Session > &session, Status status)
 Callback notification for status/state change. More...
 
virtual void MetricsSampled (const std::shared_ptr< Session > &session, const ConnectionMetrics &metrics)
 Notification callback to provide sampled connection metrics. More...
 
virtual Reply< const PublishResponse, PublishErrorCode > PublishReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id, const PublishAttributes &publish_attributes, std::weak_ptr< SubscribeNamespaceHandler > sub_ns_handler)
 Callback notification for new publish received. More...
 
virtual Reply< void, PublishNamespaceErrorCode > PublishNamespaceReceived (const std::shared_ptr< Session > &session, const TrackNamespace &track_namespace, const PublishNamespaceAttributes &publish_namespace_attributes)
 Callback notification for announce received by subscribe namespace. More...
 
virtual Reply< const FetchResponse, FetchErrorCode > StandaloneFetchReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id, const FullTrackName &track_full_name, const StandaloneFetchAttributes &attributes)
 Event to run on receiving a Standalone Fetch request. More...
 
virtual Reply< const FetchResponse, FetchErrorCode > JoiningFetchReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id, const FullTrackName &track_full_name, const JoiningFetchAttributes &attributes)
 Event to run on receiving a Joining Fetch request. More...
 
virtual Reply< void, FetchErrorCode > FetchCancelReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id)
 Callback notification on receiving a FetchCancel message. More...
 
virtual Reply< TrackStatusResponse, RequestErrorCode > TrackStatusReceived (const std::shared_ptr< Session > &session, const FullTrackName &track_full_name)
 Callback notification for track status message received. More...
 

Detailed Description

Callback interface for session events specific to client mode.

Examples
simple_publish/main.cpp, and simple_subscribe/main.cpp.

Constructor & Destructor Documentation

◆ ~ClientCallbacks()

virtual quicr::Session::ClientCallbacks::~ClientCallbacks ( )
virtualdefault

Destroy the client callback interface.

Member Function Documentation

◆ FetchCancelReceived()

virtual Reply<void, FetchErrorCode> quicr::Session::Callbacks::FetchCancelReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id 
)
virtualinherited

Callback notification on receiving a FetchCancel message.

Parameters
request_idRequest ID received.
sessionSession that received the cancellation.
Returns
Immediate or deferred acknowledgment, or error.

◆ JoiningFetchReceived()

virtual Reply<const FetchResponse, FetchErrorCode> quicr::Session::Callbacks::JoiningFetchReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id,
const FullTrackName &  track_full_name,
const JoiningFetchAttributes &  attributes 
)
virtualinherited

Event to run on receiving a Joining Fetch request.

Defaults to rejecting with kInternalError, since fetch is not served unless implemented.

Parameters
request_idRequest ID received.
sessionSession that received the request.
track_full_nameTrack full name
attributesFetch attributes received.
Returns
Immediate or deferred fetch response, or rejection reason.

◆ MetricsSampled()

virtual void quicr::Session::Callbacks::MetricsSampled ( const std::shared_ptr< Session > &  session,
const ConnectionMetrics &  metrics 
)
virtualinherited

Notification callback to provide sampled connection metrics.

Invoked every Config::metrics_sample_ms in either client or server mode. The period based metrics reset after this callback, so a value not read here is lost. Per track metrics for the same period follow this call, via PublishTrackHandler::MetricsSampled and SubscribeTrackHandler::MetricsSampled, sharing the same last_sample_time.

Invoked on the transport notify thread, which also carries stream and connection events. Return promptly; a slow implementation backs the queue up and other notifications are dropped to make room.

Parameters
sessionThe session the metrics belong to
metricsCopy of the connection metrics for the sample period

◆ OnStreamClosed()

virtual void quicr::Session::Callbacks::OnStreamClosed ( std::uint64_t  stream_id,
StreamClosedFlag  flag 
)
virtualinherited

Notify that a QUIC stream closed.

Parameters
stream_idIdentifier of the closed stream.
flagEvent that closed the stream direction.

Reimplemented in quicr::Session::ServerCallbacks.

◆ PublishNamespaceReceived()

virtual Reply<void, PublishNamespaceErrorCode> quicr::Session::Callbacks::PublishNamespaceReceived ( const std::shared_ptr< Session > &  session,
const TrackNamespace &  track_namespace,
const PublishNamespaceAttributes &  publish_namespace_attributes 
)
virtualinherited

Callback notification for announce received by subscribe namespace.

Client mode only. Called when a PUBLISH_NAMESPACE is received for a subscribed prefix.

Parameters
track_namespaceTrack namespace
sessionSession that received the request.
publish_namespace_attributesPublish announce attributes received
Returns
Immediate or deferred success, or rejection reason.

◆ PublishReceived()

virtual Reply<const PublishResponse, PublishErrorCode> quicr::Session::Callbacks::PublishReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id,
const PublishAttributes &  publish_attributes,
std::weak_ptr< SubscribeNamespaceHandler >  sub_ns_handler 
)
virtualinherited

Callback notification for new publish received.

Return the publish response to accept. Defaults to rejecting with kNotSupported.

Parameters
request_idIncoming publish request ID
sessionSession that received the request.
publish_attributesAttributes of the publish
sub_ns_handlerMatching subscribe namespace handler, if any
Returns
Immediate or deferred acceptance response, or rejection reason.

◆ SetupReceived()

virtual Expected<void, Error<ErrorCode> > quicr::Session::Callbacks::SetupReceived ( const std::shared_ptr< Session > &  session,
const SetupAttributes &  setup_attributes 
)
virtualinherited

Callback on receipt of the peer's SETUP message.

Returning an error disconnects the session.

Parameters
sessionThe session receiving SETUP
setup_attributesPeer setup attributes received
Returns
Success to continue setup, or an error that disconnects the session.
Examples
simple_publish/main.cpp, and simple_subscribe/main.cpp.

◆ StandaloneFetchReceived()

virtual Reply<const FetchResponse, FetchErrorCode> quicr::Session::Callbacks::StandaloneFetchReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id,
const FullTrackName &  track_full_name,
const StandaloneFetchAttributes &  attributes 
)
virtualinherited

Event to run on receiving a Standalone Fetch request.

Defaults to rejecting with kInternalError, since fetch is not served unless implemented.

Parameters
request_idRequest ID received.
sessionSession that received the request.
track_full_nameTrack full name
attributesFetch attributes received.
Returns
Immediate or deferred fetch response, or rejection reason.

◆ StatusChanged()

virtual void quicr::Session::Callbacks::StatusChanged ( const std::shared_ptr< Session > &  session,
Status  status 
)
virtualinherited

Callback notification for status/state change.

Callback notification indicates state change of connection, such as disconnected. May be invoked in either client or server mode.

Parameters
sessionThe session whose status changed
statusChanged Status value

◆ TrackStatusReceived()

virtual Reply<TrackStatusResponse, RequestErrorCode> quicr::Session::Callbacks::TrackStatusReceived ( const std::shared_ptr< Session > &  session,
const FullTrackName &  track_full_name 
)
virtualinherited

Callback notification for track status message received.

Defaults to accepting with an empty TrackStatusResponse.

Parameters
track_full_nameTrack full name
sessionSession that received the query.
Returns
Immediate or deferred status response, or rejection reason.

◆ UnpublishedSubscribeReceived()

virtual Reply<void, ErrorCode> quicr::Session::ClientCallbacks::UnpublishedSubscribeReceived ( const std::shared_ptr< Session > &  session,
const FullTrackName &  track_full_name,
const SubscribeAttributes &  subscribe_attributes 
)
virtual

Callback notification for new subscribe received that doesn't match an existing publish track.

Client mode only. When a new subscribe is received that doesn't match any existing publish track, this method signals the application that there is a new subscribe full track name. The application should PublishTrack() within this callback (or afterwards).

Defaults to accepting.

Parameters
track_full_nameTrack full name
sessionSession that received the request.
subscribe_attributesSubscribe attributes received
Returns
Immediate or deferred acceptance, or rejection reason.

The documentation for this struct was generated from the following file: