blob: bdb34247fb5783627e38164910c842e0b436ae80 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@available(added=16)
library fuchsia.developer.remotecontrol;
using fuchsia.component as component;
using fuchsia.diagnostics as diagnostics;
using fuchsia.io as io;
using fuchsia.sys2 as sys2;
using zx;
const MAX_NUM_MATCHES uint16 = 250;
const MAX_CONNECT_MATCHES uint16 = 5;
type TunnelError = flexible enum {
// Couldn't connect to the address to forward.
CONNECT_FAILED = 1;
// Something was wrong with the socket which was being tunneled to.
SOCKET_FAILED = 2;
// Something was wrong with the ForwardCallback which was passed.
CALLBACK_ERROR = 3;
};
// Strict methods in this protocol are due to them predating the introduction of
// API levels and being hard to migrate.
@discoverable
open protocol RemoteControl {
/// Returns the input.
strict EchoString(struct {
value string:255;
}) -> (struct {
response string:255;
});
/// Writes a string to the syslog on the device.
strict LogMessage(struct {
tag string:MAX;
message string:MAX;
severity diagnostics.Severity;
}) -> ();
flexible IdentifyHost() -> (struct {
response IdentifyHostResponse;
}) error IdentifyHostError;
// Connects a channel to a service, given a moniker and a channel iff the
// component identified by the given moniker exposes a capability of the
// requested name.
flexible OpenCapability(resource struct {
moniker string:component.MAX_MONIKER_LENGTH;
capability_set sys2.OpenDirType;
capability_name component.name;
server_channel zx.Handle:CHANNEL;
flags io.OpenFlags;
}) -> () error ConnectCapabilityError;
// Gets the current monotonic time in nanoseconds.
strict GetTime() -> (struct {
time int64;
});
};