linux_io/socket/ip/
tcp.rs

1/// Device type marker for [`crate::File`] instances that represent TCP sockets.
2#[derive(Clone, Copy)]
3pub struct TcpSocketDevice;
4
5impl crate::fd::ioctl::IoDevice for TcpSocketDevice {}
6unsafe impl crate::fd::ioctl::SubDevice<super::Ipv4SocketDevice> for TcpSocketDevice {}
7unsafe impl crate::fd::ioctl::SubDevice<super::Ipv6SocketDevice> for TcpSocketDevice {}
8unsafe impl crate::fd::ioctl::SubDevice<super::super::SocketDevice> for TcpSocketDevice {}
9
10use crate::fd::ioctl::{ioctl_read, IoctlReqRead};
11use linux_unsafe::int;
12
13/// Returns the amount of queued unread data in the receive buffer.
14///
15/// The socket must not be in listen state, otherwise an error (`EINVAL`) is
16/// returned.
17pub const SIOCINQ: IoctlReqRead<TcpSocketDevice, int> = unsafe { ioctl_read(0x541B) };
18
19/// Returns true (i.e., value is nonzero) if the inbound data stream is at the
20/// urgent mark.
21pub const SIOCATMARK: IoctlReqRead<TcpSocketDevice, int> = unsafe { ioctl_read(0x8905) };
22
23/// Returns the amount of unsent data in the socket send queue.
24///
25/// The socket must not be in listen state, otherwise an error (`EINVAL`) is
26/// returned.
27pub const SIOCOUTQ: IoctlReqRead<TcpSocketDevice, int> = unsafe { ioctl_read(0x5411) };