pub struct RawIpSocketApi<I: Ip, C> { /* private fields */ }
Expand description
The raw IP socket API.
Implementations§
Source§impl<I: Ip, C> RawIpSocketApi<I, C>
impl<I: Ip, C> RawIpSocketApi<I, C>
Source§impl<I: IpExt + DualStackIpExt, C> RawIpSocketApi<I, C>where
C: ContextPair,
C::BindingsContext: RawIpSocketsBindingsTypes + ReferenceNotifiers + 'static,
C::CoreContext: RawIpSocketMapContext<I, C::BindingsContext> + RawIpSocketStateContext<I, C::BindingsContext> + ResourceCounterContext<RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, RawIpSocketCounters<I>>,
impl<I: IpExt + DualStackIpExt, C> RawIpSocketApi<I, C>where
C: ContextPair,
C::BindingsContext: RawIpSocketsBindingsTypes + ReferenceNotifiers + 'static,
C::CoreContext: RawIpSocketMapContext<I, C::BindingsContext> + RawIpSocketStateContext<I, C::BindingsContext> + ResourceCounterContext<RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, RawIpSocketCounters<I>>,
Sourcepub fn create(
&mut self,
protocol: RawIpSocketProtocol<I>,
external_state: <C::BindingsContext as RawIpSocketsBindingsTypes>::RawIpSocketState<I>,
) -> RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>
pub fn create( &mut self, protocol: RawIpSocketProtocol<I>, external_state: <C::BindingsContext as RawIpSocketsBindingsTypes>::RawIpSocketState<I>, ) -> RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>
Creates a raw IP socket for the given protocol.
Sourcepub fn close(
&mut self,
id: RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> RemoveResourceResultWithContext<<C::BindingsContext as RawIpSocketsBindingsTypes>::RawIpSocketState<I>, C::BindingsContext>
pub fn close( &mut self, id: RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> RemoveResourceResultWithContext<<C::BindingsContext as RawIpSocketsBindingsTypes>::RawIpSocketState<I>, C::BindingsContext>
Removes the raw IP socket from the system, returning its external state.
Sourcepub fn send_to<B: BufferMut>(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
remote_ip: Option<ZonedAddr<SpecifiedAddr<I::Addr>, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>,
body: B,
) -> Result<(), RawIpSocketSendToError>
pub fn send_to<B: BufferMut>( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, remote_ip: Option<ZonedAddr<SpecifiedAddr<I::Addr>, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>, body: B, ) -> Result<(), RawIpSocketSendToError>
Sends an IP packet on the raw IP socket to the provided destination.
The provided body
is not expected to include an IP header; a system
determined header will automatically be applied.
Sourcepub fn set_device(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
device: Option<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>,
) -> Option<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
pub fn set_device( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, device: Option<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, ) -> Option<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
Sets the socket’s bound device, returning the original value.
Sourcepub fn get_device(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> Option<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
pub fn get_device( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> Option<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
Gets the socket’s bound device,
Sourcepub fn set_icmp_filter(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
filter: Option<RawIpSocketIcmpFilter<I>>,
) -> Result<Option<RawIpSocketIcmpFilter<I>>, RawIpSocketIcmpFilterError>
pub fn set_icmp_filter( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, filter: Option<RawIpSocketIcmpFilter<I>>, ) -> Result<Option<RawIpSocketIcmpFilter<I>>, RawIpSocketIcmpFilterError>
Sets the socket’s ICMP filter, returning the original value.
Note, if the socket’s protocol is not compatible (e.g. ICMPv4 for an IPv4 socket, or ICMPv6 for an IPv6 socket), an error is returned.
Sourcepub fn get_icmp_filter(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> Result<Option<RawIpSocketIcmpFilter<I>>, RawIpSocketIcmpFilterError>
pub fn get_icmp_filter( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> Result<Option<RawIpSocketIcmpFilter<I>>, RawIpSocketIcmpFilterError>
Gets the socket’s ICMP
Note, if the socket’s protocol is not compatible (e.g. ICMPv4 for an IPv4 socket, or ICMPv6 for an IPv6 socket), an error is returned.
Sourcepub fn set_unicast_hop_limit(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
new_limit: Option<NonZeroU8>,
) -> Option<NonZeroU8>
pub fn set_unicast_hop_limit( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, new_limit: Option<NonZeroU8>, ) -> Option<NonZeroU8>
Sets the socket’s unicast hop limit, returning the original value.
If None
is provided, the hop limit will be restored to the system
default.
Sourcepub fn get_unicast_hop_limit(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> NonZeroU8
pub fn get_unicast_hop_limit( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> NonZeroU8
Gets the socket’s unicast hop limit, or the system default, if unset.
Sourcepub fn set_multicast_hop_limit(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
new_limit: Option<NonZeroU8>,
) -> Option<NonZeroU8>
pub fn set_multicast_hop_limit( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, new_limit: Option<NonZeroU8>, ) -> Option<NonZeroU8>
Sets the socket’s multicast hop limit, returning the original value.
If None
is provided, the hop limit will be restored to the system
default.
Sourcepub fn get_multicast_hop_limit(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> NonZeroU8
pub fn get_multicast_hop_limit( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> NonZeroU8
Gets the socket’s multicast hop limit, or the system default, if unset.
Sourcepub fn set_multicast_loop(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
value: bool,
) -> bool
pub fn set_multicast_loop( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, value: bool, ) -> bool
Sets multicast_loop
on the socket, returning the original value.
When true, the socket will loop back all sent multicast traffic.
Sourcepub fn get_multicast_loop(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> bool
pub fn get_multicast_loop( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> bool
Gets the multicast_loop
value on the socket.
Sourcepub fn set_mark(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
domain: MarkDomain,
mark: Mark,
)
pub fn set_mark( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, domain: MarkDomain, mark: Mark, )
Sets the socket mark for the socket domain.
Sourcepub fn get_mark(
&mut self,
id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
domain: MarkDomain,
) -> Mark
pub fn get_mark( &mut self, id: &RawIpSocketId<I, <<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, domain: MarkDomain, ) -> Mark
Gets the socket mark for the socket domain.
Sourcepub fn inspect<N>(&mut self, inspector: &mut N)where
N: Inspector + InspectorDeviceExt<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>,
pub fn inspect<N>(&mut self, inspector: &mut N)where
N: Inspector + InspectorDeviceExt<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>,
Provides inspect data for raw IP sockets.