Trait NatContext

Source
pub trait NatContext<I: IpExt, BT: FilterBindingsTypes>: IpDeviceAddressIdContext<I, DeviceId: InterfaceProperties<BT::DeviceClass>> {
    // Required methods
    fn get_local_addr_for_remote(
        &mut self,
        device_id: &Self::DeviceId,
        remote: Option<SpecifiedAddr<I::Addr>>,
    ) -> Option<Self::AddressId>;
    fn get_address_id(
        &mut self,
        device_id: &Self::DeviceId,
        addr: IpDeviceAddr<I::Addr>,
    ) -> Option<Self::AddressId>;
}
Expand description

The execution context for Network Address Translation (NAT).

Required Methods§

Source

fn get_local_addr_for_remote( &mut self, device_id: &Self::DeviceId, remote: Option<SpecifiedAddr<I::Addr>>, ) -> Option<Self::AddressId>

Returns the best local address for communicating with the remote.

Source

fn get_address_id( &mut self, device_id: &Self::DeviceId, addr: IpDeviceAddr<I::Addr>, ) -> Option<Self::AddressId>

Returns a strongly-held reference to the provided address, if it is assigned to the specified device.

Implementors§

impl<BC: BindingsContext, L: LockBefore<IpState<Ipv4>>> NatContext<Ipv4, BC> for CoreCtx<'_, BC, L>

impl<BC: BindingsContext, L: LockBefore<IpState<Ipv6>>> NatContext<Ipv6, BC> for CoreCtx<'_, BC, L>