blob: f40a7f0943cb4fe64376533f385561320cc49933 [file] [log] [blame]
// Copyright 2020 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 conformance;
// TODO(fxbug.dev/36441): Allow bindings to compile on host with handles.
resource struct SingleHandle {
handle h;
};
resource struct SingleOptionalHandle {
handle? h;
};
resource struct ArrayOfHandles {
array<handle>:3 a;
};
resource struct ArrayOfOptionalHandles {
array<handle?>:3 a;
};
resource struct VectorOfHandles {
vector<handle> v;
};
resource struct VectorOfOptionalHandles {
vector<handle?> v;
};
// 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;
CHANNEL = 4;
EVENT = 5;
};
bits rights : uint32 {
DUPLICATE = 0x00000001;
TRANSFER = 0x00000002;
WAIT = 0x00004000;
INSPECT = 0x00008000;
SIGNAL = 0x00001000;
};
const rights RIGHTS_BASIC = rights.TRANSFER | rights.DUPLICATE | rights.WAIT | rights.INSPECT;
const rights DEFAULT_EVENT_RIGHTS = RIGHTS_BASIC | rights.SIGNAL;
resource_definition handle : uint32 {
properties {
obj_type subtype;
rights rights;
};
};
resource struct MultipleHandleSubtypes {
handle untyped;
handle:EVENT event;
handle:CHANNEL channel;
};
resource table ReservedFieldTable {
1: reserved;
};
resource struct ReservedFieldTableStruct {
ReservedFieldTable table;
};
resource struct EventWithDefaultRights {
handle:<EVENT, DEFAULT_EVENT_RIGHTS> h;
};
resource struct EventWithReducedRights {
handle:<EVENT, RIGHTS_BASIC> h;
};
resource struct ArrayOfVectorOfEventInStructWithReducedRights {
array<vector<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource struct VectorOfArrayOfEventInStructWithReducedRights {
vector<array<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource table ArrayOfVectorOfEventInTableWithReducedRights {
1: array<vector<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource struct ArrayOfVectorOfEventInTableWithReducedRightsStruct {
ArrayOfVectorOfEventInTableWithReducedRights t;
};
resource table VectorOfArrayOfEventInTableWithReducedRights {
1: vector<array<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource struct VectorOfArrayOfEventInTableWithReducedRightsStruct {
VectorOfArrayOfEventInTableWithReducedRights t;
};
resource union ArrayOfVectorOfEventInUnionWithReducedRights {
1: array<vector<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource struct ArrayOfVectorOfEventInUnionWithReducedRightsStruct {
ArrayOfVectorOfEventInUnionWithReducedRights u;
};
resource union VectorOfArrayOfEventInUnionWithReducedRights {
1: vector<array<handle:<EVENT, RIGHTS_BASIC>>:1>:1 h;
};
resource struct VectorOfArrayOfEventInUnionWithReducedRightsStruct {
VectorOfArrayOfEventInUnionWithReducedRights u;
};