public void ReadPacketWithNoFcs() { var dev = new CaptureFileReaderDevice("../../CaptureFiles/80211_radio_without_fcs.pcap"); dev.Open(); var rawCapture = dev.GetNextPacket(); dev.Close(); RadioPacket p = Packet.ParsePacket(rawCapture.LinkLayerType, rawCapture.Data) as RadioPacket; Assert.IsNotNull(p.PayloadPacket); TsftRadioTapField tsftField = p[RadioTapType.Tsft] as TsftRadioTapField; Assert.IsNotNull(tsftField); Assert.AreEqual(38724775, tsftField.TimestampUsec); FlagsRadioTapField flagsField = p[RadioTapType.Flags] as FlagsRadioTapField; Assert.IsNotNull(flagsField); Assert.AreEqual(0, (Int32)flagsField.Flags); RateRadioTapField rateField = p[RadioTapType.Rate] as RateRadioTapField; Assert.IsNotNull(rateField); Assert.AreEqual(1, rateField.RateMbps); ChannelRadioTapField channelField = p[RadioTapType.Channel] as ChannelRadioTapField; Assert.IsNotNull(channelField); Assert.AreEqual(2462, channelField.FrequencyMHz); Assert.AreEqual(11, channelField.Channel); Assert.AreEqual(RadioTapChannelFlags.Channel2Ghz | RadioTapChannelFlags.Cck, channelField.Flags); DbmAntennaSignalRadioTapField dbmSignalField = p[RadioTapType.DbmAntennaSignal] as DbmAntennaSignalRadioTapField; Assert.IsNotNull(dbmSignalField); Assert.AreEqual(-61, dbmSignalField.AntennaSignalDbm); DbmAntennaNoiseRadioTapField dbmNoiseField = p[RadioTapType.DbmAntennaNoise] as DbmAntennaNoiseRadioTapField; Assert.IsNotNull(dbmNoiseField); Assert.AreEqual(-84, dbmNoiseField.AntennaNoisedBm); AntennaRadioTapField antennaField = p[RadioTapType.Antenna] as AntennaRadioTapField; Assert.IsNotNull(antennaField); Assert.AreEqual(0, antennaField.Antenna); DbAntennaSignalRadioTapField dbSignalField = p[RadioTapType.DbAntennaSignal] as DbAntennaSignalRadioTapField; Assert.IsNotNull(dbSignalField); Assert.AreEqual(23, dbSignalField.SignalStrengthdB); MacFrame macFrame = p.PayloadPacket as MacFrame; Assert.IsFalse(macFrame.AppendFcs); Assert.IsFalse(macFrame.FCSValid); }
public void Test_RateRadioTapField () { RateRadioTapField field = new RateRadioTapField(2); var bytes = new byte[field.Length]; field.CopyTo(bytes, 0); RateRadioTapField recreatedField = new RateRadioTapField(new BinaryReader (new MemoryStream(bytes))); Assert.AreEqual(field.RateMbps, recreatedField.RateMbps); }
public void Test_RateRadioTapField() { RateRadioTapField field = new RateRadioTapField(2); var bytes = new Byte[field.Length]; field.CopyTo(bytes, 0); RateRadioTapField recreatedField = new RateRadioTapField(new BinaryReader(new MemoryStream(bytes))); Assert.AreEqual(field.RateMbps, recreatedField.RateMbps); }