/* $OpenBSD: dhcp.h,v 1.5 2004/05/04 15:49:49 deraadt Exp $ */12/* Protocol structures... */34/*-5* SPDX-License-Identifier: BSD-3-Clause6*7* Copyright (c) 1995, 1996 The Internet Software Consortium.8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13*14* 1. Redistributions of source code must retain the above copyright15* notice, this list of conditions and the following disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19* 3. Neither the name of The Internet Software Consortium nor the names20* of its contributors may be used to endorse or promote products derived21* from this software without specific prior written permission.22*23* THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND24* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,25* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF26* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE27* DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR28* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,29* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT30* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF31* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND32* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,33* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT34* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF35* SUCH DAMAGE.36*37* This software has been written for the Internet Software Consortium38* by Ted Lemon <[email protected]> in cooperation with Vixie39* Enterprises. To learn more about the Internet Software Consortium,40* see ``http://www.vix.com/isc''. To learn more about Vixie41* Enterprises, see ``http://www.vix.com''.42*/4344#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \4520 + /* IP header */ \468) /* UDP header */47#define DHCP_SNAME_LEN 6448#define DHCP_FILE_LEN 12849#define DHCP_FIXED_NON_UDP 23650#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD)51/* Everything but options. */52#define DHCP_MTU_MAX 150053#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN)5455#define BOOTP_MIN_LEN 30056#define DHCP_MIN_LEN 5485758struct dhcp_packet {59u_int8_t op; /* Message opcode/type */60u_int8_t htype; /* Hardware addr type (see net/if_types.h) */61u_int8_t hlen; /* Hardware addr length */62u_int8_t hops; /* Number of relay agent hops from client */63u_int32_t xid; /* Transaction ID */64u_int16_t secs; /* Seconds since client started looking */65u_int16_t flags; /* Flag bits */66struct in_addr ciaddr; /* Client IP address (if already in use) */67struct in_addr yiaddr; /* Client IP address */68struct in_addr siaddr; /* IP address of next server to talk to */69struct in_addr giaddr; /* DHCP relay agent IP address */70unsigned char chaddr[16]; /* Client hardware address */71char sname[DHCP_SNAME_LEN]; /* Server name */72char file[DHCP_FILE_LEN]; /* Boot filename */73unsigned char options[DHCP_OPTION_LEN];74/* Optional parameters75(actual length dependent on MTU). */76};7778/* BOOTP (rfc951) message types */79#define BOOTREQUEST 180#define BOOTREPLY 28182/* Possible values for flags field... */83#define BOOTP_BROADCAST 32768L8485/* Possible values for hardware type (htype) field... */86#define HTYPE_ETHER 1 /* Ethernet */87#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */88#define HTYPE_FDDI 8 /* FDDI... */8990/* Magic cookie validating dhcp options field (and bootp vendor91extensions field). */92#define DHCP_OPTIONS_COOKIE "\143\202\123\143"9394/* DHCP Option codes: */9596#define DHO_PAD 097#define DHO_SUBNET_MASK 198#define DHO_TIME_OFFSET 299#define DHO_ROUTERS 3100#define DHO_TIME_SERVERS 4101#define DHO_NAME_SERVERS 5102#define DHO_DOMAIN_NAME_SERVERS 6103#define DHO_LOG_SERVERS 7104#define DHO_COOKIE_SERVERS 8105#define DHO_LPR_SERVERS 9106#define DHO_IMPRESS_SERVERS 10107#define DHO_RESOURCE_LOCATION_SERVERS 11108#define DHO_HOST_NAME 12109#define DHO_BOOT_SIZE 13110#define DHO_MERIT_DUMP 14111#define DHO_DOMAIN_NAME 15112#define DHO_SWAP_SERVER 16113#define DHO_ROOT_PATH 17114#define DHO_EXTENSIONS_PATH 18115#define DHO_IP_FORWARDING 19116#define DHO_NON_LOCAL_SOURCE_ROUTING 20117#define DHO_POLICY_FILTER 21118#define DHO_MAX_DGRAM_REASSEMBLY 22119#define DHO_DEFAULT_IP_TTL 23120#define DHO_PATH_MTU_AGING_TIMEOUT 24121#define DHO_PATH_MTU_PLATEAU_TABLE 25122#define DHO_INTERFACE_MTU 26123#define DHO_ALL_SUBNETS_LOCAL 27124#define DHO_BROADCAST_ADDRESS 28125#define DHO_PERFORM_MASK_DISCOVERY 29126#define DHO_MASK_SUPPLIER 30127#define DHO_ROUTER_DISCOVERY 31128#define DHO_ROUTER_SOLICITATION_ADDRESS 32129#define DHO_STATIC_ROUTES 33130#define DHO_TRAILER_ENCAPSULATION 34131#define DHO_ARP_CACHE_TIMEOUT 35132#define DHO_IEEE802_3_ENCAPSULATION 36133#define DHO_DEFAULT_TCP_TTL 37134#define DHO_TCP_KEEPALIVE_INTERVAL 38135#define DHO_TCP_KEEPALIVE_GARBAGE 39136#define DHO_NIS_DOMAIN 40137#define DHO_NIS_SERVERS 41138#define DHO_NTP_SERVERS 42139#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43140#define DHO_NETBIOS_NAME_SERVERS 44141#define DHO_NETBIOS_DD_SERVER 45142#define DHO_NETBIOS_NODE_TYPE 46143#define DHO_NETBIOS_SCOPE 47144#define DHO_FONT_SERVERS 48145#define DHO_X_DISPLAY_MANAGER 49146#define DHO_DHCP_REQUESTED_ADDRESS 50147#define DHO_DHCP_LEASE_TIME 51148#define DHO_DHCP_OPTION_OVERLOAD 52149#define DHO_DHCP_MESSAGE_TYPE 53150#define DHO_DHCP_SERVER_IDENTIFIER 54151#define DHO_DHCP_PARAMETER_REQUEST_LIST 55152#define DHO_DHCP_MESSAGE 56153#define DHO_DHCP_MAX_MESSAGE_SIZE 57154#define DHO_DHCP_RENEWAL_TIME 58155#define DHO_DHCP_REBINDING_TIME 59156#define DHO_DHCP_CLASS_IDENTIFIER 60157#define DHO_DHCP_CLIENT_IDENTIFIER 61158#define DHO_NISPLUS_DOMAIN 64159#define DHO_NISPLUS_SERVERS 65160#define DHO_TFTP_SERVER_NAME 66161#define DHO_BOOTFILE_NAME 67162#define DHO_MOBILE_IP_HOME_AGENT 68163#define DHO_SMTP_SERVER 69164#define DHO_POP_SERVER 70165#define DHO_NNTP_SERVER 71166#define DHO_WWW_SERVER 72167#define DHO_FINGER_SERVER 73168#define DHO_IRC_SERVER 74169#define DHO_STREETTALK_SERVER 75170#define DHO_STREETTALK_DA_SERVER 76171#define DHO_DHCP_USER_CLASS_ID 77172#define DHO_URL 114173#define DHO_DOMAIN_SEARCH 119174#define DHO_SIP_SERVERS 120175#define DHO_CLASSLESS_ROUTES 121176#define DHO_V_I_VENDOR_CLASS 124177#define DHO_V_I_VENDOR_OPTS 125178#define DHO_END 255179180/* DHCP message types. */181#define DHCPDISCOVER 1182#define DHCPOFFER 2183#define DHCPREQUEST 3184#define DHCPDECLINE 4185#define DHCPACK 5186#define DHCPNAK 6187#define DHCPRELEASE 7188#define DHCPINFORM 8189190191