pcap_processor.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Class for processing PCAPs to collect statistical data.
  3. */
  4. #ifndef CPP_PCAPREADER_MAIN_H
  5. #define CPP_PCAPREADER_MAIN_H
  6. #include <iomanip>
  7. #include <tins/tins.h>
  8. #include <iostream>
  9. #include <time.h>
  10. #include <stdio.h>
  11. #include <sys/stat.h>
  12. #include <unordered_map>
  13. #include "statistics.h"
  14. #include "statistics_db.h"
  15. using namespace Tins;
  16. class pcap_processor {
  17. public:
  18. /*
  19. * Class constructor
  20. */
  21. pcap_processor(std::string path, std::string extraTests);
  22. /*
  23. * Attributes
  24. */
  25. statistics stats;
  26. std::string filePath;
  27. bool hasUntracked;
  28. /*
  29. * Methods
  30. */
  31. inline bool file_exists(const std::string &filePath);
  32. void process_packets(const Packet &pkt);
  33. long double get_timestamp_mu_sec(const int after_packet_number);
  34. std::string merge_pcaps(const std::string pcap_path);
  35. void collect_statistics();
  36. void write_to_database(std::string database_path);
  37. static int get_db_version() { return statistics_db::DB_VERSION; };
  38. };
  39. #endif //CPP_PCAPREADER_MAIN_H