@@ -48,10 +48,16 @@ impl ConnRecord {
48
48
self . orig . nb_pkts + self . resp . nb_pkts
49
49
}
50
50
51
+ /// Returns the total number of packet bytes observed, including headers and malformed packets.
52
+ #[ inline]
53
+ pub fn total_pkt_bytes ( & self ) -> u64 {
54
+ self . orig . nb_pkt_bytes + self . resp . nb_pkt_bytes
55
+ }
56
+
51
57
/// Returns the total number of payload bytes observed, excluding those from malformed packets.
52
58
#[ inline]
53
- pub fn total_bytes ( & self ) -> u64 {
54
- self . orig . nb_bytes + self . resp . nb_bytes
59
+ pub fn total_payload_bytes ( & self ) -> u64 {
60
+ self . orig . nb_payload_bytes + self . resp . nb_payload_bytes
55
61
}
56
62
57
63
/// Returns the connection history.
@@ -257,9 +263,12 @@ pub struct Flow {
257
263
pub nb_malformed_pkts : u64 ,
258
264
/// Number of late start packets.
259
265
pub nb_late_start_pkts : u64 ,
266
+ /// Number of packet bytes observed in the flow. Includes bytes from malformed
267
+ /// segments and ethernet and ip headers.
268
+ pub nb_pkt_bytes : u64 ,
260
269
/// Number of payload bytes observed in the flow. Does not include bytes from malformed
261
270
/// segments.
262
- pub nb_bytes : u64 ,
271
+ pub nb_payload_bytes : u64 ,
263
272
/// Maximum number of simultaneous content gaps.
264
273
///
265
274
/// A content gap is a "hole" in the TCP sequence number, indicated re-ordered or missing
@@ -284,7 +293,8 @@ impl Flow {
284
293
nb_pkts : 0 ,
285
294
nb_malformed_pkts : 0 ,
286
295
nb_late_start_pkts : 0 ,
287
- nb_bytes : 0 ,
296
+ nb_pkt_bytes : 0 ,
297
+ nb_payload_bytes : 0 ,
288
298
max_simult_gaps : 0 ,
289
299
data_start : 0 ,
290
300
capacity : DEFAULT_CHUNK_CAPACITY ,
@@ -296,14 +306,15 @@ impl Flow {
296
306
#[ inline]
297
307
fn insert_segment ( & mut self , segment : & L4Pdu ) {
298
308
self . nb_pkts += 1 ;
309
+ self . nb_pkt_bytes += segment. mbuf . data_len ( ) as u64 ;
299
310
300
311
if segment. offset ( ) > segment. mbuf . data_len ( )
301
312
|| ( segment. offset ( ) + segment. length ( ) ) > segment. mbuf . data_len ( )
302
313
{
303
314
self . nb_malformed_pkts += 1 ;
304
315
return ;
305
316
}
306
- self . nb_bytes += segment. length ( ) as u64 ;
317
+ self . nb_payload_bytes += segment. length ( ) as u64 ;
307
318
308
319
let seq_no = if segment. flags ( ) & SYN != 0 {
309
320
segment. seq_no ( ) . wrapping_add ( 1 )
0 commit comments