defApplication: Defines a new Application

The defApplication command can be used to define a new application. The defined application can be used in as many experiments as required. To do this, the code can be placed in a separate file in the same directory as the experiment scripts that will use it. But it can also be defined inline, meaning in the same file as the rest of the experiment.

Syntax

defApplication(URI, appName)

where:

  • URI is a string of characters used to identify or name a resource
  • appName is the name of the application being defined.

Usage

 1 defApplication('tcpdumpWrapper', 'dumpApp') {|app|
 2     a.shortDescription = "Capture network traffic using tcpdump" 
 3     a.path="/usr/sbin/tcpdump" 
 4     a.defProperty('interface', 'Listen on interface',
 5             'i', {:type => :string, :dynamic => false})
 6     a.defProperty('writetofile', 'Write the raw packets to file rather than parsing  and  printing them out',
 7             'w', {:type => :string, :dynamic => false})
 8     a.defProperty('snarf', 'Snarf  snaplen  bytes  of  data from each packet rather than the default of 65535 bytes.',
 9             's', {:type => :string, :dynamic => false})
10     a.defProperty('filter', 'BPF expression',
11             nil, {:type => :string, :dynamic => false, :order => 1, :use_name => false})
12 }

Click here to view a tutorial that uses the defApplication command.