TianoCore EDK2 master
Loading...
Searching...
No Matches
Dhcp4Impl.h
Go to the documentation of this file.
1
14#ifndef __EFI_DHCP4_IMPL_H__
15#define __EFI_DHCP4_IMPL_H__
16
17#include <Uefi.h>
18
19#include <Protocol/Dhcp4.h>
20#include <Protocol/Udp4.h>
22#include <Library/DebugLib.h>
25#include <Library/UefiLib.h>
26#include <Library/BaseLib.h>
27#include <Library/NetLib.h>
28
29typedef struct _DHCP_SERVICE DHCP_SERVICE;
30typedef struct _DHCP_PROTOCOL DHCP_PROTOCOL;
31
32#include "Dhcp4Option.h"
33#include "Dhcp4Io.h"
34
35#define DHCP_SERVICE_SIGNATURE SIGNATURE_32 ('D', 'H', 'C', 'P')
36#define DHCP_PROTOCOL_SIGNATURE SIGNATURE_32 ('d', 'h', 'c', 'p')
37
38#define DHCP_CHECK_MEDIA_WAITING_TIME EFI_TIMER_PERIOD_SECONDS(20)
39
40//
41// The state of the DHCP service. It starts as UNCONFIGED. If
42// and active child configures the service successfully, it
43// goes to CONFIGED. If the active child configures NULL, it
44// goes back to UNCONFIGED. It becomes DESTROY if it is (partly)
45// destroyed.
46//
47#define DHCP_UNCONFIGED 0
48#define DHCP_CONFIGED 1
49#define DHCP_DESTROY 2
50
52 UINT32 Signature;
53 EFI_DHCP4_PROTOCOL Dhcp4Protocol;
54 LIST_ENTRY Link;
55 EFI_HANDLE Handle;
56 DHCP_SERVICE *Service;
57
58 BOOLEAN InDestroy;
59
60 EFI_EVENT CompletionEvent;
61 EFI_EVENT RenewRebindEvent;
62
64 UDP_IO *UdpIo; // The UDP IO used for TransmitReceive.
65 UINT32 Timeout;
66 UINT16 ElaspedTime;
67 NET_BUF_QUEUE ResponseQueue;
68};
69
70//
71// DHCP driver is specical in that it is a singleton. Although it
72// has a service binding, there can be only one active child.
73//
75 UINT32 Signature;
76 EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
77
78 INTN ServiceState; // CONFIGED, UNCONFIGED, and DESTROY
79
80 EFI_HANDLE Controller;
81 EFI_HANDLE Image;
82
83 LIST_ENTRY Children;
84 UINTN NumChildren;
85
86 INTN DhcpState;
87 EFI_STATUS IoStatus; // the result of last user operation
88 UINT32 Xid;
89
90 IP4_ADDR ClientAddr; // lease IP or configured client address
91 IP4_ADDR Netmask;
92 IP4_ADDR ServerAddr;
93
94 EFI_DHCP4_PACKET *LastOffer; // The last received offer
95 EFI_DHCP4_PACKET *Selected;
96 DHCP_PARAMETER *Para;
97
98 UINT32 Lease;
99 UINT32 T1;
100 UINT32 T2;
101 INTN ExtraRefresh; // This refresh is reqested by user
102
103 UDP_IO *UdpIo; // Udp child receiving all DHCP message
104 UDP_IO *LeaseIoPort; // Udp child with lease IP
105 EFI_DHCP4_PACKET *LastPacket; // The last sent packet for retransmission
106 EFI_MAC_ADDRESS Mac;
107 UINT8 HwType;
108 UINT8 HwLen;
109 UINT8 ClientAddressSendOut[16];
110
111 DHCP_PROTOCOL *ActiveChild;
112 EFI_DHCP4_CONFIG_DATA ActiveConfig;
113 UINT32 UserOptionLen;
114
115 //
116 // Timer event and various timer
117 //
118 EFI_EVENT Timer;
119
120 UINT32 PacketToLive; // Retransmission timer for our packets
121 UINT32 LastTimeout; // Record the init value of PacketToLive every time
122 INTN CurRetry;
123 INTN MaxRetries;
124 UINT32 LeaseLife;
125};
126
127typedef struct {
129 UINT32 OptionCount;
130 UINT32 Index;
132
133#define DHCP_INSTANCE_FROM_THIS(Proto) \
134 CR ((Proto), DHCP_PROTOCOL, Dhcp4Protocol, DHCP_PROTOCOL_SIGNATURE)
135
136#define DHCP_SERVICE_FROM_THIS(Sb) \
137 CR ((Sb), DHCP_SERVICE, ServiceBinding, DHCP_SERVICE_SIGNATURE)
138
139extern EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate;
140
149VOID
151 IN DHCP_SERVICE *DhcpSb
152 );
153
160VOID
162 IN DHCP_PROTOCOL *Instance
163 );
164
173VOID
176 );
177
184VOID
185EFIAPI
187 IN VOID *Arg
188 );
189
197VOID
199 IN UINT16 *Elapsed,
200 IN DHCP_PROTOCOL *Instance
201 );
202
203#endif
UINT64 UINTN
INT64 INTN
VOID EFIAPI DhcpDummyExtFree(IN VOID *Arg)
Definition: Dhcp4Impl.c:1296
VOID DhcpCleanConfigure(IN OUT EFI_DHCP4_CONFIG_DATA *Config)
Definition: Dhcp4Impl.c:415
VOID PxeDhcpDone(IN DHCP_PROTOCOL *Instance)
Definition: Dhcp4Impl.c:1419
VOID DhcpYieldControl(IN DHCP_SERVICE *DhcpSb)
Definition: Dhcp4Impl.c:545
VOID SetElapsedTime(IN UINT16 *Elapsed, IN DHCP_PROTOCOL *Instance)
Definition: Dhcp4Impl.c:1783
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33