pub struct Icmpv6Builder { /* private fields */ }Expand description
Builder for ICMPv6 packets.
Implementations§
Source§impl Icmpv6Builder
impl Icmpv6Builder
Sourcepub fn echo_request(id: u16, seq: u16) -> Self
pub fn echo_request(id: u16, seq: u16) -> Self
Sourcepub fn echo_reply(id: u16, seq: u16) -> Self
pub fn echo_reply(id: u16, seq: u16) -> Self
Create an Echo Reply (pong6) packet.
§Arguments
id- Identifier (should match the request)seq- Sequence number (should match the request)
Sourcepub fn neighbor_solicitation(target: Ipv6Addr) -> Self
pub fn neighbor_solicitation(target: Ipv6Addr) -> Self
Sourcepub fn neighbor_advertisement(target: Ipv6Addr) -> Self
pub fn neighbor_advertisement(target: Ipv6Addr) -> Self
Sourcepub fn router_solicitation() -> Self
pub fn router_solicitation() -> Self
Create a Router Solicitation (NDP) packet.
Sourcepub fn router_advertisement() -> Self
pub fn router_advertisement() -> Self
Create a Router Advertisement (NDP) packet.
Sourcepub fn dest_unreachable(code: u8, payload: Vec<u8>) -> Self
pub fn dest_unreachable(code: u8, payload: Vec<u8>) -> Self
Create a Destination Unreachable packet.
§Arguments
code- Reason code (0=No route, 1=Admin prohibited, 3=Port unreachable, etc.)payload- The offending packet bytes (or truncation thereof)
Sourcepub fn time_exceeded(code: u8, payload: Vec<u8>) -> Self
pub fn time_exceeded(code: u8, payload: Vec<u8>) -> Self
Create a Time Exceeded packet.
§Arguments
code- 0=Hop limit exceeded, 1=Fragment reassembly time exceededpayload- The offending packet bytes (or truncation thereof)
Sourcepub fn pkt_too_big(mtu: u32, payload: Vec<u8>) -> Self
pub fn pkt_too_big(mtu: u32, payload: Vec<u8>) -> Self
Create a Packet Too Big packet.
§Arguments
mtu- Maximum Transmission Unit of the next-hop linkpayload- The offending packet bytes (or truncation thereof)
Sourcepub fn icmpv6_type(self, t: u8) -> Self
pub fn icmpv6_type(self, t: u8) -> Self
Set the ICMPv6 type manually.
Sourcepub fn enable_auto_checksum(self) -> Self
pub fn enable_auto_checksum(self) -> Self
Enable automatic checksum calculation (default: true).
Sourcepub fn disable_auto_checksum(self) -> Self
pub fn disable_auto_checksum(self) -> Self
Disable automatic checksum calculation.
Sourcepub fn set_src_ip(self, src: Ipv6Addr) -> Self
pub fn set_src_ip(self, src: Ipv6Addr) -> Self
Set the source IP address (used for checksum calculation).
Sourcepub fn set_dst_ip(self, dst: Ipv6Addr) -> Self
pub fn set_dst_ip(self, dst: Ipv6Addr) -> Self
Set the destination IP address (used for checksum calculation).
Sourcepub fn packet_size(&self) -> usize
pub fn packet_size(&self) -> usize
Get the total packet size.
Sourcepub fn header_size(&self) -> usize
pub fn header_size(&self) -> usize
Get the header size (base 8 bytes + any type-specific fixed fields).
Trait Implementations§
Source§impl Clone for Icmpv6Builder
impl Clone for Icmpv6Builder
Source§fn clone(&self) -> Icmpv6Builder
fn clone(&self) -> Icmpv6Builder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Icmpv6Builder
impl Debug for Icmpv6Builder
Source§impl Default for Icmpv6Builder
impl Default for Icmpv6Builder
Source§impl From<Icmpv6Builder> for LayerStack
impl From<Icmpv6Builder> for LayerStack
Source§fn from(builder: Icmpv6Builder) -> Self
fn from(builder: Icmpv6Builder) -> Self
Converts to this type from the input type.
Source§impl IntoLayerStackEntry for Icmpv6Builder
impl IntoLayerStackEntry for Icmpv6Builder
fn into_layer_stack_entry(self) -> LayerStackEntry
Auto Trait Implementations§
impl Freeze for Icmpv6Builder
impl RefUnwindSafe for Icmpv6Builder
impl Send for Icmpv6Builder
impl Sync for Icmpv6Builder
impl Unpin for Icmpv6Builder
impl UnsafeUnpin for Icmpv6Builder
impl UnwindSafe for Icmpv6Builder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more