]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ManagedNetwork.h
Formalize comments for Protocols and PPIs.
[mirror_edk2.git] / MdePkg / Include / Protocol / ManagedNetwork.h
1 /** @file
2 EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.
3 EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.
4
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__
17 #define __EFI_MANAGED_NETWORK_PROTOCOL_H__
18
19 #include <Protocol/SimpleNetwork.h>
20
21 #define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \
22 { \
23 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \
24 }
25
26 #define EFI_MANAGED_NETWORK_PROTOCOL_GUID \
27 { \
28 0x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 } \
29 }
30
31 typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;
32
33 typedef struct {
34 UINT32 ReceivedQueueTimeoutValue;
35 UINT32 TransmitQueueTimeoutValue;
36 UINT16 ProtocolTypeFilter;
37 BOOLEAN EnableUnicastReceive;
38 BOOLEAN EnableMulticastReceive;
39 BOOLEAN EnableBroadcastReceive;
40 BOOLEAN EnablePromiscuousReceive;
41 BOOLEAN FlushQueuesOnReset;
42 BOOLEAN EnableReceiveTimestamps;
43 BOOLEAN DisableBackgroundPolling;
44 } EFI_MANAGED_NETWORK_CONFIG_DATA;
45
46 typedef struct {
47 EFI_TIME Timestamp;
48 EFI_EVENT RecycleEvent;
49 UINT32 PacketLength;
50 UINT32 HeaderLength;
51 UINT32 AddressLength;
52 UINT32 DataLength;
53 BOOLEAN BroadcastFlag;
54 BOOLEAN MulticastFlag;
55 BOOLEAN PromiscuousFlag;
56 UINT16 ProtocolType;
57 VOID *DestinationAddress;
58 VOID *SourceAddress;
59 VOID *MediaHeader;
60 VOID *PacketData;
61 } EFI_MANAGED_NETWORK_RECEIVE_DATA;
62
63 typedef struct {
64 UINT32 FragmentLength;
65 VOID *FragmentBuffer;
66 } EFI_MANAGED_NETWORK_FRAGMENT_DATA;
67
68 typedef struct {
69 EFI_MAC_ADDRESS *DestinationAddress; //OPTIONAL
70 EFI_MAC_ADDRESS *SourceAddress; //OPTIONAL
71 UINT16 ProtocolType; //OPTIONAL
72 UINT32 DataLength;
73 UINT16 HeaderLength; //OPTIONAL
74 UINT16 FragmentCount;
75 EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];
76 } EFI_MANAGED_NETWORK_TRANSMIT_DATA;
77
78
79 typedef struct {
80 EFI_EVENT Event;
81 EFI_STATUS Status;
82 union {
83 EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData;
84 EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData;
85 } Packet;
86 } EFI_MANAGED_NETWORK_COMPLETION_TOKEN;
87
88 /**
89 Returns the operational parameters for the current MNP child driver.
90
91 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
92 @param MnpConfigData Pointer to storage for MNP operational parameters.
93 @param SnpModeData Pointer to storage for SNP operational parameters.
94
95 @retval EFI_SUCCESS The operation completed successfully.
96 @retval EFI_INVALID_PARAMETER This is NULL.
97 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
98 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default
99 values are returned in MnpConfigData if it is not NULL.
100 @retval Other The mode data could not be read.
101
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA)(
106 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
107 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
108 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
109 );
110
111 /**
112 Sets or clears the operational parameters for the MNP child driver.
113
114 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
115 @param MnpConfigData Pointer to configuration data that will be assigned to the MNP
116 child driver instance. If NULL, the MNP child driver instance is
117 reset to startup defaults and all pending transmit and receive
118 requests are flushed.
119
120 @retval EFI_SUCCESS The operation completed successfully.
121 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
122 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be
123 allocated.
124 @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]
125 implementation.
126 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
127 @retval Other The MNP child driver instance has been reset to startup defaults.
128
129 **/
130 typedef
131 EFI_STATUS
132 (EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE)(
133 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
134 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
135 );
136
137 /**
138 Translates an IP multicast address to a hardware (MAC) multicast address.
139
140 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
141 @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.
142 Set to FALSE if IpAddress is an IPv4 multicast address.
143 @param IpAddress Pointer to the multicast IP address (in network byte order) to convert.
144 @param MacAddress Pointer to the resulting multicast MAC address.
145
146 @retval EFI_SUCCESS The operation completed successfully.
147 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:
148 - This is NULL.
149 - IpAddress is NULL.
150 - *IpAddress is not a valid multicast IP address.
151 - MacAddress is NULL.
152 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
153 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
154 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
155 @retval Other The address could not be converted.
156
157 **/
158 typedef
159 EFI_STATUS
160 (EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC)(
161 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
162 IN BOOLEAN Ipv6Flag,
163 IN EFI_IP_ADDRESS *IpAddress,
164 OUT EFI_MAC_ADDRESS *MacAddress
165 );
166
167 /**
168 Enables and disables receive filters for multicast address.
169
170 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
171 @param JoinFlag Set to TRUE to join this multicast group.
172 Set to FALSE to leave this multicast group.
173 @param MacAddress Pointer to the multicast MAC group (address) to join or leave.
174
175 @retval EFI_SUCCESS The requested operation completed successfully.
176 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
177 - This is NULL.
178 - JoinFlag is TRUE and MacAddress is NULL.
179 - *MacAddress is not a valid multicast MAC address.
180 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
181 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.
182 @retval EFI_NOT_FOUND The supplied multicast group is not joined.
183 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
184 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
185 @retval Other The requested operation could not be completed.
186
187 **/
188 typedef
189 EFI_STATUS
190 (EFIAPI *EFI_MANAGED_NETWORK_GROUPS)(
191 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
192 IN BOOLEAN JoinFlag,
193 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
194 );
195
196 /**
197 Places asynchronous outgoing data packets into the transmit queue.
198
199 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
200 @param Token Pointer to a token associated with the transmit data descriptor.
201
202 @retval EFI_SUCCESS The transmit completion token was cached.
203 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
204 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
205 @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.
206 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
207 (usually memory).
208 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
209 @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.
210
211 **/
212 typedef
213 EFI_STATUS
214 (EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT)(
215 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
216 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
217 );
218
219 /**
220 Places an asynchronous receiving request into the receiving queue.
221
222 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
223 @param Token Pointer to a token associated with the receive data descriptor.
224
225 @retval EFI_SUCCESS The receive completion token was cached.
226 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
227 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
228 - This is NULL.
229 - Token is NULL.
230 - Token.Event is NULL
231 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
232 (usually memory).
233 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
234 @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.
235 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
236
237 **/
238 typedef
239 EFI_STATUS
240 (EFIAPI *EFI_MANAGED_NETWORK_RECEIVE)(
241 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
242 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
243 );
244
245
246 /**
247 Aborts an asynchronous transmit or receive request.
248
249 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
250 @param Token Pointer to a token that has been issued by
251 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or
252 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If
253 NULL, all pending tokens are aborted.
254
255 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
256 was signaled. When Token is NULL, all pending requests were
257 aborted and their events were signaled.
258 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
259 @retval EFI_INVALID_PARAMETER This is NULL.
260 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
261 not found in the transmit or receive queue. It has either completed
262 or was not issued by Transmit() and Receive().
263
264 **/
265 typedef
266 EFI_STATUS
267 (EFIAPI *EFI_MANAGED_NETWORK_CANCEL)(
268 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
269 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
270 );
271
272 /**
273 Polls for incoming data packets and processes outgoing data packets.
274
275 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
276
277 @retval EFI_SUCCESS Incoming or outgoing data was processed.
278 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
279 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
280 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing
281 the polling rate.
282 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
283 Consider increasing the polling rate.
284
285 **/
286 typedef
287 EFI_STATUS
288 (EFIAPI *EFI_MANAGED_NETWORK_POLL)(
289 IN EFI_MANAGED_NETWORK_PROTOCOL *This
290 );
291
292 ///
293 /// The MNP is used by network applications (and drivers) to
294 /// perform raw (unformatted) asynchronous network packet I/O.
295 ///
296 struct _EFI_MANAGED_NETWORK_PROTOCOL {
297 EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;
298 EFI_MANAGED_NETWORK_CONFIGURE Configure;
299 EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;
300 EFI_MANAGED_NETWORK_GROUPS Groups;
301 EFI_MANAGED_NETWORK_TRANSMIT Transmit;
302 EFI_MANAGED_NETWORK_RECEIVE Receive;
303 EFI_MANAGED_NETWORK_CANCEL Cancel;
304 EFI_MANAGED_NETWORK_POLL Poll;
305 };
306
307 extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;
308 extern EFI_GUID gEfiManagedNetworkProtocolGuid;
309
310 #endif