1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! RFC 3032 / RFC 5462 Multi-Protocol Label Switching (MPLS) wire frame builder.
//!
//! Synthesizes standalone MPLS unicast frames over Ethernet II (`EtherType = 0x8847`). Encodes
//! the 32-bit MPLS label stack entry in big-endian network byte order per RFC 3032 ยง2.1: a
//! 20-bit Label value (`(label & 0xFFFFF) << 12`), a 3-bit Traffic Class / Experimental field
//! (`(exp & 0x07) << 9`), a 1-bit Bottom-of-Stack flag (`(bos & 0x01) << 8`), and an 8-bit
//! Time-to-Live (`ttl`), followed by the encapsulated MPLS payload bytes.
//!
//! Canonical `.fasm` syntax:
//! `a -> b MPLS <label> [EXP <0..7>] [BOS <0|1>] [MPLS_TTL <u8>] [PAYLOAD "<str>" | HEXPAYLOAD "<hex>"]`
use crate*;
use crateWireContext;
use crateCompilerError;
use cratebuild_ethernet_and_l2;
use Vec;
/// Builds an RFC 3032 MPLS wire frame.
///
/// # Errors
/// Returns `CompilerError::BackendError` if construction fails.