#[repr(C)]pub struct IpcHandshake {
pub magic: u32,
pub protocol_version: u16,
pub _reserved: u16,
pub client_abi_major: u16,
pub client_abi_minor: u16,
pub nonce: u32,
pub flags: u32,
}Expand description
First message a client sends after ipc_connect to negotiate protocol.
Wire size: 20 bytes.
§Fields
magic: must beIPC_HANDSHAKE_MAGIC(0x4950_4339)protocol_version: client’s IPC protocol versionclient_abi_major/minor: client’s ABI versionnonce: random value for connection identification (optional)flags: reserved for future use (must be 0)
Fields§
§magic: u32Magic number ("IPC9").
protocol_version: u16IPC protocol version.
_reserved: u16§client_abi_major: u16Client ABI major version.
client_abi_minor: u16Client ABI minor version.
nonce: u32Random nonce for connection identification.
flags: u32Reserved flags (must be 0).
Implementations§
Source§impl IpcHandshake
impl IpcHandshake
Sourcepub const fn new_with_nonce(nonce: u32) -> Self
pub const fn new_with_nonce(nonce: u32) -> Self
Build a handshake with a caller-provided nonce.
The nonce is used by the server to uniquely identify this connection.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Return true when the message carries the expected handshake magic.
Sourcepub fn is_compatible(&self) -> bool
pub fn is_compatible(&self) -> bool
Return true when magic and protocol version match this ABI.
Trait Implementations§
Source§impl Clone for IpcHandshake
impl Clone for IpcHandshake
Source§fn clone(&self) -> IpcHandshake
fn clone(&self) -> IpcHandshake
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for IpcHandshake
Source§impl Debug for IpcHandshake
impl Debug for IpcHandshake
Source§impl FromBytes for IpcHandshake
impl FromBytes for IpcHandshake
Source§impl FromZeros for IpcHandshake
impl FromZeros for IpcHandshake
Source§impl IntoBytes for IpcHandshake
impl IntoBytes for IpcHandshake
§fn as_mut_bytes(&mut self) -> &mut [u8]where
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8]where
Self: FromBytes,
Gets the bytes of this value mutably. Read more
Source§impl TryFromBytes for IpcHandshake
impl TryFromBytes for IpcHandshake
§fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_bytes(
source: &[u8],
) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
§fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
§fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
fn try_read_from_suffix(
source: &[u8],
) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>where
Self: Sized,
Auto Trait Implementations§
impl Freeze for IpcHandshake
impl RefUnwindSafe for IpcHandshake
impl Send for IpcHandshake
impl Sync for IpcHandshake
impl Unpin for IpcHandshake
impl UnsafeUnpin for IpcHandshake
impl UnwindSafe for IpcHandshake
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