chromium/remoting/proto/internal_stubs.h

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

#ifndef REMOTING_PROTO_INTERNAL_STUBS_H_
#define REMOTING_PROTO_INTERNAL_STUBS_H_

#include <memory>
#include <optional>
#include <string>

#include "remoting/proto/logging_service.h"
#include "remoting/proto/session_authz_service.h"
#include "third_party/protobuf/src/google/protobuf/message_lite.h"

// This file defines proto and function stubs for internal-only implementations.
// This will allow us to build most of our code in Chromium rather than put
// everything in //remoting/internal which is only built on official builders.
namespace remoting::internal {

// Base proto used for aliasing.
class DoNothingProto : public google::protobuf::MessageLite {};

// Aliases for internal protos.
RemoteAccessHostV1Proto;

// ===========================
// RemoteAccessService helpers
// ===========================

// ProvisionCorpMachine
ProvisionCorpMachineRequest;
extern std::string GetMachineProvisioningRequestPath();
extern std::unique_ptr<ProvisionCorpMachineRequest>
GetMachineProvisioningRequest(
    const std::string& owner_email,
    const std::string& fqdn,
    const std::string& public_key,
    const std::string& version,
    const std::optional<std::string>& existing_host_id);

ProvisionCorpMachineResponse;
extern const std::string& GetAuthorizationCode(
    const ProvisionCorpMachineResponse&);
extern const std::string& GetServiceAccount(
    const ProvisionCorpMachineResponse&);
extern const std::string& GetOwnerEmail(const ProvisionCorpMachineResponse&);
extern const std::string& GetHostId(const ProvisionCorpMachineResponse&);

// ReportProvisioningError
ReportProvisioningErrorRequest;
extern std::string GetReportProvisioningErrorRequestPath();
extern std::unique_ptr<ReportProvisioningErrorRequest>
GetReportProvisioningErrorRequest(const std::string& host_id,
                                  const std::string& error_message,
                                  const std::string& version);

// SendHeartbeat
SendHeartbeatRequest;
extern std::string GetSendHeartbeatRequestPath();
extern std::unique_ptr<SendHeartbeatRequest> GetSendHeartbeatRequest(
    const std::string& host_id);

// UpdateRemoteAccessHost
UpdateRemoteAccessHostRequest;
extern std::string GetUpdateRemoteAccessHostRequestPath();
extern std::unique_ptr<UpdateRemoteAccessHostRequest>
GetUpdateRemoteAccessHostRequest(const std::string& host_id);

// ===========================
// SessionAuthzService helpers
// ===========================

// GenerateHostToken
GenerateHostTokenRequest;
extern std::string GetGenerateHostTokenRequestPath();
extern std::unique_ptr<GenerateHostTokenRequest> GetGenerateHostTokenRequest(
    const GenerateHostTokenRequestStruct&);

GenerateHostTokenResponse;
extern std::unique_ptr<GenerateHostTokenResponseStruct>
GetGenerateHostTokenResponseStruct(const GenerateHostTokenResponse&);

// VerifySessionToken
VerifySessionTokenRequest;
extern std::string GetVerifySessionTokenRequestPath();
extern std::unique_ptr<VerifySessionTokenRequest> GetVerifySessionTokenRequest(
    const VerifySessionTokenRequestStruct&);

VerifySessionTokenResponse;
extern std::unique_ptr<VerifySessionTokenResponseStruct>
GetVerifySessionTokenResponseStruct(const VerifySessionTokenResponse&);

// ReauthorizeHost
ReauthorizeHostRequest;
extern std::string GetReauthorizeHostRequestPath();
extern std::unique_ptr<ReauthorizeHostRequest> GetReauthorizeHostRequest(
    const ReauthorizeHostRequestStruct&);

ReauthorizeHostResponse;
extern std::unique_ptr<ReauthorizeHostResponseStruct>
GetReauthorizeHostResponseStruct(const ReauthorizeHostResponse&);

// ======================
// LoggingService helpers
// ======================

// ReportSessionDisconnected
ReportSessionDisconnectedRequest;
extern std::string GetReportSessionDisconnectedRequestPath();
extern std::unique_ptr<ReportSessionDisconnectedRequest>
GetReportSessionDisconnectedRequest(
    const ReportSessionDisconnectedRequestStruct&);

}  // namespace remoting::internal

#endif  // REMOTING_PROTO_INTERNAL_STUBS_H_