pub struct UdpMut {
pub upper_layer: Option<Box<LayerMut>>,
/* private fields */
}
Expand description
Mutable representation of an UPD packet
Fields§
§upper_layer: Option<Box<LayerMut>>
the upper layer
Trait Implementations§
Source§impl<'a> LayerMutable<'a> for UdpMut
impl<'a> LayerMutable<'a> for UdpMut
Source§type PacketMut = MutableUdpPacket<'a>
type PacketMut = MutableUdpPacket<'a>
Mutable packet type of the pnet lib
Source§fn modify(&'a mut self) -> Option<Self::PacketMut>
fn modify(&'a mut self) -> Option<Self::PacketMut>
This returns the a mutable reference to the pnet type to modify properties of the packet.
If you want to modify the payload YOU must use
set_payload
from the LayerMutable
traitSource§fn set_payload(&'a mut self, payload: &[u8])
fn set_payload(&'a mut self, payload: &[u8])
Modifies the payload of the packet
Source§fn switch_src_dst(&mut self)
fn switch_src_dst(&mut self)
If the layer contains a src and a dest this will be switch and propagated to the last
layer. When called on an Eth/Ipv4/Udp this will switch the mac, ipv and the port numbers
Source§fn add(&mut self, layer: LayerMut) -> bool
fn add(&mut self, layer: LayerMut) -> bool
Add upper layer as payload. Returns false if it fails e.g layer is not allowed as payload
If already a upper layer is defined this will be propagated to this upper layer
Source§fn get_layer(&'a mut self, layer: &Layers) -> Option<&'a mut LayerMut>
fn get_layer(&'a mut self, layer: &Layers) -> Option<&'a mut LayerMut>
Returns a mutable reference to the requested layer
Auto Trait Implementations§
impl Freeze for UdpMut
impl RefUnwindSafe for UdpMut
impl Send for UdpMut
impl Sync for UdpMut
impl Unpin for UdpMut
impl UnwindSafe for UdpMut
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more