pub struct ZxioBackedSocket { /* private fields */ }Expand description
A socket backed by an underlying Zircon I/O object.
Implementations§
Source§impl ZxioBackedSocket
impl ZxioBackedSocket
pub fn new( locked: &mut Locked<FileOpsCore>, current_task: &CurrentTask, domain: SocketDomain, socket_type: SocketType, protocol: SocketProtocol, ) -> Result<ZxioBackedSocket, Errno>
pub fn new_with_zxio(current_task: &CurrentTask, zxio: Zxio) -> ZxioBackedSocket
Trait Implementations§
Source§impl SocketOps for ZxioBackedSocket
impl SocketOps for ZxioBackedSocket
Source§fn get_socket_info(
&self,
) -> Result<(SocketDomain, SocketType, SocketProtocol), Errno>
fn get_socket_info( &self, ) -> Result<(SocketDomain, SocketType, SocketProtocol), Errno>
Returns the domain, type and protocol of the socket. This is only used for socket that are
build without previous knowledge of this information, and can be ignored if all sockets are
build with it.
Source§fn connect(
&self,
locked: &mut Locked<FileOpsCore>,
socket: &SocketHandle,
current_task: &CurrentTask,
peer: SocketPeer,
) -> Result<(), Errno>
fn connect( &self, locked: &mut Locked<FileOpsCore>, socket: &SocketHandle, current_task: &CurrentTask, peer: SocketPeer, ) -> Result<(), Errno>
Connect the
socket to the listening peer. On success
a new socket is created and added to the accept queue.Source§fn listen(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
backlog: i32,
_credentials: ucred,
) -> Result<(), Errno>
fn listen( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, backlog: i32, _credentials: ucred, ) -> Result<(), Errno>
Start listening at the bound address for
connect calls.Source§fn accept(
&self,
_locked: &mut Locked<FileOpsCore>,
socket: &Socket,
current_task: &CurrentTask,
) -> Result<SocketHandle, Errno>
fn accept( &self, _locked: &mut Locked<FileOpsCore>, socket: &Socket, current_task: &CurrentTask, ) -> Result<SocketHandle, Errno>
Returns the eariest socket on the accept queue of this
listening socket. Returns EAGAIN if the queue is empty.
Source§fn bind(
&self,
locked: &mut Locked<FileOpsCore>,
socket: &Socket,
current_task: &CurrentTask,
socket_address: SocketAddress,
) -> Result<(), Errno>
fn bind( &self, locked: &mut Locked<FileOpsCore>, socket: &Socket, current_task: &CurrentTask, socket_address: SocketAddress, ) -> Result<(), Errno>
Binds this socket to a
socket_address. Read moreSource§fn read(
&self,
locked: &mut Locked<FileOpsCore>,
socket: &Socket,
current_task: &CurrentTask,
data: &mut dyn OutputBuffer,
flags: SocketMessageFlags,
) -> Result<MessageReadInfo, Errno>
fn read( &self, locked: &mut Locked<FileOpsCore>, socket: &Socket, current_task: &CurrentTask, data: &mut dyn OutputBuffer, flags: SocketMessageFlags, ) -> Result<MessageReadInfo, Errno>
Reads the specified number of bytes from the socket, if possible. Read more
Source§fn write(
&self,
locked: &mut Locked<FileOpsCore>,
socket: &Socket,
current_task: &CurrentTask,
data: &mut dyn InputBuffer,
dest_address: &mut Option<SocketAddress>,
ancillary_data: &mut Vec<AncillaryData>,
) -> Result<usize, Errno>
fn write( &self, locked: &mut Locked<FileOpsCore>, socket: &Socket, current_task: &CurrentTask, data: &mut dyn InputBuffer, dest_address: &mut Option<SocketAddress>, ancillary_data: &mut Vec<AncillaryData>, ) -> Result<usize, Errno>
Writes the data in the provided user buffers to this socket. Read more
Source§fn wait_async(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
_current_task: &CurrentTask,
waiter: &Waiter,
events: FdEvents,
handler: EventHandler,
) -> WaitCanceler
fn wait_async( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, _current_task: &CurrentTask, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> WaitCanceler
Queues an asynchronous wait for the specified
events
on the waiter. Note that no wait occurs until a
wait functions is called on the waiter. Read moreSource§fn query_events(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
_current_task: &CurrentTask,
) -> Result<FdEvents, Errno>
fn query_events( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, _current_task: &CurrentTask, ) -> Result<FdEvents, Errno>
Return the events that are currently active on the
socket.Source§fn shutdown(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
how: SocketShutdownFlags,
) -> Result<(), Errno>
fn shutdown( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, how: SocketShutdownFlags, ) -> Result<(), Errno>
Shuts down this socket according to how, preventing any future reads and/or writes. Read more
Source§fn close(
&self,
locked: &mut Locked<FileOpsCore>,
current_task: &CurrentTask,
socket: &Socket,
)
fn close( &self, locked: &mut Locked<FileOpsCore>, current_task: &CurrentTask, socket: &Socket, )
Close this socket. Read more
Source§fn getsockname(
&self,
_locked: &mut Locked<FileOpsCore>,
socket: &Socket,
) -> Result<SocketAddress, Errno>
fn getsockname( &self, _locked: &mut Locked<FileOpsCore>, socket: &Socket, ) -> Result<SocketAddress, Errno>
Returns the name of this socket. Read more
Source§fn getpeername(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
) -> Result<SocketAddress, Errno>
fn getpeername( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, ) -> Result<SocketAddress, Errno>
Returns the name of the peer of this socket, if such a peer exists. Read more
Source§fn setsockopt(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
current_task: &CurrentTask,
level: u32,
optname: u32,
optval: SockOptValue,
) -> Result<(), Errno>
fn setsockopt( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, current_task: &CurrentTask, level: u32, optname: u32, optval: SockOptValue, ) -> Result<(), Errno>
Sets socket-specific options.
Source§fn getsockopt(
&self,
_locked: &mut Locked<FileOpsCore>,
_socket: &Socket,
_current_task: &CurrentTask,
level: u32,
optname: u32,
optlen: u32,
) -> Result<Vec<u8>, Errno>
fn getsockopt( &self, _locked: &mut Locked<FileOpsCore>, _socket: &Socket, _current_task: &CurrentTask, level: u32, optname: u32, optlen: u32, ) -> Result<Vec<u8>, Errno>
Retrieves socket-specific options.
Source§fn to_handle(
&self,
_socket: &Socket,
_current_task: &CurrentTask,
) -> Result<Option<NullableHandle>, Errno>
fn to_handle( &self, _socket: &Socket, _current_task: &CurrentTask, ) -> Result<Option<NullableHandle>, Errno>
Return a handle that allows access to this file descritor through the zxio protocols. Read more
Source§fn ioctl(
&self,
locked: &mut Locked<Unlocked>,
_socket: &Socket,
file: &FileObject,
current_task: &CurrentTask,
request: u32,
arg: SyscallArg,
) -> Result<SyscallResult, Errno>
fn ioctl( &self, locked: &mut Locked<Unlocked>, _socket: &Socket, file: &FileObject, current_task: &CurrentTask, request: u32, arg: SyscallArg, ) -> Result<SyscallResult, Errno>
Implements ioctl.
Auto Trait Implementations§
impl !Freeze for ZxioBackedSocket
impl !RefUnwindSafe for ZxioBackedSocket
impl Send for ZxioBackedSocket
impl Sync for ZxioBackedSocket
impl Unpin for ZxioBackedSocket
impl !UnwindSafe for ZxioBackedSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.