| // 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.io; |
| using fuchsia.logger as logger; |
| using fuchsia.diagnostics as diagnostics; |
| using zx; |
| |
| const MAX_ENTRIES int32 = 1; |
| |
| 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_path fuchsia.io.Path; |
| }; |
| |
| 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; |
| }; |
| |
| 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; |
| }; |
| |
| protocol ArchiveIterator { |
| GetNext() -> (resource struct { |
| entry vector<ArchiveIteratorEntry>:MAX_ENTRIES; |
| }) error ArchiveIteratorError; |
| }; |
| |
| @discoverable |
| protocol RemoteDiagnosticsBridge { |
| StreamDiagnostics(resource struct { |
| parameters BridgeStreamParameters; |
| iterator server_end:ArchiveIterator; |
| }) -> (struct {}) 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.") |
| Hello() -> (); |
| }; |