| library fidl.test.protocols; |
| |
| // This is not a reference to library zx to avoid complexity in the test data. |
| // A local handle is defined here that contains subtypes that this test cares |
| // about. |
| enum obj_type : uint32 { |
| NONE = 0; |
| SOCKET = 14; |
| }; |
| |
| resource_definition handle : uint32 { |
| properties { |
| obj_type subtype; |
| }; |
| }; |
| |
| protocol WithAndWithoutRequestResponse { |
| NoRequestNoResponse(); |
| NoRequestEmptyResponse() -> (); |
| NoRequestWithResponse() -> (string ret); |
| WithRequestNoResponse(string arg); |
| WithRequestEmptyResponse(string arg) -> (); |
| WithRequestWithResponse(string arg) -> (string ret); |
| -> OnEmptyResponse(); |
| -> OnWithResponse(string ret); |
| }; |
| |
| enum ErrorEnun { |
| ERR_FOO = 1; |
| ERR_BAR = 2; |
| }; |
| |
| protocol WithErrorSyntax { |
| ResponseAsStruct() -> (int64 a, int64 b, int64 c) error uint32; |
| ErrorAsPrimitive() -> () error uint32; |
| ErrorAsEnum() -> () error ErrorEnun; |
| }; |
| |
| [Transport = "Channel"] |
| protocol ChannelProtocol { |
| MethodA(int64 a, int64 b); |
| -> EventA(int64 a, int64 b); |
| MethodB(int64 a, int64 b) -> (int64 result); |
| TakeHandle(handle h) -> (); |
| MutateSocket(handle:SOCKET a) -> (handle:SOCKET b); |
| }; |
| |
| protocol Transitional { |
| [Transitional] |
| Request(int64 x) -> (int64 y); |
| |
| [Transitional] |
| OneWay(int64 x); |
| |
| [Transitional] |
| -> Event(int64 x); |
| }; |
| |
| [Discoverable] |
| protocol DiscoverableProtocol { |
| Method(); |
| }; |