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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use crate::{InterfaceOperationalState, IpNetwork, MacAddr, NetworkDataInner};
/// Reports received and transmitted byte and packet volumes.
pub struct NetworkData {
pub(crate) inner: NetworkDataInner,
}
impl NetworkData {
/// Returns the number of bytes received since the last refresh.
pub fn received(&self) -> u64 {
self.inner.received()
}
/// Returns the total number of bytes received.
pub fn total_received(&self) -> u64 {
self.inner.total_received()
}
/// Returns the number of bytes transmitted since the last refresh.
pub fn transmitted(&self) -> u64 {
self.inner.transmitted()
}
/// Returns the total number of bytes transmitted.
pub fn total_transmitted(&self) -> u64 {
self.inner.total_transmitted()
}
/// Returns the number of incoming packets since the last refresh.
pub fn packets_received(&self) -> u64 {
self.inner.packets_received()
}
/// Returns the total number of incoming packets.
pub fn total_packets_received(&self) -> u64 {
self.inner.total_packets_received()
}
/// Returns the number of outgoing packets since the last refresh.
pub fn packets_transmitted(&self) -> u64 {
self.inner.packets_transmitted()
}
/// Returns the total number of outgoing packets.
pub fn total_packets_transmitted(&self) -> u64 {
self.inner.total_packets_transmitted()
}
/// Returns the number of incoming errors since the last refresh.
pub fn errors_on_received(&self) -> u64 {
self.inner.errors_on_received()
}
/// Returns the total number of incoming errors.
pub fn total_errors_on_received(&self) -> u64 {
self.inner.total_errors_on_received()
}
/// Returns the number of outgoing errors since the last refresh.
pub fn errors_on_transmitted(&self) -> u64 {
self.inner.errors_on_transmitted()
}
/// Returns the total number of outgoing errors.
pub fn total_errors_on_transmitted(&self) -> u64 {
self.inner.total_errors_on_transmitted()
}
/// Returns the MAC address of the interface.
pub fn mac_address(&self) -> MacAddr {
self.inner.mac_address()
}
/// Returns the IP networks associated with the interface.
pub fn ip_networks(&self) -> &[IpNetwork] {
self.inner.ip_networks()
}
/// Returns the interface's Maximum Transfer Unit (MTU).
pub fn mtu(&self) -> u64 {
self.inner.mtu()
}
/// Returns the transmit link speed of the interface in bits per second.
pub fn transmit_link_speed(&self) -> Option<u64> {
self.inner.transmit_link_speed()
}
/// Returns the receive link speed of the interface in bits per second.
pub fn receive_link_speed(&self) -> Option<u64> {
self.inner.receive_link_speed()
}
/// Returns the operational state of the interface.
pub fn operational_state(&self) -> InterfaceOperationalState {
self.inner.operational_state()
}
}