]> git.ipfire.org Git - thirdparty/dhcp.git/blame - includes/dhcp.h
- Support for compressed 'domain name list' style DHCP option contents, and
[thirdparty/dhcp.git] / includes / dhcp.h
CommitLineData
d7837182
TL
1/* dhcp.h
2
3 Protocol structures... */
4
5/*
88cd8aca 6 * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
98311e4b 7 * Copyright (c) 1995-2003 by Internet Software Consortium
d7837182 8 *
98311e4b
DH
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
d7837182 12 *
98311e4b
DH
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
d7837182 20 *
98311e4b
DH
21 * Internet Systems Consortium, Inc.
22 * 950 Charter Street
23 * Redwood City, CA 94063
24 * <info@isc.org>
25 * http://www.isc.org/
d7837182 26 *
98311e4b
DH
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises. To learn more
29 * about Internet Systems Consortium, see ``http://www.isc.org''.
30 * To learn more about Vixie Enterprises, see ``http://www.vix.com''.
d7837182
TL
31 */
32
88cd8aca 33#define DHCP_UDP_OVERHEAD (20 + /* IP header */ \
d7837182
TL
34 8) /* UDP header */
35#define DHCP_SNAME_LEN 64
36#define DHCP_FILE_LEN 128
76d9aae0
TL
37#define DHCP_FIXED_NON_UDP 236
38#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD)
39 /* Everything but options. */
d7837182
TL
40#define DHCP_MTU_MAX 1500
41#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN)
42
f4835c58 43#define BOOTP_MIN_LEN 300
469cf3a4 44#define DHCP_MIN_LEN 548
f4835c58 45
d7837182 46struct dhcp_packet {
33c28146
TL
47 u_int8_t op; /* 0: Message opcode/type */
48 u_int8_t htype; /* 1: Hardware addr type (net/if_types.h) */
49 u_int8_t hlen; /* 2: Hardware addr length */
50 u_int8_t hops; /* 3: Number of relay agent hops from client */
51 u_int32_t xid; /* 4: Transaction ID */
52 u_int16_t secs; /* 8: Seconds since client started looking */
53 u_int16_t flags; /* 10: Flag bits */
54 struct in_addr ciaddr; /* 12: Client IP address (if already in use) */
55 struct in_addr yiaddr; /* 16: Client IP address */
56 struct in_addr siaddr; /* 18: IP address of next server to talk to */
57 struct in_addr giaddr; /* 20: DHCP relay agent IP address */
58 unsigned char chaddr [16]; /* 24: Client hardware address */
59 char sname [DHCP_SNAME_LEN]; /* 40: Server name */
60 char file [DHCP_FILE_LEN]; /* 104: Boot filename */
95821729 61 unsigned char options [DHCP_OPTION_LEN];
33c28146 62 /* 212: Optional parameters
95821729 63 (actual length dependent on MTU). */
d7837182
TL
64};
65
66/* BOOTP (rfc951) message types */
67#define BOOTREQUEST 1
68#define BOOTREPLY 2
69
70/* Possible values for flags field... */
71#define BOOTP_BROADCAST 32768L
72
0b5d360d
TL
73/* Possible values for hardware type (htype) field... */
74#define HTYPE_ETHER 1 /* Ethernet 10Mbps */
75#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */
d2bc90bd 76#define HTYPE_FDDI 8 /* FDDI... */
0b5d360d 77
d7837182
TL
78/* Magic cookie validating dhcp options field (and bootp vendor
79 extensions field). */
80#define DHCP_OPTIONS_COOKIE "\143\202\123\143"
81
82/* DHCP Option codes: */
83
84#define DHO_PAD 0
85#define DHO_SUBNET_MASK 1
86#define DHO_TIME_OFFSET 2
87#define DHO_ROUTERS 3
88#define DHO_TIME_SERVERS 4
89#define DHO_NAME_SERVERS 5
90#define DHO_DOMAIN_NAME_SERVERS 6
91#define DHO_LOG_SERVERS 7
92#define DHO_COOKIE_SERVERS 8
93#define DHO_LPR_SERVERS 9
94#define DHO_IMPRESS_SERVERS 10
95#define DHO_RESOURCE_LOCATION_SERVERS 11
96#define DHO_HOST_NAME 12
97#define DHO_BOOT_SIZE 13
98#define DHO_MERIT_DUMP 14
99#define DHO_DOMAIN_NAME 15
100#define DHO_SWAP_SERVER 16
101#define DHO_ROOT_PATH 17
102#define DHO_EXTENSIONS_PATH 18
103#define DHO_IP_FORWARDING 19
104#define DHO_NON_LOCAL_SOURCE_ROUTING 20
105#define DHO_POLICY_FILTER 21
106#define DHO_MAX_DGRAM_REASSEMBLY 22
107#define DHO_DEFAULT_IP_TTL 23
108#define DHO_PATH_MTU_AGING_TIMEOUT 24
109#define DHO_PATH_MTU_PLATEAU_TABLE 25
110#define DHO_INTERFACE_MTU 26
111#define DHO_ALL_SUBNETS_LOCAL 27
112#define DHO_BROADCAST_ADDRESS 28
113#define DHO_PERFORM_MASK_DISCOVERY 29
114#define DHO_MASK_SUPPLIER 30
115#define DHO_ROUTER_DISCOVERY 31
116#define DHO_ROUTER_SOLICITATION_ADDRESS 32
117#define DHO_STATIC_ROUTES 33
118#define DHO_TRAILER_ENCAPSULATION 34
119#define DHO_ARP_CACHE_TIMEOUT 35
120#define DHO_IEEE802_3_ENCAPSULATION 36
121#define DHO_DEFAULT_TCP_TTL 37
122#define DHO_TCP_KEEPALIVE_INTERVAL 38
123#define DHO_TCP_KEEPALIVE_GARBAGE 39
124#define DHO_NIS_DOMAIN 40
125#define DHO_NIS_SERVERS 41
126#define DHO_NTP_SERVERS 42
127#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43
128#define DHO_NETBIOS_NAME_SERVERS 44
129#define DHO_NETBIOS_DD_SERVER 45
130#define DHO_NETBIOS_NODE_TYPE 46
131#define DHO_NETBIOS_SCOPE 47
132#define DHO_FONT_SERVERS 48
133#define DHO_X_DISPLAY_MANAGER 49
134#define DHO_DHCP_REQUESTED_ADDRESS 50
135#define DHO_DHCP_LEASE_TIME 51
136#define DHO_DHCP_OPTION_OVERLOAD 52
137#define DHO_DHCP_MESSAGE_TYPE 53
138#define DHO_DHCP_SERVER_IDENTIFIER 54
139#define DHO_DHCP_PARAMETER_REQUEST_LIST 55
140#define DHO_DHCP_MESSAGE 56
141#define DHO_DHCP_MAX_MESSAGE_SIZE 57
142#define DHO_DHCP_RENEWAL_TIME 58
143#define DHO_DHCP_REBINDING_TIME 59
37c1b290 144#define DHO_VENDOR_CLASS_IDENTIFIER 60
d7837182 145#define DHO_DHCP_CLIENT_IDENTIFIER 61
f5707ee9
TL
146#define DHO_NWIP_DOMAIN_NAME 62
147#define DHO_NWIP_SUBOPTIONS 63
37c1b290 148#define DHO_USER_CLASS 77
136d54bf 149#define DHO_FQDN 81
126292b4 150#define DHO_DHCP_AGENT_OPTIONS 82
3fdb8405 151#define DHO_SUBNET_SELECTION 118 /* RFC3011! */
dba5803b 152#define DHO_DOMAIN_SEARCH 119 /* RFC3397 */
f7fdb216
DH
153#define DHO_VIVCO_SUBOPTIONS 124
154#define DHO_VIVSO_SUBOPTIONS 125
74f45f96
TL
155/* The DHO_AUTHENTICATE option is not a standard yet, so I've
156 allocated an option out of the "local" option space for it on a
157 temporary basis. Once an option code number is assigned, I will
158 immediately and shamelessly break this, so don't count on it
159 continuing to work. */
160#define DHO_AUTHENTICATE 210
1a634d56 161
d7837182
TL
162#define DHO_END 255
163
164/* DHCP message types. */
165#define DHCPDISCOVER 1
166#define DHCPOFFER 2
167#define DHCPREQUEST 3
168#define DHCPDECLINE 4
169#define DHCPACK 5
170#define DHCPNAK 6
171#define DHCPRELEASE 7
76d9aae0 172#define DHCPINFORM 8
126292b4
TL
173
174/* Relay Agent Information option subtypes: */
175#define RAI_CIRCUIT_ID 1
176#define RAI_REMOTE_ID 2
177#define RAI_AGENT_ID 3
334bf491 178#define RAI_LINK_SELECT 5
136d54bf
TL
179
180/* FQDN suboptions: */
181#define FQDN_NO_CLIENT_UPDATE 1
182#define FQDN_SERVER_UPDATE 2
183#define FQDN_ENCODED 3
184#define FQDN_RCODE1 4
185#define FQDN_RCODE2 5
b992d7e2
DN
186#define FQDN_HOSTNAME 6
187#define FQDN_DOMAINNAME 7
998205ce
TL
188#define FQDN_FQDN 8
189#define FQDN_SUBOPTION_COUNT 8
f7fdb216
DH
190
191/* Enterprise Suboptions: */
192#define VENDOR_ISC_SUBOPTIONS 2495