| // Copyright 2019 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.ffx; |
| using zx; |
| using fuchsia.io; |
| using fuchsia.developer.ffxdaemonlifecycle; |
| |
| alias VersionInfo = fuchsia.developer.ffxdaemonlifecycle.VersionInfo; |
| |
| type DaemonError = strict enum { |
| /// A generic timeout error. |
| TIMEOUT = 4; |
| |
| /// When querying for a target, the cache was empty. |
| TARGET_CACHE_EMPTY = 5; |
| /// When querying for a target (specified or not), there were |
| /// too many matches to be clear on which target was the intent |
| /// of the query. |
| TARGET_AMBIGUOUS = 6; |
| /// When querying for a target, no matches were found. |
| TARGET_NOT_FOUND = 7; |
| /// When attempting to use a protocol that is not supported on the daemon. |
| PROTOCOL_NOT_FOUND = 10; |
| /// An error was encountered when attempting to open a protocol stream. |
| PROTOCOL_OPEN_ERROR = 11; |
| /// An error encountered when the daemon's protocol register is in a bad |
| /// state internally. This is primarily caused by trying to open a protocol |
| /// while the daaemon is actively shutting down, and should be extremely |
| /// rare. |
| BAD_PROTOCOL_REGISTER_STATE = 12; |
| }; |
| |
| @discoverable |
| open protocol Daemon { |
| compose fuchsia.developer.ffxdaemonlifecycle.DaemonLifecycleControl; |
| |
| /// Connects to a daemon protocol. |
| /// |
| /// Takes a protocol name under which the channel will be connected (the |
| /// caller is intended to know the type of the channel a priori). |
| /// |
| /// Developers are not intended to use this directly. Instead this should |
| /// be invoked automatically through the FFX plugin/protocol framework. |
| /// |
| /// Again for emphasis: if you are a developer and you are invoking this |
| /// function directly, you should reconsider your actions. |
| flexible ConnectToProtocol(resource struct { |
| name fuchsia.io.Name; |
| server_end zx.Handle:CHANNEL; |
| }) -> () error DaemonError; |
| }; |