|
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 , kPendingServerSetup } |
| 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, ConnectionHandle src_id, uint64_t request_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, ConnectionHandle src_id, const std::shared_ptr< PublishTrackHandler > &track_handler) |
| Unbind a server publish track handler. | |
| void | BindFetchTrack (TransportConnId conn_id, std::shared_ptr< PublishFetchHandler > track_handler) |
| Bind a server fetch publisher track handler. | |
| void | UnbindFetchTrack (ConnectionHandle conn_id, const std::shared_ptr< PublishFetchHandler > &track_handler) |
| Unbind a server fetch publisher track handler. | |
| virtual void | ResolveSubscribe (ConnectionHandle connection_handle, uint64_t request_id, uint64_t track_alias, const SubscribeResponse &subscribe_response) |
| Accept or reject an subscribe that was received. | |
| virtual void | ResolvePublish (ConnectionHandle connection_handle, uint64_t request_id, bool forward, messages::SubscriberPriority priority, messages::GroupOrder group_order, const PublishResponse &publish_response) |
| Accept or reject publish 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, bool new_group_request=false) |
| Update Subscription to a track. | |
| void | PublishTrack (ConnectionHandle connection_handle, std::shared_ptr< PublishTrackHandler > track_handler) |
| Publish to a track. | |
| void | PublishTrackSub (ConnectionHandle connection_handle, std::shared_ptr< PublishTrackHandler > track_handler) |
| Publish to a track and force subscribe. | |
| 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. | |
| uint64_t | RequestTrackStatus (ConnectionHandle connection_handle, const FullTrackName &track_full_name, const messages::SubscribeAttributes &subscribe_attributes) |
| Request track status. | |
| virtual void | ResolveTrackStatus (ConnectionHandle connection_handle, uint64_t request_id, uint64_t track_alias, const SubscribeResponse &subscribe_response) |
| Accept or reject track status that was received. | |
| 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. | |
| virtual void | TrackStatusReceived (ConnectionHandle connection_handle, uint64_t request_id, const FullTrackName &track_full_name, const messages::SubscribeAttributes &subscribe_attributes) |
| Callback notification for track status message received. | |
| virtual void | TrackStatusResponseReceived (ConnectionHandle connection_handle, uint64_t request_id, const SubscribeResponse &response) |
| Callback notification for track status OK received. | |
Protected Member Functions | |
| std::shared_ptr< Transport > | GetSharedPtr () |
| ConnectionContext & | GetConnectionContext (ConnectionHandle conn) |
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, uint64_t request_id, 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 request_id, messages::FilterType filter_type, const FullTrackName &track_full_name, const messages::SubscribeAttributes &subscribe_attributes) |
| Callback notification for new subscribe received. | |
| virtual void | UnsubscribeReceived (ConnectionHandle connection_handle, uint64_t request_id)=0 |
| Callback notification on unsubscribe received. | |
| virtual std::optional< messages::Location > | GetLargestAvailable (const FullTrackName &track_name) |
| Get the largest available location for the given track, if any. | |
| virtual bool | FetchReceived (ConnectionHandle connection_handle, uint64_t request_id, const FullTrackName &track_full_name, const quicr::messages::FetchAttributes &attributes) override |
| Event to run on receiving Fetch request. | |
| virtual bool | OnFetchOk (ConnectionHandle connection_handle, uint64_t request_id, const FullTrackName &track_full_name, const messages::FetchAttributes &attributes) |
| Event to run on sending FetchOk. | |
| virtual void | FetchCancelReceived (ConnectionHandle connection_handle, uint64_t request_id)=0 |
| Callback notification on receiving a FetchCancel message. | |
| virtual void | PublishReceived (ConnectionHandle connection_handle, uint64_t request_id, const FullTrackName &track_full_name, const messages::PublishAttributes &publish_attributes)=0 |
| Callback notification for new publish received. | |
| virtual void | SubscribeDoneReceived (ConnectionHandle connection_handle, uint64_t request_id)=0 |
| Callback notification on Subscribe Done received. | |
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 |
Status of the transport.
| Enumerator | |
|---|---|
| kReady | |
| kNotReady | |
| kInternalError | |
| kInvalidParams | |
| kConnecting | |
| kDisconnecting | |
| kNotConnected | |
| kFailedToConnect | |
| kPendingServerSetup | |
|
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::BindFetchTrack | ( | TransportConnId | conn_id, |
| std::shared_ptr< PublishFetchHandler > | track_handler ) |
Bind a server fetch publisher track handler.
| conn_id | Connection Id of the client/fetcher. |
| track_handler | The fetch publisher. |
| void quicr::Server::BindPublisherTrack | ( | ConnectionHandle | connection_handle, |
| ConnectionHandle | src_id, | ||
| uint64_t | request_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 |
| src_id | Connection or peering Id for publisher origin |
| request_id | Request 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. |
| request_id | Request ID received. |
|
overridevirtual |
Event to run on receiving Fetch request.
| connection_handle | Source connection ID. |
| request_id | Request ID received. |
| track_full_name | Track full name |
| attributes | Fetch attributes received. |
Reimplemented from quicr::Transport.
|
inherited |
Fetch track.
| connection_handle | Connection ID to send fetch |
| track_handler | Track handler used for fetching |
|
protectedinherited |
|
virtual |
Get the largest available location for the given track, if any.
| track_name | The track to lookup on. |
|
protectedinherited |
|
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 |
Event to run on sending FetchOk.
| connection_handle | Source connection ID. |
| request_id | Request ID received. |
| track_full_name | Track full name |
| attributes | Fetch attributes received. |
|
pure virtual |
Callback notification for new publish received.
| connection_handle | Source connection ID |
| request_id | Request ID received |
| track_full_name | Track full name |
| publish_attributes | Publish 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 |
|
inherited |
Publish to a track and force subscribe.
| connection_handle | Connection ID from transport for the QUIC connection context |
| track_handler | Track handler to use for track related functions and callbacks |
|
inherited |
Request track status.
| connection_handle | Source connection ID. |
| track_full_name | Track full name |
| subscribe_attributes | Subscribe attributes for track status |
| void quicr::Server::ResolveAnnounce | ( | ConnectionHandle | connection_handle, |
| uint64_t | request_id, | ||
| 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 |
| request_id | Request Id received for the announce request |
| 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 publish that was received.
Accept or reject publish received via PublishReceived(). The MoQ Transport will send the protocol message based on the SubscribeResponse
| connection_handle | source connection ID |
| request_id | Request ID |
| forward | True indicates to forward data, False to pause forwarding |
| publish_response | response to for the publish |
|
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 |
| request_id | Request ID |
| track_alias | Track alias the subscriber should use. |
| subscribe_response | response to for the subscribe |
|
virtualinherited |
Accept or reject track status that was received.
Accept or reject track status received via TrackStatusReceived(). The MoQ Transport will send the protocol message based on the SubscribeResponse. Per MOQT draft-14, track status request, ok, and error are the same as subscribe
| connection_handle | source connection ID |
| request_id | Request ID that was provided by TrackStatusReceived |
| track_alias | Track alias for the track |
| subscribe_response | Response to the track status request, either Ok or Error. Largest loation should be set if kOk and there is content |
| 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 |
|
pure virtual |
Callback notification on Subscribe Done received.
| connection_handle | Source connection ID |
| request_id | Request ID received |
|
virtual |
Callback notification for new subscribe received.
| connection_handle | Source connection ID |
| request_id | Request ID received |
| filter_type | Filter type received |
| 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 |
|
virtualinherited |
Callback notification for track status message received.
| connection_handle | Source connection ID |
| request_id | Request ID received |
| track_full_name | Track full name |
| subscribe_attributes | Subscribe attributes received |
|
virtualinherited |
Callback notification for track status OK received.
| connection_handle | Source connection ID |
| request_id | Request ID received |
| response | Track status (track_status = Subscribe) response |
|
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::UnbindFetchTrack | ( | ConnectionHandle | conn_id, |
| const std::shared_ptr< PublishFetchHandler > & | track_handler ) |
Unbind a server fetch publisher track handler.
| conn_id | Connection ID of the client/fetcher. |
| track_handler | The fetch publisher. |
| void quicr::Server::UnbindPublisherTrack | ( | ConnectionHandle | connection_handle, |
| ConnectionHandle | src_id, | ||
| 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 |
| src_id | Connect or peering Id of the receiving publisher |
| 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 |
| request_id | Request 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 |
| new_group_request | True to add new group request parameter |