示例#1
0
        /// <summary>
        /// Filters all received packets from PacketList
        /// </summary>
        private void FilterAllPackets()
        {
            // To filter all packets, we must refresh the whole list
            FilteredPacketList.Clear();

            lock (PacketList)
            {
                foreach (IPPacket packet in PacketList)
                {
                    lock (FilteredPacketList)
                    {
                        AddToFilteredList(packet);
                    }
                }
            }

            // This condition here avoids threading problem:
            //   If a new packet is captured just before FilterAllPackets() is called,
            //   this removes all newPackets that arrived before this function call.
            while (FilteredPacketList.Count > 2)
            {
                uint firstPacketID = filteredPacketList[0].PacketID;
                uint lastPacketID  = filteredPacketList[filteredPacketList.Count - 2].PacketID;

                if (firstPacketID > lastPacketID)
                {
                    filteredPacketList.RemoveAt(0);
                    continue;
                }
                break;
            }
        }
示例#2
0
        private void ClearPacketListExecute()
        {
            PacketList.Clear();
            FilteredPacketList.Clear();
            StatsHandler.ResetStats();

            if (monitor != null)
            {
                StatsHandler.StopWatch.Start();
            }

            ClearSelectedPacketData();
            IsClearEnabled = false;
        }