86 virtual void PublishTrack(std::shared_ptr<PublishTrackHandler> handler);
112 uint64_t track_alias,
115 std::optional<messages::StreamHeaderProperties> stream_mode = std::nullopt);
134 [[maybe_unused]] uint64_t track_alias,
135 [[maybe_unused]]
bool is_new_stream,
136 [[maybe_unused]] uint64_t group_id,
137 [[maybe_unused]] uint64_t subgroup_id,
138 [[maybe_unused]] std::shared_ptr<
const std::vector<uint8_t>> data)
157 std::optional<Error<ErrorCode>>
GetError() const noexcept {
return error_; }
216 std::map<std::uint64_t, std::shared_ptr<PublishTrackHandler>>
handlers_;
223 std::optional<Error<ErrorCode>> error_{};
Publishes and manages tracks below one namespace prefix.
Definition: publish_namespace_handler.h:24
static auto Create(const TrackNamespace &prefix)
Creates a namespace publisher with shared ownership.
Definition: publish_namespace_handler.h:63
Reply< messages::Parameters, ErrorCode > RequestUpdateReceived(const messages::Parameters ¶ms) override
Rejects updates to a namespace publication.
constexpr Status GetStatus() const noexcept
Get the status of the Publish.
Definition: publish_namespace_handler.h:151
virtual void PublishTrack(std::shared_ptr< PublishTrackHandler > handler)
Publish a new track.
const TrackNamespace & GetPrefix() const noexcept
Definition: publish_namespace_handler.h:144
void SetError(const Error< ErrorCode > &error)
Stores an error and transitions to kError.
Definition: publish_namespace_handler.h:180
virtual void UnPublishTrack(std::shared_ptr< PublishTrackHandler > handler)
Removes and unpublishes a track.
void SetStatus(const Status status) noexcept
Set the Publish status.
Definition: publish_namespace_handler.h:166
Status
Status codes for the Publish track.
Definition: publish_namespace_handler.h:30
@ kNotPublished
Initial/inactive state.
@ kPublishNotAuthorized
Peer denied publication.
@ kNotConnected
Session transport is disconnected.
@ kPendingResponse
Waiting for the peer's response.
@ kSendingDone
In this state, callbacks will not be called.
@ kError
Request failed; inspect GetError().
@ kOk
Namespace is accepted and active.
std::optional< Error< ErrorCode > > GetError() const noexcept
Get the error code and reason for the Publish namespace, if any.
Definition: publish_namespace_handler.h:157
virtual ~PublishNamespaceHandler()
Unpublishes all retained tracks when an attached session still exists.
void RequestOkReceived(const messages::Parameters ¶ms) override
Handles peer acceptance by entering kOk.
std::map< std::uint64_t, std::shared_ptr< PublishTrackHandler > > handlers_
Track publishers keyed by the full-track-name hash.
Definition: publish_namespace_handler.h:216
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.
virtual void StatusChanged(Status status)
Notification of Publish status.
void RequestError(ErrorCode error_code, std::string reason) override
Stores a request error and enters kError.
Definition: publish_namespace_handler.h:205
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.
Definition: publish_namespace_handler.h:133
PublishNamespaceHandler(const TrackNamespace &prefix)
Constructs an inactive namespace publisher.
PublishObjectStatus
Publish status codes.
Definition: publish_track_handler.h:31
@ kInternalError
Required session/stream state was unavailable or invalid.
The reply to a callback, which may be answered immediately or deferred.
Definition: reply.h:31
MoQ Session endpoint supporting connection-explicit operations.
Definition: session.h:68
Common request state for track-related handlers.
Definition: track_handler.h:36
An N-tuple representation of a MOQ namespace.
Definition: track_name.h:22
Definition: parameters.h:185
Definition: attributes.h:13
std::span< const Byte > BytesSpan
Non-owning, read-only view of contiguous bytes.
Definition: bytes.h:21
ErrorCode
MOQT error code, as carried by REQUEST_ERROR.
Definition: errors.h:33
@ kInternalError
The endpoint encountered an unspecified internal failure.
A rejected result, holding why the request was rejected.
Definition: errors.h:21