]>
Commit | Line | Data |
---|---|---|
9095d37b | 1 | /** @file\r |
c311f86b | 2 | EFI ARP Protocol Definition\r |
9095d37b | 3 | \r |
c311f86b | 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 | |
c311f86b | 7 | The EFI ARP Protocol provides services to map IP network\r |
8 | address to hardware address used by a data link protocol.\r | |
9095d37b LG |
9 | \r |
10 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
9344f092 | 11 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
9095d37b LG |
12 | \r |
13 | @par Revision Reference:\r | |
af2dc6a7 | 14 | This Protocol was introduced in UEFI Specification 2.0.\r |
5899caf0 | 15 | \r |
d1f95000 | 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 | |
31 | typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL;\r | |
32 | \r | |
33 | typedef struct {\r | |
f1004231 LG |
34 | ///\r |
35 | /// Length in bytes of this entry.\r | |
36 | ///\r | |
107ffdc9 | 37 | UINT32 Size;\r |
f1004231 LG |
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 | |
107ffdc9 | 43 | BOOLEAN DenyFlag;\r |
f1004231 LG |
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 | |
107ffdc9 | 49 | BOOLEAN StaticFlag;\r |
f1004231 LG |
50 | \r |
51 | ///\r | |
52 | /// 16-bit ARP hardware identifier number.\r | |
53 | ///\r | |
107ffdc9 | 54 | UINT16 HwAddressType;\r |
f1004231 LG |
55 | \r |
56 | ///\r | |
57 | /// 16-bit protocol type number.\r | |
58 | ///\r | |
107ffdc9 | 59 | UINT16 SwAddressType;\r |
f1004231 LG |
60 | \r |
61 | ///\r | |
af2dc6a7 | 62 | /// The length of the hardware address.\r |
f1004231 | 63 | ///\r |
107ffdc9 | 64 | UINT8 HwAddressLength;\r |
f1004231 LG |
65 | \r |
66 | ///\r | |
af2dc6a7 | 67 | /// The length of the protocol address.\r |
f1004231 | 68 | ///\r |
107ffdc9 | 69 | UINT8 SwAddressLength;\r |
d1f95000 | 70 | } EFI_ARP_FIND_DATA;\r |
71 | \r | |
72 | typedef struct {\r | |
f1004231 LG |
73 | ///\r |
74 | /// 16-bit protocol type number in host byte order.\r | |
75 | ///\r | |
9319d2c2 | 76 | UINT16 SwAddressType;\r |
f1004231 LG |
77 | \r |
78 | ///\r | |
af2dc6a7 | 79 | /// The length in bytes of the station's protocol address to register.\r |
f1004231 | 80 | ///\r |
d1f95000 | 81 | UINT8 SwAddressLength;\r |
f1004231 LG |
82 | \r |
83 | ///\r | |
af2dc6a7 | 84 | /// The pointer to the first byte of the protocol address to register. For\r |
f1004231 | 85 | /// example, if SwAddressType is 0x0800 (IP), then\r |
cd2ed84a | 86 | /// StationAddress points to the first byte of this station's IP\r |
f1004231 LG |
87 | /// address stored in network byte order.\r |
88 | ///\r | |
9319d2c2 | 89 | VOID *StationAddress;\r |
f1004231 LG |
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 | |
d1f95000 | 96 | UINT32 EntryTimeOut;\r |
f1004231 LG |
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 | |
d1f95000 | 102 | UINT32 RetryCount;\r |
f1004231 LG |
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 | |
d1f95000 | 109 | UINT32 RetryTimeOut;\r |
110 | } EFI_ARP_CONFIG_DATA;\r | |
111 | \r | |
112 | \r | |
113 | /**\r | |
0c323d07 | 114 | This function is used to assign a station address to the ARP cache for this instance\r |
115 | of the ARP driver.\r | |
9095d37b LG |
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 | |
0c323d07 | 119 | this function with the ConfigData field set to NULL will reset this ARP instance.\r |
9095d37b LG |
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 | |
0c323d07 | 123 | the protocol type or station address to a configured ARP instance will result in errors.\r |
124 | \r | |
af2dc6a7 | 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 | |
0c323d07 | 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 | |
9095d37b LG |
131 | * This is NULL.\r |
132 | * SwAddressLength is zero when ConfigData is not NULL.\r | |
630b4187 | 133 | * StationAddress is NULL when ConfigData is not NULL.\r |
0c323d07 | 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 | |
d1f95000 | 139 | \r |
140 | **/\r | |
9095d37b | 141 | typedef\r |
d1f95000 | 142 | EFI_STATUS\r |
8b13229b | 143 | (EFIAPI *EFI_ARP_CONFIGURE)(\r |
d1f95000 | 144 | IN EFI_ARP_PROTOCOL *This,\r |
145 | IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r | |
9095d37b | 146 | );\r |
d1f95000 | 147 | \r |
148 | /**\r | |
0c323d07 | 149 | This function is used to insert entries into the ARP cache.\r |
150 | \r | |
9095d37b LG |
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 | |
0c323d07 | 154 | by the Add() function may be static (will not time out) or dynamic (will time out).\r |
9095d37b LG |
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 | |
0c323d07 | 160 | their expected network environments.\r |
9095d37b | 161 | \r |
0c323d07 | 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 | |
9095d37b LG |
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 | |
630b4187 | 185 | * Neither TargetSwAddress nor TargetHwAddress are NULL when DenyFlag is\r |
0c323d07 | 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 | |
d1f95000 | 191 | \r |
192 | **/\r | |
193 | typedef\r | |
194 | EFI_STATUS\r | |
8b13229b | 195 | (EFIAPI *EFI_ARP_ADD)(\r |
d1f95000 | 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 | |
9095d37b | 202 | );\r |
d1f95000 | 203 | \r |
204 | /**\r | |
0c323d07 | 205 | This function searches the ARP cache for matching entries and allocates a buffer into\r |
206 | which those entries are copied.\r | |
9095d37b LG |
207 | \r |
208 | The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which\r | |
0c323d07 | 209 | are protocol address pairs and hardware address pairs.\r |
9095d37b LG |
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 | |
0c323d07 | 213 | affected by Refresh.\r |
9095d37b | 214 | \r |
af2dc6a7 | 215 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
0c323d07 | 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 | |
9095d37b | 219 | @param AddressBuffer The pointer to the address buffer. Set to NULL\r |
af2dc6a7 | 220 | to match all addresses.\r |
0c323d07 | 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 | |
af2dc6a7 | 224 | @param Entries The pointer to the buffer that will receive the ARP\r |
0c323d07 | 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 | |
d1f95000 | 236 | \r |
237 | **/\r | |
9095d37b | 238 | typedef\r |
d1f95000 | 239 | EFI_STATUS\r |
8b13229b | 240 | (EFIAPI *EFI_ARP_FIND)(\r |
d1f95000 | 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 | |
9095d37b | 248 | );\r |
d1f95000 | 249 | \r |
250 | \r | |
251 | /**\r | |
0c323d07 | 252 | This function removes specified ARP cache entries.\r |
d1f95000 | 253 | \r |
af2dc6a7 | 254 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
0c323d07 | 255 | @param BySwAddress Set to TRUE to delete matching protocol addresses.\r |
256 | Set to FALSE to delete matching hardware\r | |
257 | addresses.\r | |
af2dc6a7 | 258 | @param AddressBuffer The pointer to the address buffer that is used as a\r |
0c323d07 | 259 | key to look for the cache entry. Set to NULL to\r |
260 | delete all entries.\r | |
d1f95000 | 261 | \r |
0c323d07 | 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 | |
d1f95000 | 266 | \r |
267 | **/\r | |
268 | typedef\r | |
269 | EFI_STATUS\r | |
8b13229b | 270 | (EFIAPI *EFI_ARP_DELETE)(\r |
d1f95000 | 271 | IN EFI_ARP_PROTOCOL *This,\r |
272 | IN BOOLEAN BySwAddress,\r | |
273 | IN VOID *AddressBuffer OPTIONAL\r | |
9095d37b | 274 | );\r |
d1f95000 | 275 | \r |
276 | /**\r | |
0c323d07 | 277 | This function delete all dynamic entries from the ARP cache that match the specified\r |
278 | software protocol type.\r | |
279 | \r | |
af2dc6a7 | 280 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
d1f95000 | 281 | \r |
0c323d07 | 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 | |
d1f95000 | 286 | \r |
287 | **/\r | |
288 | typedef\r | |
289 | EFI_STATUS\r | |
8b13229b | 290 | (EFIAPI *EFI_ARP_FLUSH)(\r |
d1f95000 | 291 | IN EFI_ARP_PROTOCOL *This\r |
9095d37b | 292 | );\r |
d1f95000 | 293 | \r |
294 | /**\r | |
0c323d07 | 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 | |
af2dc6a7 | 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 | |
0c323d07 | 301 | the address is resolved or some error occurs.\r |
af2dc6a7 | 302 | @param TargetHwAddress The pointer to the buffer for the resolved hardware\r |
0c323d07 | 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 | |
d1f95000 | 314 | \r |
315 | **/\r | |
316 | typedef\r | |
317 | EFI_STATUS\r | |
8b13229b | 318 | (EFIAPI *EFI_ARP_REQUEST)(\r |
9095d37b | 319 | IN EFI_ARP_PROTOCOL *This,\r |
d1f95000 | 320 | IN VOID *TargetSwAddress OPTIONAL,\r |
321 | IN EFI_EVENT ResolvedEvent OPTIONAL,\r | |
9095d37b LG |
322 | OUT VOID *TargetHwAddress\r |
323 | );\r | |
d1f95000 | 324 | \r |
325 | /**\r | |
630b4187 | 326 | This function aborts the previous ARP request (identified by This, TargetSwAddress\r |
0c323d07 | 327 | and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r |
9095d37b LG |
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 | |
0c323d07 | 333 | instance will be cancelled and their corresponding events will be signaled.\r |
9095d37b | 334 | \r |
af2dc6a7 | 335 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
336 | @param TargetSwAddress The pointer to the protocol address in previous\r | |
0c323d07 | 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 | |
d1f95000 | 351 | \r |
352 | **/\r | |
353 | typedef\r | |
354 | EFI_STATUS\r | |
8b13229b | 355 | (EFIAPI *EFI_ARP_CANCEL)(\r |
9095d37b | 356 | IN EFI_ARP_PROTOCOL *This,\r |
d1f95000 | 357 | IN VOID *TargetSwAddress OPTIONAL,\r |
358 | IN EFI_EVENT ResolvedEvent OPTIONAL\r | |
9095d37b | 359 | );\r |
d1f95000 | 360 | \r |
44717a39 | 361 | ///\r |
9095d37b | 362 | /// ARP is used to resolve local network protocol addresses into\r |
44717a39 | 363 | /// network hardware addresses.\r |
364 | ///\r | |
d1f95000 | 365 | struct _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 | |
376 | extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r | |
377 | extern EFI_GUID gEfiArpProtocolGuid;\r | |
378 | \r | |
379 | #endif\r |