mirror of
https://github.com/MidnightBlueLabs/tetra-bluestation.git
synced 2026-03-29 05:09:51 +00:00
Added config options for enabling/disabling SDS over Brew
This commit is contained in:
18
Cargo.lock
generated
18
Cargo.lock
generated
@@ -161,7 +161,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bluestation-bs"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"ctrlc",
|
||||
@@ -733,7 +733,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "net-tnmm-test"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"tetra-config",
|
||||
@@ -748,7 +748,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "net-tnmm-test-quic"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"quinn",
|
||||
"rcgen",
|
||||
@@ -910,7 +910,7 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
|
||||
|
||||
[[package]]
|
||||
name = "pdu-tool"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"tetra-config",
|
||||
@@ -1527,7 +1527,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tetra-config"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"tetra-core",
|
||||
@@ -1536,7 +1536,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tetra-core"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"git-version",
|
||||
@@ -1548,7 +1548,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tetra-entities"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"as-any",
|
||||
"bitcode",
|
||||
@@ -1576,7 +1576,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tetra-pdus"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"tetra-config",
|
||||
"tetra-core",
|
||||
@@ -1586,7 +1586,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tetra-saps"
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"tetra-core",
|
||||
"tracing",
|
||||
|
||||
@@ -17,7 +17,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.4.10"
|
||||
version = "0.5.0"
|
||||
edition = "2024"
|
||||
authors = ["Wouter Bokslag / Midnight Blue"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -3,6 +3,10 @@ use std::{collections::HashMap, time::Duration};
|
||||
use serde::Deserialize;
|
||||
use toml::Value;
|
||||
|
||||
fn default_brew_feature_sds_enabled() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Brew protocol (TetraPack/BrandMeister) configuration
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CfgBrew {
|
||||
@@ -21,6 +25,9 @@ pub struct CfgBrew {
|
||||
/// Extra initial jitter playout delay in frames (added on top of adaptive baseline)
|
||||
pub jitter_initial_latency_frames: u8,
|
||||
|
||||
/// Set to true when SDS between local and Brew clients is enabled
|
||||
pub feature_sds_enabled: bool,
|
||||
/// If present, restrict Brew call to these remote SSIs
|
||||
pub whitelisted_ssis: Option<Vec<u32>>,
|
||||
}
|
||||
|
||||
@@ -44,8 +51,13 @@ pub struct CfgBrewDto {
|
||||
#[serde(default)]
|
||||
pub jitter_initial_latency_frames: u8,
|
||||
|
||||
/// If present, restrict Brew call to these remote SSIs
|
||||
pub whitelisted_ssis: Option<Vec<u32>>,
|
||||
|
||||
/// Set to true when SDS between local and Brew clients is enabled
|
||||
#[serde(default = "default_brew_feature_sds_enabled")]
|
||||
pub feature_sds_enabled: bool,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub extra: HashMap<String, Value>,
|
||||
}
|
||||
@@ -68,6 +80,7 @@ pub fn apply_brew_patch(src: CfgBrewDto) -> CfgBrew {
|
||||
password: Some(src.password),
|
||||
reconnect_delay: Duration::from_secs(src.reconnect_delay_secs),
|
||||
jitter_initial_latency_frames: src.jitter_initial_latency_frames,
|
||||
feature_sds_enabled: src.feature_sds_enabled,
|
||||
whitelisted_ssis: src.whitelisted_ssis,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ pub fn is_active(config: &SharedConfig) -> bool {
|
||||
config.config().brew.is_some()
|
||||
}
|
||||
|
||||
/// Returns true if the SDS over Brew feature is enabled
|
||||
#[inline]
|
||||
pub fn feature_sds_enabled(config: &SharedConfig) -> bool {
|
||||
config.config().brew.as_ref().map_or(false, |brew| brew.feature_sds_enabled)
|
||||
}
|
||||
|
||||
/// Returns true if the configured Brew server is TetraPack (core.tetrapack.online)
|
||||
fn is_tetrapack(config: &SharedConfig) -> bool {
|
||||
let Some(brew_config) = &config.config().brew else {
|
||||
|
||||
@@ -5,6 +5,7 @@ pub mod entity;
|
||||
pub mod protocol;
|
||||
pub mod worker;
|
||||
|
||||
pub use components::brew_routable::feature_sds_enabled;
|
||||
/// Convenience re-export of commonly externally used functions
|
||||
pub use components::brew_routable::is_active;
|
||||
pub use components::brew_routable::is_brew_gssi_routable;
|
||||
|
||||
@@ -709,6 +709,11 @@ impl BrewWorker {
|
||||
data,
|
||||
length_bits,
|
||||
} => {
|
||||
if !brew::feature_sds_enabled(&self.config) {
|
||||
tracing::warn!("BrewWorker: ignoring SendSds command because SDS over Brew is disabled in config");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Send SHORT_TRANSFER first (header with source/dest)
|
||||
let short_msg = build_short_transfer(&uuid, source, destination);
|
||||
if let Err(e) = ws.send(Message::Binary(short_msg.into())) {
|
||||
@@ -725,6 +730,11 @@ impl BrewWorker {
|
||||
}
|
||||
}
|
||||
BrewCommand::SendSdsReport { uuid, status } => {
|
||||
if !brew::feature_sds_enabled(&self.config) {
|
||||
tracing::warn!("BrewWorker: ignoring SendSdsReport command because SDS over Brew is disabled in config");
|
||||
continue;
|
||||
}
|
||||
|
||||
let msg = build_sds_report(&uuid, status);
|
||||
if let Err(e) = ws.send(Message::Binary(msg.into())) {
|
||||
tracing::warn!("BrewWorker: failed to send SDS_REPORT: {}", e);
|
||||
|
||||
@@ -73,7 +73,7 @@ impl SdsBsSubentity {
|
||||
} else if is_local_group {
|
||||
tracing::info!("SDS: group delivery: {} -> GSSI {}", source_ssi, dest_ssi);
|
||||
self.send_d_sds_data(queue, message.dltime, source_ssi, dest_ssi, SsiType::Gssi, pdu.user_defined_data);
|
||||
} else if brew::is_active(&self.config)
|
||||
} else if brew::feature_sds_enabled(&self.config)
|
||||
&& (brew::is_brew_issi_routable(&self.config, dest_ssi) || brew::is_tetrapack_sds_service_issi(&self.config, dest_ssi))
|
||||
{
|
||||
tracing::info!("SDS: forwarding to Brew: {} -> {}", source_ssi, dest_ssi);
|
||||
|
||||
@@ -122,6 +122,7 @@ fn test_sds_brew_forward() {
|
||||
password: None,
|
||||
reconnect_delay: Duration::from_secs(1),
|
||||
jitter_initial_latency_frames: 0,
|
||||
feature_sds_enabled: true,
|
||||
whitelisted_ssis: None,
|
||||
});
|
||||
let mut test = ComponentTest::from_config(config, Some(dltime));
|
||||
@@ -326,6 +327,7 @@ fn test_u_status_brew_forward() {
|
||||
password: None,
|
||||
reconnect_delay: Duration::from_secs(1),
|
||||
jitter_initial_latency_frames: 0,
|
||||
feature_sds_enabled: true,
|
||||
whitelisted_ssis: None,
|
||||
});
|
||||
let mut test = ComponentTest::from_config(config, Some(dltime));
|
||||
|
||||
@@ -93,7 +93,7 @@ reverse_operation = false # False: UL below DL. True: UL above DL.
|
||||
# Location Area identifier
|
||||
location_area = 2
|
||||
|
||||
# Colour code (0-3), helps distinguish between adjacent cells on the same frequency
|
||||
# Colour code (0-63), helps distinguish between adjacent cells on the same frequency
|
||||
colour_code = 1
|
||||
|
||||
###############################################################################
|
||||
@@ -182,6 +182,10 @@ voice_service = true
|
||||
# Adaptive jitter buffering is always enabled; this adds fixed startup delay if needed.
|
||||
# jitter_initial_latency_frames = 0
|
||||
|
||||
# Uncomment to allow only select SSIs to be transmitted over Brew
|
||||
# If left commented, all (outside of local_ssi_ranges) are allowed over Brew
|
||||
# Enable SDS forwarding between local and Brew clients. Enabled by default.
|
||||
# feature_sds_enabled = true
|
||||
|
||||
# Uncomment to allow only calls for select SSIs to be transmitted over Brew
|
||||
# SDS works for all SSIs, currently, but the SDS over Brew feature may be fully disabled.
|
||||
# If left commented, all (outside of local_ssi_ranges) calls are allowed over Brew
|
||||
# whitelisted_ssis = [91]
|
||||
|
||||
Reference in New Issue
Block a user