pcap_processor.h 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. using namespace Tins;
  15. class pcap_processor {
  16. public:
  17. /*
  18. * Class constructor
  19. */
  20. pcap_processor(std::string path, std::string extraTests);
  21. /*
  22. * Attributes
  23. */
  24. statistics stats;
  25. std::string filePath;
  26. /*
  27. * Methods
  28. */
  29. inline bool file_exists(const std::string &filePath);
  30. void process_packets(const Packet &pkt);
  31. long double get_timestamp_mu_sec(const int after_packet_number);
  32. std::string merge_pcaps(const std::string pcap_path);
  33. void collect_statistics();
  34. void write_to_database(std::string database_path);
  35. };
  36. #endif //CPP_PCAPREADER_MAIN_H