minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_ |
| 12 | #define RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_ |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 13 | |
| 14 | #include <fstream> |
| 15 | #include <string> |
| 16 | |
Danil Chapovalov | 431abd9 | 2018-06-18 12:54:17 +0200 | [diff] [blame] | 17 | #include "absl/types/optional.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 18 | #include "rtc_base/constructor_magic.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 19 | #include "rtc_base/ignore_wundef.h" |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 20 | |
| 21 | #ifdef WEBRTC_NETWORK_TESTER_PROTO |
| 22 | RTC_PUSH_IGNORING_WUNDEF() |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 23 | #include "rtc_tools/network_tester/network_tester_config.pb.h" |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 24 | RTC_POP_IGNORING_WUNDEF() |
| 25 | using webrtc::network_tester::config::NetworkTesterAllConfigs; |
| 26 | #else |
| 27 | class NetworkTesterConfigs; |
| 28 | #endif // WEBRTC_NETWORK_TESTER_PROTO |
| 29 | |
| 30 | namespace webrtc { |
| 31 | |
| 32 | class ConfigReader { |
| 33 | public: |
| 34 | struct Config { |
| 35 | int packet_send_interval_ms; |
| 36 | int packet_size; |
| 37 | int execution_time_ms; |
| 38 | }; |
| 39 | explicit ConfigReader(const std::string& config_file_path); |
| 40 | ~ConfigReader(); |
| 41 | |
Danil Chapovalov | 431abd9 | 2018-06-18 12:54:17 +0200 | [diff] [blame] | 42 | absl::optional<Config> GetNextConfig(); |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | NetworkTesterAllConfigs proto_all_configs_; |
| 46 | int proto_config_index_; |
| 47 | RTC_DISALLOW_COPY_AND_ASSIGN(ConfigReader); |
| 48 | }; |
| 49 | |
| 50 | } // namespace webrtc |
| 51 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 52 | #endif // RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_ |