| // Copyright 2022 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.netemul; |
| |
| using fuchsia.net; |
| using fuchsia.hardware.network; |
| |
| /// A test-friendly wrapper around Fuchsia's administrative netstack APIs. |
| /// |
| /// This protocol provides a simplified interface to an underlying netstack that |
| /// allows the caller to configure it for use in a test environment. |
| @discoverable |
| closed protocol ConfigurableNetstack { |
| /// Installs a device in the netstack with the provided configuration. |
| /// |
| /// + request `options` configuration options on the interface. |
| /// |
| /// * error `INVALID_ARGS` if `options` is invalid, as validated by the |
| /// configurable-netstack. |
| /// * error `REJECTED_BY_NETSTACK` if an error is returned from an operation |
| /// on the netstack, e.g. attempting to add an invalid route. |
| /// * error `INTERNAL` if an unexpected error is encountered that is not |
| /// caused by the client, e.g. an error communicating with the netstack. |
| strict ConfigureInterface(@generated_name("InterfaceOptions") resource table { |
| /// The name of the interface to be created. |
| /// |
| /// Required. |
| 1: name string:MAX; |
| /// The device port to be installed. |
| /// |
| /// Required. |
| 2: device client_end:fuchsia.hardware.network.Port; |
| /// Whether to disable automatic generation and assignment of link- |
| /// local IPv6 addresses for the interface. |
| /// |
| /// If not set, interpreted as false. |
| 3: without_autogenerated_addresses bool; |
| /// Static IP addresses to be assigned to the interface. |
| /// Corresponding local subnet routes will also be added to the |
| /// netstack's routing table. |
| /// |
| /// If not set, interpreted as an empty vector. |
| 4: static_ips vector<fuchsia.net.Subnet>:MAX; |
| /// The IP address of the default gateway. |
| /// |
| /// If not set, no default route will be added to the netstack. |
| 5: gateway fuchsia.net.IpAddress; |
| /// Whether to enable IPv4 forwarding on the interface. |
| /// |
| /// If not set, interpreted as false. |
| 6: enable_ipv4_forwarding bool; |
| /// Whether to enable IPv6 forwarding on the interface. |
| /// |
| /// If not set, interpreted as false. |
| 7: enable_ipv6_forwarding bool; |
| }) -> () error @generated_name("ConfigurationError") strict enum { |
| INVALID_ARGUMENTS = 1; |
| REJECTED_BY_NETSTACK = 2; |
| INTERNAL = 0xFFFFFFFF; |
| }; |
| }; |