s2n_quic_core/inet/
datagram.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::{
5    connection, inet::ExplicitCongestionNotification, path::LocalAddress, time::Timestamp,
6};
7
8/// Header information for a datagram sent/received over the network
9#[derive(Clone, Copy, Debug, PartialEq)]
10pub struct Header<Path> {
11    pub path: Path,
12    pub ecn: ExplicitCongestionNotification,
13}
14
15/// Metadata for a datagram sent/received over the network
16#[derive(Clone, Copy, Debug, PartialEq)]
17pub struct DatagramInfo {
18    pub timestamp: Timestamp,
19    pub payload_len: usize,
20    pub ecn: ExplicitCongestionNotification,
21    pub destination_connection_id: connection::LocalId,
22    pub destination_connection_id_classification: connection::id::Classification,
23    pub source_connection_id: Option<connection::PeerId>,
24}
25
26/// Additional metadata for a datagram sent/received over the network
27#[derive(Clone, Copy, Debug, Default, PartialEq)]
28#[cfg_attr(kani, derive(kani::Arbitrary))]
29pub struct AncillaryData {
30    pub ecn: ExplicitCongestionNotification,
31    pub local_address: LocalAddress,
32    /// The network interface the datagram is sent/received on
33    ///
34    /// Correctly threading this value through to connections ensures packets end up on the same
35    /// network interfaces and thereby have consistent MAC addresses.
36    pub local_interface: Option<u32>,
37    /// Set when the packet buffer is an aggregate of multiple received packets
38    pub segment_size: u16,
39}