blob: dce49741ffd2af029b018e4ff70614a09cc4cc4f [file] [log] [blame]
// Copyright 2019 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.dhcp;
using fuchsia.net;
/// A DHCP duration value, in seconds. As specified in
/// https://tools.ietf.org/html/rfc2131#section-3.3, DHCP duration values are
/// relative times.
using Duration = uint32;
/// A list of IP addresses. The vector bounds of this list are MAX_OPTION_LEN /
/// len(Ipv4Address), where MAX_OPTION_LEN is the maximum byte length of a value
/// for a DHCP option as defined in https://tools.ietf.org/html/rfc2132#section-2:
/// "All other options are variable-length with a length octet following the tag octet."
using Addresses = vector<fuchsia.net.Ipv4Address>:63;
/// An ASCII string with a length limit of 255. All DHCP Option values must have
/// a length that can fit in an octet, cf. "All other options are variable-length with a length octet following the tag octet."
/// from https://tools.ietf.org/html/rfc2132#section-2. Similarly all DHCP Option
/// string values must be limited to the ASCII character set. Should non-ASCII
/// characters be sent in a `AsciiString` to Server, Server will close the channel to
/// the client.
using AsciiString = string:255;
/// A indication of which DHCP message field should be used to store additional options.
enum OptionOverloadValue : byte {
/// The file DHCP field.
FILE = 1;
/// The sname DHCP field.
SNAME = 2;
/// Both file and sname DHCP fields.
BOTH = 3;
};
/// A NetBIOS over TCP/IP node type as defined in RFC 1001/1002. This bitflag is for use with the
/// NetBiosOverTcpipNodeType option.
bits NodeTypes : byte {
/// A B node type.
B_NODE = 0x1;
/// A P node type.
P_NODE = 0x2;
/// A M node type.
M_NODE = 0x4;
/// A H node type.
H_NODE = 0x8;
};
/// The type of DHCP message. The DHCP protocol requires that all messages identify
/// their type by including the MessageType option. These values are specified
/// in https://tools.ietf.org/html/rfc2132#section-9.6.
enum MessageType : byte {
/// A DHCP Discover message.
DHCPDISCOVER = 1;
/// A DHCP Offer message.
DHCPOFFER = 2;
/// A DHCP Request message.
DHCPREQUEST = 3;
/// A DHCP Decline message.
DHCPDECLINE = 4;
/// A DHCP Ack message.
DHCPACK = 5;
/// A DHCP Nak message;
DHCPNAK = 6;
/// A DHCP Release message;
DHCPRELEASE = 7;
/// A DHCP Inform message.
DHCPINFORM = 8;
};
/// A generic representation of client configuration parameters and DHCP settings. Options are the
/// mechanism by which the DHCP protocol communicates configuration parameters from a repository on
/// a DHCP server to DHCP clients, or by which DHCP clients and servers communicate data relevant to
/// a DHCP transaction.
/// All DHCP option values must have a length which can fit within a single byte, i.e. less than 256.
/// Options for which there is no reasonable administrator-configurable value have been omitted
/// from this xunion. The omitted options are:
/// * Pad - never has a value
/// * End - never has a value
/// * RequestedIpAddress - value always selected by the DHCP client.
/// * DhcpMessageType - value always determined by state of transaction between DHCP client and server.
/// * ServerIdentifier - value always determined by address to which the server is bound.
/// * ParameterRequestList - value always selected by the DHCP client.
/// * Message - value determined in response to runtime error.
/// * VendorClassIdentifer - value always selected by the DHCP client.
/// * ClientIdentifier - value always selected by the DHCP client.
flexible union Option {
/// A 32-bit IPv4 subnet mask.
1: fuchsia.net.Ipv4Address subnet_mask;
/// The client's offset from UTC in seconds. A positive offset is east of the zero meridian, and
/// a negative offset is west of the zero meridian.
2: int32 time_offset;
/// A list of the routers in a client's subnet, listed in order of preference.
3: Addresses router;
/// A list of time servers available to the client, in order of preference.
4: Addresses time_server;
/// A list of IEN 116 Name servers available to the client, in order of preference.
5: Addresses name_server;
/// A list of Domain Name System servers available to the client, in order of preference;
6: Addresses domain_name_server;
/// A list of MIT-LCS UDP Log servers available to the client, in order of preference.
7: Addresses log_server;
/// A list of RFC 865 Cookie servers available to the client, in order of preference.
8: Addresses cookie_server;
/// A list of RFC 1179 Line Printer servers available to the client, in order of preference.
9: Addresses lpr_server;
/// A list of Imagen Impress servers available to the client, in order of preference.
10: Addresses impress_server;
/// A list of RFC 887 Resource Location servers available to the client, in order of preference.
11: Addresses resource_location_server;
/// The host name of the client, which may or may not be qualified with the local domain name.
12: AsciiString host_name;
/// The size of the client's default boot image in 512-octet blocks.
13: uint16 boot_file_size;
/// The path name to the client's core dump in the event the client crashes.
14: AsciiString merit_dump_file;
/// The client's domain name for use in resolving hostnames in the DNS.
15: AsciiString domain_name;
/// The address of the client's swap server.
16: fuchsia.net.Ipv4Address swap_server;
/// The path name to the client's root disk.
17: AsciiString root_path;
/// The path name to a TFTP-retrievable file. This file contains data which can be interpreted
/// as the BOOTP vendor-extension field. Unlike the BOOTP vendor-extension field, this file has
/// an unconstrained length and any references to Tag 18 are ignored.
18: AsciiString extensions_path;
/// A flag which will enabled IP layer packet forwarding when true.
19: bool ip_forwarding;
/// A flag which will enable forwarding of IP packets with non-local source routes.
20: bool non_local_source_routing;
/// Policy filters for non-local source routing.
/// A list of IP Address and Subnet Mask pairs. If an incoming source-routed packet has a
/// next-hop that does not match one of these pairs, then the packet will be dropped.
21: Addresses policy_filter;
/// The maximum sized datagram that the client should be able to reassemble, in octets. The
/// minimum legal value is 576.
22: uint16 max_datagram_reassembly_size;
/// The default time-to-live to use on outgoing IP datagrams. The value must be between 1 and
/// 255.
23: byte default_ip_ttl;
/// The timeout to be used when aging Path MTU values by the mechanism in RFC 1191.
24: Duration path_mtu_aging_timeout;
/// Table of MTU sizes for Path MTU Discovery.
/// A list of MTU sizes, ordered from smallest to largest. The smallest value cannot be smaller
/// than 68.
25: vector<uint16>:127 path_mtu_plateau_table;
/// The MTU for the client's interface. Minimum value of 68.
26: uint16 interface_mtu;
/// A flag indicating if all subents of the IP network to which the client is connected have the
/// same MTU.
27: bool all_subnets_local;
/// The broadcast address of the client's subnet. Legal values are defined in RFC 1122.
28: fuchsia.net.Ipv4Address broadcast_address;
/// A flag indicating whether the client should perform subnet mask discovery via ICMP.
29: bool perform_mask_discovery;
/// A flag indicating whether the client should respond to subnet mask discovery requests via
/// ICMP.
30: bool mask_supplier;
/// A flag indicating whether the client should solicit routers using Router Discovery as
/// defined in RFC 1256.
31: bool perform_router_discovery;
/// The address to which the client should transmit Router Solicitation requests.
32: fuchsia.net.Ipv4Address router_solicitation_address;
/// Static Routes which the host should put in its routing cache.
/// A list of Destination address/Next-hop address pairs defining static routes for the client's
/// routing table. The routes should be listed in descending order of priority. It is illegal
/// to use 0.0.0.0 as the destination in a static route.
33: Addresses static_route;
/// A flag specifying whether the client negotiate the use of trailers when using ARP, per RFC
/// 893.
34: bool trailer_encapsulation;
/// The timeout for ARP cache entries.
35: Duration arp_cache_timeout;
/// A flag specifying that the client should use Ethernet v2 encapsulation when false, and IEEE
/// 802.3 encapsulation when true.
36: bool ethernet_encapsulation;
/// The default time-to-live that the client should use for outgoing TCP segments. The minimum
/// value is 1.
37: byte tcp_default_ttl;
/// The interval the client should wait before sending a TCP keepalive message. A
/// value of 0 indicates that the client should not send keepalive messages unless specifically
/// requested by an application.
38: Duration tcp_keepalive_interval;
/// A flag specifying whether the client should send TCP keepalive messages with an octet of
/// garbage for compatibility with older implementations.
39: bool tcp_keepalive_garbage;
/// The name of the client's Network Information Service domain.
40: AsciiString network_information_service_domain;
/// A list of Network Information Service server addresses available to the client, listed in
/// order of preference.
41: Addresses network_information_servers;
/// A list of Network Time Protocol (NTP) server addresses available to the client, listed in
/// order of preference.
42: Addresses network_time_protocol_servers;
/// An opaque object of octets for exchanging vendor-specific information.
43: bytes:255 vendor_specific_information;
/// A list of NetBIOS name server addresses available to the client, listed in order of
/// preference.
44: Addresses netbios_over_tcpip_name_server;
/// A list of NetBIOS datagram distribution servers available to the client, listed in order of
/// preference.
45: Addresses netbios_over_tcpip_datagram_distribution_server;
/// The NetBIOS node type which should be used by the client.
46: NodeTypes netbios_over_tcpip_node_type;
/// The NetBIOS over TCP/IP scope parameter, as defined in RFC 1001, for the client.
47: AsciiString netbios_over_tcpip_scope;
/// A list of X Window System Font server addresses available to the client, listed in order of
/// preference.
48: Addresses x_window_system_font_server;
/// A list of X Window System Display Manager system addresses available to the client, listed
/// in order of preference.
49: Addresses x_window_system_display_manager;
/// The name of the client's Network Information System+ domain.
50: AsciiString network_information_service_plus_domain;
/// A list of Network Information System+ server addresses available to the client, listed in
/// order of preference.
51: Addresses network_information_service_plus_servers;
/// A list of mobile IP home agent addresses available to the client, listed in order of
/// preference.
52: Addresses mobile_ip_home_agent;
/// A list of Simple Mail Transport Protocol (SMTP) server address available to the client,
/// listed in order of preference.
53: Addresses smtp_server;
/// A list of Post Office Protocol (POP3) server addresses available to the client, listed in
/// order of preference.
54: Addresses pop3_server;
/// A list Network News Transport Protocol (NNTP) server addresses available to the client,
/// listed in order of preference.
55: Addresses nntp_server;
/// A list of default World Wide Web (WWW) server addresses available to the client, listed in
/// order of preference.
56: Addresses default_www_server;
/// A list of default Finger server addresses available to the client, listed in order of
/// preference.
57: Addresses default_finger_server;
/// A list of Internet Relay Chat server addresses available to the client, listed in order of
/// preference.
58: Addresses default_irc_server;
/// A list of StreetTalk server addresses available to the client, listed in order of
/// preference.
59: Addresses streettalk_server;
/// A list of StreetTalk Directory Assistance server addresses available to the client, listed
/// in order of preference.
60: Addresses streettalk_directory_assistance_server;
/// An option specifying whether the `sname`, `file`, or both fields have been overloaded to
/// carry DHCP options. If this option is present, the client interprets the additional fields
/// after it concludes interpreting standard option fields.
61: OptionOverloadValue option_overload;
/// The TFTP server name available to the client. This option should be used when the `sname`
/// field has been overloaded to carry options.
62: AsciiString tftp_server_name;
/// The bootfile name for the client. This option should be used when the `file` field has been
/// overloaded to carry options.
63: AsciiString bootfile_name;
/// The maximum length in octets of a DHCP message that the participant is willing to accept.
/// The minimum value is 576.
64: uint16 max_dhcp_message_size;
/// The time interval after address assignment at which the client will transition
/// to the Renewing state.
65: Duration renewal_time_value;
/// The time interval after address assignment at which the client will transition
/// to the Rebinding state.
66: Duration rebinding_time_value;
};
/// The code of a DHCP option to be retrieved by Server.GetOption(). The code
/// values are from https://tools.ietf.org/html/rfc2132 and the enum variants
/// have been listed in the order they are presented in the RFC.
enum OptionCode {
SUBNET_MASK = 1;
TIME_OFFSET = 2;
ROUTER = 3;
TIME_SERVER = 4;
NAME_SERVER = 5;
DOMAIN_NAME_SERVER = 6;
LOG_SERVER = 7;
COOKIE_SERVER = 8;
LPR_SERVER = 9;
IMPRESS_SERVER = 10;
RESOURCE_LOCATION_SERVER = 11;
HOST_NAME = 12;
BOOT_FILE_SIZE = 13;
MERIT_DUMP_FILE = 14;
DOMAIN_NAME = 15;
SWAP_SERVER = 16;
ROOT_PATH = 17;
EXTENSIONS_PATH = 18;
IP_FORWARDING = 19;
NON_LOCAL_SOURCE_ROUTING = 20;
POLICY_FILTER = 21;
MAX_DATAGRAM_REASSEMBLY_SIZE = 22;
DEFAULT_IP_TTL = 23;
PATH_MTU_AGING_TIMEOUT = 24;
PATH_MTU_PLATEAU_TABLE = 25;
INTERFACE_MTU = 26;
ALL_SUBNETS_LOCAL = 27;
BROADCAST_ADDRESS = 28;
PERFORM_MASK_DISCOVERY = 29;
MASK_SUPPLIER = 30;
PERFORM_ROUTER_DISCOVERY = 31;
ROUTER_SOLICITATION_ADDRESS = 32;
STATIC_ROUTE = 33;
TRAILER_ENCAPSULATION = 34;
ARP_CACHE_TIMEOUT = 35;
ETHERNET_ENCAPSULATION = 36;
TCP_DEFAULT_TTL = 37;
TCP_KEEPALIVE_INTERVAL = 38;
TCP_KEEPALIVE_GARBAGE = 39;
NETWORK_INFORMATION_SERVICE_DOMAIN = 40;
NETWORK_INFORMATION_SERVERS = 41;
NETWORK_TIME_PROTOCOL_SERVERS = 42;
VENDOR_SPECIFIC_INFORMATION = 43;
NETBIOS_OVER_TCPIP_NAME_SERVER = 44;
NETBIOS_OVER_TCPIP_DATAGRAM_DISTRIBUTION_SERVER = 45;
NETBIOS_OVER_TCPIP_NODE_TYPE = 46;
NETBIOS_OVER_TCPIP_SCOPE = 47;
X_WINDOW_SYSTEM_FONT_SERVER = 48;
X_WINDOW_SYSTEM_DISPLAY_MANAGER = 49;
NETWORK_INFORMATION_SERVICE_PLUS_DOMAIN = 64;
NETWORK_INFORMATION_SERVICE_PLUS_SERVERS = 65;
MOBILE_IP_HOME_AGENT = 68;
SMTP_SERVER = 69;
POP3_SERVER = 70;
NNTP_SERVER = 71;
DEFAULT_WWW_SERVER = 72;
DEFAULT_FINGER_SERVER = 73;
DEFAULT_IRC_SERVER = 74;
STREETTALK_SERVER = 75;
STREETTALK_DIRECTORY_ASSISTANCE_SERVER = 76;
OPTION_OVERLOAD = 52;
TFTP_SERVER_NAME = 66;
BOOTFILE_NAME = 67;
MAX_DHCP_MESSAGE_SIZE = 57;
RENEWAL_TIME_VALUE = 58;
REBINDING_TIME_VALUE = 59;
};