//
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
// @generated from file protos/perfetto/ipc/relay_port.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/ipc/relay_port.proto.
 */
export const file_protos_perfetto_ipc_relay_port: GenFile = /*@__PURE__*/
  fileDesc("CiRwcm90b3MvcGVyZmV0dG8vaXBjL3JlbGF5X3BvcnQucHJvdG8SD3BlcmZldHRvLnByb3RvcyLQAQoQU3luY0Nsb2NrUmVxdWVzdBI2CgVwaGFzZRgBIAEoDjInLnBlcmZldHRvLnByb3Rvcy5TeW5jQ2xvY2tSZXF1ZXN0LlBoYXNlEjcKBmNsb2NrcxgCIAMoCzInLnBlcmZldHRvLnByb3Rvcy5TeW5jQ2xvY2tSZXF1ZXN0LkNsb2NrGiwKBUNsb2NrEhAKCGNsb2NrX2lkGAEgASgNEhEKCXRpbWVzdGFtcBgCIAEoBCIdCgVQaGFzZRIICgRQSU5HEAESCgoGVVBEQVRFEAIiEwoRU3luY0Nsb2NrUmVzcG9uc2UyYQoJUmVsYXlQb3J0ElQKCVN5bmNDbG9jaxIhLnBlcmZldHRvLnByb3Rvcy5TeW5jQ2xvY2tSZXF1ZXN0GiIucGVyZmV0dG8ucHJvdG9zLlN5bmNDbG9ja1Jlc3BvbnNlIgA");

/**
 * For the client to send its clock readings to the host.
 *
 * @generated from message perfetto.protos.SyncClockRequest
 */
export type SyncClockRequest = Message<"perfetto.protos.SyncClockRequest"> & {
  /**
   * @generated from field: optional perfetto.protos.SyncClockRequest.Phase phase = 1;
   */
  phase: SyncClockRequest_Phase;

  /**
   * @generated from field: repeated perfetto.protos.SyncClockRequest.Clock clocks = 2;
   */
  clocks: SyncClockRequest_Clock[];
};

/**
 * Describes the message perfetto.protos.SyncClockRequest.
 * Use `create(SyncClockRequestSchema)` to create a new message.
 */
export const SyncClockRequestSchema: GenMessage<SyncClockRequest> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_ipc_relay_port, 0);

/**
 * @generated from message perfetto.protos.SyncClockRequest.Clock
 */
export type SyncClockRequest_Clock = Message<"perfetto.protos.SyncClockRequest.Clock"> & {
  /**
   * The clock ID enumerated in builtin_clocks.proto.
   *
   * @generated from field: optional uint32 clock_id = 1;
   */
  clockId: number;

  /**
   * The clock reading value (e.g. in nanoseconds for BUILTIN_CLOCK_BOOTTIME).
   *
   * @generated from field: optional uint64 timestamp = 2;
   */
  timestamp: bigint;
};

/**
 * Describes the message perfetto.protos.SyncClockRequest.Clock.
 * Use `create(SyncClockRequest_ClockSchema)` to create a new message.
 */
export const SyncClockRequest_ClockSchema: GenMessage<SyncClockRequest_Clock> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_ipc_relay_port, 0, 0);

/**
 * Relay service synchronizes its clocks with the host using round-trip
 * messages of clock snapshots on both sides for an estimation of clock
 * offsets of the built-in clocks.
 *
 * @generated from enum perfetto.protos.SyncClockRequest.Phase
 */
export enum SyncClockRequest_Phase {
  /**
   * Clock synchronization starts with the client (relay service) sends its
   * clock snapshots in the PING phase. The host also snapshots its clocks on
   * receiving the request and acks the client.
   *
   * @generated from enum value: PING = 1;
   */
  PING = 1,

  /**
   * Clock synchronization completes with the client sending the second clock
   * snapshot request after the round-trip of the PING request. The host
   * estimates the clock offsets using 2 consecutive clock snapshots on both
   * sides.
   *
   * @generated from enum value: UPDATE = 2;
   */
  UPDATE = 2,
}

/**
 * Describes the enum perfetto.protos.SyncClockRequest.Phase.
 */
export const SyncClockRequest_PhaseSchema: GenEnum<SyncClockRequest_Phase> = /*@__PURE__*/
  enumDesc(file_protos_perfetto_ipc_relay_port, 0, 0);

/**
 * The host doesn't send any information back to the client.
 *
 * @generated from message perfetto.protos.SyncClockResponse
 */
export type SyncClockResponse = Message<"perfetto.protos.SyncClockResponse"> & {
};

/**
 * Describes the message perfetto.protos.SyncClockResponse.
 * Use `create(SyncClockResponseSchema)` to create a new message.
 */
export const SyncClockResponseSchema: GenMessage<SyncClockResponse> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_ipc_relay_port, 1);

/**
 * IPC interface definition for serving the requests from the relay service.
 *
 * @generated from service perfetto.protos.RelayPort
 */
export const RelayPort: GenService<{
  /**
   * Synchronize the clocks with a guest. This is used for multi-machine tracing
   * with a VM guest or a remote machine. The client may make consecutive calls
   * of this method to get better results.
   *
   * @generated from rpc perfetto.protos.RelayPort.SyncClock
   */
  syncClock: {
    methodKind: "unary";
    input: typeof SyncClockRequestSchema;
    output: typeof SyncClockResponseSchema;
  },
}> = /*@__PURE__*/
  serviceDesc(file_protos_perfetto_ipc_relay_port, 0);

