]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ManagedNetwork.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / ManagedNetwork.h
CommitLineData
d1f95000 1/** @file\r
2 EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
3 EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.\r
4\r
9095d37b 5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 7\r
9095d37b 8 @par Revision Reference:\r
5899caf0 9 This Protocol is introduced in UEFI Specification 2.0\r
10\r
d1f95000 11**/\r
12\r
19bee90c
LG
13#ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__\r
14#define __EFI_MANAGED_NETWORK_PROTOCOL_H__\r
d1f95000 15\r
16#include <Protocol/SimpleNetwork.h>\r
17\r
18#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \\r
19 { \\r
20 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \\r
21 }\r
22\r
23#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \\r
24 { \\r
f6203b71 25 0x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 } \\r
d1f95000 26 }\r
27\r
28typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;\r
29\r
30typedef struct {\r
992f22b9
LG
31 ///\r
32 /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed\r
33 /// from the MNP receive queue will be dropped if its receive timeout expires.\r
34 ///\r
d1f95000 35 UINT32 ReceivedQueueTimeoutValue;\r
992f22b9
LG
36 ///\r
37 /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed\r
38 /// from the MNP transmit queue will be dropped if its receive timeout expires.\r
39 ///\r
d1f95000 40 UINT32 TransmitQueueTimeoutValue;\r
992f22b9
LG
41 ///\r
42 /// Ethernet type II 16-bit protocol type in host byte order. Valid\r
43 /// values are zero and 1,500 to 65,535.\r
44 ///\r
d1f95000 45 UINT16 ProtocolTypeFilter;\r
992f22b9
LG
46 ///\r
47 /// Set to TRUE to receive packets that are sent to the network\r
48 /// device MAC address. The startup default value is FALSE.\r
49 ///\r
d1f95000 50 BOOLEAN EnableUnicastReceive;\r
992f22b9
LG
51 ///\r
52 /// Set to TRUE to receive packets that are sent to any of the\r
53 /// active multicast groups. The startup default value is FALSE.\r
54 ///\r
d1f95000 55 BOOLEAN EnableMulticastReceive;\r
992f22b9
LG
56 ///\r
57 /// Set to TRUE to receive packets that are sent to the network\r
58 /// device broadcast address. The startup default value is FALSE.\r
59 ///\r
d1f95000 60 BOOLEAN EnableBroadcastReceive;\r
992f22b9
LG
61 ///\r
62 /// Set to TRUE to receive packets that are sent to any MAC address.\r
63 /// The startup default value is FALSE.\r
64 ///\r
d1f95000 65 BOOLEAN EnablePromiscuousReceive;\r
992f22b9
LG
66 ///\r
67 /// Set to TRUE to drop queued packets when the configuration\r
68 /// is changed. The startup default value is FALSE.\r
69 ///\r
d1f95000 70 BOOLEAN FlushQueuesOnReset;\r
992f22b9
LG
71 ///\r
72 /// Set to TRUE to timestamp all packets when they are received\r
73 /// by the MNP. Note that timestamps may be unsupported in some\r
74 /// MNP implementations. The startup default value is FALSE.\r
75 ///\r
d1f95000 76 BOOLEAN EnableReceiveTimestamps;\r
992f22b9
LG
77 ///\r
78 /// Set to TRUE to disable background polling in this MNP\r
79 /// instance. Note that background polling may not be supported in\r
80 /// all MNP implementations. The startup default value is FALSE,\r
81 /// unless background polling is not supported.\r
82 ///\r
d1f95000 83 BOOLEAN DisableBackgroundPolling;\r
84} EFI_MANAGED_NETWORK_CONFIG_DATA;\r
85\r
86typedef struct {\r
87 EFI_TIME Timestamp;\r
88 EFI_EVENT RecycleEvent;\r
89 UINT32 PacketLength;\r
90 UINT32 HeaderLength;\r
91 UINT32 AddressLength;\r
92 UINT32 DataLength;\r
93 BOOLEAN BroadcastFlag;\r
94 BOOLEAN MulticastFlag;\r
95 BOOLEAN PromiscuousFlag;\r
96 UINT16 ProtocolType;\r
97 VOID *DestinationAddress;\r
98 VOID *SourceAddress;\r
99 VOID *MediaHeader;\r
100 VOID *PacketData;\r
101} EFI_MANAGED_NETWORK_RECEIVE_DATA;\r
102\r
103typedef struct {\r
104 UINT32 FragmentLength;\r
105 VOID *FragmentBuffer;\r
106} EFI_MANAGED_NETWORK_FRAGMENT_DATA;\r
107\r
108typedef struct {\r
109 EFI_MAC_ADDRESS *DestinationAddress; //OPTIONAL\r
110 EFI_MAC_ADDRESS *SourceAddress; //OPTIONAL\r
111 UINT16 ProtocolType; //OPTIONAL\r
112 UINT32 DataLength;\r
113 UINT16 HeaderLength; //OPTIONAL\r
114 UINT16 FragmentCount;\r
115 EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];\r
116} EFI_MANAGED_NETWORK_TRANSMIT_DATA;\r
117\r
118\r
119typedef struct {\r
992f22b9
LG
120 ///\r
121 /// This Event will be signaled after the Status field is updated\r
122 /// by the MNP. The type of Event must be\r
123 /// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of\r
124 /// Event must be lower than or equal to TPL_CALLBACK.\r
125 ///\r
d1f95000 126 EFI_EVENT Event;\r
992f22b9
LG
127 ///\r
128 /// The status that is returned to the caller at the end of the operation\r
129 /// to indicate whether this operation completed successfully.\r
130 ///\r
d1f95000 131 EFI_STATUS Status;\r
132 union {\r
992f22b9
LG
133 ///\r
134 /// When this token is used for receiving, RxData is a pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA.\r
135 ///\r
d1f95000 136 EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData;\r
992f22b9
LG
137 ///\r
138 /// When this token is used for transmitting, TxData is a pointer to the EFI_MANAGED_NETWORK_TRANSMIT_DATA.\r
139 ///\r
d1f95000 140 EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData;\r
141 } Packet;\r
142} EFI_MANAGED_NETWORK_COMPLETION_TOKEN;\r
143\r
144/**\r
145 Returns the operational parameters for the current MNP child driver.\r
146\r
af2dc6a7 147 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
148 @param MnpConfigData The pointer to storage for MNP operational parameters.\r
149 @param SnpModeData The pointer to storage for SNP operational parameters.\r
d1f95000 150\r
151 @retval EFI_SUCCESS The operation completed successfully.\r
152 @retval EFI_INVALID_PARAMETER This is NULL.\r
153 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
154 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default\r
155 values are returned in MnpConfigData if it is not NULL.\r
156 @retval Other The mode data could not be read.\r
157\r
158**/\r
159typedef\r
160EFI_STATUS\r
8b13229b 161(EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA)(\r
d1f95000 162 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
163 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
f6203b71 164 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
ed66e1bc 165 );\r
d1f95000 166\r
167/**\r
168 Sets or clears the operational parameters for the MNP child driver.\r
169\r
af2dc6a7 170 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
171 @param MnpConfigData The pointer to configuration data that will be assigned to the MNP\r
d1f95000 172 child driver instance. If NULL, the MNP child driver instance is\r
173 reset to startup defaults and all pending transmit and receive\r
174 requests are flushed.\r
175\r
176 @retval EFI_SUCCESS The operation completed successfully.\r
177 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
178 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be\r
179 allocated.\r
180 @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]\r
181 implementation.\r
182 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
183 @retval Other The MNP child driver instance has been reset to startup defaults.\r
184\r
185**/\r
186typedef\r
187EFI_STATUS\r
8b13229b 188(EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE)(\r
d1f95000 189 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 190 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL\r
ed66e1bc 191 );\r
f6203b71 192\r
d1f95000 193/**\r
194 Translates an IP multicast address to a hardware (MAC) multicast address.\r
195\r
af2dc6a7 196 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 197 @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.\r
198 Set to FALSE if IpAddress is an IPv4 multicast address.\r
af2dc6a7 199 @param IpAddress The pointer to the multicast IP address (in network byte order) to convert.\r
200 @param MacAddress The pointer to the resulting multicast MAC address.\r
d1f95000 201\r
202 @retval EFI_SUCCESS The operation completed successfully.\r
203 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:\r
204 - This is NULL.\r
205 - IpAddress is NULL.\r
206 - *IpAddress is not a valid multicast IP address.\r
207 - MacAddress is NULL.\r
208 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
209 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
210 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
211 @retval Other The address could not be converted.\r
212\r
213**/\r
214typedef\r
215EFI_STATUS\r
8b13229b 216(EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC)(\r
d1f95000 217 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
218 IN BOOLEAN Ipv6Flag,\r
219 IN EFI_IP_ADDRESS *IpAddress,\r
f6203b71 220 OUT EFI_MAC_ADDRESS *MacAddress\r
ed66e1bc 221 );\r
d1f95000 222\r
223/**\r
224 Enables and disables receive filters for multicast address.\r
225\r
af2dc6a7 226 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 227 @param JoinFlag Set to TRUE to join this multicast group.\r
228 Set to FALSE to leave this multicast group.\r
af2dc6a7 229 @param MacAddress The pointer to the multicast MAC group (address) to join or leave.\r
d1f95000 230\r
231 @retval EFI_SUCCESS The requested operation completed successfully.\r
232 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
233 - This is NULL.\r
234 - JoinFlag is TRUE and MacAddress is NULL.\r
235 - *MacAddress is not a valid multicast MAC address.\r
236 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
237 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.\r
238 @retval EFI_NOT_FOUND The supplied multicast group is not joined.\r
f6203b71 239 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
d1f95000 240 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
241 @retval Other The requested operation could not be completed.\r
242\r
243**/\r
244typedef\r
245EFI_STATUS\r
8b13229b 246(EFIAPI *EFI_MANAGED_NETWORK_GROUPS)(\r
d1f95000 247 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
248 IN BOOLEAN JoinFlag,\r
f6203b71 249 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL\r
ed66e1bc 250 );\r
f6203b71 251\r
d1f95000 252/**\r
253 Places asynchronous outgoing data packets into the transmit queue.\r
254\r
af2dc6a7 255 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
256 @param Token The pointer to a token associated with the transmit data descriptor.\r
d1f95000 257\r
258 @retval EFI_SUCCESS The transmit completion token was cached.\r
259 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
260 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
261 @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.\r
262 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources\r
263 (usually memory).\r
264 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
265 @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.\r
266\r
267**/\r
268typedef\r
269EFI_STATUS\r
8b13229b 270(EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT)(\r
d1f95000 271 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 272 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
ed66e1bc 273 );\r
f6203b71 274\r
d1f95000 275/**\r
276 Places an asynchronous receiving request into the receiving queue.\r
277\r
af2dc6a7 278 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
279 @param Token The pointer to a token associated with the receive data descriptor.\r
d1f95000 280\r
281 @retval EFI_SUCCESS The receive completion token was cached.\r
282 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
283 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
284 - This is NULL.\r
285 - Token is NULL.\r
af2dc6a7 286 - Token.Event is NULL.\r
d1f95000 287 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources\r
288 (usually memory).\r
289 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
290 @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.\r
291 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
292\r
293**/\r
294typedef\r
295EFI_STATUS\r
8b13229b 296(EFIAPI *EFI_MANAGED_NETWORK_RECEIVE)(\r
d1f95000 297 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 298 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
ed66e1bc 299 );\r
f6203b71 300\r
d1f95000 301\r
302/**\r
303 Aborts an asynchronous transmit or receive request.\r
304\r
af2dc6a7 305 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
306 @param Token The pointer to a token that has been issued by\r
d1f95000 307 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or\r
308 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If\r
309 NULL, all pending tokens are aborted.\r
310\r
311 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event\r
312 was signaled. When Token is NULL, all pending requests were\r
313 aborted and their events were signaled.\r
314 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
315 @retval EFI_INVALID_PARAMETER This is NULL.\r
316 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was\r
317 not found in the transmit or receive queue. It has either completed\r
318 or was not issued by Transmit() and Receive().\r
319\r
320**/\r
321typedef\r
322EFI_STATUS\r
8b13229b 323(EFIAPI *EFI_MANAGED_NETWORK_CANCEL)(\r
d1f95000 324 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 325 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL\r
ed66e1bc 326 );\r
d1f95000 327\r
328/**\r
329 Polls for incoming data packets and processes outgoing data packets.\r
330\r
af2dc6a7 331 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 332\r
333 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
334 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
335 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
336 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing\r
337 the polling rate.\r
338 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
339 Consider increasing the polling rate.\r
340\r
341**/\r
342typedef\r
343EFI_STATUS\r
8b13229b 344(EFIAPI *EFI_MANAGED_NETWORK_POLL)(\r
f6203b71 345 IN EFI_MANAGED_NETWORK_PROTOCOL *This\r
ed66e1bc 346 );\r
d1f95000 347\r
44717a39 348///\r
9095d37b 349/// The MNP is used by network applications (and drivers) to\r
44717a39 350/// perform raw (unformatted) asynchronous network packet I/O.\r
351///\r
d1f95000 352struct _EFI_MANAGED_NETWORK_PROTOCOL {\r
353 EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;\r
354 EFI_MANAGED_NETWORK_CONFIGURE Configure;\r
355 EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;\r
356 EFI_MANAGED_NETWORK_GROUPS Groups;\r
357 EFI_MANAGED_NETWORK_TRANSMIT Transmit;\r
358 EFI_MANAGED_NETWORK_RECEIVE Receive;\r
359 EFI_MANAGED_NETWORK_CANCEL Cancel;\r
360 EFI_MANAGED_NETWORK_POLL Poll;\r
361};\r
362\r
363extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;\r
364extern EFI_GUID gEfiManagedNetworkProtocolGuid;\r
365\r
366#endif\r