LibQuicR
|
#include <server.h>
Classes | |
struct | AnnounceResponse |
Response to received MOQT Announce message. More... | |
struct | ClientSetupResponse |
Response to received MOQT ClientSetup message. More... | |
Public Types | |
enum class | Status : uint8_t { kReady = 0 , kNotReady , kInternalError , kInvalidParams , kConnecting , kDisconnecting , kNotConnected , kFailedToConnect , kPendingSeverSetup } |
Status of the transport. More... | |
enum class | ControlMessageStatus : uint8_t { kMessageIncomplete , kMessageComplete , kStreamBufferCannotBeZero , kStreamBufferMissingType , kUnsupportedMessageType } |
Control message status codes. More... | |
enum class | StreamDataMessageStatus : uint8_t |
enum class | ConnectionStatus : uint8_t { kNotConnected = 0 , kConnecting , kConnected , kIdleTimeout , kClosedByRemote } |
Connection status codes. More... | |
Public Member Functions | |
Server (const ServerConfig &cfg) | |
MoQ Server constructor to create the MOQ server mode instance. | |
Server (const ServerConfig &cfg, std::shared_ptr< ThreadedTickService > tick_service) | |
~Server ()=default | |
Status | Start () |
Starts server transport thread to listen for new connections. | |
void | Stop () |
void | BindPublisherTrack (ConnectionHandle connection_handle, uint64_t subscribe_id, const std::shared_ptr< PublishTrackHandler > &track_handler, bool ephemeral=false) |
Bind a server publish track handler based on a subscribe. | |
void | UnbindPublisherTrack (ConnectionHandle connection_handle, const std::shared_ptr< PublishTrackHandler > &track_handler) |
Unbind a server publish track handler. | |
virtual void | ResolveSubscribe (ConnectionHandle connection_handle, uint64_t subscribe_id, const SubscribeResponse &subscribe_response) |
Accept or reject an subscribe that was received. | |
const std::shared_ptr< TickService > & | GetTickService () const noexcept |
void | SubscribeTrack (ConnectionHandle connection_handle, std::shared_ptr< SubscribeTrackHandler > track_handler) |
Subscribe to a track. | |
void | UnsubscribeTrack (ConnectionHandle connection_handle, const std::shared_ptr< SubscribeTrackHandler > &track_handler) |
Unsubscribe track. | |
void | UpdateTrackSubscription (ConnectionHandle connection_handle, std::shared_ptr< SubscribeTrackHandler > track_handler) |
Update Subscription to a track. | |
void | PublishTrack (ConnectionHandle connection_handle, std::shared_ptr< PublishTrackHandler > track_handler) |
Publish to a track. | |
void | UnpublishTrack (ConnectionHandle connection_handle, const std::shared_ptr< PublishTrackHandler > &track_handler) |
Unpublish track. | |
void | FetchTrack (ConnectionHandle connection_handle, std::shared_ptr< FetchTrackHandler > track_handler) |
Fetch track. | |
void | CancelFetchTrack (ConnectionHandle connection_handle, std::shared_ptr< FetchTrackHandler > track_handler) |
Cancel Fetch track. | |
Status | GetStatus () const noexcept |
Get the status of the Client. | |
Base Calbacks | |
Both client and server implement the same transport base callbacks | |
virtual void | StatusChanged (Status status) |
Callback notification for status/state change. | |
Server Calbacks | |
slient transport specific callbacks | |
using | SubscribeAnnouncesResponse |
Callback notification for new subscribe announces received. | |
void | NewConnectionAccepted (ConnectionHandle connection_handle, const ConnectionRemoteInfo &remote) override |
Callback notification on new connection. | |
void | ConnectionStatusChanged (ConnectionHandle connection_handle, ConnectionStatus status) override |
Callback notification for connection status/state change. | |
void | MetricsSampled (ConnectionHandle connection_handle, const ConnectionMetrics &metrics) override |
Notification callback to provide sampled metrics. | |
virtual ClientSetupResponse | ClientSetupReceived (ConnectionHandle connection_handle, const ClientSetupAttributes &client_setup_attributes)=0 |
Callback on client setup message. | |
virtual void | AnnounceReceived (ConnectionHandle connection_handle, const TrackNamespace &track_namespace, const PublishAnnounceAttributes &publish_announce_attributes) |
Callback notification for new announce received that needs to be authorized. | |
void | ResolveAnnounce (ConnectionHandle connection_handle, const TrackNamespace &track_namespace, const std::vector< ConnectionHandle > &subscribers, const AnnounceResponse &announce_response) |
Accept or reject an announce that was received. | |
virtual std::vector< ConnectionHandle > | UnannounceReceived (ConnectionHandle connection_handle, const TrackNamespace &track_namespace)=0 |
Callback notification for unannounce received. | |
virtual void | UnsubscribeAnnouncesReceived (ConnectionHandle connection_handle, const TrackNamespace &prefix_namespace)=0 |
Callback notification for Unsubscribe announces received. | |
virtual SubscribeAnnouncesResponse | SubscribeAnnouncesReceived (ConnectionHandle connection_handle, const TrackNamespace &prefix_namespace, const PublishAnnounceAttributes &announce_attributes) |
virtual void | SubscribeReceived (ConnectionHandle connection_handle, uint64_t subscribe_id, uint64_t proposed_track_alias, quicr::messages::FilterType filter_type, const FullTrackName &track_full_name, const SubscribeAttributes &subscribe_attributes) |
Callback notification for new subscribe received. | |
virtual void | UnsubscribeReceived (ConnectionHandle connection_handle, uint64_t subscribe_id)=0 |
Callback notification on unsubscribe received. | |
virtual bool | FetchReceived (ConnectionHandle connection_handle, uint64_t subscribe_id, const FullTrackName &track_full_name, const FetchAttributes &attributes) |
Callback notification on Fetch message received. | |
virtual void | OnFetchOk (ConnectionHandle connection_handle, uint64_t subscribe_id, const FullTrackName &track_full_name, const FetchAttributes &attributes) |
Event to run on sending FetchOk. | |
virtual void | FetchCancelReceived (ConnectionHandle connection_handle, uint64_t subscribe_id)=0 |
Callback notification on receiving a FetchCancel message. | |
virtual void | NewGroupRequested (ConnectionHandle connection_handle, uint64_t subscribe_id, uint64_t track_alias) |
Callback notification for new subscribe announces received.
connection_handle | Source connection ID |
prefix_namespace | Track namespace |
announce_attributes | Announces attributes received |
|
stronginherited |
|
stronginherited |
Control message status codes.
|
stronginherited |
|
stronginherited |
|
inline |
|
inline |
|
default |
|
virtual |
Callback notification for new announce received that needs to be authorized.
connection_handle | Source connection ID |
track_namespace | Track namespace |
publish_announce_attributes | Publish announce attributes received |
void quicr::Server::BindPublisherTrack | ( | ConnectionHandle | connection_handle, |
uint64_t | subscribe_id, | ||
const std::shared_ptr< PublishTrackHandler > & | track_handler, | ||
bool | ephemeral = false ) |
Bind a server publish track handler based on a subscribe.
The server will create a server publish track handler based on a received subscribe. It will use this handler to send objects to subscriber.
connection_handle | Connection ID of the client/subscriber |
subscribe_id | Subscribe ID from the received subscribe |
track_handler | Server publish track handler |
ephemeral | Bool value to indicate if the state tracking is needed |
|
inherited |
Cancel Fetch track.
connection_handle | Connection ID to send fetch cancel. |
track_handler | Fetch Track handler to cancel. |
|
pure virtual |
Callback on client setup message.
In server mode, client will send a setup message on new connection. Server responds with server setup.
connection_handle | Transport connection ID |
client_setup_attributes | Decoded client setup message |
|
overridevirtual |
Callback notification for connection status/state change.
Callback notification indicates state change of connection, such as disconnected
connection_handle | Transport connection ID |
status | ConnectionStatus of connection id |
Reimplemented from quicr::Transport.
|
pure virtual |
Callback notification on receiving a FetchCancel message.
connection_handle | Source connection ID. |
subscribe_id | Subscribe ID received. |
|
virtual |
Callback notification on Fetch message received.
connection_handle | Source connection ID. |
subscribe_id | Subscribe ID received. |
track_full_name | Track full name |
attributes | Fetch attributes received. |
|
inherited |
Fetch track.
connection_handle | Connection ID to send fetch |
track_handler | Track handler used for fetching |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
overridevirtual |
Notification callback to provide sampled metrics.
Callback will be triggered on Config::metrics_sample_ms to provide the sampled data based on the sample period. After this callback, the period/sample based metrics will reset and start over for the new period.
connection_handle | Source connection ID |
metrics | Copy of the connection metrics for the sample period |
Reimplemented from quicr::Transport.
|
overridevirtual |
Callback notification on new connection.
Callback notification that a new connection has been accepted
Reimplemented from quicr::Transport.
|
virtual |
|
virtual |
Event to run on sending FetchOk.
connection_handle | Source connection ID. |
subscribe_id | Subscribe ID received. |
track_full_name | Track full name |
attributes | Fetch attributes received. |
|
inherited |
Publish to a track.
connection_handle | Connection ID from transport for the QUIC connection context |
track_handler | Track handler to use for track related functions and callbacks |
void quicr::Server::ResolveAnnounce | ( | ConnectionHandle | connection_handle, |
const TrackNamespace & | track_namespace, | ||
const std::vector< ConnectionHandle > & | subscribers, | ||
const AnnounceResponse & | announce_response ) |
Accept or reject an announce that was received.
Accept or reject an announce received via AnnounceReceived(). The MoQ Transport will send the protocol message based on the AnnounceResponse. Subscribers defined will be sent a copy of the announcement
connection_handle | source connection ID |
track_namespace | track namespace |
subscribers | Vector/list of subscriber connection handles that should be sent the announce |
announce_response | response to for the announcement |
|
virtual |
Accept or reject an subscribe that was received.
Accept or reject an subscribe received via SubscribeReceived(). The MoQ Transport will send the protocol message based on the SubscribeResponse
connection_handle | source connection ID |
subscribe_id | subscribe ID |
subscribe_response | response to for the subscribe |
Status quicr::Server::Start | ( | ) |
Starts server transport thread to listen for new connections.
Creates a new transport thread to listen for new connections. All control and track callbacks will be run based on events.
|
inlinevirtualinherited |
Callback notification for status/state change.
Callback notification indicates state change of connection, such as disconnected
status | Changed Status value |
void quicr::Server::Stop | ( | ) |
Stop the server transport
|
virtual |
|
virtual |
Callback notification for new subscribe received.
connection_handle | Source connection ID |
subscribe_id | Subscribe ID received |
proposed_track_alias | The proposed track alias the subscriber would like to use |
track_full_name | Track full name |
subscribe_attributes | Subscribe attributes received |
|
inherited |
Subscribe to a track.
connection_handle | Connection ID to send subscribe |
track_handler | Track handler to use for track related functions and callbacks |
|
pure virtual |
Callback notification for unannounce received.
The callback will indicate that a new unannounce has been received. The app should return a vector of connection handler ids that should receive a copy of the unannounce. The returned list is based on subscribe announces prefix matching.
connection_handle | Source connection ID |
track_namespace | Track namespace |
void quicr::Server::UnbindPublisherTrack | ( | ConnectionHandle | connection_handle, |
const std::shared_ptr< PublishTrackHandler > & | track_handler ) |
Unbind a server publish track handler.
Removes a server publish track handler state.
connection_handle | Connection ID of the client/subscriber |
track_handler | Server publish track handler |
|
inherited |
Unpublish track.
connection_handle | Connection ID from transport for the QUIC connection context |
track_handler | Track handler used when published track |
|
pure virtual |
Callback notification for Unsubscribe announces received.
connection_handle | Source connection ID |
prefix_namespace | Prefix namespace |
|
pure virtual |
Callback notification on unsubscribe received.
connection_handle | Source connection ID |
subscribe_id | Subscribe ID received |
|
inherited |
Unsubscribe track.
connection_handle | Connection ID to send subscribe |
track_handler | Track handler to use for track related functions and callbacks |
|
inherited |
Update Subscription to a track.
connection_handle | Connection ID to send subscribe |
track_handler | Track handler to use for track related functions and callbacks |