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
// Copyright (c) 2026 Erik Lening (hollowpointer) and Contributors
//
// This file is part of Zond Engine, licensed under the GNU Affero General
// Public License, version 3 or later. See the LICENSE file for details, or
// <https://www.gnu.org/licenses/agpl-3.0.html>.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
//! # Ethernet framing
//!
//! The outermost header on everything the link-layer paths send, and the first
//! thing read off everything they capture.
//!
//! Fourteen bytes with no options and no VLAN tag, which is why building one
//! cannot fail: the buffer is exactly the header written into it. Reading one
//! can, because the bytes come off the wire.
use MacAddr;
use ;
use cratecraft;
use crate;
use crateETH_HDR_LEN;
/// Builds the Ethernet header carrying `et` from `src_mac` to `dst_mac`.
/// Reads `frame_bytes` as an Ethernet frame.
///
/// # Errors
///
/// [`PacketError::Truncated`] when there are too few bytes for a header, which
/// is what a cut-short capture looks like from here.