Logger.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package de.tudarmstadt.informatik.hostage.logging;
  2. import java.util.ArrayList;
  3. /**
  4. * Interface to define which functionality is needed for a Logger in this application.
  5. * @author Mihai Plasoianu
  6. * @author Lars Pandikow
  7. *
  8. */
  9. public interface Logger {
  10. /**
  11. * Write a single Record to the log.
  12. * @param record The Record that has to be added.
  13. */
  14. void write(Record record);
  15. /**
  16. * Returns all saved Records.
  17. * @return ArrayList which contains all Records from the log.
  18. */
  19. ArrayList<Record> getAllRecords();
  20. /**
  21. * Returns a single Record as representative for each attack with an attack id higher then the given.
  22. * @param lastUploadedAttackId The threshold value for attack id's
  23. * @return ArrayList which contains one Record for each attack.
  24. */
  25. ArrayList<Record> getRecordOfEachAttack(int lastUploadedAttackId);
  26. /**
  27. *
  28. * @param attack_id Attack id of the record
  29. * @return A Record with a specific attack id, or null if there is no Record with such an attack id.
  30. */
  31. Record getRecordOfAttackId(long attack_id);
  32. /**
  33. * Determines the number of recorded attacks.
  34. * @return he Number of Attacks.
  35. */
  36. int getAttackCount();
  37. /**
  38. * Returns the number of recorded attack for a specific protocol.
  39. * @param protocol The considered protocol.
  40. * @return The Number of recorded attacks per protocol.
  41. */
  42. int getAttackPerProtokolCount(String protocol);
  43. /**
  44. * Finds the smallest saved attack id.
  45. * @return The smallest saved attack id.
  46. */
  47. long getSmallestAttackId();
  48. /**
  49. * Finds the highest saved attack id.
  50. * @return The highest saved attack id.
  51. */
  52. long getHighestAttackId();
  53. /**
  54. * Determines if an attack on a given protocol has already been recorded in a network with a specific BSSID.
  55. * @param protocol The considered protocol.
  56. * @param bssid The considered BSSID.
  57. * @return True if there has been a attack on a protocol in a network with the given BSSID, else returns false.
  58. */
  59. boolean bssidSeen(String protocol, String bssid);
  60. /**
  61. * Returns all BSSIDs in which an attack has been recorded.
  62. * @return String arrays with all recorded BSSIDs
  63. */
  64. String[] getAllBSSIDS();
  65. /**
  66. * Returns the last known SSID of a network with a specific BSSID.
  67. * @param bssid The considered BSSID.
  68. * @return String representation of the searched SSID, or null if there is no entry with the given BSSID
  69. */
  70. String getSSID(String bssid);
  71. /**
  72. * Deletes all Records with a smaller time stamp than the given.
  73. * @param time The time stamp to compare with.
  74. */
  75. void deleteByDate(long time);
  76. /**
  77. * Deletes all Record which contain the given BSSID.
  78. * @param bssid The BSSID to compare with.
  79. */
  80. void deleteByBSSID(String bssid);
  81. /**
  82. * Resets complete log file.
  83. */
  84. void clearData();
  85. }