]> git.ipfire.org Git - thirdparty/dhcp.git/blob - dhcp.h
DHCP Server Daemon
[thirdparty/dhcp.git] / dhcp.h
1 /* dhcp.h
2
3 Protocol structures... */
4
5 /*
6 * Copyright (c) 1995 The Internet Software Consortium. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of The Internet Software Consortium nor the names
18 * of its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
22 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * This software has been written for the Internet Software Consortium
36 * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
37 * Enterprises. To learn more about the Internet Software Consortium,
38 * see ``http://www.vix.com/isc''. To learn more about Vixie
39 * Enterprises, see ``http://www.vix.com''.
40 */
41
42 #define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \
43 20 + /* IP header */ \
44 8) /* UDP header */
45 #define DHCP_SNAME_LEN 64
46 #define DHCP_FILE_LEN 128
47 #define DHCP_FIXED_LEN (236 + DHCP_UDP_OVERHEAD) /* Everything but
48 options. */
49 #define DHCP_MTU_MAX 1500
50 #define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN)
51
52 struct dhcp_packet {
53 u_int8_t op; /* Message opcode/type */
54 u_int8_t htype; /* Hardware addr type (see net/if_types.h) */
55 u_int8_t hlen; /* Hardware addr length */
56 u_int8_t hops; /* Number of relay agent hops from client */
57 u_int32_t xid; /* Transaction ID */
58 u_int16_t secs; /* Seconds since client started looking */
59 u_int16_t flags; /* Flag bits */
60 struct in_addr ciaddr; /* Client IP address (if already in use) */
61 struct in_addr yiaddr; /* Client IP address */
62 struct in_addr siaddr; /* IP address of next server to talk to */
63 struct in_addr giaddr; /* DHCP relay agent IP address */
64 char chaddr [16]; /* Client hardware address */
65 char sname [64]; /* Server name */
66 char file [128]; /* Boot filename */
67 char options [DHCP_OPTION_LEN]; /* Optional parameters
68 (actual length dependent on MTU). */
69 };
70
71 /* BOOTP (rfc951) message types */
72 #define BOOTREQUEST 1
73 #define BOOTREPLY 2
74
75 /* Possible values for flags field... */
76 #define BOOTP_BROADCAST 32768L
77
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
144 #define DHO_DHCP_CLASS_IDENTIFIER 60
145 #define DHO_DHCP_CLIENT_IDENTIFIER 61
146 #define DHO_END 255
147
148 /* DHCP message types. */
149 #define DHCPDISCOVER 1
150 #define DHCPOFFER 2
151 #define DHCPREQUEST 3
152 #define DHCPDECLINE 4
153 #define DHCPACK 5
154 #define DHCPNAK 6
155 #define DHCPRELEASE 7