]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/UseSocketDxe/UseSocketDxe.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / UseSocketDxe / UseSocketDxe.c
diff --git a/StdLib/UseSocketDxe/UseSocketDxe.c b/StdLib/UseSocketDxe/UseSocketDxe.c
deleted file mode 100644 (file)
index 16da9c6..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/** @file\r
-  Implement the connection to the socket driver\r
-\r
-  Copyright (c) 2011, Intel Corporation. All rights reserved.\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-\r
-#include <Protocol/EfiSocket.h>\r
-#include <Protocol/ServiceBinding.h>\r
-\r
-\r
-/**\r
-  Free the socket resources\r
-\r
-  This releases the socket resources allocated by calling\r
-  EslServiceGetProtocol.\r
-\r
-  This routine is called from the ::close routine in BsdSocketLib\r
-  to release the socket resources.\r
-\r
-  @param [in] pSocketProtocol   Address of an ::EFI_SOCKET_PROTOCOL\r
-                                structure\r
-\r
-  @return       Value for ::errno, zero (0) indicates success.\r
-\r
- **/\r
-int\r
-EslServiceFreeProtocol (\r
-  IN EFI_SOCKET_PROTOCOL * pSocketProtocol\r
-  )\r
-{\r
-  EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding;\r
-  int RetVal;\r
-  EFI_STATUS Status;\r
-\r
-  //\r
-  //  Assume success\r
-  //\r
-  RetVal = 0;\r
-\r
-  //\r
-  //  Locate the socket protocol\r
-  //\r
-  Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,\r
-                                 NULL,\r
-                                 (VOID **) &pServiceBinding );\r
-  if ( !EFI_ERROR ( Status )) {\r
-    //\r
-    //  Release the handle\r
-    //\r
-    Status = pServiceBinding->DestroyChild ( pServiceBinding,\r
-                                             pSocketProtocol->SocketHandle );\r
-  }\r
-  if ( EFI_ERROR ( Status )) {\r
-    RetVal = EIO;\r
-  }\r
-\r
-  //\r
-  //  Return the operation status\r
-  //\r
-  return RetVal;\r
-}\r
-\r
-\r
-/**\r
-  Connect to the EFI socket library\r
-\r
-  This routine establishes a connection to the socket driver\r
-  and returns the API (::EFI_SOCKET_PROTOCOL address) to the\r
-  socket file system layer in BsdSocketLib.  This routine looks for\r
-  the gEfiSocketServiceBindingProtocolGuid to locate the socket\r
-  driver.  This routine then creates a child handle and locates\r
-  the gEfiSocketProtocolGuid protocol on that handle to get the\r
-  ::EFI_SOCKET_PROTOCOL structure address.\r
-\r
-  This routine is called from the ::socket routine in BsdSocketLib\r
-  to create the data structure and initialize the API for a socket.\r
-  Note that this implementation is only used by socket applications\r
-  that link directly to UseSocketDxe.\r
-\r
-  @param [in] ppSocketProtocol  Address to receive the ::EFI_SOCKET_PROTOCOL\r
-                                structure address\r
-\r
-  @return       Value for ::errno, zero (0) indicates success.\r
-\r
- **/\r
-int\r
-EslServiceGetProtocol (\r
-  IN EFI_SOCKET_PROTOCOL ** ppSocketProtocol\r
-  )\r
-{\r
-  EFI_SERVICE_BINDING_PROTOCOL * pServiceBinding;\r
-  int RetVal;\r
-  EFI_HANDLE SocketHandle;\r
-  EFI_STATUS Status;\r
-\r
-  //\r
-  //  Locate the socket protocol\r
-  //\r
-  Status = gBS->LocateProtocol ( &gEfiSocketServiceBindingProtocolGuid,\r
-                                 NULL,\r
-                                 (VOID **)&pServiceBinding );\r
-  if ( !EFI_ERROR ( Status )) {\r
-    //\r
-    //  Create a new socket\r
-    //\r
-    SocketHandle = NULL;\r
-    Status = pServiceBinding->CreateChild ( pServiceBinding,\r
-                                            &SocketHandle );\r
-    if ( !EFI_ERROR ( Status )) {\r
-      //\r
-      //  Get the socket protocol\r
-      //\r
-      Status = gBS->OpenProtocol ( SocketHandle,\r
-                                   &gEfiSocketProtocolGuid,\r
-                                   (VOID **)ppSocketProtocol,\r
-                                   NULL,\r
-                                   NULL,\r
-                                   EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL );\r
-      if ( !EFI_ERROR ( Status )) {\r
-        //\r
-        //  Success!\r
-        //\r
-        RetVal = 0;\r
-      }\r
-      else {\r
-        DEBUG (( DEBUG_ERROR,\r
-                  "ERROR - No socket protocol on 0x%08x, Status: %r\r\n",\r
-                  SocketHandle,\r
-                  Status ));\r
-        RetVal = ENODEV;\r
-      }\r
-    }\r
-    else {\r
-      //\r
-      //  Translate the error\r
-      //\r
-      DEBUG (( DEBUG_ERROR,\r
-                "ERROR - CreateChild failed, Status: %r\r\n",\r
-                Status ));\r
-      switch ( Status ) {\r
-      case EFI_SUCCESS:\r
-        RetVal = 0;\r
-        break;\r
-\r
-      case EFI_ACCESS_DENIED:\r
-      case EFI_WRITE_PROTECTED:\r
-        RetVal = EACCES;\r
-        break;\r
-\r
-      case EFI_NO_RESPONSE:\r
-        RetVal = EHOSTUNREACH;\r
-        break;\r
-\r
-      case EFI_BAD_BUFFER_SIZE:\r
-      case EFI_BUFFER_TOO_SMALL:\r
-      case EFI_INVALID_PARAMETER:\r
-        RetVal = EINVAL;\r
-        break;\r
-\r
-      case EFI_DEVICE_ERROR:\r
-      case EFI_MEDIA_CHANGED:\r
-      case EFI_NO_MEDIA:\r
-      case EFI_VOLUME_CORRUPTED:\r
-        RetVal = EIO;\r
-        break;\r
-\r
-      case EFI_NOT_FOUND:\r
-        RetVal = ENOENT;\r
-        break;\r
-\r
-      default:\r
-      case EFI_OUT_OF_RESOURCES:\r
-        RetVal = ENOMEM;\r
-        break;\r
-\r
-      case EFI_VOLUME_FULL:\r
-        RetVal = ENOSPC;\r
-        break;\r
-\r
-      case EFI_UNSUPPORTED:\r
-        RetVal = ENOSYS;\r
-        break;\r
-\r
-      case EFI_NO_MAPPING:\r
-        RetVal = ENXIO;\r
-        break;\r
-\r
-      case EFI_LOAD_ERROR:\r
-        RetVal = ESRCH;\r
-        break;\r
-\r
-      case EFI_TIMEOUT:\r
-        RetVal = ETIMEDOUT;\r
-        break;\r
-\r
-      case EFI_NOT_READY:\r
-        RetVal = EWOULDBLOCK;\r
-        break;\r
-      }\r
-    }\r
-  }\r
-  else {\r
-    DEBUG (( DEBUG_ERROR,\r
-              "ERROR - Socket driver not loaded, Status: %r\r\n",\r
-              Status ));\r
-    RetVal = ENODEV;\r
-  }\r
-\r
-  //\r
-  //  Return the operation status\r
-  //\r
-  return RetVal;\r
-}\r