pub struct OnvifServerBuilder { /* private fields */ }Expand description
Builder for configuring and constructing an OnvifServer.
Service registration, auth credentials, port, and auth bypass operations are
all set here. Fields are pub(crate) — use the builder methods to configure
the server.
Implementations§
Source§impl OnvifServerBuilder
impl OnvifServerBuilder
Sourcepub fn advertised_host(self, host: &str) -> Self
pub fn advertised_host(self, host: &str) -> Self
Set the host advertised in XAddrs for GetCapabilities, GetServices, and WS-Discovery. Real ONVIF clients need a routable address (e.g. “192.168.1.10”), not “0.0.0.0”. Defaults to “0.0.0.0” for backward compatibility.
Sourcepub fn auth(self, username: &str, password: &str) -> Self
pub fn auth(self, username: &str, password: &str) -> Self
Set the credentials used for WS-Security digest auth validation.
When called, WS-Security UsernameToken authentication is enforced on all
non-bypassed operations during OnvifServer::run. When NOT called, the
server runs unauthenticated — all operations are accessible without
credentials.
Sourcepub fn device_service(self, svc: impl DeviceService + 'static) -> Self
pub fn device_service(self, svc: impl DeviceService + 'static) -> Self
Register a Device Management Service implementation.
Sourcepub fn media_service(self, svc: impl MediaService + 'static) -> Self
pub fn media_service(self, svc: impl MediaService + 'static) -> Self
Register a Media Service implementation.
Optional: if not registered, the media route is not mounted and media capabilities are not advertised.
Sourcepub fn ptz_service(self, svc: impl PTZService + 'static) -> Self
pub fn ptz_service(self, svc: impl PTZService + 'static) -> Self
Register a PTZ Service implementation.
Optional: if not registered, the PTZ route is not mounted and PTZ capabilities are not advertised.
Sourcepub fn imaging_service(self, svc: impl ImagingService + 'static) -> Self
pub fn imaging_service(self, svc: impl ImagingService + 'static) -> Self
Register an Imaging Service implementation.
Optional: if not registered, the imaging route is not mounted and imaging capabilities are not advertised.
Sourcepub fn event_service(self, svc: impl EventService + 'static) -> Self
pub fn event_service(self, svc: impl EventService + 'static) -> Self
Register an Event Service implementation.
Optional: if not registered, the events route is not mounted and events capabilities are not advertised.
Sourcepub fn discovery_uuid(self, uuid: Uuid) -> Self
pub fn discovery_uuid(self, uuid: Uuid) -> Self
Override the stable WS-Discovery EndpointReference UUID for this device.
When not called, the builder defaults to a random UUID-v4. Callers that need a deterministic identity across restarts should supply a stable UUID here (e.g. derived from hardware ID or stored configuration).
Sourcepub fn auth_bypass_set(&self) -> &HashSet<String>
pub fn auth_bypass_set(&self) -> &HashSet<String>
Accessor for the auth bypass operation set. Used in tests and Phase 2 wiring.
Sourcepub fn build(self) -> Result<OnvifServer, BuildError>
pub fn build(self) -> Result<OnvifServer, BuildError>
Build the configured OnvifServer.
Returns Err(BuildError::MissingRequiredService("device_service")) if no
device service has been registered. device_service is required by the ONVIF
spec — it provides GetSystemDateAndTime and core device management operations.
All other services (media, PTZ, imaging, events) are optional. When omitted,
their routes are not mounted at run time and their capabilities are not
advertised in GetCapabilities / GetServices.