Skip to main content

bacnet_network/router/
counters.rs

1//! The hosted router's counts: the totals since start of what the engine
2//! counts.
3//!
4//! The engine counts as the portable cores do: `u32` counts it hands over,
5//! and starts again, each time they are taken
6//! ([`Router::take_counters`](bacnet_router_core::Router::take_counters)).
7//! The hosted router takes them each time it lets the engine's lock go and
8//! adds them to these totals, so its users read cumulative `u64` counts.
9
10/// What the hosted router's engine has counted since the router started:
11/// what it dropped, sent and was refused. Each total saturates at
12/// `u64::MAX`. They never change a decision, and name no peer.
13///
14/// It is `#[non_exhaustive]`, so a new count isn't a breaking change.
15/// Outside this crate, build one from `Counters::default()` and set its
16/// fields.
17#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
18#[non_exhaustive]
19pub struct Counters {
20    /// Frames refused because the link source, the DLEN or the SLEN was
21    /// past [`MAX_MAC_LEN`](bacnet_npdu::MAX_MAC_LEN) (#1141,
22    /// #1198).
23    pub address_length_drops: u64,
24    /// Frames dropped for a DADR beside DNET 0xFFFF (#1379).
25    pub global_broadcast_dadr_drops: u64,
26    /// Broadcasts dropped for carrying an APDU other than an
27    /// Unconfirmed-Request (#1491).
28    pub broadcast_pdu_type_drops: u64,
29    /// Frames dropped for a DADR that is a group address on its delivery
30    /// port: an APDU other than an Unconfirmed-Request, a network message,
31    /// or anything for a group the port refuses (#1504, #1677). An
32    /// Unconfirmed-Request sent as the port's broadcast instead isn't
33    /// counted.
34    pub group_dadr_drops: u64,
35    /// Frames that didn't parse as an NPDU for any other reason.
36    pub malformed: u64,
37    /// Network messages whose data or addressing the router refused.
38    pub bad_messages: u64,
39    /// Frames that came on a port the router doesn't have, or whose route
40    /// names one.
41    pub unknown_port: u64,
42    /// Relays not sent because the hop count had run out.
43    pub hop_count_drops: u64,
44    /// Protected network messages the control policy refused.
45    pub denied: u64,
46    /// Received rejects that were neither for this router nor routable.
47    pub unroutable_rejects: u64,
48    /// Rejects this router queued.
49    pub rejects: u64,
50    /// Who-Is-Router searches for unknown networks queued.
51    pub solicitations: u64,
52    /// Outputs that couldn't be written: longer than the scratch, or with
53    /// a field no NPDU may carry, such as an SNET of 0.
54    pub write_failures: u64,
55    /// Sends left out because their egress port can't carry them: by the
56    /// router's own check, or refused by the port's transport as too long,
57    /// at once or later.
58    pub egress_too_long: u64,
59    /// Sends a port reported refused, at once or later.
60    pub refused: u64,
61    /// Actions dropped because a call came before they were polled.
62    pub undrained: u64,
63    /// Router-Busy announcements started for a clogged port, repeats
64    /// included ([`RouterOptions::congestion`](super::RouterOptions::congestion), #1697).
65    pub busy_announced: u64,
66    /// Router-Available announcements started for a port that drained
67    /// (#1697).
68    pub available_announced: u64,
69    /// Global broadcasts dropped as repeats
70    /// ([`RouterOptions::duplicates`](super::RouterOptions::duplicates), #1698).
71    pub duplicate_drops: u64,
72    /// Networks a received reject or flow-control message named whose
73    /// learned route goes through another router, left unchanged
74    /// ([`RouterOptions::next_hop_rejects`](super::RouterOptions::next_hop_rejects), #1698).
75    pub not_next_hop: u64,
76    /// Requests the router's own application sent through the engine
77    /// ([`BACnetRouter::originate`](super::BACnetRouter::originate), #1699).
78    pub originated: u64,
79}