| // 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 fuchsia.net.dhcpv6; |
| |
| using fuchsia.net.name; |
| using fuchsia.net; |
| |
| /// Default port a DHCPv6 client should listen to according to [RFC 8415, |
| /// Section 7.2](https://tools.ietf.org/html/rfc8415#section-7.2). |
| const uint16 DEFAULT_CLIENT_PORT = 546; |
| |
| /// Supported DHCPv6 option codes that can be included in the client's |
| /// [Option Request Option](https://tools.ietf.org/html/rfc8415#section-21.7). |
| /// |
| /// See the full list of option codes |
| /// [here](https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#dhcpv6-parameters-2). |
| enum RequestableOptionCode { |
| DNS_SERVERS = 23; |
| }; |
| |
| /// A DHCPv6 operational model where the client only sends information |
| /// requests and handles corresponding replies, as defined in |
| /// [RFC 8415, Section 6.1](https://tools.ietf.org/html/rfc8415#section-6.1). |
| table Stateless { |
| /// A list of option codes to include in |
| /// [Option Request Option](https://tools.ietf.org/html/rfc8415#section-21.7). |
| 1: vector<RequestableOptionCode>:1 options_to_request; |
| }; |
| |
| /// Operational models for a client. |
| /// |
| /// The client will run all the provided models in parallel. |
| /// |
| /// See the full list of operational models in |
| /// [RFC 8415, Section 6](https://tools.ietf.org/html/rfc8415#section-6). |
| table OperationalModels { |
| 1: Stateless stateless; |
| }; |
| |
| /// Parameters for calling [`fuchsia.net.dhcpv6/ClientProvider.NewClient`]. |
| table NewClientParams { |
| /// The ID of the interface the client will run on. |
| /// |
| /// Required. |
| 1: uint64 interface_id; |
| |
| /// The socket address to use when communicating with servers. |
| /// |
| /// DHCPv6 servers listen for link-local multicasts, so not using a |
| /// link-local address here may cause interoperability issues. |
| /// |
| /// Client creation will fail with `INVALID_ARGS` if: |
| /// |
| /// * a multicast address is provided; |
| /// * or a link-local address is provided, and its zone index doesn't match |
| /// `interface_id` (Fuchsia has a 1:1 mapping from zone index to interface |
| /// ID). |
| /// |
| /// Client creation will fail if it fails to bind a socket to this address. |
| /// |
| /// Required. |
| 2: fuchsia.net.Ipv6SocketAddress address; |
| |
| /// The [`fuchsia.net.dhcpv6/OperationalModels`] the client will start in. |
| /// |
| /// Client creation will fail if `models` is empty or unsupported. |
| /// |
| /// Required. |
| 3: OperationalModels models; |
| }; |
| |
| /// Provides a method to create new clients. |
| [Discoverable] |
| protocol ClientProvider { |
| /// Provides a DHCPv6 client. |
| /// |
| /// + request `params` the parameters to create the client with. |
| /// + request `request` the channel handle that can be used to control the |
| /// newly created client. Will be closed if a client cannot be created, |
| /// with an epitaph explaining the reason. |
| NewClient(NewClientParams params, request<Client> request); |
| }; |
| |
| /// Provides methods to watch for discovered network configurations. |
| protocol Client { |
| compose fuchsia.net.name.DnsServerWatcher; |
| }; |