wiki:Old/Documentation/OTG/ScriptsRepository/ProtoDefReceiver

Version 1 (modified by zhibinwu, 19 years ago) ( diff )


#
# Define a prototype
#

require 'handler/prototype'
require 'handler/filter'
require 'handler/appDefinition'

p = Prototype.create("test:proto:receiver")
p.name = "Receiver"
p.description = "Nodes which receive packets"
p.defProperty('protocol', 'Protocol to use', 'udp')
p.defProperty('port', 'Port to listen on', 4000)
p.defProperty('hostname', 'My own ID for libmac filter', 'localhost')

otr = p.addApplication('otr', "test:app:otr")
otr.bindProperty('protocol')
otr.bindProperty('port')
otr.bindProperty('hostname')

otr.addMeasurement('receiverport',Filter::TIME,
  {Filter::SAMPLE_SIZE => 1},
  [
    ['pkt_seqno'],
    ['flow_no'],
    ['rcvd_pkt_size', Filter::SUM],
    ['rx_timestamp'],
    ['rssi'],
    ['xmitrate']
  ]
)

otr.addMeasurement('flow', Filter::SAMPLE,
 {Filter::SAMPLE_SIZE => 1},
 [
   ['flow_no'],
   ['sender_port']
 ]
)

if $0 == __FILE__
  p.to_xml.write($stdout, 2)
  puts
end

Note: See TracWiki for help on using the wiki.