blob: 1f8a4ae2ea09f182b1afbee45a9c389d7318fc42 [file] [log] [blame]
// Copyright 2022 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.driver.playground;
using fuchsia.url;
using zx;
// These lengths were chosen arbitrarily and can be adjusted later if needed.
const MAX_ARGV_ITEM_LENGTH uint64 = 4096;
const MAX_ARGV_VECTOR_LENGTH uint64 = 256;
type StdioParams = resource table {
1: standard_in zx.Handle:SOCKET;
2: standard_out zx.Handle:SOCKET;
3: standard_err zx.Handle:SOCKET;
};
/// Protocol for receiving an event when a tool terminates.
closed protocol CloseController {
/// This event fires when the tool has terminated.
strict -> OnTerminated(struct {
/// The process exit code of the tool.
return_code int32;
});
};
/// Protocol for running driver tools in the playground.
@discoverable
closed protocol ToolRunner {
/// Run a tool.
strict RunTool(resource struct {
/// The path to the tool executable, eg: 'fuchsia-pkg://fuchsia.com/package#bin/tool'.
tool string:fuchsia.url.MAX_URL_LENGTH;
/// The argv to pass into the tool executable.
args vector<string:MAX_ARGV_ITEM_LENGTH>:<MAX_ARGV_VECTOR_LENGTH, optional>;
/// The stdio socket handles to give to the tool.
stdio_params StdioParams;
/// Used by the playground to signal that the started tool has terminated.
close_controller server_end:CloseController;
}) -> () error zx.Status;
};