Skip to content

Commit

Permalink
remoting: Add gRPC protos for directory service.
Browse files Browse the repository at this point in the history
These protos describe the new directory service API, and are needed to
query it via gRPC.

Change-Id: I86989f1d09a2d7fc03d0868bce75db66fd2830cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1580860
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#655474}
  • Loading branch information
Erik Jensen authored and Commit Bot committed May 1, 2019
1 parent fdd65d3 commit 1b00aa7
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 0 deletions.
1 change: 1 addition & 0 deletions remoting/client/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ static_library("client") {
"//remoting/base:authorization",
"//remoting/client/input",
"//remoting/client/ui",
"//remoting/proto/remoting/v1:directory_grpc_library",
"//services/network:network_service",
"//services/network/public/mojom",
]
Expand Down
13 changes: 13 additions & 0 deletions remoting/proto/remoting/v1/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/grpc/grpc_library.gni")

cc_grpc_library("directory_grpc_library") {
sources = [
"directory_messages.proto",
"directory_service.proto",
"host_info.proto",
]
}
94 changes: 94 additions & 0 deletions remoting/proto/remoting/v1/directory_messages.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package remoting.apis.v1;

import "host_info.proto";

// Requests the deletion of a specific host from the Directory.
message DeleteHostRequest {
// The ID of the host to delete.
optional string host_id = 1;
}

// The response to a DeleteHostRequest.
message DeleteHostResponse {}

// Request host info for a single Me2Me host. This is typically used when the
// client already has the host list and wants updated host info or if a deeplink
// is used to connect to a specific host.
message GetHostRequest {
// The ID of the host to request info for.
optional string host_id = 1;
}

// The response to a GetHostRequest.
message GetHostResponse {
// The info for the host_id in the request.
optional HostInfo host_info = 1;
}

// Requests a list of hosts owned by the user making the request.
message GetHostListRequest {}

// Response to a GetHostListRequest.
message GetHostListResponse {
// The list of users owned by the user.
repeated remoting.apis.v1.HostInfo hosts = 1;
}

// Sent from a Me2Me host to update it's info and online presence.
message HeartbeatRequest {
// An encypted token used to validate the request's origin.
optional string signature = 1;
// Host identity. Normally a UUID.
optional string host_id = 2;
// Current ID for the GoogleTalk service, if applicable.
optional string jabber_id = 3;
// Current ID for the Tachyon service, if applicable.
optional string tachyon_id = 4;
// Monotonically increasing value which is used to prevent replay attacks.
optional int32 sequence_id = 5;
// Version of the Me2Me host software installed.
optional string host_version = 6;
// A reason for the host reporting itself as offline.
optional string host_offline_reason = 7;
// Operating system type the host is running on.
optional string host_os_name = 8;
// Operating system version the host is running on.
optional string host_os_version = 9;
}

// Sent in response to a HeartbeatRequest.
message HeartbeatResponse {
// The result of the request.
optional HeartbeatResult result = 1;
// The amount of time to wait before the host should send its next update.
optional int32 set_interval_seconds = 2;
}

// TODO(joedow): Translate XMPP stanza errors into proto format.
// The result of a HeartBeatRequest.
enum HeartbeatResult {
// Field was not set.
HEARTBEATRESULT_UNSET = 0;
// The heartbeat was handled successfully.
SUCCESS = 1;
// There was an error processing the heartbeat request.
ERROR = 2;
}

// Requests an auth_code with updated OAuth scopes. Should only be called by
// robot accounts assigned to a Me2me host.
message UpdateRobotTokenRequest {}

// Response to a UpdateRobotTokenRequest.
message UpdateRobotTokenResponse {
// An auth code nonce which can be exchanged for a new token from Gaia.
optional string auth_code = 1;
}
30 changes: 30 additions & 0 deletions remoting/proto/remoting/v1/directory_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

// Note that the package name is used to build the service URL.
package remoting.apis.v1;

import "directory_messages.proto";

// A set of RPC services which provide functionality for remote access hosts
// and clients.
service RemotingDirectoryService {
// RPC service which returns the info for a specific host.
rpc GetHost(GetHostRequest) returns (GetHostResponse) {}

// RPC service which returns a list of remote hosts.
rpc GetHostList(GetHostListRequest) returns (GetHostListResponse) {}

// RPC service called by the remote access host to indicate online presence
// and update Directory info such as the signaling ID and OS info.
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse) {}

// RPC service which provides an update token for a robot account.
rpc UpdateRobotToken(UpdateRobotTokenRequest)
returns (UpdateRobotTokenResponse) {}
}
78 changes: 78 additions & 0 deletions remoting/proto/remoting/v1/host_info.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package remoting.apis.v1;

// Represents a Chrome Remote Desktop host instance. It includes static data
// from when the host was first registered as well as transient data such as
// the signaling ID and the last heartbeat time.
message HostInfo {
// Host identity. Normally a UUID.
optional string host_id = 1;

// Public key for the host. Must be a 2048-bit RSA key encoded with BASE64.
optional string public_key = 2;

// A readable name shown to the user.
optional string host_name = 3;

// Time when the host was created (milliseconds since 01/01/1970 GMT).
optional int64 created_time = 4;

// Most recent JabberID.
optional string jabber_id = 5;

// JID-like ID of the form user@domain.com/chromoting_ftl_<reg ID>.
optional string ftl_id = 6;

// Status of the host.
enum Status {
// Field was not set.
STATUS_UNSET = 0;
// The host is offline.
OFFLINE = 1;
// The host is online.
ONLINE = 2;
}
// The current online status of the host based on the last heartbeat seen.
optional Status status = 7 [default = OFFLINE];

// Host offline reason. See also:
// - chromium/src/remoting/host/heartbeat_sender.h
// - kHostExitCodeStrings in chromium/src/remoting/host/host_exit_codes.cc
optional string host_offline_reason = 8;

// Time when the host was last online (milliseconds since 01/01/1970 GMT).
optional int64 last_seen_time = 9;

// State of the host registration process.
enum RegistrationState {
// Field was not set.
REGISTRATION_STATE_UNSET = 0;
// The service is waiting for the host to send its signaling ID.
WAITING_FOR_HOST_STATUS = 1;
// The service has timed out waiting for the host to send its signaling ID.
TIMED_OUT_WAITING_FOR_HOST_STATUS = 2;
// The host has sent its signaling ID and completed registration.
HOST_STATUS_RECEIVED = 3;
}
// The registration state of the host.
optional RegistrationState registration_state = 10;

// A RegEx used to validate an incoming third-party auth URL from the host.
repeated string token_url_pattern = 11;

// Version of the Me2Me/It2Me host software installed on the host.
optional string host_version = 12;

// Operating system type of the host.
optional string host_os_name = 13;

// Operating system version of the host.
optional string host_os_version = 14;
}

0 comments on commit 1b00aa7

Please sign in to comment.