Index: webrtc/p2p/base/turnserver.h |
diff --git a/webrtc/p2p/base/turnserver.h b/webrtc/p2p/base/turnserver.h |
index 113bd4c4623d06c118a1b05ede79bceee2d72ad6..44a8b3827899904b514e8f23742361466a36713e 100644 |
--- a/webrtc/p2p/base/turnserver.h |
+++ b/webrtc/p2p/base/turnserver.h |
@@ -199,8 +199,14 @@ class TurnServer : public sigslot::has_slots<> { |
// Specifies the factory to use for creating external sockets. |
void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, |
const rtc::SocketAddress& address); |
+ // For testing only. |
+ std::string SetTimestampForNextNonce(uint32_t timestamp) { |
+ ts_for_next_nonce_ = timestamp; |
+ return GenerateNonce(timestamp); |
+ } |
private: |
+ std::string GenerateNonce(uint32_t now) const; |
void OnInternalPacket(rtc::AsyncPacketSocket* socket, const char* data, |
size_t size, const rtc::SocketAddress& address, |
const rtc::PacketTime& packet_time); |
@@ -221,7 +227,6 @@ class TurnServer : public sigslot::has_slots<> { |
bool CheckAuthorization(TurnServerConnection* conn, const StunMessage* msg, |
const char* data, size_t size, |
const std::string& key); |
- std::string GenerateNonce() const; |
bool ValidateNonce(const std::string& nonce) const; |
TurnServerAllocation* FindAllocation(TurnServerConnection* conn); |
@@ -270,6 +275,10 @@ class TurnServer : public sigslot::has_slots<> { |
AllocationMap allocations_; |
+ // For testing only. If this is non-zero, the next NONCE will be generated |
+ // from this value, and it will be reset to 0 after generating the NONCE. |
+ uint32_t ts_for_next_nonce_ = 0; |
+ |
friend class TurnServerAllocation; |
}; |