Class DefaultPacketInFilter

    • Constructor Detail

      • DefaultPacketInFilter

        public DefaultPacketInFilter​(int pps,
                                     int winSize,
                                     int guardTime,
                                     int winThres,
                                     String counterName,
                                     PacketInClassifier classifier)
        Only one filter object per packet type to be associated. Multiple filter types will result in undefined behavior.
        Parameters:
        pps - Rate at which the packet is accepted in packets per second
        winSize - Size of window in milli seconds within which the packet rate will be analyzed
        guardTime - Time duration in seconds for which the packet processing will be on hold if there is a continuous window where cross of the rate happens and that window count crosses winThres
        winThres - Continuous window threshold after which gaurdTime will be activated
        counterName - Name of the counter
        classifier - Packet classification
    • Method Detail

      • pendingPackets

        public int pendingPackets()
        Description copied from interface: PacketInFilter
        Get the current value of the count of packets for this particular filter type waiting to get processed.
        Specified by:
        pendingPackets in interface PacketInFilter
        Returns:
        count of packets with current filter type waiting to get processed
      • droppedPackets

        public int droppedPackets()
        Description copied from interface: PacketInFilter
        Get the count of the dropped packets for this filter type.
        Specified by:
        droppedPackets in interface PacketInFilter
        Returns:
        count of dropped packets for this filter type
      • setPps

        public void setPps​(int pps)
        Description copied from interface: PacketInFilter
        Set the pps rate for the current filter type to calculate the max counter allowed with window size.
        Specified by:
        setPps in interface PacketInFilter
        Parameters:
        pps - Packet per second rate expected
      • setWinSize

        public void setWinSize​(int winSize)
        Description copied from interface: PacketInFilter
        Set the window size for rate limiting.
        Specified by:
        setWinSize in interface PacketInFilter
        Parameters:
        winSize - Window size in milli seconds
      • setGuardTime

        public void setGuardTime​(int guardTime)
        Description copied from interface: PacketInFilter
        Set the Guard time in case WinThres is crossed.
        Specified by:
        setGuardTime in interface PacketInFilter
        Parameters:
        guardTime - Guard time in seconds
      • setWinThres

        public void setWinThres​(int winThres)
        Description copied from interface: PacketInFilter
        Set the Window Threshold for dropping the packet.
        Specified by:
        setWinThres in interface PacketInFilter
        Parameters:
        winThres - Threshold count of the consecutive windows with packet drops
      • stop

        public void stop()
        Description copied from interface: PacketInFilter
        Stop the threads running for this filter.
        Specified by:
        stop in interface PacketInFilter
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object