# Copyright (c) 2006-2025 Roy Marples <roy@marples.name>
# All rights reserved

# Bare essentials for automatic IP configuration

##############################################################################
# DHCP RFC2132 options unless otheriwse stated
define 1	request ipaddress	subnet_mask
# RFC3442 states that the CSR has to come before all other routes
# For completeness we also specify static routes then routers
define 121	rfc3442			classless_static_routes
define 3	request array ipaddress	routers
define 6	array ipaddress		domain_name_servers
define 12	dname			host_name
define 15	array dname		domain_name
define 26	uint16			interface_mtu
define 28	request ipaddress	broadcast_address
define 33	request array ipaddress	static_routes
define 50	ipaddress		dhcp_requested_address
define 51	request uint32		dhcp_lease_time
define 52	byte			dhcp_option_overload
define 53	byte			dhcp_message_type
define 54	ipaddress		dhcp_server_identifier
define 55	array byte		dhcp_parameter_request_list
define 56	string			dhcp_message
define 57	uint16			dhcp_max_message_size
define 58	request uint32		dhcp_renewal_time
define 59	request uint32		dhcp_rebinding_time
define 60	string			vendor_class_identifier
define 61	binhex			dhcp_client_identifier

# DHCP Rapid Commit, RFC4039
define 80	norequest flag		rapid_commit

# DHCP Fully Qualified Domain Name, RFC4702
define 81	embed			fqdn
embed		bitflags=0000NEOS	flags
embed		byte			rcode1
embed		byte			rcode2
# dhcpcd always sets the E bit which means the fqdn itself is always
# RFC1035 encoded.
# The server MUST use the encoding as specified by the client as noted
# in RFC4702 Section 2.1.
embed		optional domain		fqdn

# DHCP Domain Search, RFC3397
define 119	array domain		domain_search

# Option 249 is an IANA assigned private number used by Windows DHCP servers
# to provide the exact same information as option 121, classless static routes
define 249	rfc3442			ms_classless_static_routes

##############################################################################
# ND6 options, RFC4861
definend 1	binhex			source_address
definend 2	binhex			target_address

definend 3	index embed		prefix_information
embed		byte			length
embed		bitflags=LAH		flags
embed		uint32			vltime
embed		uint32			pltime
embed		uint32			reserved
embed		ip6address		prefix

# option 4 is only for Redirect messages

definend 5	embed			mtu
embed		uint16			reserved
embed		uint32			mtu

definend 24	index embed		route_information
embed		byte			length
# bits 4 and 5 are route preference, but we can't express this
embed		byte			reserved
embed		uint32			lifetime
embed		ip6address		prefix

# ND6 options, RFC6101
definend 25	index embed		rdnss
embed		uint16			reserved
embed		uint32			lifetime
embed		array ip6address	servers

definend 31	index embed		dnssl
embed		uint16			reserved
embed		uint32			lifetime
embed		array domain		search

##############################################################################
# DHCPv6 options, RFC3315
define6 1	binhex			client_id
define6 2	binhex			server_id

define6 3	norequest index embed	ia_na
embed		binhex:4		iaid
embed		uint32			t1
embed		uint32			t2
encap 5		option
encap 13	option

define6 4	norequest index embed	ia_ta
embed		uint32			iaid
encap 5		option
encap 13	option

define6 5	norequest index embed	ia_addr
embed		ip6address		ia_addr
embed		uint32			pltime
embed		uint32			vltime
encap 13	option

define6 7	byte			preference
define6 12	ip6address		unicast

define6 13	norequest embed		status_code
embed		uint16			status_code
embed		optional string		message

define6 18	binhex			interface_id
define6 19	byte			reconfigure_msg
define6 20	flag			reconfigure_accept

# DHCPv6 DNS Configuration Options, RFC3646
define6 23	array ip6address	name_servers
define6 24	array domain		domain_search

# DHCPv6 Fully Qualified Domain Name, RFC4704
define6 39	embed			fqdn
embed		bitflags=00000NOS	flags
embed		optional domain		fqdn

# DHCPv6 SOL_MAX_RT, RFC7083
define6 82	request uint32		sol_max_rt
define6	83	request uint32		inf_max_rt
