net.floodlightcontroller.util
Class OFMessageDamper

java.lang.Object
  extended by net.floodlightcontroller.util.OFMessageDamper

public class OFMessageDamper
extends java.lang.Object

Dampens OFMessages sent to an OF switch. A message is only written to a switch if the same message (as defined by .equals()) has not been written in the last n milliseconds. Timer granularity is based on TimedCache

Author:
gregor

Nested Class Summary
protected static class OFMessageDamper.DamperEntry
          An entry in the TimedCache.
 
Constructor Summary
OFMessageDamper(int capacity, java.util.Set<OFType> typesToDampen, int timeout)
           
 
Method Summary
 boolean write(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
          write the messag to the switch according to our dampening settings
 boolean write(IOFSwitch sw, OFMessage msg, FloodlightContext cntx, boolean flush)
          write the messag to the switch according to our dampening settings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OFMessageDamper

public OFMessageDamper(int capacity,
                       java.util.Set<OFType> typesToDampen,
                       int timeout)
Parameters:
capacity - the maximum number of messages that should be kept
typesToDampen - The set of OFMessageTypes that should be dampened by this instance. Other types will be passed through
timeout - The dampening timeout. A message will only be written if the last write for the an equal message more than timeout ms ago.
Method Detail

write

public boolean write(IOFSwitch sw,
                     OFMessage msg,
                     FloodlightContext cntx)
              throws java.io.IOException
write the messag to the switch according to our dampening settings

Parameters:
sw -
msg -
cntx -
Returns:
true if the message was written to the switch, false if the message was dampened.
Throws:
java.io.IOException

write

public boolean write(IOFSwitch sw,
                     OFMessage msg,
                     FloodlightContext cntx,
                     boolean flush)
              throws java.io.IOException
write the messag to the switch according to our dampening settings

Parameters:
sw -
msg -
cntx -
flush - true to flush the packet immidiately
Returns:
true if the message was written to the switch, false if the message was dampened.
Throws:
java.io.IOException