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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! [`SessionEvent`] — netring's L7 session-stream event type.
//!
//! flowscope 0.20 (#100) demoted its `SessionEvent` to a crate-private
//! engine carrier; the public flowscope vocabulary is now `FlowEvent`
//! (tracker primitive) + `Event<K>` (typed driver). flowscope's RFC
//! recommends downstream stream layers **own** their session-event
//! type, so netring defines its own here. It is the `Stream::Item` of
//! [`SessionStream`] / [`DatagramStream`] / [`PcapSessionStream`] /
//! [`PcapDatagramStream`] and (wrapped in `TaggedEvent`) the multi
//! variants.
//!
//! The variants mirror what netring's `process_session_event` already
//! synthesizes from a [`flowscope::FlowEvent`]: flow lifecycle
//! endpoints (`Started` / `Closed`), the typed L7 `Application`
//! messages a parser flushes in between, and the two live anomaly
//! carriers. Periodic `Tick` snapshots are intentionally not surfaced
//! on the session streams (the contract is "messages and lifecycle
//! endpoints"); the enum is `#[non_exhaustive]` so adding it later is
//! additive.
//!
//! [`SessionStream`]: super::session_stream::SessionStream
//! [`DatagramStream`]: super::datagram_stream::DatagramStream
//! [`PcapSessionStream`]: crate::pcap_flow::PcapSessionStream
//! [`PcapDatagramStream`]: crate::pcap_flow::PcapDatagramStream
use ;
/// An event produced by a netring L7 session / datagram stream.
///
/// `K` is the flow key (typically [`flowscope::extract::FiveTupleKey`]);
/// `M` is the parser's message type
/// (`<P as flowscope::SessionParser>::Message`).
// `Closed` carries a full `FlowStats` (the largest variant) while
// `Started` / `TrackerAnomaly` are small. These events are produced
// one at a time and drained immediately from a `VecDeque`, never held
// in bulk, so the size spread doesn't matter — boxing `stats` would
// just add an allocation on the hot close path.