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
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