Vitaly Buka | 7ce499f | 2015-06-09 08:04:11 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BUFFET_PRIVET_PRIVETD_CONF_PARSER_H_ |
| 6 | #define BUFFET_PRIVET_PRIVETD_CONF_PARSER_H_ |
| 7 | |
| 8 | #include <set> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <chromeos/key_value_store.h> |
| 12 | |
| 13 | namespace privetd { |
| 14 | |
| 15 | extern const char kWiFiBootstrapInterfaces[]; |
| 16 | |
| 17 | enum class WiFiBootstrapMode { |
| 18 | kDisabled, |
| 19 | kManual, |
| 20 | kAutomatic, |
| 21 | }; |
| 22 | |
| 23 | enum class GcdBootstrapMode { |
| 24 | kDisabled, |
| 25 | kManual, |
| 26 | kAutomatic, |
| 27 | }; |
| 28 | |
| 29 | enum class PairingType; |
| 30 | |
| 31 | class PrivetdConfigParser final { |
| 32 | public: |
| 33 | PrivetdConfigParser(); |
| 34 | |
| 35 | bool Parse(const chromeos::KeyValueStore& config_store); |
| 36 | |
| 37 | WiFiBootstrapMode wifi_bootstrap_mode() const { return wifi_bootstrap_mode_; } |
| 38 | GcdBootstrapMode gcd_bootstrap_mode() const { return gcd_bootstrap_mode_; } |
| 39 | const std::set<std::string>& automatic_wifi_interfaces() const { |
| 40 | return automatic_wifi_interfaces_; |
| 41 | } |
| 42 | uint32_t connect_timeout_seconds() const { return connect_timeout_seconds_; } |
| 43 | uint32_t bootstrap_timeout_seconds() const { |
| 44 | return bootstrap_timeout_seconds_; |
| 45 | } |
| 46 | uint32_t monitor_timeout_seconds() const { return monitor_timeout_seconds_; } |
| 47 | const std::set<PairingType>& pairing_modes() { return pairing_modes_; } |
| 48 | const base::FilePath& embedded_code_path() const { |
| 49 | return embedded_code_path_; |
| 50 | } |
| 51 | |
| 52 | private: |
| 53 | WiFiBootstrapMode wifi_bootstrap_mode_; |
| 54 | GcdBootstrapMode gcd_bootstrap_mode_; |
| 55 | std::set<std::string> automatic_wifi_interfaces_; |
| 56 | uint32_t connect_timeout_seconds_; |
| 57 | uint32_t bootstrap_timeout_seconds_; |
| 58 | uint32_t monitor_timeout_seconds_; |
| 59 | std::set<PairingType> pairing_modes_; |
| 60 | base::FilePath embedded_code_path_; |
| 61 | }; |
| 62 | |
| 63 | } // namespace privetd |
| 64 | |
| 65 | #endif // BUFFET_PRIVET_PRIVETD_CONF_PARSER_H_ |