Esempio n. 1
0
        /// <summary>
        ///		Whenever a new IP packet arrives it should be passed to this method.
        ///		If the packet is to be filtered out it will be ignored otherwise the
        ///		IpV4PacketArrived will be raised with the packet
        /// </summary>
        /// <param name="packet">
        ///		The packet which has arrived.
        ///	</param>
        public void HandleNewPacket(IpV4Packet packet)
        {
            bool match = true;

            // check the source address filter
            foreach (string filter in m_sourceAddressFilter)
            {
                if (!IpV4Filter.IsMatch(packet.SourceAddress.ToString(), filter))
                {
                    match = false;
                    break;
                }
            }

            // if no match then exit
            if (!match)
            {
                return;
            }

            // check the destination address filter
            foreach (string filter in m_destAddressFilter)
            {
                if (!IpV4Filter.IsMatch(packet.DestinationAddress.ToString(), filter))
                {
                    match = false;
                    break;
                }
            }

            // if no match then exit
            if (!match)
            {
                return;
            }

            // if we get here then the packet has passed through the filter and we
            // raise the event
            if (IpV4PacketArrived != null)
            {
                IpV4PacketArrived(packet);
            }
        }
Esempio n. 2
0
 /// <summary>
 ///		Create a new SourceAddressFilterIndexer class.
 /// </summary>
 /// <param name="owner">
 ///		The owner of the class.
 ///	</param>
 public SourceAddressFilterIndexer(IpV4Filter owner)
 {
     this.owner = owner;
 }
Esempio n. 3
0
			/// <summary>
			///		Create a new SourceAddressFilterIndexer class.
			/// </summary>
			/// <param name="owner">
			///		The owner of the class.
			///	</param>
			public SourceAddressFilterIndexer (IpV4Filter owner)
			{
				this.owner = owner;
			}
Esempio n. 4
0
 /// <summary>
 ///		Create a new DestinationAddressFilterIndexer.
 /// </summary>
 /// <param name="owner">
 ///		The owner of the class.
 ///	</param>
 public DestinationAddressFilterIndexer(IpV4Filter owner)
 {
     this.owner = owner;
 }
Esempio n. 5
0
			/// <summary>
			///		Create a new DestinationAddressFilterIndexer.
			/// </summary>
			/// <param name="owner">
			///		The owner of the class.
			///	</param>
			public DestinationAddressFilterIndexer (IpV4Filter owner)
			{
				this.owner = owner;
			}