]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Protocol/Udp4.h
Clarify @pram b in Base.h. Accepted and edited in Qing Huang changes for @retval...
[mirror_edk2.git] / MdePkg / Include / Protocol / Udp4.h
index 7ac3c80f6c67be8b426673bda79ce9defd7d8344..5541f5e692ae716b7323ad09f55efce6dc4bcc61 100644 (file)
@@ -1,20 +1,27 @@
 /** @file\r
-  Copyright (c) 2006, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  UDP4 Service Binding Protocol as defined in UEFI specification.\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  The EFI UDPv4 Protocol provides simple packet-oriented services \r
+  to transmit and receive UDP packets.  \r
 \r
-  Module Name:  Udp4.h\r
+Copyright (c) 2006 - 2010, Intel Corporation.  All rights reserved<BR>\r
+This program and the accompanying materials are licensed and made available under \r
+the terms and conditions of the BSD License that accompanies this distribution.  \r
+The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php.                                          \r
+    \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.      \r
+\r
+  @par Revision Reference:          \r
+  This Protocol is introduced in UEFI Specification 2.0.       \r
 \r
 **/\r
 \r
 #ifndef __EFI_UDP4_PROTOCOL_H__\r
 #define __EFI_UDP4_PROTOCOL_H__\r
 \r
+#include <Protocol/Ip4.h>\r
 //\r
 //GUID definitions\r
 //\r
@@ -44,15 +51,6 @@ typedef struct {
   EFI_UDP4_SERVICE_POINT  Services[1];\r
 } EFI_UDP4_VARIABLE_DATA;\r
 \r
-//\r
-//ICMP error definitions\r
-//\r
-#define EFI_NETWORK_UNREACHABLE      EFIERR(100)\r
-#define EFI_HOST_UNREACHABLE         EFIERR(101) \r
-#define EFI_PROTOCOL_UNREACHABLE     EFIERR(102)\r
-#define EFI_PORT_UNREACHABLE         EFIERR(103)\r
-\r
-\r
 typedef struct {\r
   UINT32             FragmentLength;\r
   VOID               *FragmentBuffer;\r
@@ -121,11 +119,16 @@ typedef struct {
 /**\r
   Reads the current operational settings.\r
 \r
-  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
-  @param  Ip4ModeData    Pointer to the EFI IPv4 Protocol mode data structure.\r
-  @param  MnpConfigData  Pointer to the managed network configuration data structure.\r
-  @param  SnpModeData    Pointer to the simple network mode data structure.\r
+  The GetModeData() function copies the current operational settings of this EFI\r
+  UDPv4 Protocol instance into user-supplied buffers. This function is used\r
+  optionally to retrieve the operational mode data of underlying networks or\r
+  drivers.\r
+\r
+  @param  This           The pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData The pointer to the buffer to receive the current configuration data.\r
+  @param  Ip4ModeData    The pointer to the EFI IPv4 Protocol mode data structure.\r
+  @param  MnpConfigData  The pointer to the managed network configuration data structure.\r
+  @param  SnpModeData    The pointer to the simple network mode data structure.\r
 \r
   @retval EFI_SUCCESS           The mode data was read.\r
   @retval EFI_NOT_STARTED       When Udp4ConfigData is queried, no configuration data is\r
@@ -135,27 +138,38 @@ typedef struct {
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_GET_MODE_DATA) (\r
+(EFIAPI *EFI_UDP4_GET_MODE_DATA)(\r
   IN  EFI_UDP4_PROTOCOL                *This,\r
   OUT EFI_UDP4_CONFIG_DATA             *Udp4ConfigData OPTIONAL,\r
   OUT EFI_IP4_MODE_DATA                *Ip4ModeData    OPTIONAL,\r
   OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,\r
   OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL\r
-  )\r
-;  \r
+  );  \r
   \r
 \r
 /**\r
   Initializes, changes, or resets the operational parameters for this instance of the EFI UDPv4\r
   Protocol.\r
-\r
-  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Udp4ConfigData Pointer to the buffer to receive the current configuration data.\r
+  \r
+  The Configure() function is used to do the following:\r
+  * Initialize and start this instance of the EFI UDPv4 Protocol.\r
+  * Change the filtering rules and operational parameters.\r
+  * Reset this instance of the EFI UDPv4 Protocol.\r
+  Until these parameters are initialized, no network traffic can be sent or\r
+  received by this instance. This instance can be also reset by calling Configure()\r
+  with UdpConfigData set to NULL. Once reset, the receiving queue and transmitting\r
+  queue are flushed and no traffic is allowed through this instance.\r
+  With different parameters in UdpConfigData, Configure() can be used to bind\r
+  this instance to specified port.\r
+\r
+  @param  This           The pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Udp4ConfigData The pointer to the buffer to receive the current configuration data.\r
 \r
   @retval EFI_SUCCESS           The configuration settings were set, changed, or reset successfully.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP,\r
                                 RARP, etc.) is not finished yet.\r
-  @retval EFI_INVALID_PARAMETER One or more following conditions are TRUE:\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_INVALID_PARAMETER UdpConfigData.StationAddress is not a valid unicast IPv4 address.\r
   @retval EFI_ALREADY_STARTED   The EFI UDPv4 Protocol instance is already started/configured\r
                                 and must be stopped/reset before it can be reconfigured.\r
   @retval EFI_ACCESS_DENIED     UdpConfigData. AllowDuplicatePort is FALSE\r
@@ -169,19 +183,22 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_CONFIGURE) (\r
+(EFIAPI *EFI_UDP4_CONFIGURE)(\r
   IN EFI_UDP4_PROTOCOL      *This,\r
   IN EFI_UDP4_CONFIG_DATA   *UdpConfigData OPTIONAL\r
-  )\r
-;  \r
+  );  \r
 \r
 /**\r
   Joins and leaves multicast groups.\r
+  \r
+  The Groups() function is used to enable and disable the multicast group\r
+  filtering. If the JoinFlag is FALSE and the MulticastAddress is NULL, then all\r
+  currently joined groups are left.\r
 \r
-  @param  This             Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  This             The pointer to the EFI_UDP4_PROTOCOL instance.\r
   @param  JoinFlag         Set to TRUE to join a multicast group. Set to FALSE to leave one\r
                            or all multicast groups.\r
-  @param  MulticastAddress Pointer to multicast group address to join or leave.\r
+  @param  MulticastAddress The pointer to multicast group address to join or leave.\r
 \r
   @retval EFI_SUCCESS           The operation completed successfully.\r
   @retval EFI_NOT_STARTED       The EFI UDPv4 Protocol instance has not been started.\r
@@ -202,17 +219,34 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_GROUPS) (\r
+(EFIAPI *EFI_UDP4_GROUPS)(\r
   IN EFI_UDP4_PROTOCOL      *This,\r
   IN BOOLEAN                JoinFlag,\r
   IN EFI_IPv4_ADDRESS       *MulticastAddress    OPTIONAL\r
-  )\r
-;   \r
+  );   \r
 \r
 /**\r
   Adds and deletes routing table entries.\r
-\r
-  @param  This           Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  \r
+  The Routes() function adds a route to or deletes a route from the routing table.\r
+  Routes are determined by comparing the SubnetAddress with the destination IP\r
+  address and arithmetically AND-ing it with the SubnetMask. The gateway address\r
+  must be on the same subnet as the configured station address.\r
+  The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.\r
+  The default route matches all destination IP addresses that do not match any\r
+  other routes.\r
+  A zero GatewayAddress is a nonroute. Packets are sent to the destination IP\r
+  address if it can be found in the Address Resolution Protocol (ARP) cache or\r
+  on the local subnet. One automatic nonroute entry will be inserted into the\r
+  routing table for outgoing packets that are addressed to a local subnet\r
+  (gateway address of 0.0.0.0).\r
+  Each instance of the EFI UDPv4 Protocol has its own independent routing table.\r
+  Instances of the EFI UDPv4 Protocol that use the default IP address will also\r
+  have copies of the routing table provided by the EFI_IP4_CONFIG_PROTOCOL. These\r
+  copies will be updated automatically whenever the IP driver reconfigures its\r
+  instances; as a result, the previous modification to these copies will be lost.\r
+\r
+  @param  This           The pointer to the EFI_UDP4_PROTOCOL instance.\r
   @param  DeleteRoute    Set to TRUE to delete this route from the routing table.\r
                          Set to FALSE to add this route to the routing table.\r
   @param  SubnetAddress  The destination network address that needs to be routed.\r
@@ -231,19 +265,27 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_ROUTES) (\r
+(EFIAPI *EFI_UDP4_ROUTES)(\r
   IN EFI_UDP4_PROTOCOL      *This,\r
   IN BOOLEAN                DeleteRoute,\r
   IN EFI_IPv4_ADDRESS       *SubnetAddress,\r
   IN EFI_IPv4_ADDRESS       *SubnetMask,\r
   IN EFI_IPv4_ADDRESS       *GatewayAddress\r
-  )\r
-;     \r
+  );     \r
 \r
 /**\r
   Polls for incoming data packets and processes outgoing data packets.\r
+  \r
+  The Poll() function can be used by network drivers and applications to increase\r
+  the rate that data packets are moved between the communications device and the\r
+  transmit and receive queues.\r
+  In some systems, the periodic timer event in the managed network driver may not\r
+  poll the underlying communications device fast enough to transmit and/or receive\r
+  all data packets without missing incoming packets or dropping outgoing packets.\r
+  Drivers and applications that are experiencing packet loss should try calling\r
+  the Poll() function more often.\r
 \r
-  @param  This Pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  This The pointer to the EFI_UDP4_PROTOCOL instance.\r
 \r
   @retval EFI_SUCCESS           Incoming or outgoing data was processed.\r
   @retval EFI_INVALID_PARAMETER This is NULL.\r
@@ -253,23 +295,32 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_POLL) (\r
+(EFIAPI *EFI_UDP4_POLL)(\r
   IN EFI_UDP4_PROTOCOL      *This\r
-  )\r
-;   \r
+  );   \r
 \r
 /**\r
   Places an asynchronous receive request into the receiving queue.\r
-\r
-  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Token Pointer to a token that is associated with the receive data\r
+  \r
+  The Receive() function places a completion token into the receive packet queue.\r
+  This function is always asynchronous.\r
+  The caller must fill in the Token.Event field in the completion token, and this\r
+  field cannot be NULL. When the receive operation completes, the EFI UDPv4 Protocol\r
+  driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event\r
+  is signaled. Providing a proper notification function and context for the event\r
+  will enable the user to receive the notification and receiving status. That\r
+  notification function is guaranteed to not be re-entered.\r
+\r
+  @param  This  The pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token The pointer to a token that is associated with the receive data\r
                 descriptor.\r
 \r
   @retval EFI_SUCCESS           The receive completion token was cached.\r
   @retval EFI_NOT_STARTED       This EFI UDPv4 Protocol instance has not been started.\r
   @retval EFI_NO_MAPPING        When using a default address, configuration (DHCP, BOOTP, RARP, etc.)\r
                                 is not finished yet.\r
-  @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
+  @retval EFI_INVALID_PARAMETER This is NULL.\r
+  @retval EFI_INVALID_PARAMETER UdpConfigData.StationAddress is not a valid unicast IPv4 address.\r
   @retval EFI_OUT_OF_RESOURCES  The receive completion token could not be queued due to a lack of system\r
                                 resources (usually memory).\r
   @retval EFI_DEVICE_ERROR      An unexpected system or network error occurred.\r
@@ -280,17 +331,23 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_RECEIVE) (\r
+(EFIAPI *EFI_UDP4_RECEIVE)(\r
   IN EFI_UDP4_PROTOCOL          *This,\r
   IN EFI_UDP4_COMPLETION_TOKEN  *Token\r
-  )\r
-;   \r
+  );   \r
 \r
 /**\r
   Queues outgoing data packets into the transmit queue.\r
-\r
-  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Token Pointer to the completion token that will be placed into the\r
+  \r
+  The Transmit() function places a sending request to this instance of the EFI\r
+  UDPv4 Protocol, alongside the transmit data that was filled by the user. Whenever\r
+  the packet in the token is sent out or some errors occur, the Token.Event will\r
+  be signaled and Token.Status is updated. Providing a proper notification function\r
+  and context for the event will enable the user to receive the notification and\r
+  transmitting status.\r
+\r
+  @param  This  The pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token The pointer to the completion token that will be placed into the\r
                 transmit queue.\r
 \r
   @retval EFI_SUCCESS           The data has been queued for transmission.\r
@@ -311,17 +368,23 @@ EFI_STATUS
 **/\r
 typedef\r
 EFI_STATUS\r
-(EFIAPI *EFI_UDP4_TRANSMIT) (\r
+(EFIAPI *EFI_UDP4_TRANSMIT)(\r
   IN EFI_UDP4_PROTOCOL           *This,\r
   IN EFI_UDP4_COMPLETION_TOKEN   *Token\r
-  )\r
-;     \r
+  );     \r
 \r
 /**\r
   Aborts an asynchronous transmit or receive request.\r
-\r
-  @param  This  Pointer to the EFI_UDP4_PROTOCOL instance.\r
-  @param  Token Pointer to a token that has been issued by\r
+  \r
+  The Cancel() function is used to abort a pending transmit or receive request.\r
+  If the token is in the transmit or receive request queues, after calling this\r
+  function, Token.Status will be set to EFI_ABORTED and then Token.Event will be\r
+  signaled. If the token is not in one of the queues, which usually means that\r
+  the asynchronous operation has completed, this function will not signal the\r
+  token and EFI_NOT_FOUND is returned.\r
+\r
+  @param  This  The pointer to the EFI_UDP4_PROTOCOL instance.\r
+  @param  Token The pointer to a token that has been issued by\r
                 EFI_UDP4_PROTOCOL.Transmit() or\r
                 EFI_UDP4_PROTOCOL.Receive().If NULL, all pending\r
                 tokens are aborted.\r
@@ -343,9 +406,15 @@ EFI_STATUS
 (EFIAPI *EFI_UDP4_CANCEL)(\r
   IN EFI_UDP4_PROTOCOL          *This,\r
   IN EFI_UDP4_COMPLETION_TOKEN  *Token  OPTIONAL\r
-  )\r
-;       \r
-\r
+  );       \r
+\r
+///\r
+/// The EFI_UDP4_PROTOCOL defines an EFI UDPv4 Protocol session that can be used \r
+/// by any network drivers, applications, or daemons to transmit or receive UDP packets. \r
+/// This protocol instance can either be bound to a specified port as a service or \r
+/// connected to some remote peer as an active client. Each instance has its own settings, \r
+/// such as the routing table and group table, which are independent from each other.\r
+///\r
 struct _EFI_UDP4_PROTOCOL {\r
   EFI_UDP4_GET_MODE_DATA        GetModeData;\r
   EFI_UDP4_CONFIGURE            Configure;\r