]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Arp.h
efdd4c2f3402672319c39a3f8d1857df576455a2
[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 UINT32 Size;
40 BOOLEAN DenyFlag;
41 BOOLEAN StaticFlag;
42 UINT16 HwAddressType;
43 UINT16 SwAddressType;
44 UINT8 HwAddressLength;
45 UINT8 SwAddressLength;
46 } EFI_ARP_FIND_DATA;
47
48 typedef struct {
49 UINT16 SwAddressType; ///< Host byte order
50 UINT8 SwAddressLength;
51 VOID *StationAddress; ///< Network byte order
52 UINT32 EntryTimeOut;
53 UINT32 RetryCount;
54 UINT32 RetryTimeOut;
55 } EFI_ARP_CONFIG_DATA;
56
57
58 /**
59 Assigns a station address (protocol type and network address) to this instance of the ARP cache.
60
61 @param This A pointer to the EFI_ARP_PROTOCOL instance.
62 @param ConfigData A pointer to the EFI_ARP_CONFIG_DATA structure.Buffer
63
64 @retval EFI_SUCCESS The new station address was successfully registered.
65 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
66 @retval EFI_ACCESS_DENIED The SwAddressType, SwAddressLength, or
67 StationAddress is different from the one that is already
68 registered.
69 @retval EFI_OUT_OF_RESOURCES Storage for the new StationAddress could not be allocated.
70
71 **/
72 typedef
73 EFI_STATUS
74 (EFIAPI *EFI_ARP_CONFIGURE)(
75 IN EFI_ARP_PROTOCOL *This,
76 IN EFI_ARP_CONFIG_DATA *ConfigData OPTIONAL
77 );
78
79 /**
80 Inserts an entry to the ARP cache.
81
82 @param This A pointer to the EFI_ARP_PROTOCOL instance.
83 @param DenyFlag Set to TRUE if this entry is a "deny" entry. Set to FALSE if this
84 entry is a "normal" entry.
85 @param TargetSwAddress Pointer to a protocol address to add (or deny). May be set to
86 NULL if DenyFlag is TRUE.
87 @param TargetHwAddress Pointer to a hardware address to add (or deny). May be set to
88 NULL if DenyFlag is TRUE.
89 @param TimeoutValue Time in 100-ns units that this entry will remain in the ARP
90 cache. A value of zero means that the entry is permanent. A
91 nonzero value will override the one given by Configure() if
92 the entry to be added is dynamic entry.
93 @param Overwrite If TRUE, the matching cache entry will be overwritten with the
94 supplied parameters. If FALSE, EFI_ACCESS_DENIED is returned
95 if the corresponding cache entry already exists.
96
97 @retval EFI_SUCCESS The entry has been added or updated.
98 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
99 This is NULL. DenyFlag is FALSE and TargetHwAddress is NULL.
100 DenyFlag is FALSE and TargetSwAddress is NULL. TargetHwAddress is NULL and TargetSwAddress is NULL.
101 Both TargetSwAddress and TargetHwAddress are not NULL when DenyFlag is TRUE.
102 @retval EFI_OUT_OF_RESOURCES The new ARP cache entry could not be allocated.
103 @retval EFI_ACCESS_DENIED The ARP cache entry already exists and Overwrite is not true.
104 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
105
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_ARP_ADD)(
110 IN EFI_ARP_PROTOCOL *This,
111 IN BOOLEAN DenyFlag,
112 IN VOID *TargetSwAddress OPTIONAL,
113 IN VOID *TargetHwAddress OPTIONAL,
114 IN UINT32 TimeoutValue,
115 IN BOOLEAN Overwrite
116 );
117
118 /**
119 Locates one or more entries in the ARP cache.
120
121 @param This A pointer to the EFI_ARP_PROTOCOL instance.
122 @param BySwAddress Set to TRUE to look for matching software protocol addresses.
123 Set to FALSE to look for matching hardware protocol addresses.
124 @param AddressBuffer Pointer to address buffer. Set to NULL to match all addresses.
125 @param EntryLength The size of an entry in the entries buffer. To keep the
126 EFI_ARP_FIND_DATA structure properly aligned, this field
127 may be longer than sizeof(EFI_ARP_FIND_DATA) plus
128 the length of the software and hardware addresses.
129 @param EntryCount The number of ARP cache entries that are found by the specified criteria.
130 @param Entries Pointer to the buffer that will receive the ARP cache entries.
131 @param Refresh Set to TRUE to refresh the timeout value of the matching ARP
132 cache entry.
133
134 @retval EFI_SUCCESS The requested ARP cache entries were copied into the buffer.
135 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
136 This is NULL. Both EntryCount and EntryLength are NULL,
137 when Refresh is FALSE.
138 @retval EFI_NOT_FOUND No matching entries were found.
139 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
140
141 **/
142 typedef
143 EFI_STATUS
144 (EFIAPI *EFI_ARP_FIND)(
145 IN EFI_ARP_PROTOCOL *This,
146 IN BOOLEAN BySwAddress,
147 IN VOID *AddressBuffer OPTIONAL,
148 OUT UINT32 *EntryLength OPTIONAL,
149 OUT UINT32 *EntryCount OPTIONAL,
150 OUT EFI_ARP_FIND_DATA **Entries OPTIONAL,
151 IN BOOLEAN Refresh
152 );
153
154
155 /**
156 Removes entries from the ARP cache.
157
158 @param This A pointer to the EFI_ARP_PROTOCOL instance.
159 @param BySwAddress Set to TRUE to delete matching protocol addresses.
160 Set to FALSE to delete matching hardware addresses.
161 @param AddressBuffer Pointer to the address buffer that is used as a key to look for the
162 cache entry. Set to NULL to delete all entries.
163
164 @retval EFI_SUCCESS The entry was removed from the ARP cache.
165 @retval EFI_INVALID_PARAMETER This is NULL.
166 @retval EFI_NOT_FOUND The specified deletion key was not found.
167 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
168
169 **/
170 typedef
171 EFI_STATUS
172 (EFIAPI *EFI_ARP_DELETE)(
173 IN EFI_ARP_PROTOCOL *This,
174 IN BOOLEAN BySwAddress,
175 IN VOID *AddressBuffer OPTIONAL
176 );
177
178 /**
179 Removes all dynamic ARP cache entries that were added by this interface.
180
181 @param This A pointer to the EFI_ARP_PROTOCOL instance.
182
183 @retval EFI_SUCCESS The cache has been flushed.
184 @retval EFI_INVALID_PARAMETER This is NULL.
185 @retval EFI_NOT_FOUND There are no matching dynamic cache entries.
186 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
187
188 **/
189 typedef
190 EFI_STATUS
191 (EFIAPI *EFI_ARP_FLUSH)(
192 IN EFI_ARP_PROTOCOL *This
193 );
194
195 /**
196 Starts an ARP request session.
197
198 @param This A pointer to the EFI_ARP_PROTOCOL instance.
199 @param TargetSwAddress Pointer to the protocol address to resolve.
200 @param ResolvedEvent Pointer to the event that will be signaled when the address is
201 resolved or some error occurs.
202 @param TargetHwAddress Pointer to the buffer for the resolved hardware address in
203 network byte order. The buffer must be large enough to hold the
204 resulting hardware address. TargetHwAddress must not be
205 NULL.
206
207 @retval EFI_SUCCESS The data was copied from the ARP cache into the
208 TargetHwAddress buffer.
209 @retval EFI_INVALID_PARAMETER This or TargetHwAddress is NULL.
210 @retval EFI_ACCESS_DENIED The requested address is not present in the normal ARP cache but
211 is present in the deny address list. Outgoing traffic to that address is
212 forbidden.
213 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
214 @retval EFI_NOT_READY The request has been started and is not finished.
215 @retval EFI_UNSUPPORTED The requested conversion is not supported in this implementation or
216 configuration.
217
218 **/
219 typedef
220 EFI_STATUS
221 (EFIAPI *EFI_ARP_REQUEST)(
222 IN EFI_ARP_PROTOCOL *This,
223 IN VOID *TargetSwAddress OPTIONAL,
224 IN EFI_EVENT ResolvedEvent OPTIONAL,
225 OUT VOID *TargetHwAddress
226 );
227
228 /**
229 Cancels an ARP request session.
230
231 @param This A pointer to the EFI_ARP_PROTOCOL instance.
232 @param TargetSwAddress Pointer to the protocol address in previous request session.
233 @param ResolvedEvent Pointer to the event that is used as the notification event in
234 previous request session.
235
236 @retval EFI_SUCCESS The pending request session(s) is/are aborted and corresponding
237 event(s) is/are signaled.
238 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
239 @retval EFI_NOT_STARTED The ARP driver instance has not been configured.
240 @retval EFI_NOT_FOUND The request is not issued by
241 EFI_ARP_PROTOCOL.Request().
242
243 **/
244 typedef
245 EFI_STATUS
246 (EFIAPI *EFI_ARP_CANCEL)(
247 IN EFI_ARP_PROTOCOL *This,
248 IN VOID *TargetSwAddress OPTIONAL,
249 IN EFI_EVENT ResolvedEvent OPTIONAL
250 );
251
252 /**
253 @par Protocol Description:
254 ARP is used to resolve local network protocol addresses into
255 network hardware addresses.
256 **/
257 struct _EFI_ARP_PROTOCOL {
258 EFI_ARP_CONFIGURE Configure;
259 EFI_ARP_ADD Add;
260 EFI_ARP_FIND Find;
261 EFI_ARP_DELETE Delete;
262 EFI_ARP_FLUSH Flush;
263 EFI_ARP_REQUEST Request;
264 EFI_ARP_CANCEL Cancel;
265 };
266
267
268 extern EFI_GUID gEfiArpServiceBindingProtocolGuid;
269 extern EFI_GUID gEfiArpProtocolGuid;
270
271 #endif