blob: 09f7acf4136909f3fe71334055d4d4beefcbc2e3 [file] [log] [blame]
// Copyright 2025 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.
/// A library for common types used across netstack FIDL APIs, similar to
/// fuchsia.net, but specifically meant to house *resource* types, i.e. types
/// that contain handles to Zircon objects.
@available(added=HEAD)
library fuchsia.net.resources;
using fuchsia.net;
using zx;
/// An authorization credential for an interface, which allows the caller to
/// prove ownership of the interface (e.g. by converting the credential into a
/// [`ProofOfInterfaceAuthorization`].
type GrantForInterfaceAuthorization = resource struct {
/// The ID of the interface this credential is authenticating.
interface_id fuchsia.net.InterfaceId;
/// The EVENT providing authentication over this interface.
token zx.Handle:<EVENT, zx.Rights.TRANSFER | zx.Rights.DUPLICATE>;
};
/// A credential passed into the `fuchsia.net.*` family of APIs to authenticate
/// access to a particular interface. The Netstack only needs the ability to
/// inspect the token's basic info when proving that the client is authorized
/// to access a resource.
type ProofOfInterfaceAuthorization = resource struct {
/// The ID of the interface this credential is authenticating.
interface_id fuchsia.net.InterfaceId;
/// The EVENT providing authentication over this interface.
// TODO(https://fxbug.dev/42079239): We want to restrict the rights to None, but currently
// there are issues in FIDL or zither preventing us from naming the constant.
token zx.Handle:<EVENT, 0>;
};
/// A token representing a wake group that can be provided to networking
/// resources (such as sockets) to add them to the group.
type WakeGroupToken = resource struct {
token zx.Handle:<EVENT, zx.Rights.TRANSFER | zx.Rights.DUPLICATE>;
};