blob: d50a092cd1cb908454b4c95b94b9f4b5c5f1f53c [file] [log] [blame]
// Copyright 2017 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.modular;
using fuchsia.sys;
using zx;
/// Provided to all component instances in their incoming namespace.
[Discoverable]
protocol ComponentContext {
/// DEPRECATED: use the component's incoming namespace (for C++, see sys.ComponentContext)
/// to connect to services provided by agents. See
/// /docs/concepts/modular/guide/how_to_write_an_agent_cc.md for an example.
///
/// Used to start an agent in the user scope if it isn't already running, and
/// connect to it.
[Transitional]
DeprecatedConnectToAgent(string:MAX url,
request<fuchsia.sys.ServiceProvider> incoming_services,
request<AgentController> controller);
/// DEPRECATED: use the component's incoming namespace (for C++, see sys.ComponentContext)
/// to connect to services provided by agents. See
/// /docs/concepts/modular/guide/how_to_write_an_agent_cc.md for an example.
///
/// Connects to an agent that provides the given `request.service_name`, and
/// then connects the given `request.channel` to that service.
///
/// If an error is encountered, the `request.channel` will be closed with
/// a status code, such as:
/// * `ZX_ERR_NOT_FOUND` -- if a `request.handler` agent URL is not
/// specified, and an agent for the `request.service_name` is not found
/// * `ZX_ERR_PEER_CLOSED` -- if `request.service_name` is not available from
/// the agent (either specified or discovered)
[Transitional]
DeprecatedConnectToAgentService(AgentServiceRequest request);
};
/// Used by ComponentContext.ConnectToAgentService
resource table AgentServiceRequest {
/// The name of the requested service.
1: string:MAX service_name;
/// The channel that will be used to communicate with the requested service.
2: zx.handle:CHANNEL channel;
/// The component URL of the Agent that is to provide the specified service.
/// If no handler is specified, the framework will perform resolution to
/// find an appropriate handler.
3: fuchsia.sys.component_url handler;
/// The AgentController handle is optional. If provided, the channel
/// will be kept open until the agent providing `service_name` is terminated.
4: request<AgentController> agent_controller;
};