@@ -34,7 +34,7 @@ impl<'a> SectionHeaderBlock<'a> {
3434
3535 /// Return the `shb_hardware` option value, if present
3636 ///
37- /// Attempt to retrieve the `shb_hardware` value
37+ /// If the option is present multiple times, the first value is returned.
3838 ///
3939 /// Returns `None` if option is not present, `Some(Ok(value))` if the value is present and valid,
4040 /// or `Some(Err(_))` if value is present but invalid
@@ -47,6 +47,38 @@ impl<'a> SectionHeaderBlock<'a> {
4747 }
4848 } )
4949 }
50+
51+ /// Return the `shb_os` option value, if present
52+ ///
53+ /// If the option is present multiple times, the first value is returned.
54+ ///
55+ /// Returns `None` if option is not present, `Some(Ok(value))` if the value is present and valid,
56+ /// or `Some(Err(_))` if value is present but invalid
57+ pub fn shb_os ( & self ) -> Option < Result < & str , PcapNGOptionError > > {
58+ self . options . iter ( ) . find_map ( |opt| {
59+ if opt. code == OptionCode :: ShbOs {
60+ Some ( opt. as_str ( ) )
61+ } else {
62+ None
63+ }
64+ } )
65+ }
66+
67+ /// Return the `shb_userappl` option value, if present
68+ ///
69+ /// If the option is present multiple times, the first value is returned.
70+ ///
71+ /// Returns `None` if option is not present, `Some(Ok(value))` if the value is present and valid,
72+ /// or `Some(Err(_))` if value is present but invalid
73+ pub fn shb_userappl ( & self ) -> Option < Result < & str , PcapNGOptionError > > {
74+ self . options . iter ( ) . find_map ( |opt| {
75+ if opt. code == OptionCode :: ShbUserAppl {
76+ Some ( opt. as_str ( ) )
77+ } else {
78+ None
79+ }
80+ } )
81+ }
5082}
5183
5284impl < ' a > PcapNGBlockParser < ' a , PcapBE , SectionHeaderBlock < ' a > > for SectionHeaderBlock < ' a > {
0 commit comments