pub struct DeviceSocketApi<C>(/* private fields */);
Expand description
The device socket API.
Implementations§
Source§impl<C> DeviceSocketApi<C>
impl<C> DeviceSocketApi<C>
Source§impl<C> DeviceSocketApi<C>where
C: ContextPair,
C::CoreContext: DeviceSocketContext<C::BindingsContext> + SocketStateAccessor<C::BindingsContext>,
C::BindingsContext: DeviceSocketBindingsContext<<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId> + ReferenceNotifiers + 'static,
impl<C> DeviceSocketApi<C>where
C: ContextPair,
C::CoreContext: DeviceSocketContext<C::BindingsContext> + SocketStateAccessor<C::BindingsContext>,
C::BindingsContext: DeviceSocketBindingsContext<<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId> + ReferenceNotifiers + 'static,
Sourcepub fn create(
&mut self,
external_state: <C::BindingsContext as DeviceSocketTypes>::SocketState,
) -> DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>
pub fn create( &mut self, external_state: <C::BindingsContext as DeviceSocketTypes>::SocketState, ) -> DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>
Creates an packet socket with no protocol set configured for all devices.
Sourcepub fn set_device(
&mut self,
socket: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
device: TargetDevice<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>,
)
pub fn set_device( &mut self, socket: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, device: TargetDevice<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, )
Sets the device for which a packet socket will receive packets.
Sourcepub fn set_device_and_protocol(
&mut self,
socket: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
device: TargetDevice<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>,
protocol: Protocol,
)
pub fn set_device_and_protocol( &mut self, socket: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, device: TargetDevice<&<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, protocol: Protocol, )
Sets the device and protocol for which a socket will receive packets.
Sourcepub fn get_info(
&mut self,
id: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> SocketInfo<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
pub fn get_info( &mut self, id: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> SocketInfo<<C::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId>
Gets the bound info for a socket.
Sourcepub fn remove(
&mut self,
id: DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
) -> RemoveResourceResultWithContext<<C::BindingsContext as DeviceSocketTypes>::SocketState, C::BindingsContext>
pub fn remove( &mut self, id: DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>, ) -> RemoveResourceResultWithContext<<C::BindingsContext as DeviceSocketTypes>::SocketState, C::BindingsContext>
Removes a bound socket.
Sourcepub fn send_frame<S, D>(
&mut self,
_id: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
metadata: DeviceSocketMetadata<D, <C::CoreContext as DeviceIdContext<D>>::DeviceId>,
body: S,
) -> Result<(), SendFrameErrorReason>where
S: Serializer,
S::Buffer: BufferMut,
D: DeviceSocketSendTypes,
C::CoreContext: DeviceIdContext<D> + SendFrameContext<C::BindingsContext, DeviceSocketMetadata<D, <C::CoreContext as DeviceIdContext<D>>::DeviceId>>,
C::BindingsContext: DeviceLayerTypes,
pub fn send_frame<S, D>(
&mut self,
_id: &DeviceSocketId<<<C as ContextPair>::CoreContext as DeviceIdContext<AnyDevice>>::WeakDeviceId, <C as ContextPair>::BindingsContext>,
metadata: DeviceSocketMetadata<D, <C::CoreContext as DeviceIdContext<D>>::DeviceId>,
body: S,
) -> Result<(), SendFrameErrorReason>where
S: Serializer,
S::Buffer: BufferMut,
D: DeviceSocketSendTypes,
C::CoreContext: DeviceIdContext<D> + SendFrameContext<C::BindingsContext, DeviceSocketMetadata<D, <C::CoreContext as DeviceIdContext<D>>::DeviceId>>,
C::BindingsContext: DeviceLayerTypes,
Sends a frame for the specified socket.
Auto Trait Implementations§
impl<C> Freeze for DeviceSocketApi<C>where
C: Freeze,
impl<C> RefUnwindSafe for DeviceSocketApi<C>where
C: RefUnwindSafe,
impl<C> Send for DeviceSocketApi<C>where
C: Send,
impl<C> Sync for DeviceSocketApi<C>where
C: Sync,
impl<C> Unpin for DeviceSocketApi<C>where
C: Unpin,
impl<C> UnwindSafe for DeviceSocketApi<C>where
C: UnwindSafe,
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<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
Source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
Source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
Send a frame. Read more
Source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
Source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more