2024-01-03 03:22:36 +00:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2024-01-09 15:14:45 +00:00
|
|
|
use crate::net::iface::{IpAddress, IpEndpoint, Ipv4Address};
|
|
|
|
|
|
2023-05-31 02:48:16 +00:00
|
|
|
mod common;
|
|
|
|
|
mod datagram;
|
2023-12-28 09:24:23 +00:00
|
|
|
pub mod stream;
|
2023-05-31 02:48:16 +00:00
|
|
|
|
|
|
|
|
pub use datagram::DatagramSocket;
|
|
|
|
|
pub use stream::StreamSocket;
|
2024-01-09 15:14:45 +00:00
|
|
|
|
|
|
|
|
/// A local endpoint, which indicates that the local endpoint is unspecified.
|
|
|
|
|
///
|
|
|
|
|
/// According to the Linux man pages and the Linux implementation, `getsockname()` will _not_ fail
|
|
|
|
|
/// even if the socket is unbound. Instead, it will return an unspecified socket address. This
|
|
|
|
|
/// unspecified endpoint helps with that.
|
|
|
|
|
const UNSPECIFIED_LOCAL_ENDPOINT: IpEndpoint =
|
|
|
|
|
IpEndpoint::new(IpAddress::Ipv4(Ipv4Address::UNSPECIFIED), 0);
|