| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Finds the first allocation in the server allocation map with a source | 95 // Finds the first allocation in the server allocation map with a source |
| 96 // ip and port matching the socket address provided. | 96 // ip and port matching the socket address provided. |
| 97 TurnServerAllocation* FindAllocation(const rtc::SocketAddress& src) { | 97 TurnServerAllocation* FindAllocation(const rtc::SocketAddress& src) { |
| 98 const TurnServer::AllocationMap& map = server_.allocations(); | 98 const TurnServer::AllocationMap& map = server_.allocations(); |
| 99 for (TurnServer::AllocationMap::const_iterator it = map.begin(); | 99 for (TurnServer::AllocationMap::const_iterator it = map.begin(); |
| 100 it != map.end(); ++it) { | 100 it != map.end(); ++it) { |
| 101 if (src == it->first.src()) { | 101 if (src == it->first.src()) { |
| 102 return it->second; | 102 return it->second.get(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 return NULL; | 105 return NULL; |
| 106 } | 106 } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // For this test server, succeed if the password is the same as the username. | 109 // For this test server, succeed if the password is the same as the username. |
| 110 // Obviously, do not use this in a production environment. | 110 // Obviously, do not use this in a production environment. |
| 111 virtual bool GetKey(const std::string& username, const std::string& realm, | 111 virtual bool GetKey(const std::string& username, const std::string& realm, |
| 112 std::string* key) { | 112 std::string* key) { |
| 113 return ComputeStunCredentialHash(username, realm, username, key); | 113 return ComputeStunCredentialHash(username, realm, username, key); |
| 114 } | 114 } |
| 115 | 115 |
| 116 TurnServer server_; | 116 TurnServer server_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace cricket | 119 } // namespace cricket |
| 120 | 120 |
| 121 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ | 121 #endif // WEBRTC_P2P_BASE_TESTTURNSERVER_H_ |
| OLD | NEW |