blob: f1154ab88797f6a15faf57205278a17facdf520c [file] [log] [blame]
// Copyright 2024 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.net.policy.socketproxy;
using fuchsia.net;
using fuchsia.posix.socket;
/// Network describes a single network interface provided to NetworkRegistry.
///
/// All table fields are currently required.
type Network = table {
/// A unique ID for the registered network.
1: network_id uint32;
/// Platform specific information about the network.
2: info @generated_name("NetworkInfo") flexible union {
/// Information about Starnix registered networks.
1: starnix @generated_name("StarnixNetworkInfo") table {
1: mark uint32;
2: handle uint64;
};
/// Information about Fuchsia registered networks.
2: fuchsia @generated_name("FuchsiaNetworkInfo") table {};
};
/// The DNS servers associated with this network.
3: dns_servers @generated_name("NetworkDnsServers") table {
1: v4 vector<fuchsia.net.Ipv4Address>:MAX;
2: v6 vector<fuchsia.net.Ipv6Address>:MAX;
};
};
closed protocol NetworkRegistry {
/// Sets the default network.
///
/// The network must have previously been registered by a call to `Add`.
strict SetDefault(struct {
network_id fuchsia.posix.socket.OptionalUint32;
}) -> () error flexible enum {
/// No network with this network_id found.
NOT_FOUND = 1;
};
/// Add a new network.
///
/// This call will not return until the DNS servers have been successfully
/// updated in netcfg.
strict Add(struct {
network Network;
}) -> () error flexible enum {
/// The `network_id` was not specified in the Network table.
MISSING_NETWORK_ID = 1;
/// The `info` was not specified in the Network table.
MISSING_NETWORK_INFO = 2;
/// The `dns_servers` was not specified in the Network table.
MISSING_NETWORK_DNS_SERVERS = 3;
/// There already exists a network with this network_id.
/// To update an existing network, use Update.
DUPLICATE_NETWORK_ID = 4;
};
/// Update a previously Added network.
/// This call will not return until the DNS servers have been
/// successfully updated in netcfg.
strict Update(struct {
network Network;
}) -> () error flexible enum {
/// The `network_id` was not specified in the Network table.
MISSING_NETWORK_ID = 1;
/// The `info` was not specified in the Network table.
MISSING_NETWORK_INFO = 2;
/// The `dns_servers` was not specified in the Network table.
MISSING_NETWORK_DNS_SERVERS = 3;
/// No network with this `network_id` found.
NOT_FOUND = 4;
};
/// Remove a previously Added network.
/// This call will not return until the DNS servers have been
/// successfully updated in netcfg.
strict Remove(struct {
network_id uint32;
}) -> () error flexible enum {
/// No network with this network_id found.
NOT_FOUND = 1;
/// The specified network is currently marked as the default network.
CANNOT_REMOVE_DEFAULT_NETWORK = 2;
};
/// No-op method that allows checking for presence.
///
/// TODO(https://fxbug.dev/296283299): It's not currently possible for a
/// client with an optionally-provided protocol to check whether there's
/// someone on the other end without making a FIDL call . This method
/// provides a workaround by giving a client a method that it can call to
/// check for liveness.
strict CheckPresence() -> ();
};