includes/dhcp.h

Go to the documentation of this file.
00001 /* dhcp.h
00002 
00003    Protocol structures... */
00004 
00005 /*
00006  * Copyright (c) 2011-2012,2014 by Internet Systems Consortium, Inc. ("ISC")
00007  * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
00008  * Copyright (c) 1995-2003 by Internet Software Consortium
00009  *
00010  * Permission to use, copy, modify, and distribute this software for any
00011  * purpose with or without fee is hereby granted, provided that the above
00012  * copyright notice and this permission notice appear in all copies.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
00015  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00016  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
00017  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00018  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00019  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
00020  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00021  *
00022  *   Internet Systems Consortium, Inc.
00023  *   950 Charter Street
00024  *   Redwood City, CA 94063
00025  *   <info@isc.org>
00026  *   https://www.isc.org/
00027  *
00028  */
00029 
00030 #ifndef DHCP_H
00031 #define DHCP_H
00032 
00033 #define DHCP_UDP_OVERHEAD       (20 + /* IP header */                   \
00034                                 8)   /* UDP header */
00035 #define DHCP_SNAME_LEN          64
00036 #define DHCP_FILE_LEN           128
00037 #define DHCP_FIXED_NON_UDP      236
00038 #define DHCP_FIXED_LEN          (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD)
00039                                                 /* Everything but options. */
00040 #define BOOTP_MIN_LEN           300
00041 
00042 #define DHCP_MTU_MAX            1500
00043 #define DHCP_MTU_MIN            576
00044 
00045 #define DHCP_MAX_OPTION_LEN     (DHCP_MTU_MAX - DHCP_FIXED_LEN)
00046 #define DHCP_MIN_OPTION_LEN     (DHCP_MTU_MIN - DHCP_FIXED_LEN)
00047 
00048 struct dhcp_packet {
00049  u_int8_t  op;          /* 0: Message opcode/type */
00050         u_int8_t  htype;        /* 1: Hardware addr type (net/if_types.h) */
00051         u_int8_t  hlen;         /* 2: Hardware addr length */
00052         u_int8_t  hops;         /* 3: Number of relay agent hops from client */
00053         u_int32_t xid;          /* 4: Transaction ID */
00054         u_int16_t secs;         /* 8: Seconds since client started looking */
00055         u_int16_t flags;        /* 10: Flag bits */
00056         struct in_addr ciaddr;  /* 12: Client IP address (if already in use) */
00057         struct in_addr yiaddr;  /* 16: Client IP address */
00058         struct in_addr siaddr;  /* 18: IP address of next server to talk to */
00059         struct in_addr giaddr;  /* 20: DHCP relay agent IP address */
00060         unsigned char chaddr [16];      /* 24: Client hardware address */
00061         char sname [DHCP_SNAME_LEN];    /* 40: Server name */
00062         char file [DHCP_FILE_LEN];      /* 104: Boot filename */
00063         unsigned char options [DHCP_MAX_OPTION_LEN];
00064                                 /* 212: Optional parameters
00065                           (actual length dependent on MTU). */
00066 };
00067 
00068 /* BOOTP (rfc951) message types */
00069 #define BOOTREQUEST     1
00070 #define BOOTREPLY       2
00071 
00072 /* Possible values for flags field... */
00073 #define BOOTP_BROADCAST 32768L
00074 
00075 /* Possible values for hardware type (htype) field... */
00076 #define HTYPE_ETHER     1               /* Ethernet 10Mbps              */
00077 #define HTYPE_IEEE802   6               /* IEEE 802.2 Token Ring...     */
00078 #define HTYPE_FDDI      8               /* FDDI...                      */
00079 #define HTYPE_INFINIBAND  32            /* IP over Infiniband           */
00080 #define HTYPE_IPMP       255            /* IPMP - random hw address - there
00081                                          * is no standard for this so we
00082                                          * just steal a type            */
00083 
00084 #define HTYPE_RESERVED  0               /* RFC 5494 */
00085 
00086 /* Magic cookie validating dhcp options field (and bootp vendor
00087    extensions field). */
00088 #define DHCP_OPTIONS_COOKIE     "\143\202\123\143"
00089 
00090 /* DHCP Option codes: */
00091 
00092 #define DHO_PAD                                 0
00093 #define DHO_SUBNET_MASK                         1
00094 #define DHO_TIME_OFFSET                         2
00095 #define DHO_ROUTERS                             3
00096 #define DHO_TIME_SERVERS                        4
00097 #define DHO_NAME_SERVERS                        5
00098 #define DHO_DOMAIN_NAME_SERVERS                 6
00099 #define DHO_LOG_SERVERS                         7
00100 #define DHO_COOKIE_SERVERS                      8
00101 #define DHO_LPR_SERVERS                         9
00102 #define DHO_IMPRESS_SERVERS                     10
00103 #define DHO_RESOURCE_LOCATION_SERVERS           11
00104 #define DHO_HOST_NAME                           12
00105 #define DHO_BOOT_SIZE                           13
00106 #define DHO_MERIT_DUMP                          14
00107 #define DHO_DOMAIN_NAME                         15
00108 #define DHO_SWAP_SERVER                         16
00109 #define DHO_ROOT_PATH                           17
00110 #define DHO_EXTENSIONS_PATH                     18
00111 #define DHO_IP_FORWARDING                       19
00112 #define DHO_NON_LOCAL_SOURCE_ROUTING            20
00113 #define DHO_POLICY_FILTER                       21
00114 #define DHO_MAX_DGRAM_REASSEMBLY                22
00115 #define DHO_DEFAULT_IP_TTL                      23
00116 #define DHO_PATH_MTU_AGING_TIMEOUT              24
00117 #define DHO_PATH_MTU_PLATEAU_TABLE              25
00118 #define DHO_INTERFACE_MTU                       26
00119 #define DHO_ALL_SUBNETS_LOCAL                   27
00120 #define DHO_BROADCAST_ADDRESS                   28
00121 #define DHO_PERFORM_MASK_DISCOVERY              29
00122 #define DHO_MASK_SUPPLIER                       30
00123 #define DHO_ROUTER_DISCOVERY                    31
00124 #define DHO_ROUTER_SOLICITATION_ADDRESS         32
00125 #define DHO_STATIC_ROUTES                       33
00126 #define DHO_TRAILER_ENCAPSULATION               34
00127 #define DHO_ARP_CACHE_TIMEOUT                   35
00128 #define DHO_IEEE802_3_ENCAPSULATION             36
00129 #define DHO_DEFAULT_TCP_TTL                     37
00130 #define DHO_TCP_KEEPALIVE_INTERVAL              38
00131 #define DHO_TCP_KEEPALIVE_GARBAGE               39
00132 #define DHO_NIS_DOMAIN                          40
00133 #define DHO_NIS_SERVERS                         41
00134 #define DHO_NTP_SERVERS                         42
00135 #define DHO_VENDOR_ENCAPSULATED_OPTIONS         43
00136 #define DHO_NETBIOS_NAME_SERVERS                44
00137 #define DHO_NETBIOS_DD_SERVER                   45
00138 #define DHO_NETBIOS_NODE_TYPE                   46
00139 #define DHO_NETBIOS_SCOPE                       47
00140 #define DHO_FONT_SERVERS                        48
00141 #define DHO_X_DISPLAY_MANAGER                   49
00142 #define DHO_DHCP_REQUESTED_ADDRESS              50
00143 #define DHO_DHCP_LEASE_TIME                     51
00144 #define DHO_DHCP_OPTION_OVERLOAD                52
00145 #define DHO_DHCP_MESSAGE_TYPE                   53
00146 #define DHO_DHCP_SERVER_IDENTIFIER              54
00147 #define DHO_DHCP_PARAMETER_REQUEST_LIST         55
00148 #define DHO_DHCP_MESSAGE                        56
00149 #define DHO_DHCP_MAX_MESSAGE_SIZE               57
00150 #define DHO_DHCP_RENEWAL_TIME                   58
00151 #define DHO_DHCP_REBINDING_TIME                 59
00152 #define DHO_VENDOR_CLASS_IDENTIFIER             60
00153 #define DHO_DHCP_CLIENT_IDENTIFIER              61
00154 #define DHO_NWIP_DOMAIN_NAME                    62
00155 #define DHO_NWIP_SUBOPTIONS                     63
00156 #define DHO_USER_CLASS                          77
00157 #define DHO_FQDN                                81
00158 #define DHO_DHCP_AGENT_OPTIONS                  82
00159 #define DHO_AUTHENTICATE                        90  /* RFC3118, was 210 */
00160 #define DHO_CLIENT_LAST_TRANSACTION_TIME        91
00161 #define DHO_ASSOCIATED_IP                       92
00162 #define DHO_SUBNET_SELECTION                    118 /* RFC3011! */
00163 #define DHO_DOMAIN_SEARCH                       119 /* RFC3397 */
00164 #define DHO_CLASSLESS_STATIC_ROUTES             121 /* RFC3442 */
00165 #define DHO_VIVCO_SUBOPTIONS                    124
00166 #define DHO_VIVSO_SUBOPTIONS                    125
00167 
00168 #define DHO_END                                 255
00169 
00170 /* DHCP message types. */
00171 #define DHCPDISCOVER            1
00172 #define DHCPOFFER               2
00173 #define DHCPREQUEST             3
00174 #define DHCPDECLINE             4
00175 #define DHCPACK                 5
00176 #define DHCPNAK                 6
00177 #define DHCPRELEASE             7
00178 #define DHCPINFORM              8
00179 #define DHCPLEASEQUERY          10
00180 #define DHCPLEASEUNASSIGNED     11
00181 #define DHCPLEASEUNKNOWN        12
00182 #define DHCPLEASEACTIVE         13
00183 
00184 
00185 /* Relay Agent Information option subtypes: */
00186 #define RAI_CIRCUIT_ID  1
00187 #define RAI_REMOTE_ID   2
00188 #define RAI_AGENT_ID    3
00189 #define RAI_LINK_SELECT 5
00190 
00191 /* FQDN suboptions: */
00192 #define FQDN_NO_CLIENT_UPDATE           1
00193 #define FQDN_SERVER_UPDATE              2
00194 #define FQDN_ENCODED                    3
00195 #define FQDN_RCODE1                     4
00196 #define FQDN_RCODE2                     5
00197 #define FQDN_HOSTNAME                   6
00198 #define FQDN_DOMAINNAME                 7
00199 #define FQDN_FQDN                       8
00200 #define FQDN_SUBOPTION_COUNT            8
00201 
00202 /* Enterprise Suboptions: */
00203 #define VENDOR_ISC_SUBOPTIONS           2495
00204 
00205 #endif /* DHCP_H */
00206 

Generated on 5 Apr 2014 for ISC DHCP by  doxygen 1.6.1