pcap_processor.h 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Class for processing PCAPs to collect statistical data.
  3. */
  4. #ifndef CPP_PCAPREADER_MAIN_H
  5. #define CPP_PCAPREADER_MAIN_H
  6. // Aidmar
  7. #include <iomanip>
  8. #include <tins/tins.h>
  9. #include <iostream>
  10. #include <time.h>
  11. #include <stdio.h>
  12. #include <sys/stat.h>
  13. #include <unordered_map>
  14. #include "statistics.h"
  15. using namespace Tins;
  16. class pcap_processor {
  17. public:
  18. /*
  19. * Class constructor
  20. */
  21. pcap_processor(std::string path);
  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. };
  37. #endif //CPP_PCAPREADER_MAIN_H