blob: 6256be69a404687497b188e8164c20e51c5c7085 [file] [log] [blame]
// Copyright 2021 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 fuchsia.io;
/// The common members definition behind [`Rights`] and [`Abilities`]. Some operations may apply
/// only to certain node types (e.g. [`Operations.MODIFY_DIRECTORY`] only applies to directories).
type Operations = strict bits : uint64 {
/// Connecting to a service in a directory.
CONNECT = 0x01;
/// Read byte contents of a node or its children.
READ_BYTES = 0x02;
/// Writing to the byte contents of a node or its children.
WRITE_BYTES = 0x04;
/// Execute the byte contents of a node or its children.
EXECUTE = 0x08;
/// Reading the attributes of a node and/or its children.
GET_ATTRIBUTES = 0x10;
/// Updating the attributes of a node and/or its children.
UPDATE_ATTRIBUTES = 0x20;
/// Reading the list of nodes in a directory.
ENUMERATE = 0x40;
/// Opening a node from a directory. Must be specified with [`Rights.ENUMERATE`], as directory
/// contents can be probed by opening children.
TRAVERSE = 0x80;
/// Modifying the list of nodes in a directory, e.g. creating, renaming, link/unlink, etc...
/// Must be specified with [`Rights.ENUMERATE`], as directory contents can be probed via name
/// conflicts during node creation.
MODIFY_DIRECTORY = 0x100;
};
/// Alias for directory permission alias r*
const R_STAR_DIR Operations
= Operations.CONNECT | Operations.ENUMERATE | Operations.TRAVERSE | Operations.READ_BYTES | Operations.GET_ATTRIBUTES;
/// Alias for directory permission alias rw*
const RW_STAR_DIR Operations
= Operations.CONNECT | Operations.ENUMERATE | Operations.TRAVERSE | Operations.READ_BYTES | Operations.WRITE_BYTES | Operations.MODIFY_DIRECTORY | Operations.GET_ATTRIBUTES | Operations.UPDATE_ATTRIBUTES;
/// Alias for directory permission alias rx*
const RX_STAR_DIR Operations
= Operations.CONNECT | Operations.ENUMERATE | Operations.TRAVERSE | Operations.READ_BYTES | Operations.GET_ATTRIBUTES | Operations.EXECUTE;
/// Alias for directory permission alias w*
const W_STAR_DIR Operations
= Operations.CONNECT | Operations.ENUMERATE | Operations.TRAVERSE | Operations.WRITE_BYTES | Operations.MODIFY_DIRECTORY | Operations.UPDATE_ATTRIBUTES;
/// Alias for directory permission alias x*
const X_STAR_DIR Operations
= Operations.CONNECT | Operations.ENUMERATE | Operations.TRAVERSE | Operations.EXECUTE;
/// Rights are properties specific to a connection. They limit which operations are allowed on a
/// connection, including those which may be granted to new connections.
///
/// Invoking an operation without the corresponding right results in `ZX_ERR_ACCESS_DENIED`
/// even if the node does not have support for the operation.
alias Rights = Operations;
/// Abilities are properties intrinsic to a node. They specify which operations are supported by it.
///
/// Invoking an operation on a node that does not support it results in `ZX_ERR_NOT_SUPPORTED`.
/// Note `ZX_ERR_ACCESS_DENIED` takes precedence over `ZX_ERR_NOT_SUPPORTED` when both apply.
alias Abilities = Operations;