pub trait IP6Sender<'a> {
// Required methods
fn set_client(&self, client: &'a dyn IP6SendClient);
fn set_addr(&self, src_addr: IPAddr);
fn set_gateway(&self, gateway: MacAddress);
fn set_header(&mut self, ip6_header: IP6Header);
fn send_to(
&self,
dst: IPAddr,
transport_header: TransportHeader,
payload: &SubSliceMut<'static, u8>,
net_cap: &'static NetworkCapability,
) -> Result<(), ErrorCode>;
}
Expand description
This trait provides a basic IPv6 sending interface. It exposes basic configuration information for the IPv6 layer (setting the source address, setting the gateway MAC address), as well as a way to send an IPv6 packet.
Required Methods§
sourcefn set_client(&self, client: &'a dyn IP6SendClient)
fn set_client(&self, client: &'a dyn IP6SendClient)
This method sets the IP6SendClient
for the IP6Sender
instance, which
receives the send_done
callback when transmission has finished.
§Arguments
client
- Client that implements the IP6SendClient
trait to receive the
send_done
callback
sourcefn set_addr(&self, src_addr: IPAddr)
fn set_addr(&self, src_addr: IPAddr)
This method sets the source address for packets sent from the
IP6Sender
instance.
§Arguments
src_addr
- IPAddr
to set as the source address for packets sent
from this instance of IP6Sender
sourcefn set_gateway(&self, gateway: MacAddress)
fn set_gateway(&self, gateway: MacAddress)
This method sets the gateway/next hop MAC address for this IP6Sender
instance.
§Arguments
gateway
- MAC address to send the constructed packet to
sourcefn set_header(&mut self, ip6_header: IP6Header)
fn set_header(&mut self, ip6_header: IP6Header)
This method sets the IP6Header
for the IP6Sender
instance
§Arguments
ip6_header
- New IP6Header
that subsequent packets sent via this
IP6Sender
instance will use
sourcefn send_to(
&self,
dst: IPAddr,
transport_header: TransportHeader,
payload: &SubSliceMut<'static, u8>,
net_cap: &'static NetworkCapability,
) -> Result<(), ErrorCode>
fn send_to( &self, dst: IPAddr, transport_header: TransportHeader, payload: &SubSliceMut<'static, u8>, net_cap: &'static NetworkCapability, ) -> Result<(), ErrorCode>
This method sends the provided transport header and payload to the given destination IP address
§Arguments
dst
- IPv6 address to send the packet to
transport_header
- The TransportHeader
for the packet being sent
payload
- The transport payload for the packet being sent