Class: Thm::DataServices::Trafviz::Main
- Inherits:
-
Object
- Object
- Thm::DataServices::Trafviz::Main
- Defined in:
- lib/thm/dataservices/trafviz/trafviz.rb
Instance Attribute Summary collapse
-
#startup ⇒ Object
Returns the value of attribute startup.
Instance Method Summary collapse
- #addfilter(const, filter) ⇒ Object
- #commitfilters ⇒ Object
-
#initialize ⇒ Main
constructor
A new instance of Main.
- #run! ⇒ Object
Constructor Details
#initialize ⇒ Main
Returns a new instance of Main.
309 310 311 312 313 |
# File 'lib/thm/dataservices/trafviz/trafviz.rb', line 309 def initialize @filter_const = Array.new @startup = String.new @thm = Thm::DataServices::Trafviz::FilterManager.new end |
Instance Attribute Details
#startup ⇒ Object
Returns the value of attribute startup.
307 308 309 |
# File 'lib/thm/dataservices/trafviz/trafviz.rb', line 307 def startup @startup end |
Instance Method Details
#addfilter(const, filter) ⇒ Object
315 316 317 318 319 320 321 |
# File 'lib/thm/dataservices/trafviz/trafviz.rb', line 315 def addfilter(const, filter) if @thm.validate_filter?(filter) == true filtercode = %Q{#{const} = Pcap::Filter.new('#{filter}', @trafviz.capture)} @filter_const << "#{const})" eval(filtercode) end end |
#commitfilters ⇒ Object
323 324 325 326 327 |
# File 'lib/thm/dataservices/trafviz/trafviz.rb', line 323 def commitfilters flts = @filter_const.join(" | ") # Build string of CONST names commitcode = %Q{@trafviz.add_filter(#{flts})} eval(flts) end |
#run! ⇒ Object
329 330 331 |
# File 'lib/thm/dataservices/trafviz/trafviz.rb', line 329 def run! @trafviz = Pcaplet.new(@startup) end |