LibQuicR
quicr::Session::ServerCallbacks Struct Reference

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

#include <session_callbacks.h>

Inheritance diagram for quicr::Session::ServerCallbacks:
quicr::Session::Callbacks

Public Member Functions

virtual ~ServerCallbacks ()=default
 Destroy the server callback interface. More...
 
virtual void OnStreamClosed (std::uint64_t stream_id, StreamClosedFlag flag)
 Notify that a server-side QUIC stream closed. More...
 
virtual Reply< std::vector< TrackNamespace >, RequestErrorCode > SubscribeNamespaceReceived (const std::shared_ptr< Session > &session, const TrackNamespace &prefix_namespace, const SubscribeNamespaceAttributes &attributes)
 Callback notification for new subscribe namespace received. More...
 
virtual Reply< std::vector< TrackNamespace >, RequestErrorCode > SubscribeTracksReceived (const std::shared_ptr< Session > &session, const TrackNamespace &prefix_namespace, const SubscribeNamespaceAttributes &attributes)
 Callback notification for new subscribe tracks received. More...
 
virtual Reply< SubscribeResponse, RequestErrorCode > SubscribeReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id, const FullTrackName &track_full_name, const SubscribeAttributes &subscribe_attributes)
 Callback notification for new subscribe received. More...
 
virtual Reply< void, ErrorCode > NewGroupRequested (const FullTrackName &track_full_name, std::uint64_t group_id)
 New group requested received by a subscription. More...
 
virtual void PublishNamespaceDoneReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id)
 Callback notification for publish namespace done received. More...
 
virtual void UnsubscribeNamespaceReceived (const std::shared_ptr< Session > &session, const TrackNamespace &prefix_namespace)
 Callback notification for unsubscribe namespace received. More...
 
virtual void UnsubscribeReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id)
 Callback notification on unsubscribe received. More...
 
virtual void PublishDoneReceived (const std::shared_ptr< Session > &session, std::uint64_t request_id)
 Callback notification on publish done received. 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 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 server mode.

Constructor & Destructor Documentation

◆ ~ServerCallbacks()

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

Destroy the server 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

◆ NewGroupRequested()

virtual Reply<void, ErrorCode> quicr::Session::ServerCallbacks::NewGroupRequested ( const FullTrackName &  track_full_name,
std::uint64_t  group_id 
)
virtual

New group requested received by a subscription.

Server mode only.

Parameters
track_full_nameTrack full name
group_idGroup ID requested — should be plus one of current group or zero
Returns
Immediate or deferred acknowledgment, or rejection reason.

◆ OnStreamClosed()

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

Notify that a server-side QUIC stream closed.

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

Reimplemented from quicr::Session::Callbacks.

◆ PublishDoneReceived()

virtual void quicr::Session::ServerCallbacks::PublishDoneReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id 
)
virtual

Callback notification on publish done received.

Server mode only.

Parameters
request_idRequest ID received
sessionSession that received the notification.

◆ PublishNamespaceDoneReceived()

virtual void quicr::Session::ServerCallbacks::PublishNamespaceDoneReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id 
)
virtual

Callback notification for publish namespace done received.

Server mode only. The callback will indicate that publish namespace done has been received. The app is responsible for forwarding a copy of the publish namespace done message to the subscribe namespace connections whose prefix matches.

Parameters
request_idRequest ID for the namespace that is done
sessionSession that received the notification.

◆ 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

◆ SubscribeNamespaceReceived()

virtual Reply<std::vector<TrackNamespace>, RequestErrorCode> quicr::Session::ServerCallbacks::SubscribeNamespaceReceived ( const std::shared_ptr< Session > &  session,
const TrackNamespace &  prefix_namespace,
const SubscribeNamespaceAttributes &  attributes 
)
virtual

Callback notification for new subscribe namespace received.

Server mode only. Accept by returning the namespaces already published under the prefix, which the session sends with the OK. Defaults to accepting with none.

Parameters
prefix_namespaceTrack namespace prefix
sessionSession that received the request.
attributesAttributes received
Returns
Immediate or deferred list of already-active matching namespaces, or rejection reason.

◆ SubscribeReceived()

virtual Reply<SubscribeResponse, RequestErrorCode> quicr::Session::ServerCallbacks::SubscribeReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id,
const FullTrackName &  track_full_name,
const SubscribeAttributes &  subscribe_attributes 
)
virtual

Callback notification for new subscribe received.

Server mode only. Defaults to accepting with an empty SubscribeResponse.

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

◆ SubscribeTracksReceived()

virtual Reply<std::vector<TrackNamespace>, RequestErrorCode> quicr::Session::ServerCallbacks::SubscribeTracksReceived ( const std::shared_ptr< Session > &  session,
const TrackNamespace &  prefix_namespace,
const SubscribeNamespaceAttributes &  attributes 
)
virtual

Callback notification for new subscribe tracks received.

Server mode only. Accept by returning the namespaces already published under the prefix, which the session sends with the OK. Defaults to accepting with none.

Parameters
prefix_namespaceTrack namespace prefix
sessionSession that received the request.
attributesAttributes received
Returns
Immediate or deferred list of already-active matching namespaces, or rejection reason.

◆ 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.

◆ UnsubscribeNamespaceReceived()

virtual void quicr::Session::ServerCallbacks::UnsubscribeNamespaceReceived ( const std::shared_ptr< Session > &  session,
const TrackNamespace &  prefix_namespace 
)
virtual

Callback notification for unsubscribe namespace received.

Server mode only.

Parameters
prefix_namespacePrefix namespace
sessionSession that received the request.

◆ UnsubscribeReceived()

virtual void quicr::Session::ServerCallbacks::UnsubscribeReceived ( const std::shared_ptr< Session > &  session,
std::uint64_t  request_id 
)
virtual

Callback notification on unsubscribe received.

Server mode only.

Parameters
request_idRequest ID received
sessionSession that received the request.

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