blob: 4bb184f58c89a0c58950baa625b7dd88f556c6c6 [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;
/// An FDIO file descriptor.
// TODO(abarth): Use the real FDIO declaration once FDIO converts to FIDL2.
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.
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 is passed through to the
/// component and arrives in the component as its `directory_request`
/// interface request.
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;
};
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(CP-124): Support `host_directory` for CreateComponent and deprecate
// `provider`.
handle<channel>? host_directory;
};
/// An interface for creating component instances.
///
/// Typically obtained via `Environment.GetLauncher`.
[Discoverable]
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);
};