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

            // check the source port filter
            foreach (string filter in m_sourcePortFilter)
            {
                if (!UdpFilter.IsMatch(packet.SourcePort, filter))
                {
                    match = false;
                    break;
                }
            }

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

            // check the destination port filter
            foreach (string filter in m_destPortFilter)
            {
                if (!UdpFilter.IsMatch(packet.DestinationPort, 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 (UdpPacketArrived != null)
            {
                UdpPacketArrived(packet);
            }
        }
Exemple #2
0
 /// <summary>
 ///		Create a new UdpSourcePortFilterIndexer class.
 /// </summary>
 /// <param name="owner">
 ///		The owner.
 ///	</param>
 public UdpSourcePortFilterIndexer(UdpFilter owner)
 {
     this.owner = owner;
 }
Exemple #3
0
			/// <summary>
			///		Create a new UdpSourcePortFilterIndexer class.
			/// </summary>
			/// <param name="owner">
			///		The owner.
			///	</param>
			public UdpSourcePortFilterIndexer (UdpFilter owner)
			{
				this.owner = owner;
			}
Exemple #4
0
 /// <summary>
 ///		Create a new DestinationPortFilterIndexer class.
 /// </summary>
 /// <param name="owner">
 ///		The owner class.
 ///	</param>
 public DestinationPortFilterIndexer(UdpFilter owner)
 {
     this.owner = owner;
 }
Exemple #5
0
			/// <summary>
			///		Create a new DestinationPortFilterIndexer class.
			/// </summary>
			/// <param name="owner">
			///		The owner class.
			///	</param>
			public DestinationPortFilterIndexer (UdpFilter owner)
			{
				this.owner = owner;
			}