pcap_processor.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. /*
  28. * Methods
  29. */
  30. inline bool file_exists(const std::string &filePath);
  31. void process_packets(const Packet &pkt);
  32. long double get_timestamp_mu_sec(const int after_packet_number);
  33. std::string merge_pcaps(const std::string pcap_path);
  34. void collect_statistics();
  35. void write_to_database(std::string database_path);
  36. static int get_db_version() { return statistics_db::DB_VERSION; };
  37. };
  38. #endif //CPP_PCAPREADER_MAIN_H