• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13   PxeDhcp4.h
14 
15 Abstract:
16   EFI PXE DHCPv4 protocol definition
17 
18 --*/
19 
20 #ifndef _PXEDHCP4_H_
21 #define _PXEDHCP4_H_
22 
23 
24 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
25 //
26 // PXE DHCPv4 GUID definition
27 //
28 
29 #define EFI_PXE_DHCP4_PROTOCOL_GUID \
30   { 0x03c4e624, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x29, 0x3f, 0xc1, 0x4d} }
31 
32 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
33 //
34 // Interface definition
35 //
36 
37 EFI_FORWARD_DECLARATION (EFI_PXE_DHCP4_PROTOCOL);
38 
39 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
40 //
41 // Descriptions of the DHCP version 4 header and options can be found
42 // in RFC-2131 and RFC-2132 at www.ietf.org
43 //
44 
45 #pragma pack(1)
46 typedef struct {
47 
48   UINT8 op;
49 #define BOOTP_REQUEST   1
50 #define BOOTP_REPLY   2
51 
52   UINT8 htype;
53 
54   UINT8 hlen;
55 
56   UINT8 hops;
57 
58   UINT32 xid;
59 
60   UINT16 secs;
61 #define DHCP4_INITIAL_SECONDS 4
62 
63   UINT16 flags;
64 #define DHCP4_BROADCAST_FLAG  0x8000
65 
66   UINT32 ciaddr;
67 
68   UINT32 yiaddr;
69 
70   UINT32 siaddr;
71 
72   UINT32 giaddr;
73 
74   UINT8 chaddr[16];
75 
76   UINT8 sname[64];
77 
78   UINT8 fname[128];
79 
80 //
81 // This is the minimum option length as specified in RFC-2131.
82 // The packet must be padded out this far with DHCP4_PAD.
83 // DHCPv4 packets are usually 576 bytes in length.  This length
84 // includes the IPv4 and UDPv4 headers but not the media header.
85 // Note: Not all DHCP relay agents will forward DHCPv4 packets
86 // if they are less than 384 bytes or exceed 576 bytes.  Even if
87 // the underlying hardware can handle smaller and larger packets,
88 // many older relay agents will not accept them.
89 //
90   UINT32 magik;
91 #define DHCP4_MAGIK_NUMBER  0x63825363
92 
93   UINT8 options[308];
94 
95 } DHCP4_HEADER;
96 #pragma pack()
97 
98 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
99 //
100 // DHCPv4 packet definition.  Room for 576 bytes including IP and
101 // UDP header.
102 //
103 
104 #define DHCP4_MAX_PACKET_SIZE     576
105 #define DHCP4_UDP_HEADER_SIZE     8
106 #define DHCP4_IP_HEADER_SIZE      20
107 
108 #pragma pack(1)
109 typedef union _DHCP4_PACKET {
110   UINT32 _force_data_alignment;
111 
112   UINT8 raw[1500];
113 
114   DHCP4_HEADER dhcp4;
115 } DHCP4_PACKET;
116 #pragma pack()
117 
118 #define DHCP4_SERVER_PORT 67
119 #define DHCP4_CLIENT_PORT 68
120 
121 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
122 //
123 // DHCPv4 and PXE option numbers.
124 //
125 
126 #define DHCP4_PAD                             0
127 #define DHCP4_END                             255
128 #define DHCP4_SUBNET_MASK                     1
129 #define DHCP4_TIME_OFFSET                     2
130 #define DHCP4_ROUTER_LIST                     3
131 #define DHCP4_TIME_SERVERS                    4
132 #define DHCP4_NAME_SERVERS                    5
133 #define DHCP4_DNS_SERVERS                     6
134 #define DHCP4_LOG_SERVERS                     7
135 #define DHCP4_COOKIE_SERVERS                  8
136 #define DHCP4_LPR_SREVERS                     9
137 #define DHCP4_IMPRESS_SERVERS                 10
138 #define DHCP4_RESOURCE_LOCATION_SERVERS       11
139 #define DHCP4_HOST_NAME                       12
140 #define DHCP4_BOOT_FILE_SIZE                  13
141 #define DHCP4_DUMP_FILE                       14
142 #define DHCP4_DOMAIN_NAME                     15
143 #define DHCP4_SWAP_SERVER                     16
144 #define DHCP4_ROOT_PATH                       17
145 #define DHCP4_EXTENSION_PATH                  18
146 #define DHCP4_IP_FORWARDING                   19
147 #define DHCP4_NON_LOCAL_SOURCE_ROUTE          20
148 #define DHCP4_POLICY_FILTER                   21
149 #define DHCP4_MAX_DATAGRAM_SIZE               22
150 #define DHCP4_DEFAULT_TTL                     23
151 #define DHCP4_MTU_AGING_TIMEOUT               24
152 #define DHCP4_MTU_SIZES                       25
153 #define DHCP4_MTU_TO_USE                      26
154 #define DHCP4_ALL_SUBNETS_LOCAL               27
155 #define DHCP4_BROADCAST_ADDRESS               28
156 #define DHCP4_PERFORM_MASK_DISCOVERY          29
157 #define DHCP4_RESPOND_TO_MASK_REQ             30
158 #define DHCP4_PERFORM_ROUTER_DISCOVERY        31
159 #define DHCP4_ROUTER_SOLICIT_ADDRESS          32
160 #define DHCP4_STATIC_ROUTER_LIST              33
161 #define DHCP4_USE_ARP_TRAILERS                34
162 #define DHCP4_ARP_CACHE_TIMEOUT               35
163 #define DHCP4_ETHERNET_ENCAPSULATION          36
164 #define DHCP4_TCP_DEFAULT_TTL                 37
165 #define DHCP4_TCP_KEEP_ALIVE_INT              38
166 #define DHCP4_KEEP_ALIVE_GARBAGE              39
167 #define DHCP4_NIS_DOMAIN_NAME                 40
168 #define DHCP4_NIS_SERVERS                     41
169 #define DHCP4_NTP_SERVERS                     42
170 #define DHCP4_VENDOR_SPECIFIC                 43
171 # define PXE_MTFTP_IP                         1
172 # define PXE_MTFTP_CPORT                      2
173 # define PXE_MTFTP_SPORT                      3
174 # define PXE_MTFTP_TMOUT                      4
175 # define PXE_MTFTP_DELAY                      5
176 # define PXE_DISCOVERY_CONTROL                6
177 #  define PXE_DISABLE_BROADCAST_DISCOVERY     0x01
178 #  define PXE_DISABLE_MULTICAST_DISCOVERY     0x02
179 #  define PXE_ACCEPT_ONLY_PXE_BOOT_SERVERS    0x04
180 #  define PXE_DO_NOT_PROMPT                   0x08
181 # define PXE_DISCOVERY_MCAST_ADDR             7
182 # define PXE_BOOT_SERVERS                     8
183 # define PXE_BOOT_MENU                        9
184 # define PXE_BOOT_PROMPT                      10
185 # define PXE_MCAST_ADDRS_ALLOC                11
186 # define PXE_CREDENTIAL_TYPES                 12
187 # define PXE_BOOT_ITEM                        71
188 #define DHCP4_NBNS_SERVERS                    44
189 #define DHCP4_NBDD_SERVERS                    45
190 #define DHCP4_NETBIOS_NODE_TYPE               46
191 #define DHCP4_NETBIOS_SCOPE                   47
192 #define DHCP4_XWINDOW_SYSTEM_FONT_SERVERS     48
193 #define DHCP4_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
194 #define DHCP4_REQUESTED_IP_ADDRESS            50
195 #define DHCP4_LEASE_TIME                      51
196 #define DHCP4_OPTION_OVERLOAD                 52
197 # define DHCP4_OVERLOAD_FNAME                 1
198 # define DHCP4_OVERLOAD_SNAME                 2
199 # define DHCP4_OVERLOAD_FNAME_AND_SNAME       3
200 #define DHCP4_MESSAGE_TYPE                    53
201 # define DHCP4_MESSAGE_TYPE_DISCOVER          1
202 # define DHCP4_MESSAGE_TYPE_OFFER             2
203 # define DHCP4_MESSAGE_TYPE_REQUEST           3
204 # define DHCP4_MESSAGE_TYPE_DECLINE           4
205 # define DHCP4_MESSAGE_TYPE_ACK               5
206 # define DHCP4_MESSAGE_TYPE_NAK               6
207 # define DHCP4_MESSAGE_TYPE_RELEASE           7
208 # define DHCP4_MESSAGE_TYPE_INFORM            8
209 #define DHCP4_SERVER_IDENTIFIER               54
210 #define DHCP4_PARAMETER_REQUEST_LIST          55
211 #define DHCP4_ERROR_MESSAGE                   56
212 #define DHCP4_MAX_MESSAGE_SIZE                57
213 # define DHCP4_DEFAULT_MAX_MESSAGE_SIZE       576
214 #define DHCP4_RENEWAL_TIME                    58
215 #define DHCP4_REBINDING_TIME                  59
216 #define DHCP4_CLASS_IDENTIFIER                60
217 #define DHCP4_CLIENT_IDENTIFIER               61
218 #define DHCP4_NISPLUS_DOMAIN_NAME             64
219 #define DHCP4_NISPLUS_SERVERS                 65
220 #define DHCP4_TFTP_SERVER_NAME                66
221 #define DHCP4_BOOTFILE                        67
222 #define DHCP4_MOBILE_IP_HOME_AGENTS           68
223 #define DHCP4_SMPT_SERVERS                    69
224 #define DHCP4_POP3_SERVERS                    70
225 #define DHCP4_NNTP_SERVERS                    71
226 #define DHCP4_WWW_SERVERS                     72
227 #define DHCP4_FINGER_SERVERS                  73
228 #define DHCP4_IRC_SERVERS                     74
229 #define DHCP4_STREET_TALK_SERVERS             75
230 #define DHCP4_STREET_TALK_DIR_ASSIST_SERVERS  76
231 #define DHCP4_NDS_SERVERS                     85
232 #define DHCP4_NDS_TREE_NAME                   86
233 #define DHCP4_NDS_CONTEXT                     87
234 #define DHCP4_SYSTEM_ARCHITECTURE             93
235 #define DHCP4_NETWORK_ARCHITECTURE            94
236 #define DHCP4_PLATFORM_ID                     97
237 
238 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
239 //
240 // DHCP4 option format.
241 //
242 
243 #pragma pack(1)
244 typedef struct {
245   UINT8 op;
246   UINT8 len;
247   UINT8 data[1];
248 } DHCP4_OP;
249 #pragma pack()
250 
251 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
252 
253 typedef struct {
254   DHCP4_PACKET Discover;
255   DHCP4_PACKET Offer;
256   DHCP4_PACKET Request;
257   DHCP4_PACKET AckNak;
258   BOOLEAN SetupCompleted;
259   BOOLEAN InitCompleted;
260   BOOLEAN SelectCompleted;
261   BOOLEAN IsBootp;
262   BOOLEAN IsAck;
263 } EFI_PXE_DHCP4_DATA;
264 
265 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
266 typedef
267 EFI_STATUS
268 (EFIAPI *EFI_PXE_DHCP4_RUN) (
269   IN EFI_PXE_DHCP4_PROTOCOL *This,
270   IN OPTIONAL UINTN         OpLen,
271   IN OPTIONAL VOID          *OpList
272   );
273 
274 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
275 typedef
276 EFI_STATUS
277 (EFIAPI *EFI_PXE_DHCP4_SETUP) (
278   IN EFI_PXE_DHCP4_PROTOCOL          *This,
279   IN OPTIONAL EFI_PXE_DHCP4_DATA     * NewData
280   );
281 
282 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
283 typedef
284 EFI_STATUS
285 (EFIAPI *EFI_PXE_DHCP4_INIT) (
286   IN EFI_PXE_DHCP4_PROTOCOL *This,
287   IN UINTN                  SecondsTimeout,
288   OUT UINTN                 *Offers,
289   OUT DHCP4_PACKET          **OfferList
290   );
291 
292 #define DHCP4_MIN_SECONDS   1
293 #define DHCP4_MAX_SECONDS   60
294 
295 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
296 typedef
297 EFI_STATUS
298 (EFIAPI *EFI_PXE_DHCP4_SELECT) (
299   IN EFI_PXE_DHCP4_PROTOCOL *This,
300   IN UINTN                  SecondsTimeout,
301   IN DHCP4_PACKET           * offer
302   );
303 
304 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
305 typedef
306 EFI_STATUS
307 (EFIAPI *EFI_PXE_DHCP4_RENEW) (
308   IN EFI_PXE_DHCP4_PROTOCOL *This,
309   UINTN                     seconds_timeout
310   );
311 
312 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
313 typedef
314 EFI_STATUS
315 (EFIAPI *EFI_PXE_DHCP4_REBIND) (
316   IN EFI_PXE_DHCP4_PROTOCOL *This,
317   UINTN                     seconds_timeout
318   );
319 
320 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
321 typedef
322 EFI_STATUS
323 (EFIAPI *EFI_PXE_DHCP4_RELEASE) (
324   IN EFI_PXE_DHCP4_PROTOCOL * This
325   );
326 
327 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
328 
329 #define EFI_PXE_DHCP4_PROTOCOL_REVISION    0x00010000
330 
331 struct _EFI_PXE_DHCP4_PROTOCOL {
332   UINT64 Revision;
333   EFI_PXE_DHCP4_RUN Run;
334   EFI_PXE_DHCP4_SETUP Setup;
335   EFI_PXE_DHCP4_INIT Init;
336   EFI_PXE_DHCP4_SELECT Select;
337   EFI_PXE_DHCP4_RENEW Renew;
338   EFI_PXE_DHCP4_REBIND Rebind;
339   EFI_PXE_DHCP4_RELEASE Release;
340   EFI_PXE_DHCP4_DATA *Data;
341 };
342 
343 //
344 //
345 //
346 
347 extern EFI_GUID gEfiPxeDhcp4ProtocolGuid;
348 
349 #endif /* _PXEDHCP4_H_ */
350 /* EOF - PxeDhcp4.h */
351