| // Copyright 2021 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.netemul.test; |
| |
| using fuchsia.component; |
| using fuchsia.io; |
| using zx; |
| |
| /// Sample interface that keeps a stateful integer counter starting at zero. |
| @discoverable |
| closed protocol Counter { |
| /// Increments internal counter by one and returns new counter value. |
| strict Increment() -> (struct { |
| value uint32; |
| }); |
| /// Connects `request` to a protocol in the `/svc` directory named |
| /// `protocol_name`. |
| strict ConnectToProtocol(resource struct { |
| protocol_name fuchsia.component.name; |
| request zx.Handle:CHANNEL; |
| }); |
| /// Opens the node found at `path` in the component's namespace with |
| /// `flags`, and connects `request`. |
| /// |
| /// This is essentially a wrapper around [`fuchsia.io/Directory.Open`], |
| /// which always opens in an implementation-defined mode. |
| /// |
| /// + request `path` the absolute path from the root of the server's |
| /// namespace. |
| /// + request `flags` the rights with which to open the node. |
| /// + request `request` the server end channel to the node. |
| strict OpenInNamespace(resource struct { |
| path string:fuchsia.component.MAX_PATH_LENGTH; |
| flags fuchsia.io.OpenFlags; |
| request zx.Handle:CHANNEL; |
| }); |
| /// Opens the directory found at `path`. |
| /// |
| /// + request `path` the absolute path from the server's namespace. |
| /// * error `ZX_ERR_NOT_FOUND` if the directory at `path` is not in the server's namespace. |
| /// * error `ZX_ERR_IO` if there is some other unspecified error during I/O. |
| strict TryOpenDirectory(struct { |
| path string:fuchsia.component.MAX_PATH_LENGTH; |
| }) -> () error zx.Status; |
| }; |