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