Skip to main content

netstack3_tcp/
lib.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! Netstack3 core TCP.
6//!
7//! This crate contains the TCP implementation for netstack3.
8
9#![no_std]
10#![warn(
11    missing_docs,
12    unreachable_patterns,
13    clippy::useless_conversion,
14    clippy::redundant_clone,
15    clippy::precedence
16)]
17
18extern crate alloc;
19
20#[path = "."]
21mod internal {
22    pub(super) mod base;
23    pub(super) mod buffer;
24    pub(super) mod congestion;
25    pub(super) mod counters;
26    pub(super) mod rtt;
27    pub(super) mod sack_scoreboard;
28    pub(super) mod seq_ranges;
29    pub(super) mod settings;
30    pub(super) mod socket;
31    pub(super) mod state;
32    #[cfg(test)]
33    pub(super) mod testutil;
34    mod timestamp;
35    pub(super) mod uninstantiable;
36}
37
38pub use internal::base::{
39    BufferSizes, ConnectionError, DEFAULT_FIN_WAIT2_TIMEOUT, SocketOptions, TcpSocketTxMetadata,
40    TcpState,
41};
42pub use internal::buffer::{Buffer, BufferLimits, IntoBuffers, ReceiveBuffer, SendBuffer};
43pub use internal::counters::{
44    CombinedTcpCounters, TcpCountersWithSocket, TcpCountersWithoutSocket,
45};
46pub use internal::settings::TcpSettings;
47pub use internal::socket::accept_queue::ListenerNotifier;
48pub use internal::socket::demux::DualStackTcpSocketId;
49pub use internal::socket::diagnostics::{
50    TcpSocketDiagnosticTuple, TcpSocketDiagnostics, TcpSocketDiagnosticsSeed,
51};
52pub use internal::socket::generators::{IsnGenerator, TimestampOffsetGenerator};
53pub use internal::socket::{
54    AcceptError, BindError, BoundInfo, ConnectError, ConnectionInfo, DemuxState,
55    DualStackDemuxIdConverter, DualStackIpExt, Ipv6Options, Ipv6SocketIdToIpv4DemuxIdConverter,
56    ListenError, NoConnection, OriginalDestinationError, SetDeviceError, SetReuseAddrError,
57    SocketAddr, SocketInfo, Sockets, TcpApi, TcpBindingsContext, TcpBindingsTypes, TcpContext,
58    TcpDemuxContext, TcpDualStackContext, TcpIpTransportContext, TcpSocketDestructionContext,
59    TcpSocketId, TcpSocketSet, TcpSocketState, TcpTimerId, UnboundInfo, WeakTcpSocketId,
60};
61pub use internal::state::info::{CongestionControlState, TcpSocketInfo};
62
63/// TCP test utilities.
64#[cfg(any(test, feature = "testutils"))]
65pub mod testutil {
66    pub use crate::internal::buffer::testutil::{
67        ClientBuffers, InfiniteSendBuffer, ProvidedBuffers, RepeatingSendBuffer, RingBuffer,
68        TestSendBuffer, WriteBackClientBuffers,
69    };
70}