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

            Int32 readBytes;

            Byte[] buff;

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

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

            Assert.True(stream.NewMessage());

            readBytes = stream.Read(buff, 0, buff.Length);
            Assert.Equal(buff.Length, readBytes);
            Assert.Equal(935504716, buff.GetContentHashCode());
            Assert.Equal(192, stream.Position);
        }
Exemple #2
0
        public void NewMessage()
        {
            var l7Conversation = this.ReassembleSingleL7Conversation <UdpConversationTracker>(TestPcapFile.Dns1);
            var stream         = new PduDataStream(l7Conversation, PduDataProviderType.Mixed);

            Assert.False(stream.EndOfStream);

            Assert.Equal(0, stream.Position);
            Assert.Equal(635203591241204270, stream.CurrentPdu.FirstSeenTicks);
            Assert.True(stream.NewMessage());
            Assert.False(stream.EndOfStream);

            Assert.Equal(46, stream.Position);
            Assert.Equal(635203591242516580, stream.CurrentPdu.FirstSeenTicks);
            Assert.False(stream.NewMessage());
            Assert.True(stream.EndOfStream);
        }