blob: a8ae66173da5bf5d5279bc546331bf34c33c6bad [file] [log] [blame] [edit]
// 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 llcpptest.flexible.test;
flexible resource union FlexibleXUnion {
1: array<uint8>:30 want_more_than_30_bytes;
2: array<handle?>:4 want_more_than_4_handles;
};
/// Only one of the fields will be set by the server. This allows
/// the transaction to infer which field is present. See flexible_test.cc.
resource table FlexibleTable {
1: array<uint8>:30 want_more_than_30_bytes_at_ordinal_3;
2: array<handle?>:4 want_more_than_4_handles_at_ordinal_4;
};
/// The server will be implemented manually to purposefully return xunion/tables
/// with an unknown ordinal.
protocol ReceiveFlexibleEnvelope {
/// Receive a xunion with an unknown ordinal (suppose coming from a newer
/// server) which contains more bytes than the current max message size.
GetUnknownXUnionMoreBytes() -> (FlexibleXUnion xu);
/// Receive a xunion with an unknown ordinal (suppose coming from a newer
/// server) which contains more handles than the current max message handle
/// count.
GetUnknownXUnionMoreHandles() -> (FlexibleXUnion xu);
/// Receive a table with an unknown ordinal (suppose coming from a newer
/// server) which contains more bytes than the current max message size.
GetUnknownTableMoreBytes() -> (FlexibleTable t);
/// Receive a table with an unknown ordinal (suppose coming from a newer
/// server) which contains more handles than the current max message handle
/// count.
GetUnknownTableMoreHandles() -> (FlexibleTable t);
};
union StrictBoundedXUnion {
1: vector<uint8>:200 v;
};
union StrictUnboundedXUnion {
1: vector<uint8> v;
};
// TODO(yifeit): Test strict tables once they are supported in fidlc.
/// Test that the response to GetBoundedXUnion could be allocated on the stack,
/// while that to GetUnboundedXUnion is allocated on the heap, through
/// compile-time assertions.
protocol ReceiveStrictEnvelope {
GetBoundedXUnion() -> (StrictBoundedXUnion xu);
GetUnboundedXUnion() -> (StrictUnboundedXUnion xu);
};