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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "net/base/ip_endpoint.h" | 14 #include "net/base/ip_endpoint.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 #include "net/log/net_log.h" | 16 #include "net/log/net_log_parameters_callback.h" |
17 | 17 |
18 struct addrinfo; | 18 struct addrinfo; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 class IPAddress; | 22 class IPAddress; |
23 | 23 |
24 class NET_EXPORT AddressList { | 24 class NET_EXPORT AddressList { |
25 public: | 25 public: |
26 AddressList(); | 26 AddressList(); |
(...skipping 21 matching lines...) Expand all Loading... |
48 void set_canonical_name(const std::string& canonical_name) { | 48 void set_canonical_name(const std::string& canonical_name) { |
49 canonical_name_ = canonical_name; | 49 canonical_name_ = canonical_name; |
50 } | 50 } |
51 | 51 |
52 // Sets canonical name to the literal of the first IP address on the list. | 52 // Sets canonical name to the literal of the first IP address on the list. |
53 void SetDefaultCanonicalName(); | 53 void SetDefaultCanonicalName(); |
54 | 54 |
55 // Creates a callback for use with the NetLog that returns a Value | 55 // Creates a callback for use with the NetLog that returns a Value |
56 // representation of the address list. The callback must be destroyed before | 56 // representation of the address list. The callback must be destroyed before |
57 // |this| is. | 57 // |this| is. |
58 NetLog::ParametersCallback CreateNetLogCallback() const; | 58 NetLogParametersCallback CreateNetLogCallback() const; |
59 | 59 |
60 using iterator = std::vector<IPEndPoint>::iterator; | 60 using iterator = std::vector<IPEndPoint>::iterator; |
61 using const_iterator = std::vector<IPEndPoint>::const_iterator; | 61 using const_iterator = std::vector<IPEndPoint>::const_iterator; |
62 | 62 |
63 size_t size() const { return endpoints_.size(); } | 63 size_t size() const { return endpoints_.size(); } |
64 bool empty() const { return endpoints_.empty(); } | 64 bool empty() const { return endpoints_.empty(); } |
65 void clear() { endpoints_.clear(); } | 65 void clear() { endpoints_.clear(); } |
66 void reserve(size_t count) { endpoints_.reserve(count); } | 66 void reserve(size_t count) { endpoints_.reserve(count); } |
67 size_t capacity() const { return endpoints_.capacity(); } | 67 size_t capacity() const { return endpoints_.capacity(); } |
68 IPEndPoint& operator[](size_t index) { return endpoints_[index]; } | 68 IPEndPoint& operator[](size_t index) { return endpoints_[index]; } |
(...skipping 15 matching lines...) Expand all Loading... |
84 | 84 |
85 private: | 85 private: |
86 std::vector<IPEndPoint> endpoints_; | 86 std::vector<IPEndPoint> endpoints_; |
87 // TODO(szym): Remove. http://crbug.com/126134 | 87 // TODO(szym): Remove. http://crbug.com/126134 |
88 std::string canonical_name_; | 88 std::string canonical_name_; |
89 }; | 89 }; |
90 | 90 |
91 } // namespace net | 91 } // namespace net |
92 | 92 |
93 #endif // NET_BASE_ADDRESS_LIST_H_ | 93 #endif // NET_BASE_ADDRESS_LIST_H_ |
OLD | NEW |