Trait zero_packet::packet::builder::PayloadWriter
source · pub trait PayloadWriter<'a> {
// Required method
fn write_payload(
self,
payload: &[u8],
) -> Result<PacketBuilder<'a, PayloadState>, &'static str>;
}
Expand description
Interface for writing the payload for a packet.
Implemented for PacketBuilder
in the TcpHeader
, UdpHeader
, and IcmpHeader
states.
Required Methods§
sourcefn write_payload(
self,
payload: &[u8],
) -> Result<PacketBuilder<'a, PayloadState>, &'static str>
fn write_payload( self, payload: &[u8], ) -> Result<PacketBuilder<'a, PayloadState>, &'static str>
Writes a given payload to the packet and transitions into the Payload
state.
PacketBuilder::payload_len()
may be different than the written payload.
That is, because the data slice, which we mutate in-place, can be longer than the payload.