Skip to main content

OnvifServerBuilder

Struct OnvifServerBuilder 

Source
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

Source

pub fn port(self, port: u16) -> Self

Set the port the server will listen on. Defaults to 8080.

Source

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.

Source

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.

Source

pub fn device_service(self, svc: impl DeviceService + 'static) -> Self

Register a Device Management Service implementation.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn auth_bypass_set(&self) -> &HashSet<String>

Accessor for the auth bypass operation set. Used in tests and Phase 2 wiring.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more