OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_H_ | 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_H_ |
6 #define NET_DNS_DNS_CONFIG_SERVICE_H_ | 6 #define NET_DNS_DNS_CONFIG_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 bool EqualsIgnoreHosts(const DnsConfig& d) const; | 73 bool EqualsIgnoreHosts(const DnsConfig& d) const; |
74 | 74 |
75 void CopyIgnoreHosts(const DnsConfig& src); | 75 void CopyIgnoreHosts(const DnsConfig& src); |
76 | 76 |
77 // Returns a Value representation of |this|. Caller takes ownership of the | 77 // Returns a Value representation of |this|. Caller takes ownership of the |
78 // returned Value. For performance reasons, the Value only contains the | 78 // returned Value. For performance reasons, the Value only contains the |
79 // number of hosts rather than the full list. | 79 // number of hosts rather than the full list. |
80 base::Value* ToValue() const; | 80 base::Value* ToValue() const; |
81 | 81 |
82 bool IsValid() const { | 82 bool IsValid() const { return !nameservers.empty(); } |
83 return !nameservers.empty(); | |
84 } | |
85 | 83 |
86 // List of name server addresses. | 84 // List of name server addresses. |
87 std::vector<IPEndPoint> nameservers; | 85 std::vector<IPEndPoint> nameservers; |
88 // Suffix search list; used on first lookup when number of dots in given name | 86 // Suffix search list; used on first lookup when number of dots in given name |
89 // is less than |ndots|. | 87 // is less than |ndots|. |
90 std::vector<std::string> search; | 88 std::vector<std::string> search; |
91 | 89 |
92 DnsHosts hosts; | 90 DnsHosts hosts; |
93 | 91 |
94 // True if there are options set in the system configuration that are not yet | 92 // True if there are options set in the system configuration that are not yet |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 protected: | 148 protected: |
151 enum WatchStatus { | 149 enum WatchStatus { |
152 DNS_CONFIG_WATCH_STARTED = 0, | 150 DNS_CONFIG_WATCH_STARTED = 0, |
153 DNS_CONFIG_WATCH_FAILED_TO_START_CONFIG, | 151 DNS_CONFIG_WATCH_FAILED_TO_START_CONFIG, |
154 DNS_CONFIG_WATCH_FAILED_TO_START_HOSTS, | 152 DNS_CONFIG_WATCH_FAILED_TO_START_HOSTS, |
155 DNS_CONFIG_WATCH_FAILED_CONFIG, | 153 DNS_CONFIG_WATCH_FAILED_CONFIG, |
156 DNS_CONFIG_WATCH_FAILED_HOSTS, | 154 DNS_CONFIG_WATCH_FAILED_HOSTS, |
157 DNS_CONFIG_WATCH_MAX, | 155 DNS_CONFIG_WATCH_MAX, |
158 }; | 156 }; |
159 | 157 |
160 // Immediately attempts to read the current configuration. | 158 // Immediately attempts to read the current configuration. |
161 virtual void ReadNow() = 0; | 159 virtual void ReadNow() = 0; |
162 // Registers system watchers. Returns true iff succeeds. | 160 // Registers system watchers. Returns true iff succeeds. |
163 virtual bool StartWatching() = 0; | 161 virtual bool StartWatching() = 0; |
164 | 162 |
165 // Called when the current config (except hosts) has changed. | 163 // Called when the current config (except hosts) has changed. |
166 void InvalidateConfig(); | 164 void InvalidateConfig(); |
167 // Called when the current hosts have changed. | 165 // Called when the current hosts have changed. |
168 void InvalidateHosts(); | 166 void InvalidateHosts(); |
169 | 167 |
170 // Called with new config. |config|.hosts is ignored. | 168 // Called with new config. |config|.hosts is ignored. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 base::OneShotTimer<DnsConfigService> timer_; | 205 base::OneShotTimer<DnsConfigService> timer_; |
208 | 206 |
209 NameServerClassifier classifier_; | 207 NameServerClassifier classifier_; |
210 | 208 |
211 DISALLOW_COPY_AND_ASSIGN(DnsConfigService); | 209 DISALLOW_COPY_AND_ASSIGN(DnsConfigService); |
212 }; | 210 }; |
213 | 211 |
214 } // namespace net | 212 } // namespace net |
215 | 213 |
216 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ | 214 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ |
OLD | NEW |