Skip to main content

Bvlc6Function

Struct Bvlc6Function 

Source
pub struct Bvlc6Function(/* private fields */);
Expand description

A B/IPv6 BVLC function code: the second octet of every B/IPv6 BVLL message, which says what the message is (Annex U.2, Table U-1).

The set is open, so a decoder can report a code it doesn’t know. The constants are the twelve functions of Annex U.2. Code 0x0B is not among them: the clause that defined it (U.2.12) was deleted, so this edition treats it like any other unknown code.

Implementations§

Source§

impl Bvlc6Function

Source

pub const BVLC_RESULT: Self

Acknowledges a request that needs an answer (U.2.1).

Wire value 0x00.

Source

pub const ORIGINAL_UNICAST_NPDU: Self

A directed NPDU, naming its recipient’s VMAC (U.2.2).

Wire value 0x01.

Source

pub const ORIGINAL_BROADCAST_NPDU: Self

A broadcast NPDU from a node that isn’t a foreign device (U.2.3).

Wire value 0x02.

Source

pub const ADDRESS_RESOLUTION: Self

Asks, by multicast, which B/IPv6 address a VMAC is at (U.2.4).

Wire value 0x03.

Source

pub const FORWARDED_ADDRESS_RESOLUTION: Self

An Address-Resolution a BBMD sends on into other multicast domains (U.2.5).

Wire value 0x04.

Source

pub const ADDRESS_RESOLUTION_ACK: Self

Answers either kind of Address-Resolution (U.2.6).

Wire value 0x05.

Source

pub const VIRTUAL_ADDRESS_RESOLUTION: Self

Asks a node at a known B/IPv6 address for its VMAC (U.2.7).

Wire value 0x06.

Source

pub const VIRTUAL_ADDRESS_RESOLUTION_ACK: Self

Answers a Virtual-Address-Resolution (U.2.8).

Wire value 0x07.

Source

pub const FORWARDED_NPDU: Self

An NPDU a BBMD passes on, with its originator’s VMAC and address (U.2.9).

Wire value 0x08.

Source

pub const REGISTER_FOREIGN_DEVICE: Self

Asks a BBMD to take the sender as a foreign device (U.2.10).

Wire value 0x09.

Source

pub const DELETE_FOREIGN_DEVICE_TABLE_ENTRY: Self

Removes one entry from a BBMD’s foreign device table (U.2.11).

Wire value 0x0A.

Source

pub const DISTRIBUTE_BROADCAST_TO_NETWORK: Self

A foreign device’s broadcast, for its BBMD to distribute (U.2.13).

Wire value 0x0C.

Source

pub const ALL_NAMED: &[(&str, Self)]

Every named constant, with its name, in the order declared.

Source

pub const fn from_raw(value: u8) -> Self

Wrap a raw wire value, named or not.

Source

pub const fn to_raw(self) -> u8

The raw wire value.

Source

pub const fn name(self) -> Option<&'static str>

The constant’s name, or None for a value the standard doesn’t define.

Source

pub const fn is_defined(self) -> bool

Whether the standard defines this value.

Source§

impl Bvlc6Function

Source

pub const fn payload_shape(self) -> Option<PayloadShape>

The payload layout of this function, from its format clause in Annex U.2, or None for a code Annex U doesn’t define. The payload is everything after the 4-octet header, so it starts with a VMAC in every message (Table U-1 gives the whole lengths).

  • Virtual-Address-Resolution: the source VMAC, 3 octets (U.2.7.1).
  • BVLC-Result and Register-Foreign-Device: the source VMAC and a result code or time-to-live, 5 octets (U.2.1.1, U.2.10.1).
  • Address-Resolution and the two ACKs: two VMACs, 6 octets (U.2.4.1, U.2.6.1, U.2.8.1).
  • Delete-Foreign-Device-Table-Entry: the source VMAC and the entry’s B/IPv6 address, 21 octets (U.2.11.1).
  • Forwarded-Address-Resolution: two VMACs and the originator’s address, 24 octets (U.2.5.1).
  • Original-Broadcast-NPDU and Distribute-Broadcast-To-Network: a VMAC, then the NPDU (U.2.3.1, U.2.13.1).
  • Original-Unicast-NPDU: two VMACs, then the NPDU (U.2.2.1).
  • Forwarded-NPDU: the originator’s VMAC and address, then the NPDU (U.2.9.1).
use bacnet_bip_codec::ipv6::Bvlc6Function;
use bacnet_bip_codec::PayloadShape;

assert_eq!(
    Bvlc6Function::FORWARDED_NPDU.payload_shape(),
    Some(PayloadShape::Npdu { prefix: 21 }),
);
assert_eq!(Bvlc6Function::from_raw(0x0B).payload_shape(), None);
Source

pub const fn nak(self) -> Option<Bvlc6ResultCode>

The NAK named after this function in Annex U.2.1.1, for the five requests that have one: both address resolutions, foreign-device registration, FDT entry deletion and broadcast distribution. None for every other code.

Annex U says when to send four of them. A device that is not a BBMD answers the last three with their NAKs (U.4.4, U.4.5.3, U.4.5.4), and so does a BBMD that can’t carry them out. A BBMD answers an Address-Resolution sent to it with its NAK when the sender is not a registered foreign device, or when the BBMD can’t pass the request on (U.4.4); a broadcast distribution from a node that isn’t a registered foreign device gets its NAK the same way. A Forwarded-Address-Resolution is never answered with a BVLC-Result.

Trait Implementations§

Source§

impl Clone for Bvlc6Function

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 Copy for Bvlc6Function

Source§

impl Debug for Bvlc6Function

Name::CONSTANT for a named value, Name(raw) otherwise.

Source§

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

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

impl Display for Bvlc6Function

The constant’s name, or the raw value in decimal.

Source§

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

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

impl Eq for Bvlc6Function

Source§

impl Hash for Bvlc6Function

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Bvlc6Function

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 Bvlc6Function

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.