blob: 35b7ffc006bc06296053d21b7aa6f074157cdbca [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.
alias Duration = uint32;
/// A DHCP option field of IP addresses.
///
/// Per https://tools.ietf.org/html/rfc2132#section-2:
///
/// All other options are variable-length with a length octet following the tag octet.
///
/// The maximum length is given by 0xFF/sizeof([`fuchsia.net.Ipv4Address`]).
alias Addresses = vector<fuchsia.net.Ipv4Address>:63;
/// A DHCP option field of ASCII characters.
///
/// Per https://tools.ietf.org/html/rfc2132#section-2:
///
/// All other options are variable-length with a length octet following the tag octet.
///
/// Valid iff it consists of characters from the ASCII character set.
alias AsciiString = string:255;
/// A indication of which DHCP message field should be used to store additional options.
type OptionOverloadValue = strict enum : 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.
type NodeTypes = strict bits : 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.
type MessageType = strict enum : 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.
type Option = flexible union {
/// A 32-bit IPv4 subnet mask.
1: subnet_mask fuchsia.net.Ipv4Address;
/// 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: time_offset int32;
/// A list of the routers in a client's subnet, listed in order of preference.
3: router Addresses;
/// A list of time servers available to the client, in order of preference.
4: time_server Addresses;
/// A list of IEN 116 Name servers available to the client, in order of preference.
5: name_server Addresses;
/// A list of Domain Name System servers available to the client, in order of preference;
6: domain_name_server Addresses;
/// A list of MIT-LCS UDP Log servers available to the client, in order of preference.
7: log_server Addresses;
/// A list of RFC 865 Cookie servers available to the client, in order of preference.
8: cookie_server Addresses;
/// A list of RFC 1179 Line Printer servers available to the client, in order of preference.
9: lpr_server Addresses;
/// A list of Imagen Impress servers available to the client, in order of preference.
10: impress_server Addresses;
/// A list of RFC 887 Resource Location servers available to the client, in order of preference.
11: resource_location_server Addresses;
/// The host name of the client, which may or may not be qualified with the local domain name.
12: host_name AsciiString;
/// The size of the client's default boot image in 512-octet blocks.
13: boot_file_size uint16;
/// The path name to the client's core dump in the event the client crashes.
14: merit_dump_file AsciiString;
/// The client's domain name for use in resolving hostnames in the DNS.
15: domain_name AsciiString;
/// The address of the client's swap server.
16: swap_server fuchsia.net.Ipv4Address;
/// The path name to the client's root disk.
17: root_path AsciiString;
/// 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: extensions_path AsciiString;
/// A flag which will enabled IP layer packet forwarding when true.
19: ip_forwarding bool;
/// A flag which will enable forwarding of IP packets with non-local source routes.
20: non_local_source_routing bool;
/// 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: policy_filter Addresses;
/// The maximum sized datagram that the client should be able to reassemble, in octets. The
/// minimum legal value is 576.
22: max_datagram_reassembly_size uint16;
/// The default time-to-live to use on outgoing IP datagrams. The value must be between 1 and
/// 255.
23: default_ip_ttl byte;
/// The timeout to be used when aging Path MTU values by the mechanism in RFC 1191.
24: path_mtu_aging_timeout Duration;
/// 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: path_mtu_plateau_table vector<uint16>:127;
/// The MTU for the client's interface. Minimum value of 68.
26: interface_mtu uint16;
/// A flag indicating if all subents of the IP network to which the client is connected have the
/// same MTU.
27: all_subnets_local bool;
/// The broadcast address of the client's subnet. Legal values are defined in RFC 1122.
28: broadcast_address fuchsia.net.Ipv4Address;
/// A flag indicating whether the client should perform subnet mask discovery via ICMP.
29: perform_mask_discovery bool;
/// A flag indicating whether the client should respond to subnet mask discovery requests via
/// ICMP.
30: mask_supplier bool;
/// A flag indicating whether the client should solicit routers using Router Discovery as
/// defined in RFC 1256.
31: perform_router_discovery bool;
/// The address to which the client should transmit Router Solicitation requests.
32: router_solicitation_address fuchsia.net.Ipv4Address;
/// 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: static_route Addresses;
/// A flag specifying whether the client negotiate the use of trailers when using ARP, per RFC
/// 893.
34: trailer_encapsulation bool;
/// The timeout for ARP cache entries.
35: arp_cache_timeout Duration;
/// A flag specifying that the client should use Ethernet v2 encapsulation when false, and IEEE
/// 802.3 encapsulation when true.
36: ethernet_encapsulation bool;
/// The default time-to-live that the client should use for outgoing TCP segments. The minimum
/// value is 1.
37: tcp_default_ttl byte;
/// 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: tcp_keepalive_interval Duration;
/// A flag specifying whether the client should send TCP keepalive messages with an octet of
/// garbage for compatibility with older implementations.
39: tcp_keepalive_garbage bool;
/// The name of the client's Network Information Service domain.
40: network_information_service_domain AsciiString;
/// A list of Network Information Service server addresses available to the client, listed in
/// order of preference.
41: network_information_servers Addresses;
/// A list of Network Time Protocol (NTP) server addresses available to the client, listed in
/// order of preference.
42: network_time_protocol_servers Addresses;
/// An opaque object of octets for exchanging vendor-specific information.
43: vendor_specific_information bytes:255;
/// A list of NetBIOS name server addresses available to the client, listed in order of
/// preference.
44: netbios_over_tcpip_name_server Addresses;
/// A list of NetBIOS datagram distribution servers available to the client, listed in order of
/// preference.
45: netbios_over_tcpip_datagram_distribution_server Addresses;
/// The NetBIOS node type which should be used by the client.
46: netbios_over_tcpip_node_type NodeTypes;
/// The NetBIOS over TCP/IP scope parameter, as defined in RFC 1001, for the client.
47: netbios_over_tcpip_scope AsciiString;
/// A list of X Window System Font server addresses available to the client, listed in order of
/// preference.
48: x_window_system_font_server Addresses;
/// A list of X Window System Display Manager system addresses available to the client, listed
/// in order of preference.
49: x_window_system_display_manager Addresses;
/// The name of the client's Network Information System+ domain.
50: network_information_service_plus_domain AsciiString;
/// A list of Network Information System+ server addresses available to the client, listed in
/// order of preference.
51: network_information_service_plus_servers Addresses;
/// A list of mobile IP home agent addresses available to the client, listed in order of
/// preference.
52: mobile_ip_home_agent Addresses;
/// A list of Simple Mail Transport Protocol (SMTP) server address available to the client,
/// listed in order of preference.
53: smtp_server Addresses;
/// A list of Post Office Protocol (POP3) server addresses available to the client, listed in
/// order of preference.
54: pop3_server Addresses;
/// A list Network News Transport Protocol (NNTP) server addresses available to the client,
/// listed in order of preference.
55: nntp_server Addresses;
/// A list of default World Wide Web (WWW) server addresses available to the client, listed in
/// order of preference.
56: default_www_server Addresses;
/// A list of default Finger server addresses available to the client, listed in order of
/// preference.
57: default_finger_server Addresses;
/// A list of Internet Relay Chat server addresses available to the client, listed in order of
/// preference.
58: default_irc_server Addresses;
/// A list of StreetTalk server addresses available to the client, listed in order of
/// preference.
59: streettalk_server Addresses;
/// A list of StreetTalk Directory Assistance server addresses available to the client, listed
/// in order of preference.
60: streettalk_directory_assistance_server Addresses;
/// 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: option_overload OptionOverloadValue;
/// The TFTP server name available to the client. This option should be used when the `sname`
/// field has been overloaded to carry options.
62: tftp_server_name AsciiString;
/// The bootfile name for the client. This option should be used when the `file` field has been
/// overloaded to carry options.
63: bootfile_name AsciiString;
/// The maximum length in octets of a DHCP message that the participant is willing to accept.
/// The minimum value is 576.
64: max_dhcp_message_size uint16;
/// The time interval after address assignment at which the client will transition
/// to the Renewing state.
65: renewal_time_value Duration;
/// The time interval after address assignment at which the client will transition
/// to the Rebinding state.
66: rebinding_time_value Duration;
};
/// 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.
type OptionCode = strict enum {
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;
};