Path: blob/main/sys/contrib/edk2/Include/Protocol/ManagedNetwork.h
96339 views
/** @file1EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.2EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.34Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>5SPDX-License-Identifier: BSD-2-Clause-Patent67@par Revision Reference:8This Protocol is introduced in UEFI Specification 2.0910**/1112#ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__13#define __EFI_MANAGED_NETWORK_PROTOCOL_H__1415#include <Protocol/SimpleNetwork.h>1617#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \18{ \190xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \20}2122#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \23{ \240x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 } \25}2627typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;2829typedef struct {30///31/// Timeout value for a UEFI one-shot timer event. A packet that has not been removed32/// from the MNP receive queue will be dropped if its receive timeout expires.33///34UINT32 ReceivedQueueTimeoutValue;35///36/// Timeout value for a UEFI one-shot timer event. A packet that has not been removed37/// from the MNP transmit queue will be dropped if its receive timeout expires.38///39UINT32 TransmitQueueTimeoutValue;40///41/// Ethernet type II 16-bit protocol type in host byte order. Valid42/// values are zero and 1,500 to 65,535.43///44UINT16 ProtocolTypeFilter;45///46/// Set to TRUE to receive packets that are sent to the network47/// device MAC address. The startup default value is FALSE.48///49BOOLEAN EnableUnicastReceive;50///51/// Set to TRUE to receive packets that are sent to any of the52/// active multicast groups. The startup default value is FALSE.53///54BOOLEAN EnableMulticastReceive;55///56/// Set to TRUE to receive packets that are sent to the network57/// device broadcast address. The startup default value is FALSE.58///59BOOLEAN EnableBroadcastReceive;60///61/// Set to TRUE to receive packets that are sent to any MAC address.62/// The startup default value is FALSE.63///64BOOLEAN EnablePromiscuousReceive;65///66/// Set to TRUE to drop queued packets when the configuration67/// is changed. The startup default value is FALSE.68///69BOOLEAN FlushQueuesOnReset;70///71/// Set to TRUE to timestamp all packets when they are received72/// by the MNP. Note that timestamps may be unsupported in some73/// MNP implementations. The startup default value is FALSE.74///75BOOLEAN EnableReceiveTimestamps;76///77/// Set to TRUE to disable background polling in this MNP78/// instance. Note that background polling may not be supported in79/// all MNP implementations. The startup default value is FALSE,80/// unless background polling is not supported.81///82BOOLEAN DisableBackgroundPolling;83} EFI_MANAGED_NETWORK_CONFIG_DATA;8485typedef struct {86EFI_TIME Timestamp;87EFI_EVENT RecycleEvent;88UINT32 PacketLength;89UINT32 HeaderLength;90UINT32 AddressLength;91UINT32 DataLength;92BOOLEAN BroadcastFlag;93BOOLEAN MulticastFlag;94BOOLEAN PromiscuousFlag;95UINT16 ProtocolType;96VOID *DestinationAddress;97VOID *SourceAddress;98VOID *MediaHeader;99VOID *PacketData;100} EFI_MANAGED_NETWORK_RECEIVE_DATA;101102typedef struct {103UINT32 FragmentLength;104VOID *FragmentBuffer;105} EFI_MANAGED_NETWORK_FRAGMENT_DATA;106107typedef struct {108EFI_MAC_ADDRESS *DestinationAddress; // OPTIONAL109EFI_MAC_ADDRESS *SourceAddress; // OPTIONAL110UINT16 ProtocolType; // OPTIONAL111UINT32 DataLength;112UINT16 HeaderLength; // OPTIONAL113UINT16 FragmentCount;114EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];115} EFI_MANAGED_NETWORK_TRANSMIT_DATA;116117typedef struct {118///119/// This Event will be signaled after the Status field is updated120/// by the MNP. The type of Event must be121/// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of122/// Event must be lower than or equal to TPL_CALLBACK.123///124EFI_EVENT Event;125///126/// The status that is returned to the caller at the end of the operation127/// to indicate whether this operation completed successfully.128///129EFI_STATUS Status;130union {131///132/// When this token is used for receiving, RxData is a pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA.133///134EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData;135///136/// When this token is used for transmitting, TxData is a pointer to the EFI_MANAGED_NETWORK_TRANSMIT_DATA.137///138EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData;139} Packet;140} EFI_MANAGED_NETWORK_COMPLETION_TOKEN;141142/**143Returns the operational parameters for the current MNP child driver.144145@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.146@param MnpConfigData The pointer to storage for MNP operational parameters.147@param SnpModeData The pointer to storage for SNP operational parameters.148149@retval EFI_SUCCESS The operation completed successfully.150@retval EFI_INVALID_PARAMETER This is NULL.151@retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.152@retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default153values are returned in MnpConfigData if it is not NULL.154@retval Other The mode data could not be read.155156**/157typedef158EFI_STATUS159(EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA)(160IN EFI_MANAGED_NETWORK_PROTOCOL *This,161OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,162OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL163);164165/**166Sets or clears the operational parameters for the MNP child driver.167168@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.169@param MnpConfigData The pointer to configuration data that will be assigned to the MNP170child driver instance. If NULL, the MNP child driver instance is171reset to startup defaults and all pending transmit and receive172requests are flushed.173174@retval EFI_SUCCESS The operation completed successfully.175@retval EFI_INVALID_PARAMETER One or more parameters are invalid.176@retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be177allocated.178@retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]179implementation.180@retval EFI_DEVICE_ERROR An unexpected network or system error occurred.181@retval Other The MNP child driver instance has been reset to startup defaults.182183**/184typedef185EFI_STATUS186(EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE)(187IN EFI_MANAGED_NETWORK_PROTOCOL *This,188IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL189);190191/**192Translates an IP multicast address to a hardware (MAC) multicast address.193194@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.195@param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.196Set to FALSE if IpAddress is an IPv4 multicast address.197@param IpAddress The pointer to the multicast IP address (in network byte order) to convert.198@param MacAddress The pointer to the resulting multicast MAC address.199200@retval EFI_SUCCESS The operation completed successfully.201@retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:202- This is NULL.203- IpAddress is NULL.204- *IpAddress is not a valid multicast IP address.205- MacAddress is NULL.206@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.207@retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.208@retval EFI_DEVICE_ERROR An unexpected network or system error occurred.209@retval Other The address could not be converted.210211**/212typedef213EFI_STATUS214(EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC)(215IN EFI_MANAGED_NETWORK_PROTOCOL *This,216IN BOOLEAN Ipv6Flag,217IN EFI_IP_ADDRESS *IpAddress,218OUT EFI_MAC_ADDRESS *MacAddress219);220221/**222Enables and disables receive filters for multicast address.223224@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.225@param JoinFlag Set to TRUE to join this multicast group.226Set to FALSE to leave this multicast group.227@param MacAddress The pointer to the multicast MAC group (address) to join or leave.228229@retval EFI_SUCCESS The requested operation completed successfully.230@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:231- This is NULL.232- JoinFlag is TRUE and MacAddress is NULL.233- *MacAddress is not a valid multicast MAC address.234@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.235@retval EFI_ALREADY_STARTED The supplied multicast group is already joined.236@retval EFI_NOT_FOUND The supplied multicast group is not joined.237@retval EFI_DEVICE_ERROR An unexpected network or system error occurred.238@retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.239@retval Other The requested operation could not be completed.240241**/242typedef243EFI_STATUS244(EFIAPI *EFI_MANAGED_NETWORK_GROUPS)(245IN EFI_MANAGED_NETWORK_PROTOCOL *This,246IN BOOLEAN JoinFlag,247IN EFI_MAC_ADDRESS *MacAddress OPTIONAL248);249250/**251Places asynchronous outgoing data packets into the transmit queue.252253@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.254@param Token The pointer to a token associated with the transmit data descriptor.255256@retval EFI_SUCCESS The transmit completion token was cached.257@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.258@retval EFI_INVALID_PARAMETER One or more parameters are invalid.259@retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.260@retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources261(usually memory).262@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.263@retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.264265**/266typedef267EFI_STATUS268(EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT)(269IN EFI_MANAGED_NETWORK_PROTOCOL *This,270IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token271);272273/**274Places an asynchronous receiving request into the receiving queue.275276@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.277@param Token The pointer to a token associated with the receive data descriptor.278279@retval EFI_SUCCESS The receive completion token was cached.280@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.281@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:282- This is NULL.283- Token is NULL.284- Token.Event is NULL.285@retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources286(usually memory).287@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.288@retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.289@retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.290291**/292typedef293EFI_STATUS294(EFIAPI *EFI_MANAGED_NETWORK_RECEIVE)(295IN EFI_MANAGED_NETWORK_PROTOCOL *This,296IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token297);298299/**300Aborts an asynchronous transmit or receive request.301302@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.303@param Token The pointer to a token that has been issued by304EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or305EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If306NULL, all pending tokens are aborted.307308@retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event309was signaled. When Token is NULL, all pending requests were310aborted and their events were signaled.311@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.312@retval EFI_INVALID_PARAMETER This is NULL.313@retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was314not found in the transmit or receive queue. It has either completed315or was not issued by Transmit() and Receive().316317**/318typedef319EFI_STATUS320(EFIAPI *EFI_MANAGED_NETWORK_CANCEL)(321IN EFI_MANAGED_NETWORK_PROTOCOL *This,322IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL323);324325/**326Polls for incoming data packets and processes outgoing data packets.327328@param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.329330@retval EFI_SUCCESS Incoming or outgoing data was processed.331@retval EFI_NOT_STARTED This MNP child driver instance has not been configured.332@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.333@retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing334the polling rate.335@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.336Consider increasing the polling rate.337338**/339typedef340EFI_STATUS341(EFIAPI *EFI_MANAGED_NETWORK_POLL)(342IN EFI_MANAGED_NETWORK_PROTOCOL *This343);344345///346/// The MNP is used by network applications (and drivers) to347/// perform raw (unformatted) asynchronous network packet I/O.348///349struct _EFI_MANAGED_NETWORK_PROTOCOL {350EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;351EFI_MANAGED_NETWORK_CONFIGURE Configure;352EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;353EFI_MANAGED_NETWORK_GROUPS Groups;354EFI_MANAGED_NETWORK_TRANSMIT Transmit;355EFI_MANAGED_NETWORK_RECEIVE Receive;356EFI_MANAGED_NETWORK_CANCEL Cancel;357EFI_MANAGED_NETWORK_POLL Poll;358};359360extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;361extern EFI_GUID gEfiManagedNetworkProtocolGuid;362363#endif364365366