chromium/remoting/host/heartbeat_sender.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/host/heartbeat_sender.h"

#include <math.h>

#include <cstdint>
#include <utility>

#include "base/functional/bind.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringize_macros.h"
#include "base/system/sys_info.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "net/base/network_interfaces.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/base/constants.h"
#include "remoting/base/fqdn.h"
#include "remoting/base/logging.h"
#include "remoting/base/protobuf_http_client.h"
#include "remoting/base/protobuf_http_request.h"
#include "remoting/base/protobuf_http_request_config.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/base/service_urls.h"
#include "remoting/host/host_config.h"
#include "remoting/host/host_details.h"
#include "remoting/host/server_log_entry_host.h"
#include "remoting/signaling/ftl_signal_strategy.h"
#include "remoting/signaling/signaling_address.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"

namespace remoting {

namespace {

constexpr char kLegacyHeartbeatPath[] =;
constexpr char kSendHeartbeatPath[] =;

constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =;

constexpr base::TimeDelta kMinimumHeartbeatInterval =;
constexpr base::TimeDelta kHeartbeatResponseTimeout =;
constexpr base::TimeDelta kResendDelayOnHostNotFound =;
constexpr base::TimeDelta kResendDelayOnUnauthenticated =;

constexpr int kMaxResendOnHostNotFoundCount =;  // 2 minutes (12 x 10 seconds).
constexpr int kMaxResendOnUnauthenticatedCount =;  // 1 minute (10 x 6 seconds).

const net::BackoffEntry::Policy kBackoffPolicy =;

}  // namespace

class HeartbeatSender::HeartbeatClientImpl final
    : public HeartbeatSender::HeartbeatClient {};

HeartbeatSender::HeartbeatClientImpl::HeartbeatClientImpl(
    OAuthTokenGetter* oauth_token_getter,
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
    :{}

HeartbeatSender::HeartbeatClientImpl::~HeartbeatClientImpl() = default;

void HeartbeatSender::HeartbeatClientImpl::LegacyHeartbeat(
    std::unique_ptr<apis::v1::HeartbeatRequest> request,
    LegacyHeartbeatResponseCallback callback) {}

void HeartbeatSender::HeartbeatClientImpl::SendHeartbeat(
    std::unique_ptr<apis::v1::SendHeartbeatRequest> request,
    SendHeartbeatResponseCallback callback) {}

void HeartbeatSender::HeartbeatClientImpl::CancelPendingRequests() {}

// end of HeartbeatSender::HeartbeatClientImpl

HeartbeatSender::HeartbeatSender(
    Delegate* delegate,
    const std::string& host_id,
    SignalStrategy* signal_strategy,
    OAuthTokenGetter* oauth_token_getter,
    Observer* observer,
    scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
    bool set_fqdn)
    :{}

HeartbeatSender::~HeartbeatSender() {}

void HeartbeatSender::SetHostOfflineReason(
    const std::string& host_offline_reason,
    const base::TimeDelta& timeout,
    base::OnceCallback<void(bool success)> ack_callback) {}

void HeartbeatSender::OnSignalStrategyStateChange(SignalStrategy::State state) {}

bool HeartbeatSender::OnSignalStrategyIncomingStanza(
    const jingle_xmpp::XmlElement* stanza) {}

void HeartbeatSender::OnHostOfflineReasonTimeout() {}

void HeartbeatSender::OnHostOfflineReasonAck() {}

void HeartbeatSender::ClearHeartbeatTimer() {}

void HeartbeatSender::SendFullHeartbeat() {}

void HeartbeatSender::SendLiteHeartbeat(bool useLiteHeartbeat) {}

bool HeartbeatSender::CheckHttpStatus(const ProtobufHttpStatus& status) {}

base::TimeDelta HeartbeatSender::CalculateDelay(
    const ProtobufHttpStatus& status,
    std::optional<base::TimeDelta> optMinDelay) {}

void HeartbeatSender::OnLegacyHeartbeatResponse(
    const ProtobufHttpStatus& status,
    std::unique_ptr<apis::v1::HeartbeatResponse> response) {}

void HeartbeatSender::OnSendHeartbeatResponse(
    const ProtobufHttpStatus& status,
    std::unique_ptr<apis::v1::SendHeartbeatResponse> response) {}

std::unique_ptr<apis::v1::HeartbeatRequest>
HeartbeatSender::CreateLegacyHeartbeatRequest() {}

std::unique_ptr<apis::v1::SendHeartbeatRequest>
HeartbeatSender::CreateSendHeartbeatRequest() {}

}  // namespace remoting