|
LibQuicR
|
Publishes and manages tracks below one namespace prefix. More...
#include <publish_namespace_handler.h>
Public Types | |
| enum class | Status : uint8_t { kOk = 0 , kNotConnected , kNotPublished , kPendingResponse , kPublishNotAuthorized , kSendingDone , kError } |
| Status codes for the Publish track. More... | |
Public Member Functions | |
| virtual | ~PublishNamespaceHandler () |
| Unpublishes all retained tracks when an attached session still exists. More... | |
| virtual void | PublishTrack (std::shared_ptr< PublishTrackHandler > handler) |
| Publish a new track. More... | |
| virtual void | UnPublishTrack (std::shared_ptr< PublishTrackHandler > handler) |
| Removes and unpublishes a track. More... | |
| virtual PublishTrackHandler::PublishObjectStatus | PublishObject (uint64_t track_alias, const ObjectHeaders &object_headers, BytesSpan data, std::optional< messages::StreamHeaderProperties > stream_mode=std::nullopt) |
| Passthrough PublishObject to Publish Track matching full name hash. More... | |
| virtual PublishTrackHandler::PublishObjectStatus | ForwardPublishedData ([[maybe_unused]] uint64_t track_alias, [[maybe_unused]] bool is_new_stream, [[maybe_unused]] uint64_t group_id, [[maybe_unused]] uint64_t subgroup_id, [[maybe_unused]] std::shared_ptr< const std::vector< uint8_t >> data) |
| Passthrough to Forward received object data to each publish handler. More... | |
| const TrackNamespace & | GetPrefix () const noexcept |
| constexpr Status | GetStatus () const noexcept |
| Get the status of the Publish. More... | |
| std::optional< Error< ErrorCode > > | GetError () const noexcept |
| Get the error code and reason for the Publish namespace, if any. More... | |
| template<typename T > | |
| requires std::is_base_of_v< TrackHandler, T > std::shared_ptr< T > | Get () |
| Get the derived type of the track handler. More... | |
| void | SetRequestId (std::optional< uint64_t > request_id) |
| Sets or clears the connection-scoped request ID. More... | |
| std::optional< uint64_t > | GetRequestId () const noexcept |
| Get the request ID. More... | |
| std::optional< uint64_t > | GetRequestStreamId () const |
| Get the stream ID of the request control stream. More... | |
| FullTrackName | GetFullTrackName () const noexcept |
| Get the full track name. More... | |
| uint64_t | GetConnectionId () const noexcept |
| Gets the transport connection identifier assigned by the session. More... | |
| std::shared_ptr< Connection > | GetConnection () const |
| Binding | GetBinding () const |
Static Public Member Functions | |
| static auto | Create (const TrackNamespace &prefix) |
| Creates a namespace publisher with shared ownership. More... | |
Protected Member Functions | |
| PublishNamespaceHandler (const TrackNamespace &prefix) | |
| Constructs an inactive namespace publisher. More... | |
| virtual void | StatusChanged (Status status) |
| Notification of Publish status. More... | |
| void | SetStatus (const Status status) noexcept |
| Set the Publish status. More... | |
| void | SetError (const Error< ErrorCode > &error) |
Stores an error and transitions to kError. More... | |
| void | RequestOkReceived (const messages::Parameters ¶ms) override |
Handles peer acceptance by entering kOk. More... | |
| Reply< messages::Parameters, ErrorCode > | RequestUpdateReceived (const messages::Parameters ¶ms) override |
| Rejects updates to a namespace publication. More... | |
| void | RequestError (ErrorCode error_code, std::string reason) override |
Stores a request error and enters kError. More... | |
| void | SetTransport (std::shared_ptr< Session > transport) |
| Sets the session used for control and data operations. More... | |
| const std::weak_ptr< Session > & | GetSession () const noexcept |
| Gets the non-owning session handle. More... | |
Protected Attributes | |
| std::map< std::uint64_t, std::shared_ptr< PublishTrackHandler > > | handlers_ |
| Track publishers keyed by the full-track-name hash. More... | |
| FullTrackName | full_track_name_ |
| Full track identity retained for the handler's lifetime. More... | |
| std::mutex | binding_operation_mutex_ |
Publishes and manages tracks below one namespace prefix.
The handler owns shared references to registered track publishers. Public operations are not internally synchronized and should be serialized with session/application callbacks.
|
strong |
Status codes for the Publish track.
| Enumerator | |
|---|---|
| kOk | Namespace is accepted and active. |
| kNotConnected | Session transport is disconnected. |
| kNotPublished | Initial/inactive state. |
| kPendingResponse | Waiting for the peer's response. |
| kPublishNotAuthorized | Peer denied publication. |
| kSendingDone | In this state, callbacks will not be called. |
| kError | Request failed; inspect |
|
protected |
Constructs an inactive namespace publisher.
| prefix | Prefix that every contained track must share. |
|
virtual |
Unpublishes all retained tracks when an attached session still exists.
|
inlinestatic |
Creates a namespace publisher with shared ownership.
| prefix | Prefix that every contained track must share. |
|
inlinevirtual |
Passthrough to Forward received object data to each publish handler.
Passthrough to send to the publish handlers. Selection and filters can be applied.
kInternalError and does not inspect its arguments or forward data.| track_alias | Track alias |
| is_new_stream | Indicates if this data starts a new stream |
| group_id | Group ID for stream |
| subgroup_id | Subgroup ID for stream |
| data | MoQ data to send |
|
inlineinherited |
Get the derived type of the track handler.
| T | Derived type of the track handler. |
T, or null when the dynamic type is incompatible. | std::bad_weak_ptr | if this object is not currently owned by a shared_ptr. |
|
inlineinherited |
|
inherited |
|
inlinenoexceptinherited |
Gets the transport connection identifier assigned by the session.
Get the error code and reason for the Publish namespace, if any.
|
inlinenoexceptinherited |
Get the full track name.
|
inlinenoexcept |
|
inlinenoexceptinherited |
Get the request ID.
std::nullopt when none is assigned.
|
inherited |
Get the stream ID of the request control stream.
std::nullopt if no stream is attached.
|
protectednoexceptinherited |
Gets the non-owning session handle.
|
inlineconstexprnoexcept |
Get the status of the Publish.
|
virtual |
Passthrough PublishObject to Publish Track matching full name hash.
Passthrough to send to the publish handler. Selection and filters maybe applied.
| track_alias | Track alias |
| object_headers | Object headers, must include group and object Ids |
| data | Full complete payload data for the object |
| stream_mode | MOQT stream mode, stream mode |
The alias is looked up in handlers_. No handler yields kInternalError. The payload view is borrowed only for this call; the selected handler copies it before asynchronous transmission.
| TransportException | Propagated if the selected publisher cannot enqueue data. |
|
virtual |
Publish a new track.
Creates a new publish track handler that will be used to send data for a track. Selection and filters may be applied here.
| handler | Publish Track Handler for the publish |
| std::invalid_argument | if the handler's namespace does not share this prefix. |
| std::runtime_error | if this namespace handler has no live session. |
Retains shared ownership under the track-name hash and asks the session to publish it. handler must not be null.
|
inlineoverrideprotectedvirtual |
Stores a request error and enters kError.
| error_code | Peer-provided error code. |
| reason | Peer-provided reason, moved into the stored error. |
Reimplemented from quicr::TrackHandler.
|
overrideprotectedvirtual |
Handles peer acceptance by entering kOk.
| params | Response parameters, which are ignored without validation. |
Implements quicr::TrackHandler.
|
overrideprotectedvirtual |
Rejects updates to a namespace publication.
| params | Unused update parameters. |
| messages::ProtocolViolationException | Always. |
Implements quicr::TrackHandler.
Stores an error and transitions to kError.
| error | Error code and optional reason, copied into the handler. |
|
inlineinherited |
Sets or clears the connection-scoped request ID.
| request_id | Request ID assigned by the session, or std::nullopt when unbound. |
|
inlineprotectednoexcept |
Set the Publish status.
| status | Status of the Publish |
Entering kError without a preceding SetError() installs an internal-error fallback, then invokes StatusChanged even if the value did not change.
|
protectedinherited |
Sets the session used for control and data operations.
| transport | Session retained weakly; passing null clears effective access. |
|
protectedvirtual |
Notification of Publish status.
Notification of the Publish status
| status | Indicates status of the Publish |
|
virtual |
Removes and unpublishes a track.
| handler | Track publisher to remove; must not be null. |
| std::runtime_error | if this namespace handler has no live session. |
|
protectedinherited |
|
protectedinherited |
Full track identity retained for the handler's lifetime.
|
protected |
Track publishers keyed by the full-track-name hash.
Entries retain shared ownership until explicitly unpublished or this namespace handler is destroyed. Derived classes may inspect or customize routing through this map.