Skip to main content

UnixSocketFileDescription

Trait UnixSocketFileDescription 

Source
pub trait UnixSocketFileDescription: UnixFileDescription {
Show 17 methods // Provided methods fn bind<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _address: SocketAddr, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>> { ... } fn listen<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _backlog: i32, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>> { ... } fn accept<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _is_client_sock_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<(i32, SocketAddr), IoError>>, ) -> InterpResult<'tcx> { ... } fn connect<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _address: SocketAddr, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<(), IoError>>, ) -> InterpResult<'tcx> { ... } fn recv<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ptr: Pointer, _len: usize, _is_peek: bool, _is_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<usize, IoError>>, ) -> InterpResult<'tcx> { ... } fn send<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ptr: Pointer, _len: usize, _is_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<usize, IoError>>, ) -> InterpResult<'tcx> { ... } fn setsockopt<'tcx>( self: FileDescriptionRef<Self>, _level: i32, _option: i32, _value_ptr: Pointer, _value_len: u64, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>> { ... } fn getsockopt<'tcx>( self: FileDescriptionRef<Self>, _level: i32, _option: i32, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<MPlaceTy<'tcx>, IoError>> { ... } fn getsockname<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<SocketAddr, IoError>> { ... } fn getpeername<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<SocketAddr, IoError>>, ) -> InterpResult<'tcx> { ... } fn shutdown<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _how: Shutdown, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>> { ... } fn set_read_timeout<'tcx>( self: FileDescriptionRef<Self>, _timeout: Option<Duration>, ) -> InterpResult<'tcx> { ... } fn get_read_timeout<'tcx>( self: FileDescriptionRef<Self>, ) -> InterpResult<'tcx, Option<Duration>> { ... } fn set_write_timeout<'tcx>( self: FileDescriptionRef<Self>, _timeout: Option<Duration>, ) -> InterpResult<'tcx> { ... } fn get_write_timeout<'tcx>( self: FileDescriptionRef<Self>, ) -> InterpResult<'tcx, Option<Duration>> { ... } fn take_error<'tcx>( self: FileDescriptionRef<Self>, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Option<Error>> { ... } fn with_socket_ref<T>( &self, _cb: impl FnOnce(SockRef<'_>) -> T, ) -> Result<T, ()> where Self: Sized { ... }
}
Expand description

Represents unix-specific socket file descriptions.

Not to be confused with Unix domain sockets.

Provided Methods§

Source

fn bind<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _address: SocketAddr, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>>

Bind the socket to address.

Source

fn listen<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _backlog: i32, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>>

Start listening on the socket. backlog specifies how many pending incoming connections can exist at the same time before new requests are rejected.

Source

fn accept<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _is_client_sock_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<(i32, SocketAddr), IoError>>, ) -> InterpResult<'tcx>

Accept an incoming connection on the socket. is_client_sock_non_block specifies whether the newly accepted client connection should be non-blocking. After a successful accept, finish should be called with a tuple containing the file descriptor of the peer socket and it’s address.

Source

fn connect<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _address: SocketAddr, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<(), IoError>>, ) -> InterpResult<'tcx>

Connect the socket to address.

Source

fn recv<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ptr: Pointer, _len: usize, _is_peek: bool, _is_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<usize, IoError>>, ) -> InterpResult<'tcx>

Receive data on the socket into the given buffer ptr. len indicates how many bytes we should try to receive. is_peek specifies whether the receive removes the bytes from the receive buffer (false) or leaves them in the receive buffer (true). is_non_block specifies whether the receive operation is non-blocking. After a successful receive, finish should be called with the amount of bytes received.

Source

fn send<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ptr: Pointer, _len: usize, _is_non_block: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<usize, IoError>>, ) -> InterpResult<'tcx>

Send data from the given buffer ptr into the socket. len indicates how many bytes we should try to send. is_non_block specifies whether the send operation is non-blocking. After a successful send, finish should be called with the amount of bytes sent.

Source

fn setsockopt<'tcx>( self: FileDescriptionRef<Self>, _level: i32, _option: i32, _value_ptr: Pointer, _value_len: u64, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>>

Set the socket option option on level. value_ptr points to the new value of the socket option, and value_len contains the amount of bytes the value uses at value_ptr.

Source

fn getsockopt<'tcx>( self: FileDescriptionRef<Self>, _level: i32, _option: i32, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<MPlaceTy<'tcx>, IoError>>

Get the value of a socket option option on level.

Source

fn getsockname<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<SocketAddr, IoError>>

Get the local address of the socket.

Source

fn getpeername<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ecx: &mut MiriInterpCx<'tcx>, _finish: DynMachineCallback<'tcx, Result<SocketAddr, IoError>>, ) -> InterpResult<'tcx>

Get the remote address of the socket.

Source

fn shutdown<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _how: Shutdown, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<(), IoError>>

Shut down the read and/or the write end of the socket.

Source

fn set_read_timeout<'tcx>( self: FileDescriptionRef<Self>, _timeout: Option<Duration>, ) -> InterpResult<'tcx>

Set the read timeout for the socket. If timeout is None, then read operations should block indefinitely. Otherwise, read operations should block until timeout is expired.

Source

fn get_read_timeout<'tcx>( self: FileDescriptionRef<Self>, ) -> InterpResult<'tcx, Option<Duration>>

Get the read timeout for the socket.

Source

fn set_write_timeout<'tcx>( self: FileDescriptionRef<Self>, _timeout: Option<Duration>, ) -> InterpResult<'tcx>

Set the write timeout for the socket. If timeout is None, then write operations should block indefinitely. Otherwise, write operations should block until timeout is expired.

Source

fn get_write_timeout<'tcx>( self: FileDescriptionRef<Self>, ) -> InterpResult<'tcx, Option<Duration>>

Get the write timeout for the socket.

Source

fn take_error<'tcx>( self: FileDescriptionRef<Self>, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Option<Error>>

Get the stored I/O error of the socket, if any exists. This method should consume the stored error.

Source

fn with_socket_ref<T>( &self, _cb: impl FnOnce(SockRef<'_>) -> T, ) -> Result<T, ()>
where Self: Sized,

If the shimmed socket contains an underlying host socket, the cb callback function is invoked with a [socket2::SockRef] to the underlying host socket and Ok with the return value of the callback is returned. Otherwise, when the shimmed socket is not backed by a host socket, Err is returned.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§