blob: f549f2027f5a14b7e5c94443d9a21e9fda904ab6 [file] [log] [blame]
// Copyright 2016 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.sys;
using zx;
/// An FDIO file descriptor.
// TODO(abarth): Use the real FDIO declaration once FDIO converts to FIDL2.
resource struct FileDescriptor {
/// The FDIO types of the handle (e.g., `FA_FDIO_REMOTE`).
int32 type0;
int32 type1;
int32 type2;
/// The handles for the file descriptor (e.g., a channel).
handle? handle0;
handle? handle1;
handle? handle2;
/// Information used to create an instance of a component and obtain
/// services from it.
resource struct LaunchInfo {
/// The location from which to retrieve this component.
/// This field will probably be replaced with a stronger notion of identity,
/// such as an unforgeable token. This field is included in this iteration to
/// ease the transition from the previous component interfaces.
component_url url;
/// The arguments to be provided to the component.
vector<string:MAX>:MAX? arguments;
/// The file descriptor to use for stdout.
/// If null, the component will use the default stdout for the environment.
FileDescriptor? out;
/// The file descriptor to use for stderr.
/// If null, the component will use the default stderr for the environment.
FileDescriptor? err;
/// The interface request for a Directory that points at the "svc/" subdirectory
/// of the component's outgoing directory channel. The channel CANNOT be used
/// to connect to other directories (such as "debug/" or "diagnostics/") the component
/// publishes in their outgoing directory.
zx.handle:CHANNEL? directory_request;
/// A custom namespace that can be appended to the namespace generated by
/// appmgr and provided to this component.
/// Adding a mount point at standard paths like 'pkg' or 'svc' will be ignored.
/// HACK(alhaad): Adding mount points for deprecated default directories like
/// '/data' will override the default.
FlatNamespace? flat_namespace;
/// A list of services to be added to this component's svc namespace. These
/// services are in addition to those coming from Environment.
ServiceList? additional_services;
resource struct ServiceList {
/// A list of services that can be requested from `provider`.
vector<string> names;
/// A service provider to get the services listed in `names` from.
ServiceProvider? provider;
/// A channel to the directory hosting the services in `names`.
// TODO( Support `host_directory` for CreateComponent and deprecate
// `provider`.
zx.handle:CHANNEL? host_directory;
/// An interface for creating component instances.
/// Typically obtained via `Environment.GetLauncher`.
protocol Launcher {
/// Creates a new instance of the component described by `launch_info`.
/// The component instance is created in the `Environment`
/// associated with this `Launcher`. When creating the component,
/// the environment requests the environment services for this component from
/// its `EnvironmentHost`.
/// The `controller` can be used to control the lifecycle of the created
/// component instance. If an `ComponentController`'s interface is
/// requested, the component instance is killed when the interface is closed.
CreateComponent(LaunchInfo launch_info,
request<ComponentController>? controller);