Skip to main content

UnixSocketFileDescription

Trait UnixSocketFileDescription 

Source
pub trait UnixSocketFileDescription: UnixFileDescription {
    // 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>> { ... }
}
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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§