• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 #ifndef RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_
12 #define RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_
13 
14 #include <fstream>
15 #include <string>
16 
17 #include "absl/types/optional.h"
18 #include "rtc_base/constructor_magic.h"
19 #include "rtc_base/ignore_wundef.h"
20 
21 #ifdef WEBRTC_NETWORK_TESTER_PROTO
22 RTC_PUSH_IGNORING_WUNDEF()
23 #include "rtc_tools/network_tester/network_tester_config.pb.h"
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 
42   absl::optional<Config> GetNextConfig();
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 
52 #endif  // RTC_TOOLS_NETWORK_TESTER_CONFIG_READER_H_
53