| 1 | {{{ |
| 2 | |
| 3 | |
| 4 | # |
| 5 | # Define a prototype |
| 6 | # |
| 7 | |
| 8 | require 'handler/prototype' |
| 9 | require 'handler/filter' |
| 10 | require 'handler/appDefinition' |
| 11 | |
| 12 | p = Prototype.create("test:proto:receiver") |
| 13 | p.name = "Receiver" |
| 14 | p.description = "Nodes which receive packets" |
| 15 | p.defProperty('protocol', 'Protocol to use', 'udp') |
| 16 | p.defProperty('port', 'Port to listen on', 4000) |
| 17 | p.defProperty('hostname', 'My own ID for libmac filter', 'localhost') |
| 18 | |
| 19 | otr = p.addApplication('otr', "test:app:otr") |
| 20 | otr.bindProperty('protocol') |
| 21 | otr.bindProperty('port') |
| 22 | otr.bindProperty('hostname') |
| 23 | |
| 24 | otr.addMeasurement('receiverport',Filter::TIME, |
| 25 | {Filter::SAMPLE_SIZE => 1}, |
| 26 | [ |
| 27 | ['pkt_seqno'], |
| 28 | ['flow_no'], |
| 29 | ['rcvd_pkt_size', Filter::SUM], |
| 30 | ['rx_timestamp'], |
| 31 | ['rssi'], |
| 32 | ['xmitrate'] |
| 33 | ] |
| 34 | ) |
| 35 | |
| 36 | otr.addMeasurement('flow', Filter::SAMPLE, |
| 37 | {Filter::SAMPLE_SIZE => 1}, |
| 38 | [ |
| 39 | ['flow_no'], |
| 40 | ['sender_port'] |
| 41 | ] |
| 42 | ) |
| 43 | |
| 44 | if $0 == __FILE__ |
| 45 | p.to_xml.write($stdout, 2) |
| 46 | puts |
| 47 | end |
| 48 | |
| 49 | }}} |