- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdump.lua
More file actions
Latest commit
33 lines (29 loc) · 788 Bytes
/
Copy pathdump.lua
File metadata and controls
33 lines (29 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
localmg=require"moongen"
localmemory=require"memory"
localdevice=require"device"
localstats=require"stats"
locallog=require"log"
functionconfigure(parser)
parser:argument("rxDev", "The device to receive from"):convert(tonumber)
end
functionmaster(args)
localrxDev=device.config{port=args.rxDev, dropEnable=false}
device.waitForLinks()
mg.startTask("dumpSlave", rxDev:getRxQueue(0))
mg.waitForTasks()
end
functiondumpSlave(queue)
localbufs=memory.bufArray()
localpktCtr=stats:newPktRxCounter("Packets counted", "plain")
whilemg.running() do
localrx=queue:tryRecv(bufs, 100)
fori=1, rxdo
localbuf=bufs[i]
--buf:dump()
pktCtr:countPacket(buf)
end
bufs:free(rx)
pktCtr:update()
end
pktCtr:finalize()
end