]>
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 | |
2f88bd3a | 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 | |
2f88bd3a | 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 | |
2f88bd3a | 49 | BOOLEAN StaticFlag;\r |
f1004231 LG |
50 | \r |
51 | ///\r | |
52 | /// 16-bit ARP hardware identifier number.\r | |
53 | ///\r | |
2f88bd3a | 54 | UINT16 HwAddressType;\r |
f1004231 LG |
55 | \r |
56 | ///\r | |
57 | /// 16-bit protocol type number.\r | |
58 | ///\r | |
2f88bd3a | 59 | UINT16 SwAddressType;\r |
f1004231 LG |
60 | \r |
61 | ///\r | |
af2dc6a7 | 62 | /// The length of the hardware address.\r |
f1004231 | 63 | ///\r |
2f88bd3a | 64 | UINT8 HwAddressLength;\r |
f1004231 LG |
65 | \r |
66 | ///\r | |
af2dc6a7 | 67 | /// The length of the protocol address.\r |
f1004231 | 68 | ///\r |
2f88bd3a | 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 | |
2f88bd3a | 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 |
2f88bd3a | 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 | |
2f88bd3a | 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 | |
2f88bd3a | 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 | |
2f88bd3a | 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 | |
2f88bd3a | 109 | UINT32 RetryTimeOut;\r |
d1f95000 | 110 | } EFI_ARP_CONFIG_DATA;\r |
111 | \r | |
d1f95000 | 112 | /**\r |
0c323d07 | 113 | This function is used to assign a station address to the ARP cache for this instance\r |
114 | of the ARP driver.\r | |
9095d37b LG |
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 | |
0c323d07 | 118 | this function with the ConfigData field set to NULL will reset this ARP instance.\r |
9095d37b LG |
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 | |
0c323d07 | 122 | the protocol type or station address to a configured ARP instance will result in errors.\r |
123 | \r | |
af2dc6a7 | 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 | |
0c323d07 | 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 | |
9095d37b LG |
130 | * This is NULL.\r |
131 | * SwAddressLength is zero when ConfigData is not NULL.\r | |
630b4187 | 132 | * StationAddress is NULL when ConfigData is not NULL.\r |
0c323d07 | 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 | |
d1f95000 | 138 | \r |
139 | **/\r | |
9095d37b | 140 | typedef\r |
d1f95000 | 141 | EFI_STATUS\r |
8b13229b | 142 | (EFIAPI *EFI_ARP_CONFIGURE)(\r |
d1f95000 | 143 | IN EFI_ARP_PROTOCOL *This,\r |
144 | IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r | |
9095d37b | 145 | );\r |
d1f95000 | 146 | \r |
147 | /**\r | |
0c323d07 | 148 | This function is used to insert entries into the ARP cache.\r |
149 | \r | |
9095d37b LG |
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 | |
0c323d07 | 153 | by the Add() function may be static (will not time out) or dynamic (will time out).\r |
9095d37b LG |
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 | |
0c323d07 | 159 | their expected network environments.\r |
9095d37b | 160 | \r |
0c323d07 | 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 | |
9095d37b LG |
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 | |
630b4187 | 184 | * Neither TargetSwAddress nor TargetHwAddress are NULL when DenyFlag is\r |
0c323d07 | 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 | |
d1f95000 | 190 | \r |
191 | **/\r | |
192 | typedef\r | |
193 | EFI_STATUS\r | |
8b13229b | 194 | (EFIAPI *EFI_ARP_ADD)(\r |
d1f95000 | 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 | |
9095d37b | 201 | );\r |
d1f95000 | 202 | \r |
203 | /**\r | |
0c323d07 | 204 | This function searches the ARP cache for matching entries and allocates a buffer into\r |
205 | which those entries are copied.\r | |
9095d37b LG |
206 | \r |
207 | The first part of the allocated buffer is EFI_ARP_FIND_DATA, following which\r | |
0c323d07 | 208 | are protocol address pairs and hardware address pairs.\r |
9095d37b LG |
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 | |
0c323d07 | 212 | affected by Refresh.\r |
9095d37b | 213 | \r |
af2dc6a7 | 214 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
0c323d07 | 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 | |
9095d37b | 218 | @param AddressBuffer The pointer to the address buffer. Set to NULL\r |
af2dc6a7 | 219 | to match all addresses.\r |
0c323d07 | 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 | |
af2dc6a7 | 223 | @param Entries The pointer to the buffer that will receive the ARP\r |
0c323d07 | 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 | |
d1f95000 | 235 | \r |
236 | **/\r | |
9095d37b | 237 | typedef\r |
d1f95000 | 238 | EFI_STATUS\r |
8b13229b | 239 | (EFIAPI *EFI_ARP_FIND)(\r |
d1f95000 | 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 | |
9095d37b | 247 | );\r |
d1f95000 | 248 | \r |
d1f95000 | 249 | /**\r |
0c323d07 | 250 | This function removes specified ARP cache entries.\r |
d1f95000 | 251 | \r |
af2dc6a7 | 252 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
0c323d07 | 253 | @param BySwAddress Set to TRUE to delete matching protocol addresses.\r |
254 | Set to FALSE to delete matching hardware\r | |
255 | addresses.\r | |
af2dc6a7 | 256 | @param AddressBuffer The pointer to the address buffer that is used as a\r |
0c323d07 | 257 | key to look for the cache entry. Set to NULL to\r |
258 | delete all entries.\r | |
d1f95000 | 259 | \r |
0c323d07 | 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 | |
d1f95000 | 264 | \r |
265 | **/\r | |
266 | typedef\r | |
267 | EFI_STATUS\r | |
8b13229b | 268 | (EFIAPI *EFI_ARP_DELETE)(\r |
d1f95000 | 269 | IN EFI_ARP_PROTOCOL *This,\r |
270 | IN BOOLEAN BySwAddress,\r | |
271 | IN VOID *AddressBuffer OPTIONAL\r | |
9095d37b | 272 | );\r |
d1f95000 | 273 | \r |
274 | /**\r | |
0c323d07 | 275 | This function delete all dynamic entries from the ARP cache that match the specified\r |
276 | software protocol type.\r | |
277 | \r | |
af2dc6a7 | 278 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
d1f95000 | 279 | \r |
0c323d07 | 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 | |
d1f95000 | 284 | \r |
285 | **/\r | |
286 | typedef\r | |
287 | EFI_STATUS\r | |
8b13229b | 288 | (EFIAPI *EFI_ARP_FLUSH)(\r |
d1f95000 | 289 | IN EFI_ARP_PROTOCOL *This\r |
9095d37b | 290 | );\r |
d1f95000 | 291 | \r |
292 | /**\r | |
0c323d07 | 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 | |
af2dc6a7 | 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 | |
0c323d07 | 299 | the address is resolved or some error occurs.\r |
af2dc6a7 | 300 | @param TargetHwAddress The pointer to the buffer for the resolved hardware\r |
0c323d07 | 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 | |
d1f95000 | 312 | \r |
313 | **/\r | |
314 | typedef\r | |
315 | EFI_STATUS\r | |
8b13229b | 316 | (EFIAPI *EFI_ARP_REQUEST)(\r |
9095d37b | 317 | IN EFI_ARP_PROTOCOL *This,\r |
d1f95000 | 318 | IN VOID *TargetSwAddress OPTIONAL,\r |
319 | IN EFI_EVENT ResolvedEvent OPTIONAL,\r | |
9095d37b LG |
320 | OUT VOID *TargetHwAddress\r |
321 | );\r | |
d1f95000 | 322 | \r |
323 | /**\r | |
630b4187 | 324 | This function aborts the previous ARP request (identified by This, TargetSwAddress\r |
0c323d07 | 325 | and ResolvedEvent) that is issued by EFI_ARP_PROTOCOL.Request().\r |
9095d37b LG |
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 | |
0c323d07 | 331 | instance will be cancelled and their corresponding events will be signaled.\r |
9095d37b | 332 | \r |
af2dc6a7 | 333 | @param This The pointer to the EFI_ARP_PROTOCOL instance.\r |
334 | @param TargetSwAddress The pointer to the protocol address in previous\r | |
0c323d07 | 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 | |
d1f95000 | 349 | \r |
350 | **/\r | |
351 | typedef\r | |
352 | EFI_STATUS\r | |
8b13229b | 353 | (EFIAPI *EFI_ARP_CANCEL)(\r |
9095d37b | 354 | IN EFI_ARP_PROTOCOL *This,\r |
d1f95000 | 355 | IN VOID *TargetSwAddress OPTIONAL,\r |
356 | IN EFI_EVENT ResolvedEvent OPTIONAL\r | |
9095d37b | 357 | );\r |
d1f95000 | 358 | \r |
44717a39 | 359 | ///\r |
9095d37b | 360 | /// ARP is used to resolve local network protocol addresses into\r |
44717a39 | 361 | /// network hardware addresses.\r |
362 | ///\r | |
d1f95000 | 363 | struct _EFI_ARP_PROTOCOL {\r |
2f88bd3a MK |
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 | |
d1f95000 | 371 | };\r |
372 | \r | |
2f88bd3a MK |
373 | extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r |
374 | extern EFI_GUID gEfiArpProtocolGuid;\r | |
d1f95000 | 375 | \r |
376 | #endif\r |