Skip to main content

RouterApplicationPorts

Struct RouterApplicationPorts 

Source
#[non_exhaustive]
pub struct RouterApplicationPorts { pub client: RouterApplicationPort, pub server: RouterApplicationPort, }
Expand description

The router’s application entity split between a client and a server (#2069), from StartedRouter::into_application_ports: give Self::client to a BACnetClient and Self::server to a BACnetServer, each with its generic_builder.

Both send as RouterApplicationPort does. What the router delivers is shared out by what it is:

  • a Confirmed-Request goes to the server, except a ConfirmedCOVNotification, which goes to the client, and a ConfirmedEventNotification, which goes to both: the server’s answer is sent and the client’s dropped, unless the server’s port can’t take it (not started, stopped or full), when the client’s answer is sent. A ConfirmedAuditNotification goes to the server alone;
  • an Unconfirmed-Request goes to both, so the client hears I-Am, I-Have and unconfirmed notifications, and the server Who-Is and Who-Has;
  • an answer (Simple-ACK, Complex-ACK, Error, Reject, and a Segment-ACK or Abort sent by the answering side) goes to the port whose stack sent the request, matched by device and invoke ID among requests open or closed within the last 10 seconds, or to the client when neither did. One the client could mistake for a request that went out under another ID is dropped;
  • a Segment-ACK or Abort sent by a requester goes to the server.

The two stacks choose invoke IDs on their own. When both have a request open to one device under the same ID, the later one goes out under another ID free for that device, and its answers come back under its own. Up to 1,024 requests are tracked, each for 60 seconds from its last segment, retry or answer; past that the least recently used goes. Each of the stacks’ waits for one answer or segment, such as a client’s APDU timeout, must be shorter than 60 seconds, or a late answer goes unmatched.

Each port’s queue is small, and the router’s local queue stays the one that fills and drops. A stack that stops taking what its port holds for 100 ms is taken as stalled: the other no longer waits for it, and what arrives for it is dropped while its queue is full. It holds the other up for at most 100 ms each time it frees a slot and stays full again.

let started = BACnetRouter::start(ports, RouterOptions::new()).await?;
let (router, ports, _controls) = started.into_application_ports();
// `BACnetServer::generic_builder().transport(ports.server)` hosts a
// device on the router; `BACnetClient::generic_builder()
// .transport(ports.client)` reads others through it.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§client: RouterApplicationPort

The port for the client: the answers to its requests, notifications and every Unconfirmed-Request.

§server: RouterApplicationPort

The port for the server: the requests to the entity, the answers to its own requests and every Unconfirmed-Request.

Trait Implementations§

Source§

impl Debug for RouterApplicationPorts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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