#include "talk/p2p/base/stunrequest.h"
-#include "talk/base/common.h"
-#include "talk/base/helpers.h"
-#include "talk/base/logging.h"
+#include "webrtc/base/common.h"
+#include "webrtc/base/helpers.h"
+#include "webrtc/base/logging.h"
namespace cricket {
const int DELAY_UNIT = 100; // 100 milliseconds
const int DELAY_MAX_FACTOR = 16;
-StunRequestManager::StunRequestManager(talk_base::Thread* thread)
+StunRequestManager::StunRequestManager(rtc::Thread* thread)
: thread_(thread) {
}
// Parse the STUN message and continue processing as usual.
- talk_base::ByteBuffer buf(data, size);
- talk_base::scoped_ptr<StunMessage> response(iter->second->msg_->CreateNew());
+ rtc::ByteBuffer buf(data, size);
+ rtc::scoped_ptr<StunMessage> response(iter->second->msg_->CreateNew());
if (!response->Read(&buf))
return false;
: count_(0), timeout_(false), manager_(0),
msg_(new StunMessage()), tstamp_(0) {
msg_->SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
}
StunRequest::StunRequest(StunMessage* request)
: count_(0), timeout_(false), manager_(0),
msg_(request), tstamp_(0) {
msg_->SetTransactionID(
- talk_base::CreateRandomString(kStunTransactionIdLength));
+ rtc::CreateRandomString(kStunTransactionIdLength));
}
StunRequest::~StunRequest() {
}
uint32 StunRequest::Elapsed() const {
- return talk_base::TimeSince(tstamp_);
+ return rtc::TimeSince(tstamp_);
}
manager_ = manager;
}
-void StunRequest::OnMessage(talk_base::Message* pmsg) {
+void StunRequest::OnMessage(rtc::Message* pmsg) {
ASSERT(manager_ != NULL);
ASSERT(pmsg->message_id == MSG_STUN_SEND);
return;
}
- tstamp_ = talk_base::Time();
+ tstamp_ = rtc::Time();
- talk_base::ByteBuffer buf;
+ rtc::ByteBuffer buf;
msg_->Write(&buf);
manager_->SignalSendPacket(buf.Data(), buf.Length(), this);
}
int StunRequest::GetNextDelay() {
- int delay = DELAY_UNIT * talk_base::_min(1 << count_, DELAY_MAX_FACTOR);
+ int delay = DELAY_UNIT * rtc::_min(1 << count_, DELAY_MAX_FACTOR);
count_ += 1;
if (count_ == MAX_SENDS)
timeout_ = true;