]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/Efi/EfiSocketLib.h
StdLib: Remove EfiSocketLib and Ip4Config Protocol dependency.
[mirror_edk2.git] / StdLib / Include / Efi / EfiSocketLib.h
index 53ad0d4003ef7897430152ff9a186a440f45ca91..7618d02801ac1ca84a9befe938abf6eadf8e73ef 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Definitions for the EFI Socket layer library.\r
 \r
-  Copyright (c) 2011, Intel Corporation\r
+  Copyright (c) 2011 - 2015, 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
 \r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiLib.h>\r
 \r
 #include <Protocol/EfiSocket.h>\r
+#include <Protocol/Ip4Config2.h>\r
+#include <Protocol/Ip6Config.h>\r
 #include <Protocol/ServiceBinding.h>\r
 #include <Protocol/Tcp4.h>\r
+#include <Protocol/Tcp6.h>\r
 #include <Protocol/Udp4.h>\r
+#include <Protocol/Udp6.h>\r
 \r
 #include <sys/time.h>\r
 \r
 #define DBG_EXIT_STATUS(Status) DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", Status: %r\n", Status ))      ///<  Display routine exit with status value\r
 #define DBG_EXIT_TF(Status)     DEBUG (( DEBUG_INFO, "Exiting " __FUNCTION__ ", returning %s\n", (FALSE == Status) ? L"FALSE" : L"TRUE" ))  ///<  Display routine with TRUE/FALSE value\r
 #else   //  _MSC_VER\r
-#define DBG_ENTER()\r
-#define DBG_EXIT()\r
-#define DBG_EXIT_DEC(Status)\r
-#define DBG_EXIT_HEX(Status)\r
-#define DBG_EXIT_STATUS(Status)\r
-#define DBG_EXIT_TF(Status)\r
+#define DBG_ENTER()               ///<  Display routine entry\r
+#define DBG_EXIT()                ///<  Display routine exit\r
+#define DBG_EXIT_DEC(Status)      ///<  Display routine exit with decimal value\r
+#define DBG_EXIT_HEX(Status)      ///<  Display routine exit with hex value\r
+#define DBG_EXIT_STATUS(Status)   ///<  Display routine exit with status value\r
+#define DBG_EXIT_TF(Status)       ///<  Display routine with TRUE/FALSE value\r
 #endif  //  _MSC_VER\r
 \r
 #define DIM(x)    ( sizeof ( x ) / sizeof ( x[0] ))   ///<  Compute the number of entries in an array\r
 \r
 #if !defined(MDEPKG_NDEBUG)\r
 \r
+/**\r
+  Verify that the TPL is at the correct level\r
+**/\r
+#define VERIFY_AT_TPL(tpl)                           \\r
+{                                                 \\r
+  EFI_TPL PreviousTpl;                            \\r
+                                                  \\r
+  PreviousTpl = EfiGetCurrentTpl ( );             \\r
+  if ( PreviousTpl != tpl ) {                     \\r
+    DEBUG (( DEBUG_ERROR | DEBUG_TPL,             \\r
+              "Current TPL: %d, New TPL: %d\r\n", \\r
+              PreviousTpl, tpl ));                \\r
+    ASSERT ( PreviousTpl == tpl );                \\r
+  }                                               \\r
+}\r
+\r
 #define VERIFY_TPL(tpl)                           \\r
 {                                                 \\r
   EFI_TPL PreviousTpl;                            \\r
                                                   \\r
-  PreviousTpl = gBS->RaiseTPL ( TPL_HIGH_LEVEL ); \\r
-  gBS->RestoreTPL ( PreviousTpl );                \\r
+  PreviousTpl = EfiGetCurrentTpl ( );             \\r
   if ( PreviousTpl > tpl ) {                      \\r
     DEBUG (( DEBUG_ERROR | DEBUG_TPL,             \\r
               "Current TPL: %d, New TPL: %d\r\n", \\r
 \r
 #else   //  MDEPKG_NDEBUG\r
 \r
-#define VERIFY_TPL(tpl)\r
+#define VERIFY_AT_TPL(tpl)    ///<  Verify that the TPL is at the correct level\r
+#define VERIFY_TPL(tpl)       ///<  Verify that the TPL is at the correct level\r
 \r
 #endif  //  MDEPKG_NDEBUG\r
 \r
+/**\r
+  Raise TPL to the specified level\r
+**/\r
 #define RAISE_TPL(PreviousTpl, tpl)     \\r
   VERIFY_TPL ( tpl );                   \\r
-  PreviousTpl = gBS->RaiseTPL ( tpl );  \\r
-  DEBUG (( DEBUG_TPL | DEBUG_TPL,       \\r
-          "%d: TPL\r\n",                \\r
-          tpl ))\r
+  PreviousTpl = gBS->RaiseTPL ( tpl );\r
 \r
+/**\r
+  Restore the TPL to the previous value\r
+**/\r
 #define RESTORE_TPL(tpl)            \\r
-  gBS->RestoreTPL ( tpl );          \\r
-  DEBUG (( DEBUG_TPL | DEBUG_TPL,   \\r
-          "%d: TPL\r\n",            \\r
-          tpl ))\r
+  gBS->RestoreTPL ( tpl )\r
 \r
 //------------------------------------------------------------------------------\r
 // Data Types\r
 //------------------------------------------------------------------------------\r
 \r
-typedef struct _DT_SERVICE DT_SERVICE;  ///<  Forward delcaration\r
-\r
-typedef\r
-EFI_STATUS\r
-(* PFN_SB_INITIALIZE) (\r
-    DT_SERVICE * pService\r
-    );\r
-\r
-typedef\r
-VOID\r
-(* PFN_SB_SHUTDOWN) (\r
-    DT_SERVICE * pService\r
-    );\r
+typedef struct _ESL_SERVICE ESL_SERVICE;  ///<  Forward delcaration\r
 \r
 /**\r
   Protocol binding and installation control structure\r
@@ -130,172 +139,193 @@ VOID
 typedef struct {\r
   CHAR16 * pName;                 ///<  Protocol name\r
   EFI_GUID * pNetworkBinding;     ///<  Network service binding protocol for socket support\r
+  EFI_GUID * pNetworkProtocolGuid;///<  Network protocol GUID\r
   CONST EFI_GUID * pTagGuid;      ///<  Tag to mark protocol in use\r
-  PFN_SB_INITIALIZE pfnInitialize;///<  Routine to initialize the service\r
-  PFN_SB_SHUTDOWN pfnShutdown;    ///<  Routine to shutdown the service\r
-} DT_SOCKET_BINDING;\r
+  UINTN ServiceListOffset;        ///<  Offset in ::ESL_LAYER for the list of services\r
+  UINTN RxIo;                     ///<  Number of receive ESL_IO_MGMT structures for data\r
+  UINTN TxIoNormal;               ///<  Number of transmit ESL_IO_MGMT structures for normal data\r
+  UINTN TxIoUrgent;               ///<  Number of transmit ESL_IO_MGMT structures for urgent data\r
+} ESL_SOCKET_BINDING;\r
 \r
 //------------------------------------------------------------------------------\r
 // GUIDs\r
 //------------------------------------------------------------------------------\r
 \r
-extern CONST EFI_GUID mEslRawServiceGuid;\r
-extern CONST EFI_GUID mEslTcp4ServiceGuid;\r
-extern CONST EFI_GUID mEslUdp4ServiceGuid;\r
+extern CONST EFI_GUID mEslIp4ServiceGuid;   ///<  Tag GUID for the IPv4 layer\r
+extern CONST EFI_GUID mEslIp6ServiceGuid;   ///<  Tag GUID for the IPv6 layer\r
+extern CONST EFI_GUID mEslTcp4ServiceGuid;  ///<  Tag GUID for the TCPv4 layer\r
+extern CONST EFI_GUID mEslTcp6ServiceGuid;  ///<  Tag GUID for the TCPv6 layer\r
+extern CONST EFI_GUID mEslUdp4ServiceGuid;  ///<  Tag GUID for the UDPv4 layer\r
+extern CONST EFI_GUID mEslUdp6ServiceGuid;  ///<  Tag GUID for the UDPv6 layer\r
 \r
 //------------------------------------------------------------------------------\r
 // Data\r
 //------------------------------------------------------------------------------\r
 \r
-extern CONST DT_SOCKET_BINDING cEslSocketBinding [];\r
-extern CONST UINTN cEslSocketBindingEntries;\r
+extern CONST ESL_SOCKET_BINDING cEslSocketBinding[];///<  List of network service bindings\r
+extern CONST UINTN cEslSocketBindingEntries;        ///<  Number of network service bindings\r
 \r
 //------------------------------------------------------------------------------\r
-// Service Support Routines\r
+// DXE Support Routines\r
 //------------------------------------------------------------------------------\r
 \r
 /**\r
-  Connect to the network service bindings\r
+  Creates a child handle and installs a protocol.\r
 \r
-  Walk the network service protocols on the controller handle and\r
-  locate any that are not in use.  Create service structures to\r
-  manage the service binding for the socket driver.\r
+  When the socket application is linked against UseSocketDxe, the ::socket\r
+  routine indirectly calls this routine in SocketDxe to create a child\r
+  handle if necessary and install the socket protocol on the handle.\r
+  Upon return, EslServiceGetProtocol in UseSocketLib returns the\r
+  ::EFI_SOCKET_PROTOCOL address to the socket routine.\r
 \r
-  @param [in] BindingHandle    Handle for protocol binding.\r
-  @param [in] Controller       Handle of device to work with.\r
+  @param [in] pThis        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
+  @param [in] pChildHandle Pointer to the handle of the child to create. If it is NULL,\r
+                           then a new handle is created. If it is a pointer to an existing UEFI handle, \r
+                           then the protocol is added to the existing UEFI handle.\r
 \r
-  @retval EFI_SUCCESS          This driver is added to Controller.\r
-  @retval other                This driver does not support this device.\r
+  @retval EFI_SUCCESS           The protocol was added to ChildHandle.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create\r
+                                the child\r
+  @retval other                 The child handle was not created\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EslServiceConnect (\r
-  IN EFI_HANDLE BindingHandle,\r
-  IN EFI_HANDLE Controller\r
+EslDxeCreateChild (\r
+  IN     EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
+  IN OUT EFI_HANDLE * pChildHandle\r
   );\r
 \r
 /**\r
-  Shutdown the network connections to this controller by removing\r
-  NetworkInterfaceIdentifier protocol and closing the DevicePath\r
-  and PciIo protocols on Controller.\r
+  Destroys a child handle with a protocol installed on it.\r
+  \r
+  When the socket application is linked against UseSocketDxe, the ::close\r
+  routine indirectly calls this routine in SocketDxe to undo the operations\r
+  done by the ::EslDxeCreateChild routine.  This routine removes the socket\r
+  protocol from the handle and then destroys the child handle if there are\r
+  no other protocols attached.\r
 \r
-  @param [in] BindingHandle    Handle for protocol binding.\r
-  @param [in] Controller           Handle of device to stop driver on.\r
+  @param [in] pThis       Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
+  @param [in] ChildHandle Handle of the child to destroy\r
 \r
-  @retval EFI_SUCCESS          This driver is removed Controller.\r
-  @retval EFI_DEVICE_ERROR     The device could not be stopped due to a device error.\r
-  @retval other                This driver was not removed from this device.\r
+  @retval EFI_SUCCESS           The protocol was removed from ChildHandle.\r
+  @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.\r
+  @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
+  @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle\r
+                                because its services are being used.\r
+  @retval other                 The child handle was not destroyed\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EslServiceDisconnect (\r
-  IN  EFI_HANDLE BindingHandle,\r
-  IN  EFI_HANDLE Controller\r
+EslDxeDestroyChild (\r
+  IN EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
+  IN EFI_HANDLE ChildHandle\r
   );\r
 \r
 /**\r
 Install the socket service\r
 \r
+SocketDxe uses this routine to announce the socket interface to\r
+the rest of EFI.\r
+\r
 @param [in] pImageHandle      Address of the image handle\r
 \r
 @retval EFI_SUCCESS     Service installed successfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EslServiceInstall (\r
+EslDxeInstall (\r
   IN EFI_HANDLE * pImageHandle\r
   );\r
 \r
-/**\r
-Initialize the service layer\r
-\r
-@param [in] ImageHandle       Handle for the image.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-EslServiceLoad (\r
-  IN EFI_HANDLE ImageHandle\r
-  );\r
-\r
 /**\r
 Uninstall the socket service\r
 \r
+SocketDxe uses this routine to notify EFI that the socket layer\r
+is no longer available.\r
+\r
 @param [in] ImageHandle       Handle for the image.\r
 \r
 @retval EFI_SUCCESS     Service installed successfully\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EslServiceUninstall (\r
+EslDxeUninstall (\r
   IN EFI_HANDLE ImageHandle\r
   );\r
 \r
+//------------------------------------------------------------------------------\r
+// Service Support Routines\r
+//------------------------------------------------------------------------------\r
+\r
 /**\r
-  Shutdown the service layer\r
+  Connect to the network service bindings\r
+\r
+  Walk the network service protocols on the controller handle and\r
+  locate any that are not in use.  Create ::ESL_SERVICE structures to\r
+  manage the network layer interfaces for the socket driver.  Tag\r
+  each of the network interfaces that are being used.  Finally, this\r
+  routine calls ESL_SOCKET_BINDING::pfnInitialize to prepare the network\r
+  interface for use by the socket layer.\r
+\r
+  @param [in] BindingHandle    Handle for protocol binding.\r
+  @param [in] Controller       Handle of device to work with.\r
+\r
+  @retval EFI_SUCCESS          This driver is added to Controller.\r
+  @retval other                This driver does not support this device.\r
 \r
 **/\r
-VOID\r
+EFI_STATUS\r
 EFIAPI\r
-EslServiceUnload (\r
-  VOID\r
+EslServiceConnect (\r
+  IN EFI_HANDLE BindingHandle,\r
+  IN EFI_HANDLE Controller\r
   );\r
 \r
-//------------------------------------------------------------------------------\r
-// Socket Service Binding Protocol Routines\r
-//------------------------------------------------------------------------------\r
-\r
 /**\r
-  Creates a child handle and installs a protocol.\r
-\r
-  The CreateChild() function installs a protocol on ChildHandle.\r
-  If pChildHandle is a pointer to NULL, then a new handle is created and returned in pChildHandle.\r
-  If pChildHandle is not a pointer to NULL, then the protocol installs on the existing pChildHandle.\r
+  Shutdown the connections to the network layer by locating the\r
+  tags on the network interfaces established by ::EslServiceConnect.\r
+  This routine calls ESL_SOCKET_BINDING::pfnShutdown to shutdown the any\r
+  activity on the network interface and then free the ::ESL_SERVICE\r
+  structures.\r
 \r
-  @param [in] pThis        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
-  @param [in] pChildHandle Pointer to the handle of the child to create. If it is NULL,\r
-                           then a new handle is created. If it is a pointer to an existing UEFI handle,\r
-                           then the protocol is added to the existing UEFI handle.\r
+  @param [in] BindingHandle    Handle for protocol binding.\r
+  @param [in] Controller       Handle of device to stop driver on.\r
 \r
-  @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
-  @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
-  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create\r
-                                the child\r
-  @retval other                 The child handle was not created\r
+  @retval EFI_SUCCESS          This driver is removed Controller.\r
+  @retval EFI_DEVICE_ERROR     The device could not be stopped due to a device error.\r
+  @retval other                This driver was not removed from this device.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-EslSocketCreateChild (\r
-  IN     EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
-  IN OUT EFI_HANDLE * pChildHandle\r
+EslServiceDisconnect (\r
+  IN  EFI_HANDLE BindingHandle,\r
+  IN  EFI_HANDLE Controller\r
   );\r
 \r
 /**\r
-  Destroys a child handle with a protocol installed on it.\r
+Initialize the service layer\r
 \r
-  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
-  that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
-  last protocol on ChildHandle, then ChildHandle is destroyed.\r
+@param [in] ImageHandle       Handle for the image.\r
 \r
-  @param [in] pThis       Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
-  @param [in] ChildHandle Handle of the child to destroy\r
+**/\r
+VOID\r
+EFIAPI\r
+EslServiceLoad (\r
+  IN EFI_HANDLE ImageHandle\r
+  );\r
 \r
-  @retval EFI_SUCCES            The protocol was removed from ChildHandle.\r
-  @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.\r
-  @retval EFI_INVALID_PARAMETER Child handle is not a valid UEFI Handle.\r
-  @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle\r
-                                because its services are being used.\r
-  @retval other                 The child handle was not destroyed\r
+/**\r
+  Shutdown the service layer\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 EFIAPI\r
-EslSocketDestroyChild (\r
-  IN EFI_SERVICE_BINDING_PROTOCOL * pThis,\r
-  IN EFI_HANDLE ChildHandle\r
+EslServiceUnload (\r
+  VOID\r
   );\r
 \r
 //------------------------------------------------------------------------------\r
@@ -305,11 +335,13 @@ EslSocketDestroyChild (
 /**\r
   Bind a name to a socket.\r
 \r
-  The ::SocketBind routine connects a name to a socket on the local machine.  The\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html">POSIX</a>\r
-  documentation for the bind routine is available online for reference.\r
+  This routine calls the network specific layer to save the network\r
+  address of the local connection point.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::bind routine calls this routine to connect a name\r
+  (network address and port) to a socket on the local machine.\r
+\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
 \r
   @param [in] pSockAddr Address of a sockaddr structure that contains the\r
                         connection point on the local machine.  An IPv4 address\r
@@ -321,7 +353,7 @@ EslSocketDestroyChild (
                         number from the dynamic range.  Specifying a specific\r
                         port number causes the network layer to use that port.\r
 \r
-  @param [in] SockAddrLen   Specifies the length in bytes of the sockaddr structure.\r
+  @param [in] SockAddrLength  Specifies the length in bytes of the sockaddr structure.\r
 \r
   @param [out] pErrno   Address to receive the errno value upon completion.\r
 \r
@@ -331,7 +363,7 @@ EslSocketDestroyChild (
 EFI_STATUS\r
 EslSocketBind (\r
   IN EFI_SOCKET_PROTOCOL * pSocketProtocol,\r
-  IN const struct sockaddr * pSockAddr,\r
+  IN CONST struct sockaddr * pSockAddr,\r
   IN socklen_t SockAddrLength,\r
   OUT int * pErrno\r
   );\r
@@ -339,9 +371,14 @@ EslSocketBind (
 /**\r
   Determine if the socket is closed\r
 \r
-  Reverses the operations of the ::SocketAllocate() routine.\r
+  This routine checks the state of the socket to determine if\r
+  the network specific layer has completed the close operation.\r
+\r
+  The ::close routine polls this routine to determine when the\r
+  close operation is complete.  The close operation needs to\r
+  reverse the operations of the ::EslSocketAllocate routine.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
   @param [out] pErrno         Address to receive the errno value upon completion.\r
 \r
   @retval EFI_SUCCESS     Socket successfully closed\r
@@ -359,11 +396,19 @@ EslSocketClosePoll (
 /**\r
   Start the close operation on the socket\r
 \r
-  Start closing the socket by closing all of the ports.  Upon\r
-  completion, the ::SocketPoll() routine finishes closing the\r
-  socket.\r
+  This routine calls the network specific layer to initiate the\r
+  close state machine.  This routine then calls the network\r
+  specific layer to determine if the close state machine has gone\r
+  to completion.  The result from this poll is returned to the\r
+  caller.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::close routine calls this routine to start the close\r
+  operation which reverses the operations of the\r
+  ::EslSocketAllocate routine.  The close routine then polls\r
+  the ::EslSocketClosePoll routine to determine when the\r
+  socket is closed.\r
+\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
   @param [in] bCloseNow       Boolean to control close behavior\r
   @param [out] pErrno         Address to receive the errno value upon completion.\r
 \r
@@ -383,35 +428,23 @@ EslSocketCloseStart (
 /**\r
   Connect to a remote system via the network.\r
 \r
-  The ::SocketConnect routine attempts to establish a connection to a\r
-  socket on the local or remote system using the specified address.\r
-  The POSIX\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html">connect</a>\r
-  documentation is available online.\r
-\r
-  There are three states associated with a connection:\r
-  <ul>\r
-    <li>Not connected</li>\r
-    <li>Connection in progress</li>\r
-    <li>Connected</li>\r
-  </ul>\r
-  In the "Not connected" state, calls to ::connect start the connection\r
-  processing and update the state to "Connection in progress".  During\r
-  the "Connection in progress" state, connect polls for connection completion\r
-  and moves the state to "Connected" after the connection is established.\r
-  Note that these states are only visible when the file descriptor is marked\r
-  with O_NONBLOCK.  Also, the POLL_WRITE bit is set when the connection\r
-  completes and may be used by poll or select as an indicator to call\r
-  connect again.\r
-\r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  This routine calls the network specific layer to establish\r
+  the remote system address and establish the connection to\r
+  the remote system.\r
 \r
-  @param [in] pSockAddr       Network address of the remote system.\r
+  The ::connect routine calls this routine to establish a\r
+  connection with the specified remote system.  This routine\r
+  is designed to be polled by the connect routine for completion\r
+  of the network connection.\r
+  \r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
 \r
+  @param [in] pSockAddr       Network address of the remote system.\r
+    \r
   @param [in] SockAddrLength  Length in bytes of the network address.\r
-\r
+  \r
   @param [out] pErrno   Address to receive the errno value upon completion.\r
-\r
+  \r
   @retval EFI_SUCCESS   The connection was successfully established.\r
   @retval EFI_NOT_READY The connection is in progress, call this routine again.\r
   @retval Others        The connection attempt failed.\r
@@ -428,8 +461,14 @@ EslSocketConnect (
 /**\r
   Get the local address.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  This routine calls the network specific layer to get the network\r
+  address of the local host connection point.\r
 \r
+  The ::getsockname routine calls this routine to obtain the network\r
+  address associated with the local host connection point.\r
+\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  \r
   @param [out] pAddress       Network address to receive the local system address\r
 \r
   @param [in,out] pAddressLength  Length of the local network address structure\r
@@ -450,8 +489,14 @@ EslSocketGetLocalAddress (
 /**\r
   Get the peer address.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  This routine calls the network specific layer to get the remote\r
+  system connection point.\r
+\r
+  The ::getpeername routine calls this routine to obtain the network\r
+  address of the remote connection point.\r
 \r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  \r
   @param [out] pAddress       Network address to receive the remote system address\r
 \r
   @param [in,out] pAddressLength  Length of the remote network address structure\r
@@ -472,14 +517,18 @@ EslSocketGetPeerAddress (
 /**\r
   Establish the known port to listen for network connections.\r
 \r
-  The ::SocketListen routine places the port into a state that enables connection\r
-  attempts.  Connections are placed into FIFO order in a queue to be serviced\r
-  by the application.  The application calls the ::SocketAccept routine to remove\r
-  the next connection from the queue and get the associated socket.  The\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">POSIX</a>\r
-  documentation for the bind routine is available online for reference.\r
+  This routine calls into the network protocol layer to establish\r
+  a handler that is called upon connection completion.  The handler\r
+  is responsible for inserting the connection into the FIFO.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::listen routine indirectly calls this routine to place the\r
+  socket into a state that enables connection attempts.  Connections\r
+  are placed in a FIFO that is serviced by the application.  The\r
+  application calls the ::accept (::EslSocketAccept) routine to\r
+  remove the next connection from the FIFO and get the associated\r
+  socket and address.\r
+\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
 \r
   @param [in] Backlog         Backlog specifies the maximum FIFO depth for\r
                               the connections waiting for the application\r
@@ -502,17 +551,19 @@ EslSocketListen (
 /**\r
   Get the socket options\r
 \r
-  Retrieve the socket options one at a time by name.  The\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html">POSIX</a>\r
-  documentation is available online.\r
+  This routine handles the socket level options and passes the\r
+  others to the network specific layer.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
-  @param [in] level           Option protocol level\r
-  @param [in] option_name     Name of the option\r
-  @param [out] option_value   Buffer to receive the option value\r
-  @param [in,out] option_len  Length of the buffer in bytes,\r
-                              upon return length of the option value in bytes\r
-  @param [out] pErrno         Address to receive the errno value upon completion.\r
+  The ::getsockopt routine calls this routine to retrieve the\r
+  socket options one at a time by name.\r
+\r
+  @param [in] pSocketProtocol   Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  @param [in] level             Option protocol level\r
+  @param [in] OptionName        Name of the option\r
+  @param [out] pOptionValue     Buffer to receive the option value\r
+  @param [in,out] pOptionLength Length of the buffer in bytes,\r
+                                upon return length of the option value in bytes\r
+  @param [out] pErrno           Address to receive the errno value upon completion.\r
 \r
   @retval EFI_SUCCESS - Socket data successfully received\r
 \r
@@ -530,18 +581,20 @@ EslSocketOptionGet (
 /**\r
   Set the socket options\r
 \r
-  Adjust the socket options one at a time by name.  The\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">POSIX</a>\r
-  documentation is available online.\r
+  This routine handles the socket level options and passes the\r
+  others to the network specific layer.\r
+\r
+  The ::setsockopt routine calls this routine to adjust the socket\r
+  options one at a time by name.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
   @param [in] level           Option protocol level\r
-  @param [in] option_name     Name of the option\r
-  @param [in] option_value    Buffer containing the option value\r
-  @param [in] option_len      Length of the buffer in bytes\r
+  @param [in] OptionName      Name of the option\r
+  @param [in] pOptionValue    Buffer containing the option value\r
+  @param [in] OptionLength    Length of the buffer in bytes\r
   @param [out] pErrno         Address to receive the errno value upon completion.\r
 \r
-  @retval EFI_SUCCESS - Socket data successfully received\r
+  @retval EFI_SUCCESS - Option successfully set\r
 \r
  **/\r
 EFI_STATUS\r
@@ -557,10 +610,14 @@ EslSocketOptionSet (
 /**\r
   Poll a socket for pending activity.\r
 \r
-  The SocketPoll routine checks a socket for pending activity associated\r
-  with the event mask.  Activity is returned in the detected event buffer.\r
+  This routine builds a detected event mask which is returned to\r
+  the caller in the buffer provided.\r
+\r
+  The ::poll routine calls this routine to determine if the socket\r
+  needs to be serviced as a result of connection, error, receive or\r
+  transmit activity.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
 \r
   @param [in] Events    Events of interest for this socket\r
 \r
@@ -583,15 +640,22 @@ EslSocketPoll (
 /**\r
   Receive data from a network connection.\r
 \r
+  This routine calls the network specific routine to remove the\r
+  next portion of data from the receive queue and return it to the\r
+  caller.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::recvfrom routine calls this routine to determine if any data\r
+  is received from the remote system.  Note that the other routines\r
+  ::recv and ::read are layered on top of ::recvfrom.\r
 \r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  \r
   @param [in] Flags           Message control flags\r
-\r
+  \r
   @param [in] BufferLength    Length of the the buffer\r
-\r
+  \r
   @param [in] pBuffer         Address of a buffer to receive the data.\r
-\r
+  \r
   @param [in] pDataLength     Number of received data bytes in the buffer.\r
 \r
   @param [out] pAddress       Network address to receive the remote system address\r
@@ -618,13 +682,16 @@ EslSocketReceive (
 /**\r
   Shutdown the socket receive and transmit operations\r
 \r
-  The SocketShutdown routine stops the socket receive and transmit\r
-  operations.\r
+  This routine sets a flag to stop future transmissions and calls\r
+  the network specific layer to cancel the pending receive operation.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::shutdown routine calls this routine to stop receive and transmit\r
+  operations on the socket.\r
 \r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  \r
   @param [in] How             Which operations to stop\r
-\r
+  \r
   @param [out] pErrno         Address to receive the errno value upon completion.\r
 \r
   @retval EFI_SUCCESS - Socket operations successfully shutdown\r
@@ -640,17 +707,23 @@ EslSocketShutdown (
 /**\r
   Send data using a network connection.\r
 \r
-  The SocketTransmit routine queues the data for transmission to the\r
-  remote network connection.\r
+  This routine calls the network specific layer to queue the data\r
+  for transmission.  Eventually the buffer will reach the head of\r
+  the queue and will get transmitted over the network.  For datagram\r
+  sockets there is no guarantee that the data reaches the application\r
+  running on the remote system.\r
 \r
-  @param [in] pSocketProtocol Address of the socket protocol structure.\r
+  The ::sendto routine calls this routine to send data to the remote\r
+  system.  Note that ::send and ::write are layered on top of ::sendto.\r
 \r
+  @param [in] pSocketProtocol Address of an ::EFI_SOCKET_PROTOCOL structure.\r
+  \r
   @param [in] Flags           Message control flags\r
-\r
+  \r
   @param [in] BufferLength    Length of the the buffer\r
-\r
+  \r
   @param [in] pBuffer         Address of a buffer containing the data to send\r
-\r
+  \r
   @param [in] pDataLength     Address to receive the number of data bytes sent\r
 \r
   @param [in] pAddress        Network address of the remote system address\r
@@ -659,7 +732,7 @@ EslSocketShutdown (
 \r
   @param [out] pErrno         Address to receive the errno value upon completion.\r
 \r
-  @retval EFI_SUCCESS - Socket data successfully received\r
+  @retval EFI_SUCCESS - Socket data successfully queued for transmit\r
 \r
  **/\r
 EFI_STATUS\r