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_ADDRESS_SORTER_POSIX_H_ | 5 #ifndef NET_DNS_ADDRESS_SORTER_POSIX_H_ |
6 #define NET_DNS_ADDRESS_SORTER_POSIX_H_ | 6 #define NET_DNS_ADDRESS_SORTER_POSIX_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // This implementation uses explicit policy to perform the sorting. It is not | 23 // This implementation uses explicit policy to perform the sorting. It is not |
24 // thread-safe and always completes synchronously. | 24 // thread-safe and always completes synchronously. |
25 class NET_EXPORT_PRIVATE AddressSorterPosix | 25 class NET_EXPORT_PRIVATE AddressSorterPosix |
26 : public AddressSorter, | 26 : public AddressSorter, |
27 public base::NonThreadSafe, | 27 public base::NonThreadSafe, |
28 public NetworkChangeNotifier::IPAddressObserver { | 28 public NetworkChangeNotifier::IPAddressObserver { |
29 public: | 29 public: |
30 // Generic policy entry. | 30 // Generic policy entry. |
31 struct PolicyEntry { | 31 struct PolicyEntry { |
32 // IPv4 addresses must be mapped to IPv6. | 32 // IPv4 addresses must be mapped to IPv6. |
33 unsigned char prefix[kIPv6AddressSize]; | 33 unsigned char prefix[IPAddress::kIPv6AddressSize]; |
34 unsigned prefix_length; | 34 unsigned prefix_length; |
35 unsigned value; | 35 unsigned value; |
36 }; | 36 }; |
37 | 37 |
38 typedef std::vector<PolicyEntry> PolicyTable; | 38 typedef std::vector<PolicyEntry> PolicyTable; |
39 | 39 |
40 enum AddressScope { | 40 enum AddressScope { |
41 SCOPE_UNDEFINED = 0, | 41 SCOPE_UNDEFINED = 0, |
42 SCOPE_NODELOCAL = 1, | 42 SCOPE_NODELOCAL = 1, |
43 SCOPE_LINKLOCAL = 2, | 43 SCOPE_LINKLOCAL = 2, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 PolicyTable precedence_table_; | 84 PolicyTable precedence_table_; |
85 PolicyTable label_table_; | 85 PolicyTable label_table_; |
86 PolicyTable ipv4_scope_table_; | 86 PolicyTable ipv4_scope_table_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(AddressSorterPosix); | 88 DISALLOW_COPY_AND_ASSIGN(AddressSorterPosix); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace net | 91 } // namespace net |
92 | 92 |
93 #endif // NET_DNS_ADDRESS_SORTER_POSIX_H_ | 93 #endif // NET_DNS_ADDRESS_SORTER_POSIX_H_ |
OLD | NEW |