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<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
domain: SocketDomain,
socket_type: SocketType,
protocol: SocketProtocol,
kernel_private: bool,
) -> Result<SocketHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn new<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
domain: SocketDomain,
socket_type: SocketType,
protocol: SocketProtocol,
kernel_private: bool,
) -> Result<SocketHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
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<L>(
&self,
locked: &mut Locked<L>,
) -> Result<SocketAddress, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn getpeername<L>(
&self,
locked: &mut Locked<L>,
) -> Result<SocketAddress, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn setsockopt<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
level: u32,
optname: u32,
optval: SockOptValue,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn getsockopt<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
level: u32,
optname: u32,
optlen: u32,
) -> Result<Vec<u8>, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn receive_timeout(&self) -> Option<MonotonicDuration>
pub fn send_timeout(&self) -> Option<MonotonicDuration>
pub fn ioctl( &self, locked: &mut Locked<Unlocked>, file: &FileObject, current_task: &CurrentTask, request: u32, arg: SyscallArg, ) -> Result<SyscallResult, Errno>
pub fn bind<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
socket_address: SocketAddress,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn listen<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
backlog: i32,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn accept<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
) -> Result<SocketHandle, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn read<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
data: &mut dyn OutputBuffer,
flags: SocketMessageFlags,
) -> Result<MessageReadInfo, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn write<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
data: &mut dyn InputBuffer,
dest_address: &mut Option<SocketAddress>,
ancillary_data: &mut Vec<AncillaryData>,
) -> Result<usize, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn wait_async<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
waiter: &Waiter,
events: FdEvents,
handler: EventHandler,
) -> WaitCancelerwhere
L: LockEqualOrBefore<FileOpsCore>,
pub fn query_events<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
) -> Result<FdEvents, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn shutdown<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
how: SocketShutdownFlags,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn close<L>(&self, locked: &mut Locked<L>, current_task: &CurrentTask)where
L: LockEqualOrBefore<FileOpsCore>,
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 Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl !UnwindSafe 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<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.