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
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::{num, io};
error_chain! {
foreign_links {
ParseIntError(num::ParseIntError)
/// Parser error
;
Io(io::Error)
/// IO-Error from std::io
;
}
errors {
/// Receiving a packet on ethernet channel failed.
EthernetReceiveError {
description("failed to read packet from ethernet channel")
}
/// Getting a handle to packet-capture-channel failed.
ChannelCreationError {
description("error during creation of receiving network packet channel")
}
/// Reinterpreting a low level byte-stream as network packet failed.
PacketConversionError {
description("reinterpreting a low level byte-stream as network packet failed")
}
/// The packet capture code might be missing a packet/network type. Unhandled code paths throw this error.
UnknownNetworkObject {
description("unknown/unimplemented network object")
}
/// This crate works with non-loopback devices -> packets that are incoming and outgoing are unexpected.
/// This case should never happen and it stops the program, but in reality, it can be ignored. Please
/// raise an issue, so the case can be discussed and this error removed.
LocalToLocalConnectionError {
description("packet on loopback device has local-to-local connection")
}
/// Reading a /proc/net/tcp{6} or /proc/net/udp{6} file failed
ProcNetFileError(path: String, error: io::Error) {
description("error when attempting to read /proc/net file")
display("error when attempting to read /proc/net file: '{}' ({})", path, error)
}
/// An /proc/net/tcp{6} or /proc/net/udp{6} exists but does not have correct formatting.
ProcNetFileHasWrongFormat {
description("an /proc/net/tcp{6} or /proc/net/udp{6} exists but does not have correct formatting")
}
/// Parsing a MAC adress failed
MacAddrParseError {
description("failed to parse MAC address")
}
}
}