Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 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/base/net_log.h" | |
| 16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 17 | 18 |
| 18 struct addrinfo; | 19 struct addrinfo; |
| 19 | 20 |
| 21 namespace base { | |
| 22 class Value; | |
|
eroman
2012/06/11 23:42:25
I believe net_log.h already declares this.
mmenke
2012/06/12 00:42:19
Done.
| |
| 23 } | |
| 24 | |
| 20 namespace net { | 25 namespace net { |
| 21 | 26 |
| 22 class NET_EXPORT AddressList | 27 class NET_EXPORT AddressList |
| 23 : NON_EXPORTED_BASE(private std::vector<IPEndPoint>) { | 28 : NON_EXPORTED_BASE(private std::vector<IPEndPoint>) { |
| 24 public: | 29 public: |
| 25 AddressList(); | 30 AddressList(); |
| 26 ~AddressList(); | 31 ~AddressList(); |
| 27 | 32 |
| 28 // Creates an address list for a single IP literal. | 33 // Creates an address list for a single IP literal. |
| 29 explicit AddressList(const IPEndPoint& endpoint); | 34 explicit AddressList(const IPEndPoint& endpoint); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 43 return canonical_name_; | 48 return canonical_name_; |
| 44 } | 49 } |
| 45 | 50 |
| 46 void set_canonical_name(const std::string& canonical_name) { | 51 void set_canonical_name(const std::string& canonical_name) { |
| 47 canonical_name_ = canonical_name; | 52 canonical_name_ = canonical_name; |
| 48 } | 53 } |
| 49 | 54 |
| 50 // Sets canonical name to the literal of the first IP address on the list. | 55 // Sets canonical name to the literal of the first IP address on the list. |
| 51 void SetDefaultCanonicalName(); | 56 void SetDefaultCanonicalName(); |
| 52 | 57 |
| 58 // Creates a Value for use with the NetLog containing the address list. | |
| 59 base::Value* NetLogCallback(NetLog::LogLevel log_level) const; | |
|
eroman
2012/06/11 23:42:25
Given the usecases of this, might consider making
mmenke
2012/06/12 00:42:19
Done, though used "CreateNetLogCallback" instead.
| |
| 60 | |
| 53 // Exposed methods from std::vector. | 61 // Exposed methods from std::vector. |
| 54 using std::vector<IPEndPoint>::size; | 62 using std::vector<IPEndPoint>::size; |
| 55 using std::vector<IPEndPoint>::empty; | 63 using std::vector<IPEndPoint>::empty; |
| 56 using std::vector<IPEndPoint>::clear; | 64 using std::vector<IPEndPoint>::clear; |
| 57 using std::vector<IPEndPoint>::reserve; | 65 using std::vector<IPEndPoint>::reserve; |
| 58 using std::vector<IPEndPoint>::capacity; | 66 using std::vector<IPEndPoint>::capacity; |
| 59 using std::vector<IPEndPoint>::operator[]; | 67 using std::vector<IPEndPoint>::operator[]; |
| 60 using std::vector<IPEndPoint>::front; | 68 using std::vector<IPEndPoint>::front; |
| 61 using std::vector<IPEndPoint>::back; | 69 using std::vector<IPEndPoint>::back; |
| 62 using std::vector<IPEndPoint>::push_back; | 70 using std::vector<IPEndPoint>::push_back; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 73 // TODO(szym): Remove. http://crbug.com/126134 | 81 // TODO(szym): Remove. http://crbug.com/126134 |
| 74 std::string canonical_name_; | 82 std::string canonical_name_; |
| 75 }; | 83 }; |
| 76 | 84 |
| 77 // Sets the port on each element in |list| to |port|. | 85 // Sets the port on each element in |list| to |port|. |
| 78 void NET_EXPORT SetPortOnAddressList(uint16 port, AddressList* list); | 86 void NET_EXPORT SetPortOnAddressList(uint16 port, AddressList* list); |
| 79 | 87 |
| 80 } // namespace net | 88 } // namespace net |
| 81 | 89 |
| 82 #endif // NET_BASE_ADDRESS_LIST_H_ | 90 #endif // NET_BASE_ADDRESS_LIST_H_ |
| OLD | NEW |