pub trait IpSocketContext<I, BC: IpSocketBindingsContext>: DeviceIdContext<AnyDevice, DeviceId: InterfaceProperties<BC::DeviceClass>> + FilterHandlerProvider<I, BC>where
I: IpDeviceStateIpExt + IpExt,{
// Required methods
fn lookup_route(
&mut self,
bindings_ctx: &mut BC,
device: Option<&Self::DeviceId>,
src_ip: Option<IpDeviceAddr<I::Addr>>,
dst_ip: RoutableIpAddr<I::Addr>,
transparent: bool,
marks: &Marks,
) -> Result<ResolvedRoute<I, Self::DeviceId>, ResolveRouteError>;
fn send_ip_packet<S>(
&mut self,
bindings_ctx: &mut BC,
meta: SendIpPacketMeta<I, &Self::DeviceId, SpecifiedAddr<I::Addr>>,
body: S,
packet_metadata: IpLayerPacketMetadata<I, Self::WeakAddressId, BC>,
) -> Result<(), IpSendFrameError<S>>
where S: TransportPacketSerializer<I>,
S::Buffer: BufferMut;
fn get_loopback_device(&mut self) -> Option<Self::DeviceId>;
fn confirm_reachable(
&mut self,
bindings_ctx: &mut BC,
dst: SpecifiedAddr<I::Addr>,
input: RuleInput<'_, I, Self::DeviceId>,
);
}
Expand description
The context required in order to implement IpSocketHandler
.
Blanket impls of IpSocketHandler
are provided in terms of
IpSocketContext
.
Required Methods§
Sourcefn lookup_route(
&mut self,
bindings_ctx: &mut BC,
device: Option<&Self::DeviceId>,
src_ip: Option<IpDeviceAddr<I::Addr>>,
dst_ip: RoutableIpAddr<I::Addr>,
transparent: bool,
marks: &Marks,
) -> Result<ResolvedRoute<I, Self::DeviceId>, ResolveRouteError>
fn lookup_route( &mut self, bindings_ctx: &mut BC, device: Option<&Self::DeviceId>, src_ip: Option<IpDeviceAddr<I::Addr>>, dst_ip: RoutableIpAddr<I::Addr>, transparent: bool, marks: &Marks, ) -> Result<ResolvedRoute<I, Self::DeviceId>, ResolveRouteError>
Returns a route for a socket.
If device
is specified, the available routes are limited to those that
egress over the device.
Sourcefn send_ip_packet<S>(
&mut self,
bindings_ctx: &mut BC,
meta: SendIpPacketMeta<I, &Self::DeviceId, SpecifiedAddr<I::Addr>>,
body: S,
packet_metadata: IpLayerPacketMetadata<I, Self::WeakAddressId, BC>,
) -> Result<(), IpSendFrameError<S>>where
S: TransportPacketSerializer<I>,
S::Buffer: BufferMut,
fn send_ip_packet<S>(
&mut self,
bindings_ctx: &mut BC,
meta: SendIpPacketMeta<I, &Self::DeviceId, SpecifiedAddr<I::Addr>>,
body: S,
packet_metadata: IpLayerPacketMetadata<I, Self::WeakAddressId, BC>,
) -> Result<(), IpSendFrameError<S>>where
S: TransportPacketSerializer<I>,
S::Buffer: BufferMut,
Send an IP packet to the next-hop node.
Sourcefn get_loopback_device(&mut self) -> Option<Self::DeviceId>
fn get_loopback_device(&mut self) -> Option<Self::DeviceId>
Returns DeviceId
for the loopback device.
Sourcefn confirm_reachable(
&mut self,
bindings_ctx: &mut BC,
dst: SpecifiedAddr<I::Addr>,
input: RuleInput<'_, I, Self::DeviceId>,
)
fn confirm_reachable( &mut self, bindings_ctx: &mut BC, dst: SpecifiedAddr<I::Addr>, input: RuleInput<'_, I, Self::DeviceId>, )
Confirms the provided IP socket destination is reachable.
Implementations must retrieve the next hop given the provided IP socket and confirm neighbor reachability for the resolved target device.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.