]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/Arp.h
correct some coding style issues.
[mirror_edk2.git] / MdePkg / Include / Protocol / Arp.h
... / ...
CommitLineData
1/** @file\r
2 \r
3 EFI ARP Protocol Definition\r
4 \r
5 The EFI ARP Service Binding Protocol is used to locate EFI\r
6 ARP Protocol drivers to create and destroy child of the\r
7 driver to communicate with other host using ARP protocol.\r
8 \r
9 The EFI ARP Protocol provides services to map IP network\r
10 address to hardware address used by a data link protocol.\r
11 \r
12 Copyright (c) 2006 - 2008, Intel Corporation \r
13 All rights reserved. This program and the accompanying materials \r
14 are licensed and made available under the terms and conditions of the BSD License \r
15 which accompanies this distribution. The full text of the license may be found at \r
16 http://opensource.org/licenses/bsd-license.php \r
17 \r
18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
20 \r
21**/\r
22\r
23#ifndef __EFI_ARP_PROTOCOL_H__\r
24#define __EFI_ARP_PROTOCOL_H__\r
25\r
26#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \\r
27 { \\r
28 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3 } \\r
29 }\r
30\r
31#define EFI_ARP_PROTOCOL_GUID \\r
32 { \\r
33 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } \\r
34 }\r
35\r
36typedef struct _EFI_ARP_PROTOCOL EFI_ARP_PROTOCOL;\r
37\r
38typedef struct {\r
39 ///\r
40 /// Length in bytes of this entry.\r
41 ///\r
42 UINT32 Size;\r
43\r
44 ///\r
45 /// Set to TRUE if this entry is a "deny" entry.\r
46 /// Set to FALSE if this entry is a "normal" entry.\r
47 ///\r
48 BOOLEAN DenyFlag;\r
49\r
50 ///\r
51 /// Set to TRUE if this entry will not time out.\r
52 /// Set to FALSE if this entry will time out.\r
53 ///\r
54 BOOLEAN StaticFlag;\r
55\r
56 ///\r
57 /// 16-bit ARP hardware identifier number.\r
58 ///\r
59 UINT16 HwAddressType;\r
60\r
61 ///\r
62 /// 16-bit protocol type number.\r
63 ///\r
64 UINT16 SwAddressType;\r
65\r
66 ///\r
67 /// Length of the hardware address.\r
68 ///\r
69 UINT8 HwAddressLength;\r
70\r
71 ///\r
72 /// Length of the protocol address.\r
73 ///\r
74 UINT8 SwAddressLength;\r
75} EFI_ARP_FIND_DATA;\r
76\r
77typedef struct {\r
78 ///\r
79 /// 16-bit protocol type number in host byte order.\r
80 ///\r
81 UINT16 SwAddressType;\r
82\r
83 ///\r
84 /// Length in bytes of the station's protocol address to register.\r
85 ///\r
86 UINT8 SwAddressLength;\r
87\r
88 ///\r
89 /// Pointer to the first byte of the protocol address to register. For\r
90 /// example, if SwAddressType is 0x0800 (IP), then\r
91 /// StationAddress points to the first byte of this station's IP\r
92 /// address stored in network byte order.\r
93 ///\r
94 VOID *StationAddress;\r
95\r
96 ///\r
97 /// The timeout value in 100-ns units that is associated with each\r
98 /// new dynamic ARP cache entry. If it is set to zero, the value is\r
99 /// implementation-specific.\r
100 ///\r
101 UINT32 EntryTimeOut;\r
102\r
103 ///\r
104 /// The number of retries before a MAC address is resolved. If it is\r
105 /// set to zero, the value is implementation-specific.\r
106 ///\r
107 UINT32 RetryCount;\r
108\r
109 ///\r
110 /// The timeout value in 100-ns units that is used to wait for the ARP\r
111 /// reply packet or the timeout value between two retries. Set to zero\r
112 /// to use implementation-specific value.\r
113 ///\r
114 UINT32 RetryTimeOut;\r
115} EFI_ARP_CONFIG_DATA;\r
116\r
117\r
118/**\r
119 Assigns a station address (protocol type and network address) to this instance of the ARP cache.\r
120\r
121 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
122 @param ConfigData A pointer to the EFI_ARP_CONFIG_DATA structure.Buffer\r
123\r
124 @retval EFI_SUCCESS The new station address was successfully registered.\r
125 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
126 This is NULL.\r
127 SwAddressLength is zero when ConfigData is not NULL.\r
128 StationAddress is NULL when ConfigData is not NULL.\r
129 @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or\r
130 StationAddress is different from the one that is already\r
131 registered.\r
132 @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be allocated.\r
133\r
134**/\r
135typedef \r
136EFI_STATUS\r
137(EFIAPI *EFI_ARP_CONFIGURE)(\r
138 IN EFI_ARP_PROTOCOL *This,\r
139 IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL\r
140 ); \r
141\r
142/**\r
143 Inserts an entry to the ARP cache.\r
144\r
145 @param This A pointer to the EFI_ARP_PROTOCOL instance. \r
146 @param DenyFlag Set to TRUE if this entry is a "deny" entry. Set to FALSE if this\r
147 entry is a "normal" entry.\r
148 @param TargetSwAddress Pointer to a protocol address to add (or deny). May be set to\r
149 NULL if DenyFlag is TRUE.\r
150 @param TargetHwAddress Pointer to a hardware address to add (or deny). May be set to\r
151 NULL if DenyFlag is TRUE.\r
152 @param TimeoutValue Time in 100-ns units that this entry will remain in the ARP\r
153 cache. A value of zero means that the entry is permanent. A\r
154 nonzero value will override the one given by Configure() if\r
155 the entry to be added is dynamic entry.\r
156 @param Overwrite If TRUE, the matching cache entry will be overwritten with the\r
157 supplied parameters. If FALSE, EFI_ACCESS_DENIED is returned \r
158 if the corresponding cache entry already exists.\r
159\r
160 @retval EFI_SUCCESS The entry has been added or updated.\r
161 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
162 This is NULL. DenyFlag is FALSE and TargetHwAddress is NULL.\r
163 DenyFlag is FALSE and TargetSwAddress is NULL. TargetHwAddress is NULL and TargetSwAddress is NULL. \r
164 Both TargetSwAddress and TargetHwAddress are not NULL when DenyFlag is TRUE.\r
165 @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.\r
166 @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite is not true.\r
167 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
168\r
169**/\r
170typedef\r
171EFI_STATUS\r
172(EFIAPI *EFI_ARP_ADD)(\r
173 IN EFI_ARP_PROTOCOL *This,\r
174 IN BOOLEAN DenyFlag,\r
175 IN VOID *TargetSwAddress OPTIONAL,\r
176 IN VOID *TargetHwAddress OPTIONAL,\r
177 IN UINT32 TimeoutValue,\r
178 IN BOOLEAN Overwrite\r
179 ); \r
180\r
181/**\r
182 Locates one or more entries in the ARP cache.\r
183\r
184 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
185 @param BySwAddress Set to TRUE to look for matching software protocol addresses.\r
186 Set to FALSE to look for matching hardware protocol addresses.\r
187 @param AddressBuffer Pointer to address buffer. Set to NULL to match all addresses.\r
188 @param EntryLength The size of an entry in the entries buffer. To keep the\r
189 EFI_ARP_FIND_DATA structure properly aligned, this field\r
190 may be longer than sizeof(EFI_ARP_FIND_DATA) plus\r
191 the length of the software and hardware addresses.\r
192 @param EntryCount The number of ARP cache entries that are found by the specified criteria.\r
193 @param Entries Pointer to the buffer that will receive the ARP cache entries.\r
194 @param Refresh Set to TRUE to refresh the timeout value of the matching ARP\r
195 cache entry.\r
196\r
197 @retval EFI_SUCCESS The requested ARP cache entries were copied into the buffer.\r
198 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
199 This is NULL. Both EntryCount and EntryLength are NULL, \r
200 when Refresh is FALSE.\r
201 @retval EFI_NOT_FOUND No matching entries were found.\r
202 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
203\r
204**/\r
205typedef \r
206EFI_STATUS\r
207(EFIAPI *EFI_ARP_FIND)(\r
208 IN EFI_ARP_PROTOCOL *This,\r
209 IN BOOLEAN BySwAddress,\r
210 IN VOID *AddressBuffer OPTIONAL,\r
211 OUT UINT32 *EntryLength OPTIONAL,\r
212 OUT UINT32 *EntryCount OPTIONAL,\r
213 OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,\r
214 IN BOOLEAN Refresh\r
215 ); \r
216\r
217\r
218/**\r
219 Removes entries from the ARP cache.\r
220\r
221 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
222 @param BySwAddress Set to TRUE to delete matching protocol addresses.\r
223 Set to FALSE to delete matching hardware addresses.\r
224 @param AddressBuffer Pointer to the address buffer that is used as a key to look for the\r
225 cache entry. Set to NULL to delete all entries.\r
226\r
227 @retval EFI_SUCCESS The entry was removed from the ARP cache.\r
228 @retval EFI_INVALID_PARAMETER This is NULL.\r
229 @retval EFI_NOT_FOUND The specified deletion key was not found.\r
230 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
231\r
232**/\r
233typedef\r
234EFI_STATUS\r
235(EFIAPI *EFI_ARP_DELETE)(\r
236 IN EFI_ARP_PROTOCOL *This,\r
237 IN BOOLEAN BySwAddress,\r
238 IN VOID *AddressBuffer OPTIONAL\r
239 ); \r
240\r
241/**\r
242 Removes all dynamic ARP cache entries that were added by this interface.\r
243\r
244 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
245 \r
246 @retval EFI_SUCCESS The cache has been flushed.\r
247 @retval EFI_INVALID_PARAMETER This is NULL.\r
248 @retval EFI_NOT_FOUND There are no matching dynamic cache entries.\r
249 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
250\r
251**/\r
252typedef\r
253EFI_STATUS\r
254(EFIAPI *EFI_ARP_FLUSH)(\r
255 IN EFI_ARP_PROTOCOL *This\r
256 ); \r
257\r
258/**\r
259 Starts an ARP request session.\r
260\r
261 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
262 @param TargetSwAddress Pointer to the protocol address to resolve.\r
263 @param ResolvedEvent Pointer to the event that will be signaled when the address is\r
264 resolved or some error occurs.\r
265 @param TargetHwAddress Pointer to the buffer for the resolved hardware address in\r
266 network byte order. The buffer must be large enough to hold the\r
267 resulting hardware address. TargetHwAddress must not be\r
268 NULL.\r
269\r
270 @retval EFI_SUCCESS The data was copied from the ARP cache into the\r
271 TargetHwAddress buffer.\r
272 @retval EFI_INVALID_PARAMETER This or TargetHwAddress is NULL.\r
273 @retval EFI_ACCESS_DENIED The requested address is not present in the normal ARP cache but\r
274 is present in the deny address list. Outgoing traffic to that address is\r
275 forbidden.\r
276 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
277 @retval EFI_NOT_READY The request has been started and is not finished.\r
278 @retval EFI_UNSUPPORTED The requested conversion is not supported in this implementation or\r
279 configuration.\r
280\r
281**/\r
282typedef\r
283EFI_STATUS\r
284(EFIAPI *EFI_ARP_REQUEST)(\r
285 IN EFI_ARP_PROTOCOL *This, \r
286 IN VOID *TargetSwAddress OPTIONAL,\r
287 IN EFI_EVENT ResolvedEvent OPTIONAL,\r
288 OUT VOID *TargetHwAddress \r
289 ); \r
290\r
291/**\r
292 Cancels an ARP request session.\r
293\r
294 @param This A pointer to the EFI_ARP_PROTOCOL instance.\r
295 @param TargetSwAddress Pointer to the protocol address in previous request session.\r
296 @param ResolvedEvent Pointer to the event that is used as the notification event in\r
297 previous request session.\r
298\r
299 @retval EFI_SUCCESS The pending request session(s) is/are aborted and corresponding\r
300 event(s) is/are signaled.\r
301 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
302 This is NULL.\r
303 TargetSwAddress is not NULL and ResolvedEvent is NULL.\r
304 TargetSwAddress is NULL and ResolvedEvent is not NULL\r
305 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.\r
306 @retval EFI_NOT_FOUND The request is not issued by\r
307 EFI_ARP_PROTOCOL.Request().\r
308\r
309**/\r
310typedef\r
311EFI_STATUS\r
312(EFIAPI *EFI_ARP_CANCEL)(\r
313 IN EFI_ARP_PROTOCOL *This, \r
314 IN VOID *TargetSwAddress OPTIONAL,\r
315 IN EFI_EVENT ResolvedEvent OPTIONAL\r
316 ); \r
317\r
318///\r
319/// ARP is used to resolve local network protocol addresses into \r
320/// network hardware addresses.\r
321///\r
322struct _EFI_ARP_PROTOCOL {\r
323 EFI_ARP_CONFIGURE Configure;\r
324 EFI_ARP_ADD Add;\r
325 EFI_ARP_FIND Find;\r
326 EFI_ARP_DELETE Delete;\r
327 EFI_ARP_FLUSH Flush;\r
328 EFI_ARP_REQUEST Request;\r
329 EFI_ARP_CANCEL Cancel;\r
330};\r
331\r
332\r
333extern EFI_GUID gEfiArpServiceBindingProtocolGuid;\r
334extern EFI_GUID gEfiArpProtocolGuid;\r
335\r
336#endif\r