blob: 9a6350f781c34e753a83bac544bce430495014f1 [file] [log] [blame] [edit]
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;
};
bits rights : uint32 {
TRANSFER = 1;
DUPLICATE = 2;
};
resource_definition handle : uint32 {
properties {
obj_type subtype;
rights rights;
};
};
protocol WithAndWithoutRequestResponse {
NoRequestNoResponse();
NoRequestEmptyResponse() -> ();
NoRequestWithResponse() -> (string ret);
WithRequestNoResponse(string arg);
WithRequestEmptyResponse(string arg) -> ();
WithRequestWithResponse(string arg) -> (string ret);
-> OnEmptyResponse();
-> OnWithResponse(string ret);
};
enum ErrorEnum {
ERR_FOO = 1;
ERR_BAR = 2;
};
protocol WithErrorSyntax {
ResponseAsStruct() -> (int64 a, int64 b, int64 c) error uint32;
ErrorAsPrimitive() -> () error uint32;
ErrorAsEnum() -> () error ErrorEnum;
HandleInResult() -> (handle h) error uint32;
};
[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);
};
[Transport = "Syscall"]
protocol SyscallProtocol {
MethodA(int64 a, int64 b);
};
protocol Transitional {
[Transitional]
Request(int64 x) -> (int64 y);
[transitional]
OneWay(int64 x);
[Transitional]
-> Event(int64 x);
};
[Discoverable]
protocol DiscoverableProtocol {
Method();
};
protocol HandleRightsProtocol {
NoResponseMethod(handle:<SOCKET, rights.TRANSFER | rights.DUPLICATE> h);
ResponseMethod(handle:<SOCKET, rights.TRANSFER | rights.DUPLICATE> h) -> (handle:<SOCKET, rights.TRANSFER> h);
-> AnEvent(handle:<SOCKET, rights.TRANSFER | rights.DUPLICATE> h);
};