| 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 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 class NET_EXPORT AddressList | 23 class NET_EXPORT AddressList |
| 23 : NON_EXPORTED_BASE(private std::vector<IPEndPoint>) { | 24 : NON_EXPORTED_BASE(private std::vector<IPEndPoint>) { |
| 24 public: | 25 public: |
| 25 AddressList(); | 26 AddressList(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 return canonical_name_; | 44 return canonical_name_; |
| 44 } | 45 } |
| 45 | 46 |
| 46 void set_canonical_name(const std::string& canonical_name) { | 47 void set_canonical_name(const std::string& canonical_name) { |
| 47 canonical_name_ = canonical_name; | 48 canonical_name_ = canonical_name; |
| 48 } | 49 } |
| 49 | 50 |
| 50 // Sets canonical name to the literal of the first IP address on the list. | 51 // Sets canonical name to the literal of the first IP address on the list. |
| 51 void SetDefaultCanonicalName(); | 52 void SetDefaultCanonicalName(); |
| 52 | 53 |
| 54 // Creates a callback for use with the NetLog that returns a Value |
| 55 // representation of the address list. The callback must be destroyed before |
| 56 // |this| is. |
| 57 NetLog::ParametersCallback CreateNetLogCallback() const; |
| 58 |
| 53 // Exposed methods from std::vector. | 59 // Exposed methods from std::vector. |
| 54 using std::vector<IPEndPoint>::size; | 60 using std::vector<IPEndPoint>::size; |
| 55 using std::vector<IPEndPoint>::empty; | 61 using std::vector<IPEndPoint>::empty; |
| 56 using std::vector<IPEndPoint>::clear; | 62 using std::vector<IPEndPoint>::clear; |
| 57 using std::vector<IPEndPoint>::reserve; | 63 using std::vector<IPEndPoint>::reserve; |
| 58 using std::vector<IPEndPoint>::capacity; | 64 using std::vector<IPEndPoint>::capacity; |
| 59 using std::vector<IPEndPoint>::operator[]; | 65 using std::vector<IPEndPoint>::operator[]; |
| 60 using std::vector<IPEndPoint>::front; | 66 using std::vector<IPEndPoint>::front; |
| 61 using std::vector<IPEndPoint>::back; | 67 using std::vector<IPEndPoint>::back; |
| 62 using std::vector<IPEndPoint>::push_back; | 68 using std::vector<IPEndPoint>::push_back; |
| 63 using std::vector<IPEndPoint>::insert; | 69 using std::vector<IPEndPoint>::insert; |
| 64 using std::vector<IPEndPoint>::erase; | 70 using std::vector<IPEndPoint>::erase; |
| 65 using std::vector<IPEndPoint>::iterator; | 71 using std::vector<IPEndPoint>::iterator; |
| 66 using std::vector<IPEndPoint>::const_iterator; | 72 using std::vector<IPEndPoint>::const_iterator; |
| 67 using std::vector<IPEndPoint>::begin; | 73 using std::vector<IPEndPoint>::begin; |
| 68 using std::vector<IPEndPoint>::end; | 74 using std::vector<IPEndPoint>::end; |
| 69 using std::vector<IPEndPoint>::rbegin; | 75 using std::vector<IPEndPoint>::rbegin; |
| 70 using std::vector<IPEndPoint>::rend; | 76 using std::vector<IPEndPoint>::rend; |
| 71 | 77 |
| 72 private: | 78 private: |
| 73 // TODO(szym): Remove. http://crbug.com/126134 | 79 // TODO(szym): Remove. http://crbug.com/126134 |
| 74 std::string canonical_name_; | 80 std::string canonical_name_; |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 // Sets the port on each element in |list| to |port|. | 83 // Sets the port on each element in |list| to |port|. |
| 78 void NET_EXPORT SetPortOnAddressList(uint16 port, AddressList* list); | 84 void NET_EXPORT SetPortOnAddressList(uint16 port, AddressList* list); |
| 79 | 85 |
| 80 } // namespace net | 86 } // namespace net |
| 81 | 87 |
| 82 #endif // NET_BASE_ADDRESS_LIST_H_ | 88 #endif // NET_BASE_ADDRESS_LIST_H_ |
| OLD | NEW |