PacketSniffer.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package de.tu_darmstadt.tk.SmartHomeNetworkSim.core;
  2. import java.util.HashMap;
  3. import java.util.LinkedList;
  4. /**
  5. * Interface for processing of captured packets. If registered in the program,
  6. * the {@link #processPackets(HashMap)} method will be called after each
  7. * simulation step, and the captured packets during the last step, will be the argument.
  8. *
  9. * @author Andreas T. Meyer-Berg
  10. */
  11. public interface PacketSniffer {
  12. /**
  13. * Process the packages. This method will be called after every simulation
  14. * step, if and object implementing this Interface, is registered in the
  15. * framework.
  16. *
  17. * @param packets
  18. * the packets captured during the last simulation step. They are
  19. * grouped by each link.
  20. */
  21. public void processPackets(HashMap<Link, LinkedList<Packet>> packets);
  22. /**
  23. * Set the mode of the algorithm, whether it should be training or testing
  24. * with the given packets
  25. * @param testing <code>false</code> if it should be training, <code>true</code> if
  26. * it should be testing
  27. */
  28. public void setMode(boolean testing);
  29. /**
  30. * Returns the mode of the algorithm, whether it should be training or testing
  31. * with the given packets.<br>
  32. * <code>false</code>: if it should be training<br>
  33. * <code>true</code>: if it should be testing
  34. */
  35. public boolean getMode();
  36. }