config_reader.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_
  11. #define RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_
  12. #include <fstream>
  13. #include <string>
  14. #include "absl/types/optional.h"
  15. #include "rtc_base/constructor_magic.h"
  16. #include "rtc_base/ignore_wundef.h"
  17. #ifdef WEBRTC_NETWORK_TESTER_PROTO
  18. RTC_PUSH_IGNORING_WUNDEF()
  19. #include "rtc_tools/network_tester/network_tester_config.pb.h"
  20. RTC_POP_IGNORING_WUNDEF()
  21. using webrtc::network_tester::config::NetworkTesterAllConfigs;
  22. #else
  23. class NetworkTesterConfigs;
  24. #endif // WEBRTC_NETWORK_TESTER_PROTO
  25. namespace webrtc {
  26. class ConfigReader {
  27. public:
  28. struct Config {
  29. int packet_send_interval_ms;
  30. int packet_size;
  31. int execution_time_ms;
  32. };
  33. explicit ConfigReader(const std::string& config_file_path);
  34. ~ConfigReader();
  35. absl::optional<Config> GetNextConfig();
  36. private:
  37. NetworkTesterAllConfigs proto_all_configs_;
  38. int proto_config_index_;
  39. RTC_DISALLOW_COPY_AND_ASSIGN(ConfigReader);
  40. };
  41. } // namespace webrtc
  42. #endif // RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_