public class DefaultPacketInFilter extends java.lang.Object implements PacketInFilter
PacketInFilter.FilterAction| Constructor and 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.
|
| Modifier and Type | Method and 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.
|
public DefaultPacketInFilter(int pps,
int winSize,
int guardTime,
int winThres,
java.lang.String counterName,
PacketInClassifier classifier)
pps - Rate at which the packet is accepted in packets per secondwinSize - Size of window in milli seconds within which
the packet rate will be analyzedguardTime - 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
winThreswinThres - Continuous window threshold after which gaurdTime will be
activatedcounterName - Name of the counterclassifier - Packet classificationpublic PacketInFilter.FilterAction preProcess(PacketContext packet)
PacketInFilterpreProcess in interface PacketInFilterpacket - PackerContext holding the packet informationpublic java.lang.String name()
PacketInFiltername in interface PacketInFilterpublic int pendingPackets()
PacketInFilterpendingPackets in interface PacketInFilterpublic int droppedPackets()
PacketInFilterdroppedPackets in interface PacketInFilterpublic void setPps(int pps)
PacketInFiltersetPps in interface PacketInFilterpps - Packet per second rate expectedpublic void setWinSize(int winSize)
PacketInFiltersetWinSize in interface PacketInFilterwinSize - Window size in milli secondspublic void setGuardTime(int guardTime)
PacketInFiltersetGuardTime in interface PacketInFilterguardTime - Guard time in secondspublic void setWinThres(int winThres)
PacketInFiltersetWinThres in interface PacketInFilterwinThres - Threshold count of the consecutive windows with packet dropspublic void stop()
PacketInFilterstop in interface PacketInFilterpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object