pub struct Socket {
pub domain: SocketDomain,
pub socket_type: SocketType,
pub protocol: SocketProtocol,
pub security: SocketState,
/* private fields */
}Expand description
A Socket represents one endpoint of a bidirectional communication channel.
Fields§
§domain: SocketDomainThe domain of this socket.
socket_type: SocketTypeThe type of this socket.
protocol: SocketProtocolThe protocol of this socket.
security: SocketStateSecurity module state associated with this socket. Note that the socket’s security label is
applied to the associated fs_node.
Implementations§
Source§impl Socket
impl Socket
Sourcepub fn new(
current_task: &CurrentTask,
domain: SocketDomain,
socket_type: SocketType,
protocol: SocketProtocol,
kernel_private: bool,
) -> Result<SocketHandle, Errno>
pub fn new( current_task: &CurrentTask, domain: SocketDomain, socket_type: SocketType, protocol: SocketProtocol, kernel_private: bool, ) -> Result<SocketHandle, Errno>
pub fn new_with_ops(ops: Box<dyn SocketOps>) -> Result<SocketHandle, Errno>
pub fn new_with_ops_and_info( ops: Box<dyn SocketOps>, domain: SocketDomain, socket_type: SocketType, protocol: SocketProtocol, ) -> SocketHandle
Sourcepub fn get_from_file(file: &FileHandle) -> Result<&SocketHandle, Errno>
pub fn get_from_file(file: &FileHandle) -> Result<&SocketHandle, Errno>
Returns the Socket that this FileHandle refers to. If this file is not a socket file, returns ENOTSOCK.
pub fn downcast_socket<T>(&self) -> Option<&T>where
T: 'static,
pub fn getsockname(&self) -> Result<SocketAddress, Errno>
pub fn getpeername(&self) -> Result<SocketAddress, Errno>
pub fn setsockopt( &self, current_task: &CurrentTask, level: u32, optname: u32, optval: SockOptValue, ) -> Result<(), Errno>
pub fn getsockopt( &self, current_task: &CurrentTask, level: u32, optname: u32, optlen: u32, ) -> Result<Vec<u8>, Errno>
pub fn receive_timeout(&self) -> Option<MonotonicDuration>
pub fn send_timeout(&self) -> Option<MonotonicDuration>
pub fn ioctl( &self, file: &FileObject, current_task: &CurrentTask, request: u32, arg: SyscallArg, ) -> Result<SyscallResult, Errno>
pub fn bind( &self, current_task: &CurrentTask, socket_address: SocketAddress, ) -> Result<(), Errno>
pub fn listen( &self, current_task: &CurrentTask, backlog: i32, ) -> Result<(), Errno>
pub fn accept(&self, current_task: &CurrentTask) -> Result<SocketHandle, Errno>
pub fn read( &self, current_task: &CurrentTask, data: &mut dyn OutputBuffer, flags: SocketMessageFlags, ) -> Result<MessageReadInfo, Errno>
pub fn write( &self, current_task: &CurrentTask, data: &mut dyn InputBuffer, dest_address: &mut Option<SocketAddress>, ancillary_data: &mut Vec<AncillaryData>, ) -> Result<usize, Errno>
pub fn wait_async( &self, current_task: &CurrentTask, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> WaitCanceler
pub fn query_events( &self, current_task: &CurrentTask, ) -> Result<FdEvents, Errno>
pub fn shutdown( &self, current_task: &CurrentTask, how: SocketShutdownFlags, ) -> Result<(), Errno>
pub fn close(&self, current_task: &CurrentTask)
pub fn to_handle( &self, _file: &FileObject, current_task: &CurrentTask, ) -> Result<Option<NullableHandle>, Errno>
Sourcepub fn fs_node(&self) -> Option<FsNodeHandle>
pub fn fs_node(&self) -> Option<FsNodeHandle>
Returns the crate::vfs::FsNode unique to this Socket.
Auto Trait Implementations§
impl !Freeze for Socket
impl !RefUnwindSafe for Socket
impl !UnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnsafeUnpin for Socket
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<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§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 more