chromium/third_party/webrtc/p2p/base/stun_request.cc

/*
 *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "p2p/base/stun_request.h"

#include <algorithm>
#include <memory>
#include <utility>
#include <vector>

#include "absl/memory/memory.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/checks.h"
#include "rtc_base/crypto_random.h"
#include "rtc_base/logging.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/time_utils.h"  // For TimeMillis

namespace cricket {
SafeTask;

// RFC 5389 says SHOULD be 500ms.
// For years, this was 100ms, but for networks that
// experience moments of high RTT (such as 2G networks), this doesn't
// work well.
const int STUN_INITIAL_RTO =;  // milliseconds

// The timeout doubles each retransmission, up to this many times
// RFC 5389 says SHOULD retransmit 7 times.
// This has been 8 for years (not sure why).
const int STUN_MAX_RETRANSMISSIONS =;  // Total sends: 9

// We also cap the doubling, even though the standard doesn't say to.
// This has been 1.6 seconds for years, but for networks that
// experience moments of high RTT (such as 2G networks), this doesn't
// work well.
const int STUN_MAX_RTO =;  // milliseconds, or 5 doublings

StunRequestManager::StunRequestManager(
    webrtc::TaskQueueBase* thread,
    std::function<void(const void*, size_t, StunRequest*)> send_packet)
    :{}

StunRequestManager::~StunRequestManager() = default;

void StunRequestManager::Send(StunRequest* request) {}

void StunRequestManager::SendDelayed(StunRequest* request, int delay) {}

void StunRequestManager::FlushForTest(int msg_type) {}

bool StunRequestManager::HasRequestForTest(int msg_type) {}

void StunRequestManager::Clear() {}

bool StunRequestManager::CheckResponse(StunMessage* msg) {}

bool StunRequestManager::empty() const {}

bool StunRequestManager::CheckResponse(const char* data, size_t size) {}

void StunRequestManager::OnRequestTimedOut(StunRequest* request) {}

void StunRequestManager::SendPacket(const void* data,
                                    size_t size,
                                    StunRequest* request) {}

StunRequest::StunRequest(StunRequestManager& manager)
    :{}

StunRequest::StunRequest(StunRequestManager& manager,
                         std::unique_ptr<StunMessage> message)
    :{}

StunRequest::~StunRequest() {}

int StunRequest::type() {}

const StunMessage* StunRequest::msg() const {}

int StunRequest::Elapsed() const {}

void StunRequest::SendInternal() {}

void StunRequest::SendDelayed(webrtc::TimeDelta delay) {}

void StunRequest::Send(webrtc::TimeDelta delay) {}

void StunRequest::ResetTasksForTest() {}

void StunRequest::OnSent() {}

int StunRequest::resend_delay() {}

void StunRequest::set_timed_out() {}

}  // namespace cricket