| // Copyright 2022 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 test.basic.protocol; |
| |
| using zx; |
| |
| /// Never actually replies. Just closes the connection. |
| closed protocol Closer { |
| strict Close() -> (); |
| }; |
| |
| /// Replies with the value requested. |
| closed protocol ValueEcho { |
| strict Echo(struct { |
| s string; |
| }) -> (struct { |
| s string; |
| }); |
| }; |
| |
| /// Replies with the handle requested. |
| closed protocol ResourceEcho { |
| strict Echo(resource struct { |
| h zx.Handle; |
| }) -> (resource struct { |
| h zx.Handle; |
| }); |
| }; |
| |
| closed protocol ValueOneWay { |
| strict OneWay(struct { |
| in string; |
| }); |
| }; |
| |
| closed protocol ResourceOneWay { |
| strict OneWay(resource struct { |
| h zx.Handle; |
| }); |
| }; |
| |
| closed protocol ValueEvent { |
| strict -> OnValueEvent(struct { |
| s string; |
| }); |
| }; |
| |
| closed protocol ResourceEvent { |
| strict -> OnResourceEvent(resource struct { |
| h zx.Handle; |
| }); |
| }; |
| |
| /// A basic protocol exercising all interaction types: two way call, |
| /// one way call, and event. All the payloads are values. |
| closed protocol Values { |
| compose ValueEcho; |
| compose ValueOneWay; |
| compose ValueEvent; |
| }; |
| |
| /// A basic protocol exercising all interaction types: two way call, |
| /// one way call, and event. All the payloads are resources. |
| closed protocol Resources { |
| compose ResourceEcho; |
| compose ResourceOneWay; |
| compose ResourceEvent; |
| }; |
| |
| /// [`TwoEvents`] is useful for testing binding APIs that allow a client to omit |
| /// one or more event handlers. In that case the corresponding events should be |
| /// silently ignored. |
| closed protocol TwoEvents { |
| strict -> EventA(); |
| strict -> EventB(); |
| }; |