1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use thiserror::{Error};

#[derive(Error, Debug)]
pub enum EkkoError {
    #[error("Socket send, reason: {0}")]
    SocketSend(String),
    #[error("Failed to create socket, reason: {0}")]
    SocketCreateIcmpv4(String),
    #[error("Failed to create socket, reason: {0}")]
    SocketCreateIcmpv6(String),
    #[error("Socket failed binding to address '{0}', reason: {1}")]
    SocketBindIpv4(String, String),
    #[error("Socket failed binding to address '{0}', reason: {1}")]
    SocketBindIpv6(String, String),
    #[error("Socket returned no address for responder.")]
    SocketReceiveNoIpv4,
    #[error("Socket returned no address for responder.")]
    SocketReceiveNoIpv6,
    #[error("Cannot combine address '{src:?}' (source) with '{tgt:?}' (target).")]
    SocketIpMismatch { src: String, tgt: String },
    #[error("Could not set sockets receive buffer size, reason: {0}")]
    SocketSetReceiveBufferSize(String),
    #[error("Could not set sockets read timeout, reason: {0}")]
    SocketSetReadTimeout(String),
    #[error("Could not set socket max hops, reason: {0}")]
    SocketSetMaxHopsIpv4(String),
    #[error("Could not set socket max hops, reason: {0}")]
    SocketSetMaxHopsIpv6(String),
    #[error("Failed to read response field '{0}', reason: {1}")]
    ResponseReadField(&'static str, String),
    #[error("Failed to read request field '{0}', reason: {1}")]
    RequestReadField(&'static str, String),
    #[error("Failed to write Icmpv4 request field '{0}', reason: {1}")]
    RequestWriteIcmpv4Field(&'static str, String),
    #[error("Failed to write Icmpv6 request field '{0}', reason: {1}")]
    RequestWriteIcmpv6Field(&'static str, String),
    #[error("Failed to write request payload, reason: {0}")]
    RequestWriteIcmpv4Payload(String),
    #[error("Failed to write request payload, reason: {0}")]
    RequestWriteIcmpv6Payload(String),
    #[error("Failed to resolve address for hostname '{0}'.")]
    UnresolvedTarget(String),
    #[error("Failed to resolve address for hostname '{0}', reason: {1}")]
    BadTarget(String, String),
}