]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/ManagedNetwork.h
92a41dd1835272fa0034780cccec39a5390fc0db
[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, 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 /**
113 Sets or clears the operational parameters for the MNP child driver.
114
115 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
116 @param MnpConfigData Pointer to configuration data that will be assigned to the MNP
117 child driver instance. If NULL, the MNP child driver instance is
118 reset to startup defaults and all pending transmit and receive
119 requests are flushed.
120
121 @retval EFI_SUCCESS The operation completed successfully.
122 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
123 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be
124 allocated.
125 @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]
126 implementation.
127 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
128 @retval Other The MNP child driver instance has been reset to startup defaults.
129
130 **/
131 typedef
132 EFI_STATUS
133 (EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE) (
134 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
135 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
136 )
137 ;
138
139 /**
140 Translates an IP multicast address to a hardware (MAC) multicast address.
141
142 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
143 @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.
144 Set to FALSE if IpAddress is an IPv4 multicast address.
145 @param IpAddress Pointer to the multicast IP address (in network byte order) to convert.
146 @param MacAddress Pointer to the resulting multicast MAC address.
147
148 @retval EFI_SUCCESS The operation completed successfully.
149 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:
150 - This is NULL.
151 - IpAddress is NULL.
152 - *IpAddress is not a valid multicast IP address.
153 - MacAddress is NULL.
154 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
155 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
156 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
157 @retval Other The address could not be converted.
158
159 **/
160 typedef
161 EFI_STATUS
162 (EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC) (
163 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
164 IN BOOLEAN Ipv6Flag,
165 IN EFI_IP_ADDRESS *IpAddress,
166 OUT EFI_MAC_ADDRESS *MacAddress
167 )
168 ;
169
170 /**
171 Enables and disables receive filters for multicast address.
172
173 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
174 @param JoinFlag Set to TRUE to join this multicast group.
175 Set to FALSE to leave this multicast group.
176 @param MacAddress Pointer to the multicast MAC group (address) to join or leave.
177
178 @retval EFI_SUCCESS The requested operation completed successfully.
179 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
180 - This is NULL.
181 - JoinFlag is TRUE and MacAddress is NULL.
182 - *MacAddress is not a valid multicast MAC address.
183 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
184 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.
185 @retval EFI_NOT_FOUND The supplied multicast group is not joined.
186 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.
187 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.
188 @retval Other The requested operation could not be completed.
189
190 **/
191 typedef
192 EFI_STATUS
193 (EFIAPI *EFI_MANAGED_NETWORK_GROUPS) (
194 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
195 IN BOOLEAN JoinFlag,
196 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
197 )
198 ;
199
200 /**
201 Places asynchronous outgoing data packets into the transmit queue.
202
203 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
204 @param Token Pointer to a token associated with the transmit data descriptor.
205
206 @retval EFI_SUCCESS The transmit completion token was cached.
207 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
208 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
209 @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.
210 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
211 (usually memory).
212 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
213 @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.
214
215 **/
216 typedef
217 EFI_STATUS
218 (EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT) (
219 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
220 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
221 )
222 ;
223
224 /**
225 Places an asynchronous receiving request into the receiving queue.
226
227 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
228 @param Token Pointer to a token associated with the receive data descriptor.
229
230 @retval EFI_SUCCESS The receive completion token was cached.
231 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
232 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
233 - This is NULL.
234 - Token is NULL.
235 - Token.Event is NULL
236 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources
237 (usually memory).
238 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
239 @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.
240 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
241
242 **/
243 typedef
244 EFI_STATUS
245 (EFIAPI *EFI_MANAGED_NETWORK_RECEIVE) (
246 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
247 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token
248 )
249 ;
250
251
252 /**
253 Aborts an asynchronous transmit or receive request.
254
255 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
256 @param Token Pointer to a token that has been issued by
257 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or
258 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If
259 NULL, all pending tokens are aborted.
260
261 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event
262 was signaled. When Token is NULL, all pending requests were
263 aborted and their events were signaled.
264 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
265 @retval EFI_INVALID_PARAMETER This is NULL.
266 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
267 not found in the transmit or receive queue. It has either completed
268 or was not issued by Transmit() and Receive().
269
270 **/
271 typedef
272 EFI_STATUS
273 (EFIAPI *EFI_MANAGED_NETWORK_CANCEL) (
274 IN EFI_MANAGED_NETWORK_PROTOCOL *This,
275 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL
276 )
277 ;
278
279 /**
280 Polls for incoming data packets and processes outgoing data packets.
281
282 @param This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.
283
284 @retval EFI_SUCCESS Incoming or outgoing data was processed.
285 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.
286 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
287 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing
288 the polling rate.
289 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
290 Consider increasing the polling rate.
291
292 **/
293 typedef
294 EFI_STATUS
295 (EFIAPI *EFI_MANAGED_NETWORK_POLL) (
296 IN EFI_MANAGED_NETWORK_PROTOCOL *This
297 )
298 ;
299
300 struct _EFI_MANAGED_NETWORK_PROTOCOL {
301 EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;
302 EFI_MANAGED_NETWORK_CONFIGURE Configure;
303 EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;
304 EFI_MANAGED_NETWORK_GROUPS Groups;
305 EFI_MANAGED_NETWORK_TRANSMIT Transmit;
306 EFI_MANAGED_NETWORK_RECEIVE Receive;
307 EFI_MANAGED_NETWORK_CANCEL Cancel;
308 EFI_MANAGED_NETWORK_POLL Poll;
309 };
310
311 extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;
312 extern EFI_GUID gEfiManagedNetworkProtocolGuid;
313
314 #endif