public void TestAddPacket() { var queue = new SendQueueWrapper(1024); var packet = EthernetPacket.RandomPacket(); queue.Add(packet); Assert.AreEqual(PcapHeader.MemorySize + packet.TotalPacketLength, queue.CurrentLength); }
public void TestAddByteArray() { var queue = new SendQueueWrapper(1024); var bytes = new Byte[] { 0x1, 0x2, 0x3 }; queue.Add(bytes); Assert.AreEqual(PcapHeader.MemorySize + bytes.Length, queue.CurrentLength); }
public void TestAddRawCapture() { var queue = new SendQueueWrapper(1024); var bytes = new Byte[] { 0x1, 0x2, 0x3 }; var rawCapture = new RawCapture(LinkLayers.Ethernet, new PosixTimeval(10, 20), bytes); queue.Add(rawCapture); Assert.AreEqual(PcapHeader.MemorySize + rawCapture.PacketLength, queue.CurrentLength); }
/// <summary> /// Helper method /// </summary> /// <returns></returns> private static SendQueueWrapper GetSendQueue() { var queue = new SendQueueWrapper(1024); var packet = EthernetPacket.RandomPacket(); packet.Type = (EthernetType)0x1234; for (var i = 0; i < PacketCount; i++) { Assert.IsTrue(queue.Add(packet.Bytes, 123456, i * DeltaMs * 1000)); } return(queue); }