pub struct ScServerBuilder { /* private fields */ }sc-tls only.Expand description
SC-specific server builder.
Created by BACnetServer::sc_builder(). Requires the sc-tls feature.
A caller-provisioned, nonzero device_uuid and validated
tls_config are required before build can connect.
Implementations§
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn mutation_policy(self, policy: MutationPolicy) -> Self
pub fn mutation_policy(self, policy: MutationPolicy) -> Self
Select local mutation authorization (default: MutationPolicy::Permissive).
SC mTLS channel/peer authentication is not service authorization.
Sourcepub fn policy(self, policy: impl ServerPolicy) -> Self
pub fn policy(self, policy: impl ServerPolicy) -> Self
Install the server’s authorization policy; see ServerPolicy, or
FnPolicy to build one from closures.
It replaces any policy set before; put every decision in one policy
(one FnPolicy chain) rather than calling this twice.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn reinit_password(self, password: impl Into<String>) -> Self
pub fn reinit_password(self, password: impl Into<String>) -> Self
Set the password required for ReinitializeDevice requests.
Sourcepub fn on_reinitialize<F>(self, handler: F) -> Selfwhere
F: Fn(&ReinitializeContext, &mut ObjectDatabase) -> Result<(), Error> + Send + Sync + 'static,
pub fn on_reinitialize<F>(self, handler: F) -> Selfwhere
F: Fn(&ReinitializeContext, &mut ObjectDatabase) -> Result<(), Error> + Send + Sync + 'static,
Set the ReinitializeDevice handler. It must reply before restarting and
stay quick; see ReinitializeHandler.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn time_sync_policy(self, policy: TimeSyncPolicy) -> Self
pub fn time_sync_policy(self, policy: TimeSyncPolicy) -> Self
Configure inbound clock restrictions on claimed SC VMAC / routed sources.
Dispatch does not expose certificate principals; see TimeSyncSource.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn hub_url(self, url: &str) -> Self
pub fn hub_url(self, url: &str) -> Self
Set the hub WebSocket URL (e.g. wss://hub.example.com/bacnet).
Sourcepub fn tls_config(self, config: ScNodeTlsConfig) -> Self
pub fn tls_config(self, config: ScNodeTlsConfig) -> Self
Set the validated local node TLS policy, shared across initial and reconnect attempts (including normal TLS resumption).
use bacnet_server::server::{BACnetServer, ScServerBuilder};
use bacnet_transport::sc_tls::ScNodeTlsConfig;
fn configured(tls: ScNodeTlsConfig) -> ScServerBuilder {
BACnetServer::sc_builder().tls_config(tls)
}use bacnet_server::server::BACnetServer;
fn raw(config: std::sync::Arc<tokio_rustls::rustls::ClientConfig>) {
let _ = BACnetServer::sc_builder().tls_config(config);
}Sourcepub fn device_uuid(self, uuid: [u8; 16]) -> Self
pub fn device_uuid(self, uuid: [u8; 16]) -> Self
Set the caller-provisioned, persistent BACnet/SC device UUID.
The caller must generate it before deployment, store it durably, and reuse
the same bytes for the device’s lifetime, including restarts. Distinct
devices must not share a UUID. This builder neither generates nor stores
identities across lifecycles and cannot detect a changed provisioned UUID.
build rejects missing/all-zero UUIDs before dialing; it does not enforce
UUID version or variant bits.
Sourcepub fn device(self, identity: DeviceIdentity) -> Self
pub fn device(self, identity: DeviceIdentity) -> Self
Set the one Device identity. With no supplied database, startup creates a stock Device after resolving the owned transport’s receive capacity.
Sourcepub fn database(self, db: ObjectDatabase) -> Self
pub fn database(self, db: ObjectDatabase) -> Self
Set the object database (transfers ownership).
Sourcepub fn device_binding(self, binding: DeviceBinding) -> Result<Self, Error>
pub fn device_binding(self, binding: DeviceBinding) -> Result<Self, Error>
Register one explicit unicast route for a Device recipient.
Sourcepub fn heartbeat_interval_ms(self, ms: u64) -> Self
pub fn heartbeat_interval_ms(self, ms: u64) -> Self
Set the heartbeat interval in milliseconds (default 30 000).
Sourcepub fn heartbeat_timeout_ms(self, ms: u64) -> Self
pub fn heartbeat_timeout_ms(self, ms: u64) -> Self
Set the heartbeat timeout in milliseconds (default 60 000).
Sourcepub fn reconnect(self, config: ScReconnectConfig) -> Self
pub fn reconnect(self, config: ScReconnectConfig) -> Self
Enable automatic reconnection with the given configuration.
Sourcepub fn dcc_password(self, password: impl Into<String>) -> Self
pub fn dcc_password(self, password: impl Into<String>) -> Self
Set the password required for DeviceCommunicationControl requests.
Sourcepub fn dcc_policy(self, policy: DccPolicy) -> Self
pub fn dcc_policy(self, policy: DccPolicy) -> Self
Select explicit local DCC authorization (default: deny all).
Sourcepub fn dcc_source_restriction(
self,
restriction: Option<DccSourceRestriction>,
) -> Self
pub fn dcc_source_restriction( self, restriction: Option<DccSourceRestriction>, ) -> Self
Restrict claimed DCC sources; requires explicit RequirePassword policy.
Sourcepub fn dcc_disable_rate_limit(self, limit: Option<DccDisableRateLimit>) -> Self
pub fn dcc_disable_rate_limit(self, limit: Option<DccDisableRateLimit>) -> Self
Limit authorized DISABLE_INITIATION globally; None (default) disables it.
Sourcepub fn audit_notification_sink(self, sink: ObjectIdentifier) -> Self
pub fn audit_notification_sink(self, sink: ObjectIdentifier) -> Self
Select the only local Audit Log that receives authorized notifications.
Sourcepub fn enable_fault_detection(self, enabled: bool) -> Self
pub fn enable_fault_detection(self, enabled: bool) -> Self
Enable periodic fault detection / reliability evaluation.
When enabled, every object’s opt-in reliability hook runs every 10 seconds; the default hook is a no-op.
Sourcepub fn enable_event_enrollment(self, enabled: bool) -> Self
pub fn enable_event_enrollment(self, enabled: bool) -> Self
Enable periodic Event Enrollment evaluation (default true).
Sourcepub fn event_enrollment_interval_secs(self, secs: u64) -> Self
pub fn event_enrollment_interval_secs(self, secs: u64) -> Self
Set the interval in seconds between Event Enrollment evaluation passes.
Sourcepub fn cov_policy(self, policy: CovPolicy) -> Self
pub fn cov_policy(self, policy: CovPolicy) -> Self
Set the COV quota and notification work budget policy, checked by
CovPolicy::validate before SC dialing.
Sourcepub async fn build(
self,
) -> Result<BACnetServer<ScTransport<TlsWebSocket>>, Error>
pub async fn build( self, ) -> Result<BACnetServer<ScTransport<TlsWebSocket>>, Error>
Connect to the hub and start the server.
Reconnect configuration is validated before UUID validation, binding-table construction, TLS lookup, or dialing, and again when the transport starts. An error still consumes this builder and drops its inputs; this does not promise generic endpoint rollback.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn request_admission_policy(self, policy: RequestAdmissionPolicy) -> Self
pub fn request_admission_policy(self, policy: RequestAdmissionPolicy) -> Self
Set positive global and peer handler limits, validated before TLS dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn read_property_multiple_budget(
self,
budget: ReadPropertyMultipleBudget,
) -> Self
pub fn read_property_multiple_budget( self, budget: ReadPropertyMultipleBudget, ) -> Self
Set positive per-service RPM limits, validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn get_alarm_summary_budget(self, budget: GetAlarmSummaryBudget) -> Self
pub fn get_alarm_summary_budget(self, budget: GetAlarmSummaryBudget) -> Self
Set limits validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn atomic_read_file_budget(self, budget: AtomicReadFileBudget) -> Self
pub fn atomic_read_file_budget(self, budget: AtomicReadFileBudget) -> Self
Set AtomicReadFile limits validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn atomic_write_file_budget(self, budget: AtomicWriteFileBudget) -> Self
pub fn atomic_write_file_budget(self, budget: AtomicWriteFileBudget) -> Self
Set AtomicWriteFile payload limits, validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn read_range_budget(self, budget: ReadRangeBudget) -> Self
pub fn read_range_budget(self, budget: ReadRangeBudget) -> Self
Set ReadRange page limits, validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn get_event_information_budget(
self,
budget: GetEventInformationBudget,
) -> Self
pub fn get_event_information_budget( self, budget: GetEventInformationBudget, ) -> Self
Set GetEventInformation limits, validated before SC dialing.
Source§impl ScServerBuilder
impl ScServerBuilder
Sourcepub fn get_enrollment_summary_budget(
self,
budget: GetEnrollmentSummaryBudget,
) -> Self
pub fn get_enrollment_summary_budget( self, budget: GetEnrollmentSummaryBudget, ) -> Self
Set GetEnrollmentSummary limits validated before SC dialing.