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_WIN_H_ | 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
6 #define NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ | 6 #define NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
7 | 7 |
8 // The sole purpose of dns_config_service_win.h is for unittests so we just | 8 // The sole purpose of dns_config_service_win.h is for unittests so we just |
9 // include these headers here. | 9 // include these headers here. |
10 #include <winsock2.h> | 10 #include <winsock2.h> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 // but on earlier versions it is insufficient. | 27 // but on earlier versions it is insufficient. |
28 // | 28 // |
29 // Experimental evaluation of Windows behavior suggests that domain parsing is | 29 // Experimental evaluation of Windows behavior suggests that domain parsing is |
30 // naive. Domain suffixes in |search| are not validated until they are appended | 30 // naive. Domain suffixes in |search| are not validated until they are appended |
31 // to the resolved name. We attempt to replicate this behavior. | 31 // to the resolved name. We attempt to replicate this behavior. |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // Registry key paths. | |
38 const wchar_t* const kTcpipPath = | |
39 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"; | |
40 const wchar_t* const kTcpip6Path = | |
41 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters"; | |
42 const wchar_t* const kDnscachePath = | |
43 L"SYSTEM\\CurrentControlSet\\Services\\Dnscache\\Parameters"; | |
44 const wchar_t* const kPolicyPath = | |
45 L"SOFTWARE\\Policies\\Microsoft\\Windows NT\\DNSClient"; | |
46 | |
47 // Returns the path to the HOSTS file. | |
48 base::FilePath GetHostsPath(); | |
49 | |
50 // Parses |value| as search list (comma-delimited list of domain names) from | 37 // Parses |value| as search list (comma-delimited list of domain names) from |
51 // a registry key and stores it in |out|. Returns true on success. Empty | 38 // a registry key and stores it in |out|. Returns true on success. Empty |
52 // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames | 39 // entries (e.g., "chromium.org,,org") terminate the list. Non-ascii hostnames |
53 // are converted to punycode. | 40 // are converted to punycode. |
54 bool NET_EXPORT_PRIVATE ParseSearchList(const base::string16& value, | 41 bool NET_EXPORT_PRIVATE ParseSearchList(const base::string16& value, |
55 std::vector<std::string>* out); | 42 std::vector<std::string>* out); |
56 | 43 |
57 // All relevant settings read from registry and IP Helper. This isolates our | 44 // All relevant settings read from registry and IP Helper. This isolates our |
58 // logic from system calls and is exposed for unit tests. Keep it an aggregate | 45 // logic from system calls and is exposed for unit tests. Keep it an aggregate |
59 // struct for easy initialization. | 46 // struct for easy initialization. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 78 |
92 // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient | 79 // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient |
93 DevolutionSetting policy_devolution; | 80 DevolutionSetting policy_devolution; |
94 // SYSTEM\CurrentControlSet\Dnscache\Parameters | 81 // SYSTEM\CurrentControlSet\Dnscache\Parameters |
95 DevolutionSetting dnscache_devolution; | 82 DevolutionSetting dnscache_devolution; |
96 // SYSTEM\CurrentControlSet\Tcpip\Parameters | 83 // SYSTEM\CurrentControlSet\Tcpip\Parameters |
97 DevolutionSetting tcpip_devolution; | 84 DevolutionSetting tcpip_devolution; |
98 | 85 |
99 // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\AppendToMultiLabelName | 86 // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\AppendToMultiLabelName |
100 RegDword append_to_multi_label_name; | 87 RegDword append_to_multi_label_name; |
88 | |
89 // True when the Name Resolution Policy Table (NRPT) has at least one rule: | |
90 // SOFTWARE\Policies\Microsoft\Windows NT\DNSClient\DnsPolicyConfig\Rule* | |
91 bool have_name_resolution_policy; | |
101 }; | 92 }; |
102 | 93 |
103 enum ConfigParseWinResult { | 94 enum ConfigParseWinResult { |
104 CONFIG_PARSE_WIN_OK = 0, | 95 CONFIG_PARSE_WIN_OK = 0, |
105 CONFIG_PARSE_WIN_READ_IPHELPER, | 96 CONFIG_PARSE_WIN_READ_IPHELPER, |
106 CONFIG_PARSE_WIN_READ_POLICY_SEARCHLIST, | 97 CONFIG_PARSE_WIN_READ_POLICY_SEARCHLIST, |
107 CONFIG_PARSE_WIN_READ_TCPIP_SEARCHLIST, | 98 CONFIG_PARSE_WIN_READ_TCPIP_SEARCHLIST, |
108 CONFIG_PARSE_WIN_READ_DOMAIN, | 99 CONFIG_PARSE_WIN_READ_DOMAIN, |
109 CONFIG_PARSE_WIN_READ_POLICY_DEVOLUTION, | 100 CONFIG_PARSE_WIN_READ_POLICY_DEVOLUTION, |
110 CONFIG_PARSE_WIN_READ_DNSCACHE_DEVOLUTION, | 101 CONFIG_PARSE_WIN_READ_DNSCACHE_DEVOLUTION, |
111 CONFIG_PARSE_WIN_READ_TCPIP_DEVOLUTION, | 102 CONFIG_PARSE_WIN_READ_TCPIP_DEVOLUTION, |
112 CONFIG_PARSE_WIN_READ_APPEND_MULTILABEL, | 103 CONFIG_PARSE_WIN_READ_APPEND_MULTILABEL, |
113 CONFIG_PARSE_WIN_READ_PRIMARY_SUFFIX, | 104 CONFIG_PARSE_WIN_READ_PRIMARY_SUFFIX, |
114 CONFIG_PARSE_WIN_BAD_ADDRESS, | 105 CONFIG_PARSE_WIN_BAD_ADDRESS, |
115 CONFIG_PARSE_WIN_NO_NAMESERVERS, | 106 CONFIG_PARSE_WIN_NO_NAMESERVERS, |
107 CONFIG_PARSE_WIN_UNHANDLED_OPTIONS, | |
cbentzel
2013/09/16 10:11:50
Did you add this new value simply to see UMA for h
mmenke
2013/09/16 16:34:46
You should add this to histograms.xml in this CL,
szym
2013/09/16 19:17:35
The CL initially had it, but I removed it so that
szym
2013/09/16 19:17:35
Yes. This follows dns_config_service_posix.*
| |
116 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. | 108 CONFIG_PARSE_WIN_MAX // Bounding values for enumeration. |
117 }; | 109 }; |
118 | 110 |
119 // Fills in |dns_config| from |settings|. Exposed for tests. | 111 // Fills in |dns_config| from |settings|. Exposed for tests. |
120 ConfigParseWinResult NET_EXPORT_PRIVATE ConvertSettingsToDnsConfig( | 112 ConfigParseWinResult NET_EXPORT_PRIVATE ConvertSettingsToDnsConfig( |
121 const DnsSystemSettings& settings, | 113 const DnsSystemSettings& settings, |
122 DnsConfig* dns_config); | 114 DnsConfig* dns_config); |
123 | 115 |
124 // Use DnsConfigService::CreateSystemService to use it outside of tests. | 116 // Use DnsConfigService::CreateSystemService to use it outside of tests. |
125 class NET_EXPORT_PRIVATE DnsConfigServiceWin : public DnsConfigService { | 117 class NET_EXPORT_PRIVATE DnsConfigServiceWin : public DnsConfigService { |
(...skipping 19 matching lines...) Expand all Loading... | |
145 | 137 |
146 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); | 138 DISALLOW_COPY_AND_ASSIGN(DnsConfigServiceWin); |
147 }; | 139 }; |
148 | 140 |
149 } // namespace internal | 141 } // namespace internal |
150 | 142 |
151 } // namespace net | 143 } // namespace net |
152 | 144 |
153 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ | 145 #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ |
154 | 146 |
OLD | NEW |