Class: ITRP::Cmd_pcap

Inherits:
Cmd
  • Object
show all
Defined in:
lib/handlers/pcap.rb

Instance Attribute Summary

Attributes inherited from Cmd

#attach_cmd, #children, #enabled_in_state, #trigger

Instance Method Summary collapse

Methods inherited from Cmd

#appstate, #completions, #find_node, #is_root?, #place_node, #print_state, #set_time_window, #treeprint

Constructor Details

#initialize(e) ⇒ Cmd_pcap

Returns a new instance of Cmd_pcap.



4
5
6
7
8
9
# File 'lib/handlers/pcap.rb', line 4

def initialize (e)
	super(e)
	@enabled_in_state = :any
	@attach_cmd  = ''
	@trigger = 'pcap'
end

Instance Method Details

#enter(cmdline) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/handlers/pcap.rb', line 11

def enter(cmdline)

	patt = cmdline.scan(/pcap\s+([\w=_:\.\-]+)/).flatten.first 

       expr = patt

       if expr == "usefilter" 
       p @appenv  
           expr = @appenv.context_data[:filter]
       end 


       expr.gsub!(/flow=/,"{99A78737-4B41-4387-8F31-8077DB917336}=")
       puts "Using filter " + expr 

	req =TrisulRP::Protocol.mk_request(TRP::Message::Command::PCAP_REQUEST,
		 :time_interval => appstate(:time_interval),
		 :filter_expression => expr, 
		 :save_file => "/tmp/kk.pcap")

	rows = []
	TrisulRP::Protocol.get_response_zmq(@appenv.zmq_endpt,req) do |resp|
	
		p resp
	end

end