Skip to content

Commit

Permalink
Serialize: use provided if_tsresol and if_tsoffset (Closes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
chifflier committed Jan 23, 2024
1 parent 2052c8b commit a95e241
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,23 @@ impl<'a> ToVec for InterfaceDescriptionBlock<'a> {
self.reserved = 0;
// check time resolutopn
if !self.options.iter().any(|o| o.code == OptionCode::IfTsresol) {
let tsresol_bytes = vec![self.if_tsresol, 0, 0, 0];
self.options.push(PcapNGOption {
code: OptionCode::IfTsresol,
len: 1,
value: Cow::Borrowed(&[6, 0, 0, 0]),
value: Cow::Owned(tsresol_bytes),
});
}
if !self
.options
.iter()
.any(|o| o.code == OptionCode::IfTsoffset)
{
let tsoffset_bytes = self.if_tsoffset.to_le_bytes();
self.options.push(PcapNGOption {
code: OptionCode::IfTsoffset,
len: 8,
value: Cow::Borrowed(&[0, 0, 0, 0, 0, 0, 0, 0]),
value: Cow::Owned(tsoffset_bytes.to_vec()),
});
}
fix_options(&mut self.options);
Expand Down

0 comments on commit a95e241

Please sign in to comment.