ping_fox/
ping_receive.rs

1use std::net::IpAddr;
2use std::time::Duration;
3
4/// Structure representing ping receive cases.
5#[derive(Debug)]
6pub enum PingReceive {
7    /// Case represeting the data from a received echo reply message.
8    Data(PingReceiveData),
9    /// Case representing a timeout on an attempt to receive an echo reply message.
10    Timeout,
11}
12
13/// Structure represeting a received echo reply message.
14#[derive(Debug)]
15#[allow(clippy::module_name_repetitions)]
16pub struct PingReceiveData {
17    /// The size of the payload in the received reply message.
18    pub package_size: usize,
19    /// The IP address of the host which sent the reply.
20    pub ip_addr: IpAddr,
21    /// The time to live (TTL) of the received reply message.
22    pub ttl: u8,
23    /// The sequence number of the echo reply.
24    pub sequence_number: u16,
25    /// The measured duration between sending the echo message and receiving the reply.
26    pub ping_duration: Duration,
27}