flowparser_sflow/flow_records/
extended_proxy_socket_ipv4.rs1use nom::IResult;
2use nom::number::complete::be_u32;
3use serde::{Deserialize, Serialize};
4use std::net::Ipv4Addr;
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct ExtendedProxySocketIpv4 {
8 pub protocol: u32,
9 pub local_ip: Ipv4Addr,
10 pub remote_ip: Ipv4Addr,
11 pub local_port: u32,
12 pub remote_port: u32,
13}
14
15pub(crate) fn parse_extended_proxy_socket_ipv4(
16 input: &[u8],
17) -> IResult<&[u8], ExtendedProxySocketIpv4> {
18 let (input, protocol) = be_u32(input)?;
19 let (input, local_ip_raw) = be_u32(input)?;
20 let (input, remote_ip_raw) = be_u32(input)?;
21 let (input, local_port) = be_u32(input)?;
22 let (input, remote_port) = be_u32(input)?;
23
24 Ok((
25 input,
26 ExtendedProxySocketIpv4 {
27 protocol,
28 local_ip: Ipv4Addr::from(local_ip_raw),
29 remote_ip: Ipv4Addr::from(remote_ip_raw),
30 local_port,
31 remote_port,
32 },
33 ))
34}