1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PxeDhcp4.h
Abstract:
Common header for PxeDhcp4 protocol driver
**/
#ifndef _PXEDHCP4_H
#define _PXEDHCP4_H
#include <PiDxe.h>
#include <Protocol/PxeBaseCode.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/PxeDhcp4.h>
#include <Protocol/PxeDhcp4Callback.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// PxeDhcp4 protocol instance data
//
typedef struct {
//
// Signature field used to locate beginning of containment record.
//
UINTN Signature;
#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
//
// Device handle the protocol is bound to.
//
EFI_HANDLE Handle;
//
// Public PxeDhcp4 protocol interface.
//
EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
//
// Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
//
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
//
// PxeDhcp4 called function for PxeDhcp4Callback.
//
EFI_PXE_DHCP4_FUNCTION function;
//
// Timeout event and flag for PxeDhcp4Callback.
//
EFI_EVENT TimeoutEvent;
BOOLEAN TimeoutOccurred;
//
// Periodic event and flag for PxeDhcp4Callback.
//
EFI_EVENT PeriodicEvent;
BOOLEAN PeriodicOccurred;
//
// DHCP server IP address.
//
UINT32 ServerIp;
//
// DHCP renewal and rebinding times, in seconds.
//
UINT32 RenewTime;
UINT32 RebindTime;
UINT32 LeaseTime;
//
// Number of offers received & allocated offer list.
//
UINTN offers;
DHCP4_PACKET *offer_list;
//
//
//
BOOLEAN StopPxeBc;
} PXE_DHCP4_PRIVATE_DATA;
#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Protocol function prototypes.
//
extern
EFI_STATUS
EFIAPI
PxeDhcp4Run (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN OPTIONAL UINTN OpLen,
IN OPTIONAL VOID *OpList
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Setup (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN EFI_PXE_DHCP4_DATA *Data
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Init (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
OUT UINTN *offer_list_entries,
OUT DHCP4_PACKET **offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Select (
IN EFI_PXE_DHCP4_PROTOCOL *This,
IN UINTN seconds_timeout,
IN DHCP4_PACKET *offer_list
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Renew (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Rebind (
IN EFI_PXE_DHCP4_PROTOCOL *This,
UINTN seconds_timeout
)
;
extern
EFI_STATUS
EFIAPI
PxeDhcp4Release (
IN EFI_PXE_DHCP4_PROTOCOL *This
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Support function prototypes.
//
extern
UINT16
htons (
UINTN n
)
;
extern
UINT32
htonl (
UINTN n
)
;
extern
VOID
EFIAPI
timeout_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
VOID
EFIAPI
periodic_notify (
IN EFI_EVENT Event,
IN VOID *Context
)
;
extern
EFI_STATUS
find_opt (
IN DHCP4_PACKET *Packet,
IN UINT8 OpCode,
IN UINTN Skip,
OUT DHCP4_OP **OpPtr
)
;
extern
EFI_STATUS
add_opt (
IN DHCP4_PACKET *Packet,
IN DHCP4_OP *OpPtr
)
;
extern
EFI_STATUS
start_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OPTIONAL EFI_IP_ADDRESS *station_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
)
;
extern
VOID
stop_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
start_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN UINTN seconds_timeout
)
;
extern
VOID
stop_receive_events (
IN PXE_DHCP4_PRIVATE_DATA *Private
)
;
extern
EFI_STATUS
tx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN EFI_IP_ADDRESS *dest_ip,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN EFI_IP_ADDRESS *src_ip,
IN VOID *buffer,
IN UINTN BufferSize
)
;
extern
EFI_STATUS
rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
OUT VOID *buffer,
OUT UINTN *BufferSize,
IN OUT EFI_IP_ADDRESS *dest_ip,
IN OUT EFI_IP_ADDRESS *src_ip,
IN UINT16 op_flags
)
;
extern
EFI_STATUS
tx_rx_udp (
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN OUT EFI_IP_ADDRESS *ServerIp,
IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
IN OPTIONAL EFI_IP_ADDRESS *client_ip,
IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
IN DHCP4_PACKET *tx_pkt,
OUT DHCP4_PACKET *rx_pkt,
IN INTN
(
*rx_vfy)
(
IN PXE_DHCP4_PRIVATE_DATA *Private,
IN DHCP4_PACKET *tx_pkt,
IN DHCP4_PACKET *rx_pkt,
IN UINTN rx_pkt_size
),
IN UINTN seconds_timeout
)
;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
//
// Global variable definitions.
//
extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPxeDhcp4ComponentName2;
EFI_STATUS
EFIAPI
PxeDhcp4DriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Register Driver Binding protocol for this driver.
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
EFI_SUCCESS - Driver loaded.
other - Driver not loaded.
--*/
;
#endif /* _PXEDHCP4_H */
/* EOF - PxeDhcp4.h */
|