Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TrackNamespaceManager #103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion moqt-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod modules;
pub use modules::moqt_client::MOQTClient;
pub use modules::pubsub_relation_manager_repository::PubSubRelationManagerRepository;
pub use modules::send_stream_dispatcher_repository::SendStreamDispatcherRepository;
pub use modules::track_namespace_manager_repository::TrackNamespaceManagerRepository;
pub use modules::*;
3 changes: 2 additions & 1 deletion moqt-core/src/modules.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pub mod constants;
pub mod control_message_type;
pub mod messages;
pub mod models;
pub mod moqt_client;
pub mod pubsub_relation_manager_repository;
pub mod send_stream_dispatcher_repository;
pub mod track_namespace_manager_repository;
pub mod variable_bytes;
pub mod variable_integer;
50 changes: 47 additions & 3 deletions moqt-core/src/modules/messages/control_messages/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ use serde::Serialize;
use std::any::Any;
use tracing;

#[derive(Debug, Serialize, Clone, PartialEq, TryFromPrimitive, IntoPrimitive, Copy)]
#[derive(Debug, Serialize, Clone, PartialEq, Eq, TryFromPrimitive, IntoPrimitive, Copy)]
#[repr(u8)]
pub enum GroupOrder {
Ascending = 0x1,
Descending = 0x2,
}

#[derive(Debug, Serialize, Clone, PartialEq, TryFromPrimitive, IntoPrimitive, Copy)]
#[derive(Debug, Serialize, Clone, PartialEq, Eq, TryFromPrimitive, IntoPrimitive, Copy)]
#[repr(u8)]
pub enum FilterType {
LatestGroup = 0x1,
Expand Down Expand Up @@ -109,12 +109,56 @@ impl Subscribe {
})
}

pub fn subscribe_id(&self) -> u64 {
self.subscribe_id
}

pub fn track_alias(&self) -> u64 {
self.track_alias
}

pub fn track_namespace(&self) -> &Vec<String> {
&self.track_namespace
}
pub fn track_name(&self) -> &str {
&self.track_name
}

pub fn subscriber_priority(&self) -> u8 {
self.subscriber_priority
}

pub fn group_order(&self) -> GroupOrder {
self.group_order
}

pub fn filter_type(&self) -> FilterType {
self.filter_type
}

pub fn start_group(&self) -> Option<u64> {
self.start_group
}

pub fn start_object(&self) -> Option<u64> {
self.start_object
}

pub fn end_group(&self) -> Option<u64> {
self.end_group
}

pub fn end_object(&self) -> Option<u64> {
self.end_object
}

pub fn set_subscribe_id(&mut self, subscribe_id: u64) {
self.subscribe_id = subscribe_id;
}

pub fn set_track_alias(&mut self, track_alias: u64) {
self.track_alias = track_alias;
}
}

impl MOQTPayload for Subscribe {
Expand All @@ -138,7 +182,7 @@ impl MOQTPayload for Subscribe {
read_fixed_length_bytes_from_buffer(buf, 1).context("subscriber priority")?[0];
let group_order_u8 = read_fixed_length_bytes_from_buffer(buf, 1)?[0];

// Values larger than 0x2 are a protocol error.
// Values larger than 0x2 are a Protocol Violation.
let group_order = match GroupOrder::try_from(group_order_u8).context("group order") {
Ok(group_order) => group_order,
Err(err) => {
Expand Down
Loading