flowparser_sflow/counter_records/
app_operations.rs1use nom::IResult;
2use nom::number::complete::be_u32;
3use serde::{Deserialize, Serialize};
4
5use crate::flow_records::parse_sflow_string;
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8pub struct AppOperations {
9 pub application: String,
10 pub success: u32,
11 pub other: u32,
12 pub timeout: u32,
13 pub internal_error: u32,
14 pub bad_request: u32,
15 pub forbidden: u32,
16 pub too_large: u32,
17 pub not_implemented: u32,
18 pub not_found: u32,
19 pub unavailable: u32,
20 pub unauthorized: u32,
21 pub status_ok: u32,
22}
23
24pub(crate) fn parse_app_operations(input: &[u8]) -> IResult<&[u8], AppOperations> {
25 let (input, application) = parse_sflow_string(input)?;
26 let (input, success) = be_u32(input)?;
27 let (input, other) = be_u32(input)?;
28 let (input, timeout) = be_u32(input)?;
29 let (input, internal_error) = be_u32(input)?;
30 let (input, bad_request) = be_u32(input)?;
31 let (input, forbidden) = be_u32(input)?;
32 let (input, too_large) = be_u32(input)?;
33 let (input, not_implemented) = be_u32(input)?;
34 let (input, not_found) = be_u32(input)?;
35 let (input, unavailable) = be_u32(input)?;
36 let (input, unauthorized) = be_u32(input)?;
37 let (input, status_ok) = be_u32(input)?;
38
39 Ok((
40 input,
41 AppOperations {
42 application,
43 success,
44 other,
45 timeout,
46 internal_error,
47 bad_request,
48 forbidden,
49 too_large,
50 not_implemented,
51 not_found,
52 unavailable,
53 unauthorized,
54 status_ok,
55 },
56 ))
57}