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_BASE_ADDRESS_LIST_H_ | 5 #ifndef NET_BASE_ADDRESS_LIST_H_ |
6 #define NET_BASE_ADDRESS_LIST_H_ | 6 #define NET_BASE_ADDRESS_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 AddressList(); | 25 AddressList(); |
26 ~AddressList(); | 26 ~AddressList(); |
27 | 27 |
28 // Creates an address list for a single IP literal. | 28 // Creates an address list for a single IP literal. |
29 explicit AddressList(const IPEndPoint& endpoint); | 29 explicit AddressList(const IPEndPoint& endpoint); |
30 | 30 |
31 static AddressList CreateFromIPAddress(const IPAddressNumber& address, | 31 static AddressList CreateFromIPAddress(const IPAddressNumber& address, |
32 uint16 port); | 32 uint16 port); |
33 | 33 |
34 static AddressList CreateFromIPAddressList( | 34 static AddressList CreateFromIPAddressList(const IPAddressList& addresses, |
35 const IPAddressList& addresses, | 35 const std::string& canonical_name); |
36 const std::string& canonical_name); | |
37 | 36 |
38 // Copies the data from |head| and the chained list into an AddressList. | 37 // Copies the data from |head| and the chained list into an AddressList. |
39 static AddressList CreateFromAddrinfo(const struct addrinfo* head); | 38 static AddressList CreateFromAddrinfo(const struct addrinfo* head); |
40 | 39 |
41 // Returns a copy of |list| with port on each element set to |port|. | 40 // Returns a copy of |list| with port on each element set to |port|. |
42 static AddressList CopyWithPort(const AddressList& list, uint16 port); | 41 static AddressList CopyWithPort(const AddressList& list, uint16 port); |
43 | 42 |
44 // TODO(szym): Remove all three. http://crbug.com/126134 | 43 // TODO(szym): Remove all three. http://crbug.com/126134 |
45 const std::string& canonical_name() const { | 44 const std::string& canonical_name() const { return canonical_name_; } |
46 return canonical_name_; | |
47 } | |
48 | 45 |
49 void set_canonical_name(const std::string& canonical_name) { | 46 void set_canonical_name(const std::string& canonical_name) { |
50 canonical_name_ = canonical_name; | 47 canonical_name_ = canonical_name; |
51 } | 48 } |
52 | 49 |
53 // Sets canonical name to the literal of the first IP address on the list. | 50 // Sets canonical name to the literal of the first IP address on the list. |
54 void SetDefaultCanonicalName(); | 51 void SetDefaultCanonicalName(); |
55 | 52 |
56 // Creates a callback for use with the NetLog that returns a Value | 53 // Creates a callback for use with the NetLog that returns a Value |
57 // representation of the address list. The callback must be destroyed before | 54 // representation of the address list. The callback must be destroyed before |
(...skipping 20 matching lines...) Expand all Loading... |
78 using std::vector<IPEndPoint>::rend; | 75 using std::vector<IPEndPoint>::rend; |
79 | 76 |
80 private: | 77 private: |
81 // TODO(szym): Remove. http://crbug.com/126134 | 78 // TODO(szym): Remove. http://crbug.com/126134 |
82 std::string canonical_name_; | 79 std::string canonical_name_; |
83 }; | 80 }; |
84 | 81 |
85 } // namespace net | 82 } // namespace net |
86 | 83 |
87 #endif // NET_BASE_ADDRESS_LIST_H_ | 84 #endif // NET_BASE_ADDRESS_LIST_H_ |
OLD | NEW |