frameassembly 1.2.2

Declarative Rust DSL and compiler to generate deterministic .pcap/.pcapng packet captures across 81 L2-L7 protocols for Wireshark, IDS & CI testing.
Documentation
//! Bidirectional Forwarding Detection (BFD, RFC 5880 / RFC 5881 / RFC 5883) AST definitions.
//!
//! Defines the low-overhead, short-duration forwarding plane fault detection control packet specified
//! in RFC 5880 and encapsulated over UDP destination port `3784` (single-hop, RFC 5881) or `4784`
//! (multihop, RFC 5883). The mandatory 24-byte BFD Control header packs a 3-bit Version (`1`), a 5-bit
//! Diagnostic code (`DIAG`, `0..=31`), a 2-bit Session State (`STATE`: `0` AdminDown, `1` Down, `2` Init,
//! `3` Up), control flags, an 8-bit Detection Time Multiplier (`MULT`, default `3`), an 8-bit Length (`24`),
//! 32-bit `My Discriminator` (`MY_DISC`) and `Your Discriminator` (`YOUR_DISC`) identifiers, and 32-bit
//! microsecond timer intervals (`MIN_TX`, `MIN_RX`, and Required Min Echo RX Interval).
//!
//! Canonical `.fasm` syntax:
//! `a -> b BFD [STATE <0..3>] [DIAG <0..31>] [MY_DISC <u32>] [YOUR_DISC <u32>] [MIN_TX <u32>] [MIN_RX <u32>] [MULT <u8>]`

use core::marker::PhantomData;

/// Bidirectional Forwarding Detection (RFC 5880) control packet specification over UDP port `3784`.
///
/// Syntax mapping: `BFD [STATE <0..3>] [DIAG <0..31>] [MY_DISC <u32>] [YOUR_DISC <u32>] [MIN_TX <u32>] [MIN_RX <u32>] [MULT <u8>]`
#[doc(alias = "BFD")]
#[doc(alias = "RFC 5880")]
#[doc(alias = "RFC5880")]
#[doc(alias = "RFC5881")]
#[doc(alias = "3784")]
#[doc(alias = "STATE")]
#[doc(alias = "DIAG")]
#[doc(alias = "MY_DISC")]
#[doc(alias = "YOUR_DISC")]
#[doc(alias = "MIN_TX")]
#[doc(alias = "MIN_RX")]
#[doc(alias = "MULT")]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct BfdSpec<'a> {
    /// 2-bit BFD Session State (`STATE <0..=3>`: `0` AdminDown, `1` Down, `2` Init, `3` Up; default `3`).
    pub state: Option<u8>,
    /// 5-bit Diagnostic code indicating the reason for the last state transition (`DIAG <0..=31>`, default `0`).
    pub diag: Option<u8>,
    /// 32-bit unique session discriminator generated by the transmitting system (`MY_DISC <u32>`, default `1`).
    pub my_disc: Option<u32>,
    /// 32-bit session discriminator received from the remote peer (`YOUR_DISC <u32>`, default `0`).
    pub your_disc: Option<u32>,
    /// Desired Minimum TX Interval in microseconds (`MIN_TX <u32>`, default `1_000_000`).
    pub min_tx: Option<u32>,
    /// Required Minimum RX Interval in microseconds (`MIN_RX <u32>`, default `1_000_000`).
    pub min_rx: Option<u32>,
    /// 8-bit Detection Time Multiplier (`MULT <u8>`, default `3`).
    pub mult: Option<u8>,
    /// Optional lifetime phantom marker for AST uniformity.
    pub _marker: PhantomData<&'a ()>,
}