Exemple #1
0
        public void SeekBegin()
        {
            var l7Conversation = this.ReassembleSingleL7Conversation <UdpConversationTracker>(TestPcapFile.Dns1);
            var stream         = new PduDataStream(l7Conversation, PduDataProviderType.Mixed);

            Int32 readBytes;

            Byte[] buff;

            Assert.Equal(635203591241204270, stream.CurrentPdu.FirstSeenTicks);
            buff      = new Byte[46];
            readBytes = stream.Read(buff, 0, buff.Length);
            Assert.Equal(635203591241204270, stream.CurrentPdu.FirstSeenTicks);
            Assert.Equal(buff.Length, readBytes);
            Assert.Equal(644053552, buff.GetContentHashCode());
            Assert.Equal(46, stream.Position);

            stream.Seek(0, SeekOrigin.Begin);

            Assert.Equal(635203591241204270, stream.CurrentPdu.FirstSeenTicks);
            buff      = new Byte[46];
            readBytes = stream.Read(buff, 0, buff.Length);
            Assert.Equal(635203591241204270, stream.CurrentPdu.FirstSeenTicks);
            Assert.Equal(buff.Length, readBytes);
            Assert.Equal(644053552, buff.GetContentHashCode());
            Assert.Equal(46, stream.Position);
        }
Exemple #2
0
        public void SeekForward()
        {
            var l7Conversation = this.ReassembleSingleL7Conversation <UdpConversationTracker>(TestPcapFile.Dns1);
            var stream         = new PduDataStream(l7Conversation, PduDataProviderType.Mixed);

            Int32 readBytes;

            Byte[] buff;
            Int64  p;

            p = stream.Seek(46, SeekOrigin.Begin);
            Assert.Equal(46, p);

            buff      = new Byte[146];
            readBytes = stream.Read(buff, 0, buff.Length);

            Assert.Equal(buff.Length, readBytes);
            Assert.Equal(935504716, buff.GetContentHashCode());
            Assert.Equal(192, stream.Position);
        }