Class: PStream::Stream
- Inherits:
-
Object
- Object
- PStream::Stream
- Defined in:
- lib/pstream/stream.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#frames ⇒ Object
Returns the value of attribute frames.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(pcap, prot, id, desc, frames) ⇒ Stream
constructor
A new instance of Stream.
- #to_s ⇒ Object
Constructor Details
#initialize(pcap, prot, id, desc, frames) ⇒ Stream
Returns a new instance of Stream.
14 15 16 17 18 19 20 |
# File 'lib/pstream/stream.rb', line 14 def initialize(pcap, prot, id, desc, frames) @desc = desc @frames = frames @id = id @pcap = pcap @prot = prot end |
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc.
2 3 4 |
# File 'lib/pstream/stream.rb', line 2 def desc @desc end |
#frames ⇒ Object
Returns the value of attribute frames.
3 4 5 |
# File 'lib/pstream/stream.rb', line 3 def frames @frames end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/pstream/stream.rb', line 4 def id @id end |
Instance Method Details
#contents ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/pstream/stream.rb', line 6 def contents out = %x( tshark -r #{@pcap} -z follow,#{@prot},hex,#{@id} | \ sed "s|^ ||" | \grep -E "^[0-9A-Fa-f]{8}" ) return out end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/pstream/stream.rb', line 22 def to_s() return contents end |