Class DefaultPacketInFilter

  • All Implemented Interfaces:
    PacketInFilter

    public class DefaultPacketInFilter
    extends java.lang.Object
    implements PacketInFilter
    Default implementation of a packet-in filter.
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultPacketInFilter​(int pps, int winSize, int guardTime, int winThres, java.lang.String counterName, PacketInClassifier classifier)
      Only one filter object per packet type to be associated.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int droppedPackets()
      Get the count of the dropped packets for this filter type.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      java.lang.String name()
      Get the name of the counter.
      int pendingPackets()
      Get the current value of the count of packets for this particular filter type waiting to get processed.
      PacketInFilter.FilterAction preProcess​(PacketContext packet)
      Returns FilterAction before processing the packet.
      void setGuardTime​(int guardTime)
      Set the Guard time in case WinThres is crossed.
      void setPps​(int pps)
      Set the pps rate for the current filter type to calculate the max counter allowed with window size.
      void setWinSize​(int winSize)
      Set the window size for rate limiting.
      void setWinThres​(int winThres)
      Set the Window Threshold for dropping the packet.
      void stop()
      Stop the threads running for this filter.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPacketInFilter

        public DefaultPacketInFilter​(int pps,
                                     int winSize,
                                     int guardTime,
                                     int winThres,
                                     java.lang.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

      • name

        public java.lang.String name()
        Description copied from interface: PacketInFilter
        Get the name of the counter.
        Specified by:
        name in interface PacketInFilter
        Returns:
        name of the counter
      • 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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object