I recently thought that it could be interesting to automatically get everything I needed about a MiWi network using a program reading the .zna capture files. I wanted to check every data sent on the 802.15.4 layer at a higher layer than Zena.

But the project has been cancelled, so I won’t make this program. But still, I decided to give the format of the file for those who would have the same needs.

everything is Little Endian

[ 4 ] - Frame Number (starting at 0) : 00 00 00 00 is frame 1, 01 00 00 00 is frame 2
[ 4 ] - Time 
[ 1 ] - Length of the frame (remember it counts the 2 last mandatory bytes) 
[ 2 ] - Mac Frame Control
[ 0-125 ] - Frame content
[ 1 ] - RSSI
[ 1 ] - Corr + CRC

MSB of this last byte describes if the CRC is OK.

In .Net, making this program is pretty easy. You just have to read the first 9 bytes. You will then read the next X (given by the 9th byte) + 3 bytes. Converting these bytes into a readeable message is easy :

var frameHeader = new Byte[] { 
    , , , , 
    , , , ,
    4
};
var rawFrameNumber = new Byte[4];
Array.Copy(frameHeader, , rawFrameNumber, , rawFrameNumber.Length); 
if (!BitConverter.IsLittleEndian) // .Net isn't x86 specific
    Array.Reverse(rawFrameNumber, , rawFrameNumber.Length);
var frameNumber = BitConverter.ToUInt32(rawFrameNumber, );