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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 ProtocolType proto); | 193 ProtocolType proto); |
194 // Starts listening for the connections on this socket. When someone tries | 194 // Starts listening for the connections on this socket. When someone tries |
195 // to connect, the connection will be accepted and a new internal socket | 195 // to connect, the connection will be accepted and a new internal socket |
196 // will be added. | 196 // will be added. |
197 void AddInternalServerSocket(rtc::AsyncSocket* socket, | 197 void AddInternalServerSocket(rtc::AsyncSocket* socket, |
198 ProtocolType proto); | 198 ProtocolType proto); |
199 // Specifies the factory to use for creating external sockets. | 199 // Specifies the factory to use for creating external sockets. |
200 void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, | 200 void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, |
201 const rtc::SocketAddress& address); | 201 const rtc::SocketAddress& address); |
202 // For testing only. | 202 // For testing only. |
203 std::string SetTimestampForNextNonce(uint32_t timestamp) { | 203 std::string SetTimestampForNextNonce(int64_t timestamp) { |
204 ts_for_next_nonce_ = timestamp; | 204 ts_for_next_nonce_ = timestamp; |
205 return GenerateNonce(timestamp); | 205 return GenerateNonce(timestamp); |
206 } | 206 } |
207 | 207 |
208 private: | 208 private: |
209 std::string GenerateNonce(uint32_t now) const; | 209 std::string GenerateNonce(int64_t now) const; |
210 void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data, | 210 void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data, |
211 size_t size, const rtc::SocketAddress& address, | 211 size_t size, const rtc::SocketAddress& address, |
212 const rtc::PacketTime& packet_time); | 212 const rtc::PacketTime& packet_time); |
213 | 213 |
214 void OnNewInternalConnection(rtc::AsyncSocket* socket); | 214 void OnNewInternalConnection(rtc::AsyncSocket* socket); |
215 | 215 |
216 // Accept connections on this server socket. | 216 // Accept connections on this server socket. |
217 void AcceptConnection(rtc::AsyncSocket* server_socket); | 217 void AcceptConnection(rtc::AsyncSocket* server_socket); |
218 void OnInternalSocketClose(rtc::AsyncPacketSocket* socket, int err); | 218 void OnInternalSocketClose(rtc::AsyncPacketSocket* socket, int err); |
219 | 219 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 InternalSocketMap server_sockets_; | 270 InternalSocketMap server_sockets_; |
271 ServerSocketMap server_listen_sockets_; | 271 ServerSocketMap server_listen_sockets_; |
272 rtc::scoped_ptr<rtc::PacketSocketFactory> | 272 rtc::scoped_ptr<rtc::PacketSocketFactory> |
273 external_socket_factory_; | 273 external_socket_factory_; |
274 rtc::SocketAddress external_addr_; | 274 rtc::SocketAddress external_addr_; |
275 | 275 |
276 AllocationMap allocations_; | 276 AllocationMap allocations_; |
277 | 277 |
278 // For testing only. If this is non-zero, the next NONCE will be generated | 278 // For testing only. If this is non-zero, the next NONCE will be generated |
279 // from this value, and it will be reset to 0 after generating the NONCE. | 279 // from this value, and it will be reset to 0 after generating the NONCE. |
280 uint32_t ts_for_next_nonce_ = 0; | 280 int64_t ts_for_next_nonce_ = 0; |
281 | 281 |
282 friend class TurnServerAllocation; | 282 friend class TurnServerAllocation; |
283 }; | 283 }; |
284 | 284 |
285 } // namespace cricket | 285 } // namespace cricket |
286 | 286 |
287 #endif // WEBRTC_P2P_BASE_TURNSERVER_H_ | 287 #endif // WEBRTC_P2P_BASE_TURNSERVER_H_ |
OLD | NEW |