]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/Arp.h
MdePkg: Replace BSD License with BSD+Patent License
[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/**\r
114 This function is used to assign a station address to the ARP cache for this instance\r
115 of the ARP driver.\r
116\r
117 Each ARP instance has one station address. The EFI_ARP_PROTOCOL driver will\r
118 respond to ARP requests that match this registered station address. A call to\r
119 this function with the ConfigData field set to NULL will reset this ARP instance.\r
120\r
121 Once a protocol type and station address have been assigned to this ARP instance,\r
122 all the following ARP functions will use this information. Attempting to change\r
123 the protocol type or station address to a configured ARP instance will result in errors.\r
124\r
125 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
126 @param ConfigData The pointer to the EFI_ARP_CONFIG_DATA structure.\r
127\r
128 @retval EFI_SUCCESS The new station address was successfully\r
129 registered.\r
130 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
131 * This is NULL.\r
132 * SwAddressLength is zero when ConfigData is not NULL.\r
133 * StationAddress is NULL when ConfigData is not NULL.\r
134 @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or\r
135 StationAddress is different from the one that is\r
136 already registered.\r
137 @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be\r
138 allocated.\r
139\r
140**/\r
141typedef\r
142EFI_STATUS\r
143(EFIAPI *EFI_ARP_CONFIGURE)(\r
144 IN EFI_ARP_PROTOCOL *This,\r
145 IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r
146 );\r
147\r
148/**\r
149 This function is used to insert entries into the ARP cache.\r
150\r
151 ARP cache entries are typically inserted and updated by network protocol drivers\r
152 as network traffic is processed. Most ARP cache entries will time out and be\r
153 deleted if the network traffic stops. ARP cache entries that were inserted\r
154 by the Add() function may be static (will not time out) or dynamic (will time out).\r
155 Default ARP cache timeout values are not covered in most network protocol\r
156 specifications (although RFC 1122 comes pretty close) and will only be\r
157 discussed in general terms in this specification. The timeout values that are\r
158 used in the EFI Sample Implementation should be used only as a guideline.\r
159 Final product implementations of the EFI network stack should be tuned for\r
160 their expected network environments.\r
161\r
162 @param This Pointer to the EFI_ARP_PROTOCOL instance.\r
163 @param DenyFlag Set to TRUE if this entry is a deny entry. Set to\r
164 FALSE if this entry is a normal entry.\r
165 @param TargetSwAddress Pointer to a protocol address to add (or deny).\r
166 May be set to NULL if DenyFlag is TRUE.\r
167 @param TargetHwAddress Pointer to a hardware address to add (or deny).\r
168 May be set to NULL if DenyFlag is TRUE.\r
169 @param TimeoutValue Time in 100-ns units that this entry will remain\r
170 in the ARP cache. A value of zero means that the\r
171 entry is permanent. A nonzero value will override\r
172 the one given by Configure() if the entry to be\r
173 added is a dynamic entry.\r
174 @param Overwrite If TRUE, the matching cache entry will be\r
175 overwritten with the supplied parameters. If\r
176 FALSE, EFI_ACCESS_DENIED is returned if the\r
177 corresponding cache entry already exists.\r
178\r
179 @retval EFI_SUCCESS The entry has been added or updated.\r
180 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
181 * This is NULL.\r
182 * DenyFlag is FALSE and TargetHwAddress is NULL.\r
183 * DenyFlag is FALSE and TargetSwAddress is NULL.\r
184 * TargetHwAddress is NULL and TargetSwAddress is NULL.\r
185 * Neither TargetSwAddress nor TargetHwAddress are NULL when DenyFlag is\r
186 TRUE.\r
187 @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.\r
188 @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite\r
189 is not true.\r
190 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
191\r
192**/\r
193typedef\r
194EFI_STATUS\r
195(EFIAPI *EFI_ARP_ADD)(\r
196 IN EFI_ARP_PROTOCOL *This,\r
197 IN BOOLEAN DenyFlag,\r
198 IN VOID *TargetSwAddress OPTIONAL,\r
199 IN VOID *TargetHwAddress OPTIONAL,\r
200 IN UINT32 TimeoutValue,\r
201 IN BOOLEAN Overwrite\r
202 );\r
203\r
204/**\r
205 This function searches the ARP cache for matching entries and allocates a buffer into\r
206 which those entries are copied.\r
207\r
208 The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which\r
209 are protocol address pairs and hardware address pairs.\r
210 When finding a specific protocol address (BySwAddress is TRUE and AddressBuffer\r
211 is not NULL), the ARP cache timeout for the found entry is reset if Refresh is\r
212 set to TRUE. If the found ARP cache entry is a permanent entry, it is not\r
213 affected by Refresh.\r
214\r
215 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
216 @param BySwAddress Set to TRUE to look for matching software protocol\r
217 addresses. Set to FALSE to look for matching\r
218 hardware protocol addresses.\r
219 @param AddressBuffer The pointer to the address buffer. Set to NULL\r
220 to match all addresses.\r
221 @param EntryLength The size of an entry in the entries buffer.\r
222 @param EntryCount The number of ARP cache entries that are found by\r
223 the specified criteria.\r
224 @param Entries The pointer to the buffer that will receive the ARP\r
225 cache entries.\r
226 @param Refresh Set to TRUE to refresh the timeout value of the\r
227 matching ARP cache entry.\r
228\r
229 @retval EFI_SUCCESS The requested ARP cache entries were copied into\r
230 the buffer.\r
231 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
232 This is NULL. Both EntryCount and EntryLength are\r
233 NULL, when Refresh is FALSE.\r
234 @retval EFI_NOT_FOUND No matching entries were found.\r
235 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
236\r
237**/\r
238typedef\r
239EFI_STATUS\r
240(EFIAPI *EFI_ARP_FIND)(\r
241 IN EFI_ARP_PROTOCOL *This,\r
242 IN BOOLEAN BySwAddress,\r
243 IN VOID *AddressBuffer OPTIONAL,\r
244 OUT UINT32 *EntryLength OPTIONAL,\r
245 OUT UINT32 *EntryCount OPTIONAL,\r
246 OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,\r
247 IN BOOLEAN Refresh\r
248 );\r
249\r
250\r
251/**\r
252 This function removes specified ARP cache entries.\r
253\r
254 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
255 @param BySwAddress Set to TRUE to delete matching protocol addresses.\r
256 Set to FALSE to delete matching hardware\r
257 addresses.\r
258 @param AddressBuffer The pointer to the address buffer that is used as a\r
259 key to look for the cache entry. Set to NULL to\r
260 delete all entries.\r
261\r
262 @retval EFI_SUCCESS The entry was removed from the ARP cache.\r
263 @retval EFI_INVALID_PARAMETER This is NULL.\r
264 @retval EFI_NOT_FOUND The specified deletion key was not found.\r
265 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
266\r
267**/\r
268typedef\r
269EFI_STATUS\r
270(EFIAPI *EFI_ARP_DELETE)(\r
271 IN EFI_ARP_PROTOCOL *This,\r
272 IN BOOLEAN BySwAddress,\r
273 IN VOID *AddressBuffer OPTIONAL\r
274 );\r
275\r
276/**\r
277 This function delete all dynamic entries from the ARP cache that match the specified\r
278 software protocol type.\r
279\r
280 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
281\r
282 @retval EFI_SUCCESS The cache has been flushed.\r
283 @retval EFI_INVALID_PARAMETER This is NULL.\r
284 @retval EFI_NOT_FOUND There are no matching dynamic cache entries.\r
285 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
286\r
287**/\r
288typedef\r
289EFI_STATUS\r
290(EFIAPI *EFI_ARP_FLUSH)(\r
291 IN EFI_ARP_PROTOCOL *This\r
292 );\r
293\r
294/**\r
295 This function tries to resolve the TargetSwAddress and optionally returns a\r
296 TargetHwAddress if it already exists in the ARP cache.\r
297\r
298 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
299 @param TargetSwAddress The pointer to the protocol address to resolve.\r
300 @param ResolvedEvent The pointer to the event that will be signaled when\r
301 the address is resolved or some error occurs.\r
302 @param TargetHwAddress The pointer to the buffer for the resolved hardware\r
303 address in network byte order.\r
304\r
305 @retval EFI_SUCCESS The data is copied from the ARP cache into the\r
306 TargetHwAddress buffer.\r
307 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
308 This is NULL. TargetHwAddress is NULL.\r
309 @retval EFI_ACCESS_DENIED The requested address is not present in the normal\r
310 ARP cache but is present in the deny address list.\r
311 Outgoing traffic to that address is forbidden.\r
312 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
313 @retval EFI_NOT_READY The request has been started and is not finished.\r
314\r
315**/\r
316typedef\r
317EFI_STATUS\r
318(EFIAPI *EFI_ARP_REQUEST)(\r
319 IN EFI_ARP_PROTOCOL *This,\r
320 IN VOID *TargetSwAddress OPTIONAL,\r
321 IN EFI_EVENT ResolvedEvent OPTIONAL,\r
322 OUT VOID *TargetHwAddress\r
323 );\r
324\r
325/**\r
326 This function aborts the previous ARP request (identified by This, TargetSwAddress\r
327 and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r
328\r
329 If the request is in the internal ARP request queue, the request is aborted\r
330 immediately and its ResolvedEvent is signaled. Only an asynchronous address\r
331 request needs to be canceled. If TargeSwAddress and ResolveEvent are both\r
332 NULL, all the pending asynchronous requests that have been issued by This\r
333 instance will be cancelled and their corresponding events will be signaled.\r
334\r
335 @param This The pointer to the EFI_ARP_PROTOCOL instance.\r
336 @param TargetSwAddress The pointer to the protocol address in previous\r
337 request session.\r
338 @param ResolvedEvent Pointer to the event that is used as the\r
339 notification event in previous request session.\r
340\r
341 @retval EFI_SUCCESS The pending request session(s) is/are aborted and\r
342 corresponding event(s) is/are signaled.\r
343 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
344 This is NULL. TargetSwAddress is not NULL and\r
345 ResolvedEvent is NULL. TargetSwAddress is NULL and\r
346 ResolvedEvent is not NULL.\r
347 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
348 @retval EFI_NOT_FOUND The request is not issued by\r
349 EFI_ARP_PROTOCOL.Request().\r
350\r
351\r
352**/\r
353typedef\r
354EFI_STATUS\r
355(EFIAPI *EFI_ARP_CANCEL)(\r
356 IN EFI_ARP_PROTOCOL *This,\r
357 IN VOID *TargetSwAddress OPTIONAL,\r
358 IN EFI_EVENT ResolvedEvent OPTIONAL\r
359 );\r
360\r
361///\r
362/// ARP is used to resolve local network protocol addresses into\r
363/// network hardware addresses.\r
364///\r
365struct _EFI_ARP_PROTOCOL {\r
366 EFI_ARP_CONFIGURE Configure;\r
367 EFI_ARP_ADD Add;\r
368 EFI_ARP_FIND Find;\r
369 EFI_ARP_DELETE Delete;\r
370 EFI_ARP_FLUSH Flush;\r
371 EFI_ARP_REQUEST Request;\r
372 EFI_ARP_CANCEL Cancel;\r
373};\r
374\r
375\r
376extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r
377extern EFI_GUID gEfiArpProtocolGuid;\r
378\r
379#endif\r