pub struct SocketFile {
handle: SpinLock<SocketHandle>,
local_endpoint: SpinLock<Option<IpEndpoint>>,
remote_endpoint: SpinLock<Option<IpEndpoint>>,
shutdown_rd: SpinLock<bool>,
shutdown_wr: SpinLock<bool>,
flags: SpinLock<OpenFlags>,
options: SpinLock<SocketOptions>,
}Fields§
§handle: SpinLock<SocketHandle>§local_endpoint: SpinLock<Option<IpEndpoint>>§remote_endpoint: SpinLock<Option<IpEndpoint>>§shutdown_rd: SpinLock<bool>§shutdown_wr: SpinLock<bool>§flags: SpinLock<OpenFlags>§options: SpinLock<SocketOptions>Implementations§
Source§impl SocketFile
impl SocketFile
pub fn new(handle: SocketHandle) -> Self
pub fn new_with_flags(handle: SocketHandle, flags: OpenFlags) -> Self
pub fn get_socket_options(&self) -> SocketOptions
pub fn set_socket_options(&self, opts: SocketOptions)
pub fn handle(&self) -> SocketHandle
pub fn set_handle(&self, new_handle: SocketHandle)
pub fn set_local_endpoint(&self, endpoint: IpEndpoint)
pub fn get_local_endpoint(&self) -> Option<IpEndpoint>
pub fn set_remote_endpoint(&self, endpoint: IpEndpoint)
pub fn get_remote_endpoint(&self) -> Option<IpEndpoint>
pub fn shutdown_read(&self)
pub fn shutdown_write(&self)
pub fn is_shutdown_read(&self) -> bool
pub fn is_shutdown_write(&self) -> bool
Trait Implementations§
Source§impl Drop for SocketFile
impl Drop for SocketFile
Source§impl File for SocketFile
impl File for SocketFile
Source§fn metadata(&self) -> Result<InodeMetadata, FsError>
fn metadata(&self) -> Result<InodeMetadata, FsError>
获取文件元数据
Source§fn set_status_flags(&self, new_flags: OpenFlags) -> Result<(), FsError>
fn set_status_flags(&self, new_flags: OpenFlags) -> Result<(), FsError>
设置文件状态标志(可选方法,用于 F_SETFL) Read more
Source§fn recvfrom(&self, buf: &mut [u8]) -> Result<(usize, Option<Vec<u8>>), FsError>
fn recvfrom(&self, buf: &mut [u8]) -> Result<(usize, Option<Vec<u8>>), FsError>
从socket接收数据并获取源地址(可选方法,用于recvfrom) Read more
Source§fn lseek(&self, _offset: isize, _whence: SeekWhence) -> Result<usize, FsError>
fn lseek(&self, _offset: isize, _whence: SeekWhence) -> Result<usize, FsError>
设置文件偏移量(可选方法) Read more
Source§fn get_pipe_size(&self) -> Result<usize, FsError>
fn get_pipe_size(&self) -> Result<usize, FsError>
获取管道大小(可选方法,用于 F_GETPIPE_SZ) Read more
Source§fn set_pipe_size(&self, _size: usize) -> Result<(), FsError>
fn set_pipe_size(&self, _size: usize) -> Result<(), FsError>
设置管道大小(可选方法,用于 F_SETPIPE_SZ) Read more
Source§fn set_owner(&self, _pid: i32) -> Result<(), FsError>
fn set_owner(&self, _pid: i32) -> Result<(), FsError>
设置异步 I/O 所有者(可选方法,用于 F_SETOWN) Read more
Source§fn read_at(&self, _offset: usize, _buf: &mut [u8]) -> Result<usize, FsError>
fn read_at(&self, _offset: usize, _buf: &mut [u8]) -> Result<usize, FsError>
从指定位置读取数据(可选方法,用于 pread64/preadv) Read more