Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 838403000
secs: 3621155483
nanos: 175000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 849399000
secs: 3621155483
nanos: 178000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -160,12 +160,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 853386000
secs: 3621155483
nanos: 179000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 853386000
secs: 3621155483
nanos: 179000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -260,12 +260,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 1090527232
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 838403000
secs: 3621155483
nanos: 175000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 850391000
secs: 3621155483
nanos: 178000
- - Netscaler: NetscalerRoundTripTime
- DataNumber: 3
- - IANA: EgressInterface
Expand Down Expand Up @@ -334,12 +334,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -428,12 +428,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 886381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 889368000
secs: 3621155483
nanos: 187000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -528,12 +528,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 1093672960
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 886381000
secs: 3621155483
nanos: 186000
- - Netscaler: NetscalerRoundTripTime
- DataNumber: 2
- - IANA: EgressInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 838403000
secs: 3621155483
nanos: 175000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 849399000
secs: 3621155483
nanos: 178000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -174,12 +174,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 853386000
secs: 3621155483
nanos: 179000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 853386000
secs: 3621155483
nanos: 179000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -274,12 +274,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 1090527232
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 838403000
secs: 3621155483
nanos: 175000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 850391000
secs: 3621155483
nanos: 178000
- - Netscaler: NetscalerRoundTripTime
- DataNumber: 3
- - IANA: EgressInterface
Expand Down Expand Up @@ -348,12 +348,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -442,12 +442,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 84025344
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 886381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 889368000
secs: 3621155483
nanos: 187000
- - IANA: IngressInterface
- DataNumber: 1
- - IANA: EgressInterface
Expand Down Expand Up @@ -542,12 +542,12 @@ expression: "parser.parse_bytes(&hex::decode(hex2).unwrap())"
- DataNumber: 1093672960
- - IANA: FlowStartMicroseconds
- Duration:
secs: 15552744373216
nanos: 884381000
secs: 3621155483
nanos: 186000
- - IANA: FlowEndMicroseconds
- Duration:
secs: 15552744373216
nanos: 886381000
secs: 3621155483
nanos: 186000
- - Netscaler: NetscalerRoundTripTime
- DataNumber: 2
- - IANA: EgressInterface
Expand Down
24 changes: 10 additions & 14 deletions src/variable_versions/data_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,22 +315,18 @@ impl FieldValue {
)
}
FieldDataType::DurationMicros => {
let (i, data_number) = DataNumber::parse(remaining, field_length, false)?;
(
i,
FieldValue::Duration(Duration::from_micros(
<DataNumber as Into<usize>>::into(data_number) as u64,
)),
)
let (i, seconds) = u32::parse_be(remaining)?;
let (i, fraction) = u32::parse_be(i)?;
let dur = Duration::from_secs(seconds as u64)
+ Duration::from_micros((fraction as u64 * 1_000_000) >> 32);
(i, FieldValue::Duration(dur))
}
FieldDataType::DurationNanos => {
let (i, data_number) = DataNumber::parse(remaining, field_length, false)?;
(
i,
FieldValue::Duration(Duration::from_nanos(
<DataNumber as Into<usize>>::into(data_number) as u64,
)),
)
let (i, seconds) = u32::parse_be(remaining)?;
let (i, fraction) = u32::parse_be(i)?;
let dur = Duration::from_secs(seconds as u64)
+ Duration::from_nanos((fraction as u64 * 1_000_000_000) >> 32);
(i, FieldValue::Duration(dur))
}
FieldDataType::ProtocolType => {
let (i, protocol) = ProtocolTypes::parse(remaining)?;
Expand Down