Skip to main content

BACnetAddress

Struct BACnetAddress 

Source
pub struct BACnetAddress {
    pub network_number: u16,
    pub mac_address: MacAddr,
}
Expand description

A BACnet network address: network number (0 = local) plus MAC address.

Fields§

§network_number: u16

Network number (0 = local network, 1-65534 = remote, 65535 = broadcast).

§mac_address: MacAddr

MAC-layer address (variable length, at most Self::MAX_MAC_LEN on the wire; empty = broadcast).

Implementations§

Source§

impl BACnetAddress

Source

pub const MAX_MAC_LEN: usize = 18

The longest mac_address, in octets, that this stack encodes or decodes in any BACnetAddress (#1124, #1156), and of any DADR or SADR the network layer encodes or decodes (#1141).

Clause 21 puts no length on the OCTET STRING, but a MAC is only useful if it names a node on some data link. Table 6-2 gives the network-layer address length of each standard data link, and the longest there is 7 octets (a LonTalk Neuron_ID destination). The data links this stack serves address a node in at most 6 octets: 1 for MS/TP, 3 for B/IPv6 (its VMAC, U.1.3) and 6 for B/IP, Ethernet and B/SC. The bound stays at 18, the length of a B/IPv6 address (16-octet IPv6 address and 2-octet UDP port), which the stack once used as the B/IPv6 MAC: it is a defensive ceiling, and lowering it is a decision of its own. A longer MAC names no node on any data link the stack serves, nor on a standard one behind a router.

Every codec for this type in bacnet-encoding holds to the bound: the recipient, ValueSource and AuditLogQuery decoders refuse a longer MAC and their encoders refuse to write one. The local setters that store a configured recipient (a Recipient_List destination or the Audit_Notification_Recipient) refuse one too, so a stored recipient always decodes again. The NPDU codec refuses a longer DLEN or SLEN (NpduAddress::MAX_MAC_LEN in bacnet-encoding), and bacnet-network’s NetworkLayer and BACnetRouter drop a frame whose link-layer source MAC is longer (#1198), so the source addresses the stack learns off the network, which COV subscription lists and audit records report, fit the bound as well. So does the device MAC a You-Are request assigns (#1200).

Source

pub fn local_broadcast() -> Self

Create a local-broadcast address.

Source

pub fn from_ip(ip_port_bytes: [u8; 6]) -> Self

Create a BACnet/IP address from a 6-byte octet-string (4-byte IPv4 + 2-byte port).

Trait Implementations§

Source§

impl Clone for BACnetAddress

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BACnetAddress

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BACnetAddress

Source§

impl PartialEq for BACnetAddress

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BACnetAddress

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.