utilities.h 934 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef UTILITIES_H
  2. #define UTILITIES_H
  3. #include <iostream>
  4. #include <fstream>
  5. #include <vector>
  6. #include <sstream>
  7. #include <chrono>
  8. #include <algorithm>
  9. #include <tins/tins.h>
  10. // Aidmar
  11. /**
  12. * Split a string.
  13. * @param str string to be splitted
  14. * @param delimiter delimiter to use in splitting
  15. * @return vector of substrings
  16. */
  17. /*std::vector<std::string> split(std::string str, char delimiter) {
  18. std::vector<std::string> internal;
  19. std::stringstream ss(str); // Turn the string into a stream.
  20. std::string tok;
  21. while(getline(ss, tok, delimiter)) {
  22. internal.push_back(tok);
  23. }
  24. return internal;
  25. }*/
  26. void split_str(const std::string& s, char delim,std::vector<std::string>& v);
  27. std::string getIPv4Class(std::string ipAddress);
  28. int getClosestIndex(std::vector<std::chrono::microseconds> v, std::chrono::microseconds refElem);
  29. void snifferIteratorIncrement(Tins::SnifferIterator& iterator);
  30. #endif //UTILITIES_H