]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/Arp.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / Arp.h
... / ...
CommitLineData
1/** @file\r
2 EFI ARP Protocol Definition\r
3\r
4 The EFI ARP Service Binding Protocol is used to locate EFI\r
5 ARP Protocol drivers to create and destroy child of the\r
6 driver to communicate with other host using ARP protocol.\r
7 The EFI ARP Protocol provides services to map IP network\r
8 address to hardware address used by a data link protocol.\r
9\r
10Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
11SPDX-License-Identifier: BSD-2-Clause-Patent\r
12\r
13 @par Revision Reference:\r
14 This Protocol was introduced in UEFI Specification 2.0.\r
15\r
16**/\r
17\r
18#ifndef __EFI_ARP_PROTOCOL_H__\r
19#define __EFI_ARP_PROTOCOL_H__\r
20\r
21#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \\r
22 { \\r
23 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3 } \\r
24 }\r
25\r
26#define EFI_ARP_PROTOCOL_GUID \\r
27 { \\r
28 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } \\r
29 }\r
30\r
31typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL;\r
32\r
33typedef struct {\r
34 ///\r
35 /// Length in bytes of this entry.\r
36 ///\r
37 UINT32 Size;\r
38\r
39 ///\r
40 /// Set to TRUE if this entry is a "deny" entry.\r
41 /// Set to FALSE if this entry is a "normal" entry.\r
42 ///\r
43 BOOLEAN DenyFlag;\r
44\r
45 ///\r
46 /// Set to TRUE if this entry will not time out.\r
47 /// Set to FALSE if this entry will time out.\r
48 ///\r
49 BOOLEAN StaticFlag;\r
50\r
51 ///\r
52 /// 16-bit ARP hardware identifier number.\r
53 ///\r
54 UINT16 HwAddressType;\r
55\r
56 ///\r
57 /// 16-bit protocol type number.\r
58 ///\r
59 UINT16 SwAddressType;\r
60\r
61 ///\r
62 /// The length of the hardware address.\r
63 ///\r
64 UINT8 HwAddressLength;\r
65\r
66 ///\r
67 /// The length of the protocol address.\r
68 ///\r
69 UINT8 SwAddressLength;\r
70} EFI_ARP_FIND_DATA;\r
71\r
72typedef struct {\r
73 ///\r
74 /// 16-bit protocol type number in host byte order.\r
75 ///\r
76 UINT16 SwAddressType;\r
77\r
78 ///\r
79 /// The length in bytes of the station's protocol address to register.\r
80 ///\r
81 UINT8 SwAddressLength;\r
82\r
83 ///\r
84 /// The pointer to the first byte of the protocol address to register. For\r
85 /// example, if SwAddressType is 0x0800 (IP), then\r
86 /// StationAddress points to the first byte of this station's IP\r
87 /// address stored in network byte order.\r
88 ///\r
89 VOID *StationAddress;\r
90\r
91 ///\r
92 /// The timeout value in 100-ns units that is associated with each\r
93 /// new dynamic ARP cache entry. If it is set to zero, the value is\r
94 /// implementation-specific.\r
95 ///\r
96 UINT32 EntryTimeOut;\r
97\r
98 ///\r
99 /// The number of retries before a MAC address is resolved. If it is\r
100 /// set to zero, the value is implementation-specific.\r
101 ///\r
102 UINT32 RetryCount;\r
103\r
104 ///\r
105 /// The timeout value in 100-ns units that is used to wait for the ARP\r
106 /// reply packet or the timeout value between two retries. Set to zero\r
107 /// to use implementation-specific value.\r
108 ///\r
109 UINT32 RetryTimeOut;\r
110} EFI_ARP_CONFIG_DATA;\r
111\r
112/**\r
113 This function is used to assign a station address to the ARP cache for this instance\r
114 of the ARP driver.\r
115\r
116 Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will\r
117 respond to ARP requests that match this registered station address. A call to\r
118 this function with the ConfigData field set to NULL will reset this ARP instance.\r
119\r
120 Once a protocol type and station address have been assigned to this ARP instance,\r
121 all the following ARP functions will use this information. Attempting to change\r
122 the protocol type or station address to a configured ARP instance will result in errors.\r
123\r
124 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
125 @param ConfigData The pointer to the EFI_ARP_CONFIG_DATA structure.\r
126\r
127 @retval EFI_SUCCESS The new station address was successfully\r
128 registered.\r
129 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
130 * This is NULL.\r
131 * SwAddressLength is zero when ConfigData is not NULL.\r
132 * StationAddress is NULL when ConfigData is not NULL.\r
133 @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or\r
134 StationAddress is different from the one that is\r
135 already registered.\r
136 @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be\r
137 allocated.\r
138\r
139**/\r
140typedef\r
141EFI_STATUS\r
142(EFIAPI *EFI_ARP_CONFIGURE)(\r
143 IN EFI_ARP_PROTOCOL *This,\r
144 IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r
145 );\r
146\r
147/**\r
148 This function is used to insert entries into the ARP cache.\r
149\r
150 ARP cache entries are typically inserted and updated by network protocol drivers\r
151 as network traffic is processed. Most ARP cache entries will time out and be\r
152 deleted if the network traffic stops. ARP cache entries that were inserted\r
153 by the Add() function may be static (will not time out) or dynamic (will time out).\r
154 Default ARP cache timeout values are not covered in most network protocol\r
155 specifications (although RFC 1122 comes pretty close) and will only be\r
156 discussed in general terms in this specification. The timeout values that are\r
157 used in the EFI Sample Implementation should be used only as a guideline.\r
158 Final product implementations of the EFI network stack should be tuned for\r
159 their expected network environments.\r
160\r
161 @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
162 @param DenyFlag Set to TRUE if this entry is a deny entry. Set to\r
163 FALSE if this entry is a normal entry.\r
164 @param TargetSwAddress Pointer to a protocol address to add (or deny).\r
165 May be set to NULL if DenyFlag is TRUE.\r
166 @param TargetHwAddress Pointer to a hardware address to add (or deny).\r
167 May be set to NULL if DenyFlag is TRUE.\r
168 @param TimeoutValue Time in 100-ns units that this entry will remain\r
169 in the ARP cache. A value of zero means that the\r
170 entry is permanent. A nonzero value will override\r
171 the one given by Configure() if the entry to be\r
172 added is a dynamic entry.\r
173 @param Overwrite If TRUE, the matching cache entry will be\r
174 overwritten with the supplied parameters. If\r
175 FALSE, EFI_ACCESS_DENIED is returned if the\r
176 corresponding cache entry already exists.\r
177\r
178 @retval EFI_SUCCESS The entry has been added or updated.\r
179 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
180 * This is NULL.\r
181 * DenyFlag is FALSE and TargetHwAddress is NULL.\r
182 * DenyFlag is FALSE and TargetSwAddress is NULL.\r
183 * TargetHwAddress is NULL and TargetSwAddress is NULL.\r
184 * Neither TargetSwAddress nor TargetHwAddress are NULL when DenyFlag is\r
185 TRUE.\r
186 @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.\r
187 @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite\r
188 is not true.\r
189 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
190\r
191**/\r
192typedef\r
193EFI_STATUS\r
194(EFIAPI *EFI_ARP_ADD)(\r
195 IN EFI_ARP_PROTOCOL *This,\r
196 IN BOOLEAN DenyFlag,\r
197 IN VOID *TargetSwAddress OPTIONAL,\r
198 IN VOID *TargetHwAddress OPTIONAL,\r
199 IN UINT32 TimeoutValue,\r
200 IN BOOLEAN Overwrite\r
201 );\r
202\r
203/**\r
204 This function searches the ARP cache for matching entries and allocates a buffer into\r
205 which those entries are copied.\r
206\r
207 The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which\r
208 are protocol address pairs and hardware address pairs.\r
209 When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer\r
210 is not NULL), the ARP cache timeout for the found entry is reset if Refresh is\r
211 set to TRUE. If the found ARP cache entry is a permanent entry, it is not\r
212 affected by Refresh.\r
213\r
214 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
215 @param BySwAddress Set to TRUE to look for matching software protocol\r
216 addresses. Set to FALSE to look for matching\r
217 hardware protocol addresses.\r
218 @param AddressBuffer The pointer to the address buffer. Set to NULL\r
219 to match all addresses.\r
220 @param EntryLength The size of an entry in the entries buffer.\r
221 @param EntryCount The number of ARP cache entries that are found by\r
222 the specified criteria.\r
223 @param Entries The pointer to the buffer that will receive the ARP\r
224 cache entries.\r
225 @param Refresh Set to TRUE to refresh the timeout value of the\r
226 matching ARP cache entry.\r
227\r
228 @retval EFI_SUCCESS The requested ARP cache entries were copied into\r
229 the buffer.\r
230 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
231 This is NULL. Both EntryCount and EntryLength are\r
232 NULL, when Refresh is FALSE.\r
233 @retval EFI_NOT_FOUND No matching entries were found.\r
234 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
235\r
236**/\r
237typedef\r
238EFI_STATUS\r
239(EFIAPI *EFI_ARP_FIND)(\r
240 IN EFI_ARP_PROTOCOL *This,\r
241 IN BOOLEAN BySwAddress,\r
242 IN VOID *AddressBuffer OPTIONAL,\r
243 OUT UINT32 *EntryLength OPTIONAL,\r
244 OUT UINT32 *EntryCount OPTIONAL,\r
245 OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,\r
246 IN BOOLEAN Refresh\r
247 );\r
248\r
249/**\r
250 This function removes specified ARP cache entries.\r
251\r
252 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
253 @param BySwAddress Set to TRUE to delete matching protocol addresses.\r
254 Set to FALSE to delete matching hardware\r
255 addresses.\r
256 @param AddressBuffer The pointer to the address buffer that is used as a\r
257 key to look for the cache entry. Set to NULL to\r
258 delete all entries.\r
259\r
260 @retval EFI_SUCCESS The entry was removed from the ARP cache.\r
261 @retval EFI_INVALID_PARAMETER This is NULL.\r
262 @retval EFI_NOT_FOUND The specified deletion key was not found.\r
263 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
264\r
265**/\r
266typedef\r
267EFI_STATUS\r
268(EFIAPI *EFI_ARP_DELETE)(\r
269 IN EFI_ARP_PROTOCOL *This,\r
270 IN BOOLEAN BySwAddress,\r
271 IN VOID *AddressBuffer OPTIONAL\r
272 );\r
273\r
274/**\r
275 This function delete all dynamic entries from the ARP cache that match the specified\r
276 software protocol type.\r
277\r
278 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
279\r
280 @retval EFI_SUCCESS The cache has been flushed.\r
281 @retval EFI_INVALID_PARAMETER This is NULL.\r
282 @retval EFI_NOT_FOUND There are no matching dynamic cache entries.\r
283 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
284\r
285**/\r
286typedef\r
287EFI_STATUS\r
288(EFIAPI *EFI_ARP_FLUSH)(\r
289 IN EFI_ARP_PROTOCOL *This\r
290 );\r
291\r
292/**\r
293 This function tries to resolve the TargetSwAddress and optionally returns a\r
294 TargetHwAddress if it already exists in the ARP cache.\r
295\r
296 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
297 @param TargetSwAddress The pointer to the protocol address to resolve.\r
298 @param ResolvedEvent The pointer to the event that will be signaled when\r
299 the address is resolved or some error occurs.\r
300 @param TargetHwAddress The pointer to the buffer for the resolved hardware\r
301 address in network byte order.\r
302\r
303 @retval EFI_SUCCESS The data is copied from the ARP cache into the\r
304 TargetHwAddress buffer.\r
305 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
306 This is NULL. TargetHwAddress is NULL.\r
307 @retval EFI_ACCESS_DENIED The requested address is not present in the normal\r
308 ARP cache but is present in the deny address list.\r
309 Outgoing traffic to that address is forbidden.\r
310 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
311 @retval EFI_NOT_READY The request has been started and is not finished.\r
312\r
313**/\r
314typedef\r
315EFI_STATUS\r
316(EFIAPI *EFI_ARP_REQUEST)(\r
317 IN EFI_ARP_PROTOCOL *This,\r
318 IN VOID *TargetSwAddress OPTIONAL,\r
319 IN EFI_EVENT ResolvedEvent OPTIONAL,\r
320 OUT VOID *TargetHwAddress\r
321 );\r
322\r
323/**\r
324 This function aborts the previous ARP request (identified by This, TargetSwAddress\r
325 and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r
326\r
327 If the request is in the internal ARP request queue, the request is aborted\r
328 immediately and its ResolvedEvent is signaled. Only an asynchronous address\r
329 request needs to be canceled. If TargeSwAddress and ResolveEvent are both\r
330 NULL, all the pending asynchronous requests that have been issued by This\r
331 instance will be cancelled and their corresponding events will be signaled.\r
332\r
333 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
334 @param TargetSwAddress The pointer to the protocol address in previous\r
335 request session.\r
336 @param ResolvedEvent Pointer to the event that is used as the\r
337 notification event in previous request session.\r
338\r
339 @retval EFI_SUCCESS The pending request session(s) is/are aborted and\r
340 corresponding event(s) is/are signaled.\r
341 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
342 This is NULL. TargetSwAddress is not NULL and\r
343 ResolvedEvent is NULL. TargetSwAddress is NULL and\r
344 ResolvedEvent is not NULL.\r
345 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
346 @retval EFI_NOT_FOUND The request is not issued by\r
347 EFI_ARP_PROTOCOL.Request().\r
348\r
349\r
350**/\r
351typedef\r
352EFI_STATUS\r
353(EFIAPI *EFI_ARP_CANCEL)(\r
354 IN EFI_ARP_PROTOCOL *This,\r
355 IN VOID *TargetSwAddress OPTIONAL,\r
356 IN EFI_EVENT ResolvedEvent OPTIONAL\r
357 );\r
358\r
359///\r
360/// ARP is used to resolve local network protocol addresses into\r
361/// network hardware addresses.\r
362///\r
363struct _EFI_ARP_PROTOCOL {\r
364 EFI_ARP_CONFIGURE Configure;\r
365 EFI_ARP_ADD Add;\r
366 EFI_ARP_FIND Find;\r
367 EFI_ARP_DELETE Delete;\r
368 EFI_ARP_FLUSH Flush;\r
369 EFI_ARP_REQUEST Request;\r
370 EFI_ARP_CANCEL Cancel;\r
371};\r
372\r
373extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r
374extern EFI_GUID gEfiArpProtocolGuid;\r
375\r
376#endif\r