pcap_processor.h 883 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 <tins/tins.h>
  7. #include <iostream>
  8. #include <time.h>
  9. #include <stdio.h>
  10. #include <sys/stat.h>
  11. #include <unordered_map>
  12. #include "statistics.h"
  13. using namespace Tins;
  14. class pcap_processor {
  15. public:
  16. /*
  17. * Class constructor
  18. */
  19. pcap_processor(std::string path);
  20. /*
  21. * Attributes
  22. */
  23. statistics stats;
  24. std::string filePath;
  25. /*
  26. * Methods
  27. */
  28. inline bool file_exists(const std::string &filePath);
  29. void process_packets(const Packet &pkt);
  30. long double get_timestamp_mu_sec(const int after_packet_number);
  31. std::string merge_pcaps(const std::string pcap_path);
  32. void collect_statistics();
  33. void write_to_database(std::string database_path);
  34. };
  35. #endif //CPP_PCAPREADER_MAIN_H