Subrata Banik | 8b9f289 | 2018-01-25 10:50:39 +0530 | [diff] [blame] | 1 | /** @file |
| 2 | This file contains the DHCPv4 and DHCPv6 option definitions and other configuration. |
| 3 | They are used to carry additional information and parameters in DHCP messages. |
| 4 | |
| 5 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> |
| 6 | This program and the accompanying materials |
| 7 | are licensed and made available under the terms and conditions of the BSD License |
| 8 | which accompanies this distribution. The full text of the license may be found at |
| 9 | http://opensource.org/licenses/bsd-license.php |
| 10 | |
| 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. |
| 13 | **/ |
| 14 | |
| 15 | #ifndef _DHCP_H_ |
| 16 | #define _DHCP_H_ |
| 17 | |
| 18 | /// |
| 19 | /// Dynamic Host Configuration Protocol for IPv4 (DHCPv4) |
| 20 | /// |
| 21 | /// Dhcpv4 Options, definitions from RFC 2132 |
| 22 | /// |
| 23 | #define DHCP4_TAG_PAD 0 /// Pad Option |
| 24 | #define DHCP4_TAG_EOP 255 /// End Option |
| 25 | #define DHCP4_TAG_NETMASK 1 /// Subnet Mask |
| 26 | #define DHCP4_TAG_TIME_OFFSET 2 /// Time Offset from UTC |
| 27 | #define DHCP4_TAG_ROUTER 3 /// Router option, |
| 28 | #define DHCP4_TAG_TIME_SERVER 4 /// Time Server |
| 29 | #define DHCP4_TAG_NAME_SERVER 5 /// Name Server |
| 30 | #define DHCP4_TAG_DNS_SERVER 6 /// Domain Name Server |
| 31 | #define DHCP4_TAG_LOG_SERVER 7 /// Log Server |
| 32 | #define DHCP4_TAG_COOKIE_SERVER 8 /// Cookie Server |
| 33 | #define DHCP4_TAG_LPR_SERVER 9 /// LPR Print Server |
| 34 | #define DHCP4_TAG_IMPRESS_SERVER 10 /// Impress Server |
| 35 | #define DHCP4_TAG_RL_SERVER 11 /// Resource Location Server |
| 36 | #define DHCP4_TAG_HOSTNAME 12 /// Host Name |
| 37 | #define DHCP4_TAG_BOOTFILE_LEN 13 /// Boot File Size |
| 38 | #define DHCP4_TAG_DUMP 14 /// Merit Dump File |
| 39 | #define DHCP4_TAG_DOMAINNAME 15 /// Domain Name |
| 40 | #define DHCP4_TAG_SWAP_SERVER 16 /// Swap Server |
| 41 | #define DHCP4_TAG_ROOTPATH 17 /// Root path |
| 42 | #define DHCP4_TAG_EXTEND_PATH 18 /// Extensions Path |
| 43 | #define DHCP4_TAG_IPFORWARD 19 /// IP Forwarding Enable/Disable |
| 44 | #define DHCP4_TAG_NONLOCAL_SRR 20 /// on-Local Source Routing Enable/Disable |
| 45 | #define DHCP4_TAG_POLICY_SRR 21 /// Policy Filter |
| 46 | #define DHCP4_TAG_EMTU 22 /// Maximum Datagram Reassembly Size |
| 47 | #define DHCP4_TAG_TTL 23 /// Default IP Time-to-live |
| 48 | #define DHCP4_TAG_PATHMTU_AGE 24 /// Path MTU Aging Timeout |
| 49 | #define DHCP4_TAG_PATHMTU_PLATEAU 25 /// Path MTU Plateau Table |
| 50 | #define DHCP4_TAG_IFMTU 26 /// Interface MTU |
| 51 | #define DHCP4_TAG_SUBNET_LOCAL 27 /// All Subnets are Local |
| 52 | #define DHCP4_TAG_BROADCAST 28 /// Broadcast Address |
| 53 | #define DHCP4_TAG_DISCOVER_MASK 29 /// Perform Mask Discovery |
| 54 | #define DHCP4_TAG_SUPPLY_MASK 30 /// Mask Supplier |
| 55 | #define DHCP4_TAG_DISCOVER_ROUTE 31 /// Perform Router Discovery |
| 56 | #define DHCP4_TAG_ROUTER_SOLICIT 32 /// Router Solicitation Address |
| 57 | #define DHCP4_TAG_STATIC_ROUTE 33 /// Static Route |
| 58 | #define DHCP4_TAG_TRAILER 34 /// Trailer Encapsulation |
| 59 | #define DHCP4_TAG_ARPAGE 35 /// ARP Cache Timeout |
| 60 | #define DHCP4_TAG_ETHER_ENCAP 36 /// Ethernet Encapsulation |
| 61 | #define DHCP4_TAG_TCP_TTL 37 /// TCP Default TTL |
| 62 | #define DHCP4_TAG_KEEP_INTERVAL 38 /// TCP Keepalive Interval |
| 63 | #define DHCP4_TAG_KEEP_GARBAGE 39 /// TCP Keepalive Garbage |
| 64 | #define DHCP4_TAG_NIS_DOMAIN 40 /// Network Information Service Domain |
| 65 | #define DHCP4_TAG_NIS_SERVER 41 /// Network Information Servers |
| 66 | #define DHCP4_TAG_NTP_SERVER 42 /// Network Time Protocol Servers |
| 67 | #define DHCP4_TAG_VENDOR 43 /// Vendor Specific Information |
| 68 | #define DHCP4_TAG_NBNS 44 /// NetBIOS over TCP/IP Name Server |
| 69 | #define DHCP4_TAG_NBDD 45 /// NetBIOS Datagram Distribution Server |
| 70 | #define DHCP4_TAG_NBTYPE 46 /// NetBIOS over TCP/IP Node Type |
| 71 | #define DHCP4_TAG_NBSCOPE 47 /// NetBIOS over TCP/IP Scope |
| 72 | #define DHCP4_TAG_XFONT 48 /// X Window System Font Server |
| 73 | #define DHCP4_TAG_XDM 49 /// X Window System Display Manager |
| 74 | #define DHCP4_TAG_REQUEST_IP 50 /// Requested IP Address |
| 75 | #define DHCP4_TAG_LEASE 51 /// IP Address Lease Time |
| 76 | #define DHCP4_TAG_OVERLOAD 52 /// Option Overload |
| 77 | #define DHCP4_TAG_MSG_TYPE 53 /// DHCP Message Type |
| 78 | #define DHCP4_TAG_SERVER_ID 54 /// Server Identifier |
| 79 | #define DHCP4_TAG_PARA_LIST 55 /// Parameter Request List |
| 80 | #define DHCP4_TAG_MESSAGE 56 /// Message |
| 81 | #define DHCP4_TAG_MAXMSG 57 /// Maximum DHCP Message Size |
| 82 | #define DHCP4_TAG_T1 58 /// Renewal (T1) Time Value |
| 83 | #define DHCP4_TAG_T2 59 /// Rebinding (T2) Time Value |
| 84 | #define DHCP4_TAG_VENDOR_CLASS_ID 60 /// Vendor class identifier |
| 85 | #define DHCP4_TAG_CLIENT_ID 61 /// Client-identifier |
| 86 | #define DHCP4_TAG_NISPLUS 64 /// Network Information Service+ Domain |
| 87 | #define DHCP4_TAG_NISPLUS_SERVER 65 /// Network Information Service+ Servers |
| 88 | #define DHCP4_TAG_TFTP 66 /// TFTP server name |
| 89 | #define DHCP4_TAG_BOOTFILE 67 /// Bootfile name |
| 90 | #define DHCP4_TAG_MOBILEIP 68 /// Mobile IP Home Agent |
| 91 | #define DHCP4_TAG_SMTP 69 /// Simple Mail Transport Protocol Server |
| 92 | #define DHCP4_TAG_POP3 70 /// Post Office Protocol (POP3) Server |
| 93 | #define DHCP4_TAG_NNTP 71 /// Network News Transport Protocol Server |
| 94 | #define DHCP4_TAG_WWW 72 /// Default World Wide Web (WWW) Server |
| 95 | #define DHCP4_TAG_FINGER 73 /// Default Finger Server |
| 96 | #define DHCP4_TAG_IRC 74 /// Default Internet Relay Chat (IRC) Server |
| 97 | #define DHCP4_TAG_STTALK 75 /// StreetTalk Server |
| 98 | #define DHCP4_TAG_STDA 76 /// StreetTalk Directory Assistance Server |
| 99 | #define DHCP4_TAG_USER_CLASS_ID 77 /// User class identifier |
| 100 | #define DHCP4_TAG_ARCH 93 /// Client System Architecture Type, RFC 4578 |
| 101 | #define DHCP4_TAG_UNDI 94 /// Client Network Interface Identifier, RFC 4578 |
| 102 | #define DHCP4_TAG_UUID 97 /// Client Machine Identifier, RFC 4578 |
| 103 | #define DHCP4_TAG_CLASSLESS_ROUTE 121 /// Classless Route |
| 104 | |
| 105 | |
| 106 | /// |
| 107 | /// Dynamic Host Configuration Protocol for IPv6 (DHCPv6) |
| 108 | /// |
| 109 | /// Enumeration of Dhcp6 message type, refers to section-5.3 of rfc-3315. |
| 110 | /// |
| 111 | typedef enum { |
| 112 | Dhcp6MsgSolicit = 1, |
| 113 | Dhcp6MsgAdvertise = 2, |
| 114 | Dhcp6MsgRequest = 3, |
| 115 | Dhcp6MsgConfirm = 4, |
| 116 | Dhcp6MsgRenew = 5, |
| 117 | Dhcp6MsgRebind = 6, |
| 118 | Dhcp6MsgReply = 7, |
| 119 | Dhcp6MsgRelease = 8, |
| 120 | Dhcp6MsgDecline = 9, |
| 121 | Dhcp6MsgReconfigure = 10, |
| 122 | Dhcp6MsgInfoRequest = 11 |
| 123 | } DHCP6_MSG_TYPE; |
| 124 | |
| 125 | /// |
| 126 | /// Enumeration of option code in Dhcp6 packet, refers to section-24.3 of rfc-3315. |
| 127 | /// |
| 128 | typedef enum { |
| 129 | Dhcp6OptClientId = 1, |
| 130 | Dhcp6OptServerId = 2, |
| 131 | Dhcp6OptIana = 3, |
| 132 | Dhcp6OptIata = 4, |
| 133 | Dhcp6OptIaAddr = 5, |
| 134 | Dhcp6OptRequestOption = 6, |
| 135 | Dhcp6OptPreference = 7, |
| 136 | Dhcp6OptElapsedTime = 8, |
| 137 | Dhcp6OptReplayMessage = 9, |
| 138 | Dhcp6OptAuthentication = 11, |
| 139 | Dhcp6OptServerUnicast = 12, |
| 140 | Dhcp6OptStatusCode = 13, |
| 141 | Dhcp6OptRapidCommit = 14, |
| 142 | Dhcp6OptUserClass = 15, |
| 143 | Dhcp6OptVendorClass = 16, |
| 144 | Dhcp6OptVendorInfo = 17, |
| 145 | Dhcp6OptInterfaceId = 18, |
| 146 | Dhcp6OptReconfigMessage = 19, |
| 147 | Dhcp6OptReconfigureAccept = 20 |
| 148 | } DHCP6_OPT_CODE; |
| 149 | |
| 150 | /// |
| 151 | /// Enumeration of status code recorded by IANA, refers to section-24.4 of rfc-3315. |
| 152 | /// |
| 153 | typedef enum { |
| 154 | Dhcp6StsSuccess = 0, |
| 155 | Dhcp6StsUnspecFail = 1, |
| 156 | Dhcp6StsNoAddrsAvail = 2, |
| 157 | Dhcp6StsNoBinding = 3, |
| 158 | Dhcp6StsNotOnLink = 4, |
| 159 | Dhcp6StsUseMulticast = 5 |
| 160 | } DHCP6_STS_CODE; |
| 161 | |
| 162 | /// |
| 163 | /// Enumeration of Duid type recorded by IANA, refers to section-24.5 of rfc-3315. |
| 164 | /// |
| 165 | typedef enum { |
| 166 | Dhcp6DuidTypeLlt = 1, |
| 167 | Dhcp6DuidTypeEn = 2, |
| 168 | Dhcp6DuidTypeLl = 3, |
| 169 | Dhcp6DuidTypeUuid = 4 |
| 170 | } DHCP6_DUID_TYPE; |
| 171 | |
| 172 | /// Transmission and Retransmission Parameters |
| 173 | /// This section presents a table of values used to describe the message |
| 174 | /// transmission behavior of clients and servers. |
| 175 | /// |
| 176 | /// Transmit parameters of solicit message, refers to section-5.5 of rfc-3315. |
| 177 | /// |
| 178 | #define DHCP6_SOL_MAX_DELAY 1 |
| 179 | #define DHCP6_SOL_IRT 1 |
| 180 | #define DHCP6_SOL_MRC 0 |
| 181 | #define DHCP6_SOL_MRT 120 |
| 182 | #define DHCP6_SOL_MRD 0 |
| 183 | /// |
| 184 | /// Transmit parameters of request message, refers to section-5.5 of rfc-3315. |
| 185 | /// |
| 186 | #define DHCP6_REQ_IRT 1 |
| 187 | #define DHCP6_REQ_MRC 10 |
| 188 | #define DHCP6_REQ_MRT 30 |
| 189 | #define DHCP6_REQ_MRD 0 |
| 190 | /// |
| 191 | /// Transmit parameters of confirm message, refers to section-5.5 of rfc-3315. |
| 192 | /// |
| 193 | #define DHCP6_CNF_MAX_DELAY 1 |
| 194 | #define DHCP6_CNF_IRT 1 |
| 195 | #define DHCP6_CNF_MRC 0 |
| 196 | #define DHCP6_CNF_MRT 4 |
| 197 | #define DHCP6_CNF_MRD 10 |
| 198 | /// |
| 199 | /// Transmit parameters of renew message, refers to section-5.5 of rfc-3315. |
| 200 | /// |
| 201 | #define DHCP6_REN_IRT 10 |
| 202 | #define DHCP6_REN_MRC 0 |
| 203 | #define DHCP6_REN_MRT 600 |
| 204 | #define DHCP6_REN_MRD 0 |
| 205 | /// |
| 206 | /// Transmit parameters of rebind message, refers to section-5.5 of rfc-3315. |
| 207 | /// |
| 208 | #define DHCP6_REB_IRT 10 |
| 209 | #define DHCP6_REB_MRC 0 |
| 210 | #define DHCP6_REB_MRT 600 |
| 211 | #define DHCP6_REB_MRD 0 |
| 212 | /// |
| 213 | /// Transmit parameters of information request message, refers to section-5.5 of rfc-3315. |
| 214 | /// |
| 215 | #define DHCP6_INF_MAX_DELAY 1 |
| 216 | #define DHCP6_INF_IRT 1 |
| 217 | #define DHCP6_INF_MRC 0 |
| 218 | #define DHCP6_INF_MRT 120 |
| 219 | #define DHCP6_INF_MRD 0 |
| 220 | /// |
| 221 | /// Transmit parameters of release message, refers to section-5.5 of rfc-3315. |
| 222 | /// |
| 223 | #define DHCP6_REL_IRT 1 |
| 224 | #define DHCP6_REL_MRC 5 |
| 225 | #define DHCP6_REL_MRT 0 |
| 226 | #define DHCP6_REL_MRD 0 |
| 227 | /// |
| 228 | /// Transmit parameters of decline message, refers to section-5.5 of rfc-3315. |
| 229 | /// |
| 230 | #define DHCP6_DEC_IRT 1 |
| 231 | #define DHCP6_DEC_MRC 5 |
| 232 | #define DHCP6_DEC_MRT 0 |
| 233 | #define DHCP6_DEC_MRD 0 |
| 234 | |
| 235 | //// |
| 236 | //// DHCPv6 Options, definitions from RFC 3315,RFC 5970 and RFC 3646. |
| 237 | //// |
| 238 | #define DHCP6_OPT_CLIENT_ID 1 /// Client Identifier Option |
| 239 | #define DHCP6_OPT_SERVER_ID 2 /// Server Identifier Option |
| 240 | #define DHCP6_OPT_IA_NA 3 /// The Identity Association for Non-temporary Addresses option |
| 241 | #define DHCP6_OPT_IA_TA 4 /// The Identity Association for the Temporary Addresses |
| 242 | #define DHCP6_OPT_IAADDR 5 /// IA Address option |
| 243 | #define DHCP6_OPT_ORO 6 /// Request option |
| 244 | #define DHCP6_OPT_PREFERENCE 7 /// Preference option |
| 245 | #define DHCP6_OPT_ELAPSED_TIME 8 /// Elapsed Time Option |
| 246 | #define DHCP6_OPT_REPLAY_MSG 9 /// Relay Message option |
| 247 | #define DHCP6_OPT_AUTH 11 /// Authentication option |
| 248 | #define DHCP6_OPT_UNICAST 12 /// Server Unicast Option |
| 249 | #define DHCP6_OPT_STATUS_CODE 13 /// Status Code Option |
| 250 | #define DHCP6_OPT_RAPID_COMMIT 14 /// Rapid Commit option |
| 251 | #define DHCP6_OPT_USER_CLASS 15 /// User Class option |
| 252 | #define DHCP6_OPT_VENDOR_CLASS 16 /// Vendor Class Option |
| 253 | #define DHCP6_OPT_VENDOR_OPTS 17 /// Vendor-specific Information Option |
| 254 | #define DHCP6_OPT_INTERFACE_ID 18 /// Interface-Id Option |
| 255 | #define DHCP6_OPT_RECONFIG_MSG 19 /// Reconfigure Message Option |
| 256 | #define DHCP6_OPT_RECONFIG_ACCEPT 20 /// Reconfigure Accept Option |
| 257 | #define DHCP6_OPT_DNS_SERVERS 23 /// DNS Configuration options, RFC 3646 |
| 258 | #define DHCP6_OPT_BOOT_FILE_URL 59 /// Assigned by IANA, RFC 5970 |
| 259 | #define DHCP6_OPT_BOOT_FILE_PARAM 60 /// Assigned by IANA, RFC 5970 |
| 260 | #define DHCP6_OPT_ARCH 61 /// Assigned by IANA, RFC 5970 |
| 261 | #define DHCP6_OPT_UNDI 62 /// Assigned by IANA, RFC 5970 |
| 262 | |
| 263 | /// |
| 264 | /// Processor Architecture Types |
| 265 | /// These identifiers are defined by IETF: |
| 266 | /// http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml |
| 267 | /// |
| 268 | #define PXE_CLIENT_ARCH_X86_BIOS 0x0000 /// x86 BIOS for PXE |
| 269 | #define PXE_CLIENT_ARCH_IPF 0x0002 /// Itanium for PXE |
| 270 | #define PXE_CLIENT_ARCH_IA32 0x0006 /// x86 uefi for PXE |
| 271 | #define PXE_CLIENT_ARCH_X64 0x0007 /// x64 uefi for PXE |
| 272 | #define PXE_CLIENT_ARCH_EBC 0x0009 /// EBC for PXE |
| 273 | #define PXE_CLIENT_ARCH_ARM 0x000A /// Arm uefi 32 for PXE |
| 274 | #define PXE_CLIENT_ARCH_AARCH64 0x000B /// Arm uefi 64 for PXE |
| 275 | |
| 276 | #define HTTP_CLIENT_ARCH_IA32 0x000F /// x86 uefi boot from http |
| 277 | #define HTTP_CLIENT_ARCH_X64 0x0010 /// x64 uefi boot from http |
| 278 | #define HTTP_CLIENT_ARCH_EBC 0x0011 /// EBC boot from http |
| 279 | #define HTTP_CLIENT_ARCH_ARM 0x0012 /// Arm uefi 32 boot from http |
| 280 | #define HTTP_CLIENT_ARCH_AARCH64 0x0013 /// Arm uefi 64 boot from http |
| 281 | |
| 282 | #endif |