Skip to main content

flowparser_sflow/counter_records/
slow_path_counts.rs

1use nom::IResult;
2use nom::number::complete::be_u32;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6pub struct SlowPathCounts {
7    pub unknown: u32,
8    pub other: u32,
9    pub cam_miss: u32,
10    pub cam_full: u32,
11    pub no_hw_support: u32,
12    pub cntrl: u32,
13}
14
15pub(crate) fn parse_slow_path_counts(input: &[u8]) -> IResult<&[u8], SlowPathCounts> {
16    let (input, unknown) = be_u32(input)?;
17    let (input, other) = be_u32(input)?;
18    let (input, cam_miss) = be_u32(input)?;
19    let (input, cam_full) = be_u32(input)?;
20    let (input, no_hw_support) = be_u32(input)?;
21    let (input, cntrl) = be_u32(input)?;
22
23    Ok((
24        input,
25        SlowPathCounts {
26            unknown,
27            other,
28            cam_miss,
29            cam_full,
30            no_hw_support,
31            cntrl,
32        },
33    ))
34}