blob: 2b6bd18a66672835c1912b949fb86357466dfaac [file] [log] [blame] [edit]
// Copyright 2020 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.
library fuchsia.developer.remotecontrol;
using fuchsia.logger as logger;
using fuchsia.diagnostics as diagnostics;
using zx;
const MAX_ENTRIES int32 = 3;
type StreamError = strict enum : uint32 {
// Indicates an error that doesn't fall into any of the below types.
GENERIC_ERROR = 1;
// Indicates a required parameter is missing
MISSING_PARAMETER = 2;
// Indicates a parameter has a value that is currently unsupported.
UNSUPPORTED_PARAMETER = 3;
// Indicates a failure when setting up the subscription to ArchiveAccessor
SETUP_SUBSCRIPTION_FAILED = 4;
};
type BridgeStreamParameters = table {
1: stream_mode diagnostics.StreamMode;
2: data_type diagnostics.DataType;
3: client_selector_configuration diagnostics.ClientSelectorConfiguration;
4: accessor diagnostics.Selector;
};
type ArchiveIteratorEntry = resource table {
@deprecated("The data is now sent using the diagnostics_data field")
1: data string:logger.MAX_DATAGRAM_LEN_BYTES;
@deprecated("The data is now sent using the diagnostics_data field")
2: truncated_chars uint32;
3: diagnostics_data DiagnosticsData;
// Indicates EOF for a request to snapshot data.
// If this is set by the daemon, the connection will not be retried.
4: end_of_stream bool;
};
type InlineData = struct {
data string:logger.MAX_DATAGRAM_LEN_BYTES;
@deprecated(
"Data is no longer truncated, instead large messages use the socket variant of the DiagnosticsData union")
truncated_chars uint32;
};
type DiagnosticsData = strict resource union {
1: inline InlineData;
2: socket zx.Handle:SOCKET;
};
type ArchiveIteratorError = strict enum : uint32 {
GENERIC_ERROR = 1;
DATA_READ_FAILED = 2;
TRUNCATION_FAILED = 3;
};
@discoverable
closed protocol ArchiveIterator {
strict GetNext() -> (resource struct {
entry vector<ArchiveIteratorEntry>:MAX_ENTRIES;
}) error ArchiveIteratorError;
};
/// This protocol is necessary as a bridge between `fuchsia.diagnsotics.*ArchiveAccessor`
/// and the host due to the limitation of Overnet not supporting sending VMOs at the
/// moment.
/// When there's support for sending VMOs over Overnet, ffx tooling will be able
/// to talk directly to `fuchsia.diagnostics.ArchiveAccessor` instead of this protocol.
@discoverable
closed protocol RemoteDiagnosticsBridge {
strict StreamDiagnostics(resource struct {
parameters BridgeStreamParameters;
iterator server_end:ArchiveIterator;
}) -> () error StreamError;
// This is a workaround to ensure the bridge is started by the framework
// before the frontend attempts to connect to it.
// TODO: remove this once fxbug.dev/60910 has been fixed.
@deprecated("Hack method - will be removed shortly.")
strict Hello() -> ();
};