]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/sendto.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / BsdSocketLib / sendto.c
diff --git a/StdLib/BsdSocketLib/sendto.c b/StdLib/BsdSocketLib/sendto.c
deleted file mode 100644 (file)
index 2fb7737..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file\r
-  Implement the sendto API.\r
-\r
-  Copyright (c) 2011, 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
-\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
-**/\r
-\r
-#include <SocketInternals.h>\r
-\r
-\r
-/**\r
-  Send data using a network connection.\r
-\r
-  The sendto routine queues data to the network for transmission.\r
-  This routine is typically used for SOCK_DGRAM sockets that are shared\r
-  between multiple machine where it is required to specify the target\r
-  system address when sending the data.\r
-\r
-  The\r
-  <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html">POSIX</a>\r
-  documentation is available online.\r
-\r
-  @param [in] s         Socket file descriptor returned from ::socket.\r
-\r
-  @param [in] buffer    Address of a buffer containing the data to send.\r
-\r
-  @param [in] length    Length of the buffer in bytes.\r
-\r
-  @param [in] flags     Message control flags\r
-\r
-  @param [in] to        Remote system address\r
-\r
-  @param [in] tolen     Length of remote system address structure\r
-\r
-  @return     This routine returns the number of data bytes that were\r
-              sent and -1 when an error occurs.  In the case of\r
-              an error, ::errno contains more details.\r
-\r
- **/\r
-ssize_t\r
-sendto (\r
-  int s,\r
-  const void * buffer,\r
-  size_t length,\r
-  int flags,\r
-  const struct sockaddr * to,\r
-  socklen_t tolen\r
-  )\r
-{\r
-  BOOLEAN bBlocking;\r
-  ssize_t LengthInBytes;\r
-  CONST UINT8 * pData;\r
-  struct __filedes * pDescriptor;\r
-  EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
-  EFI_STATUS Status;\r
-\r
-  //\r
-  //  Assume failure\r
-  //\r
-  LengthInBytes = -1;\r
-\r
-  //\r
-  //  Locate the context for this socket\r
-  //\r
-  pSocketProtocol = BslFdToSocketProtocol ( s,\r
-                                            &pDescriptor,\r
-                                            &errno );\r
-  if ( NULL != pSocketProtocol ) {\r
-    //\r
-    //  Determine if the operation is blocking\r
-    //\r
-    bBlocking = (BOOLEAN)( 0 == ( pDescriptor->Oflags & O_NONBLOCK ));\r
-\r
-    //\r
-    //  Send the data using the socket\r
-    //\r
-    pData = buffer;\r
-    do {\r
-      errno = 0;\r
-      Status = pSocketProtocol->pfnTransmit ( pSocketProtocol,\r
-                                              flags,\r
-                                              length,\r
-                                              pData,\r
-                                              (size_t *)&LengthInBytes,\r
-                                              to,\r
-                                              tolen,\r
-                                              &errno );\r
-      if ( EFI_ERROR ( Status ) && ( EFI_NOT_READY != Status )) {\r
-        LengthInBytes = -1;\r
-        break;\r
-      }\r
-\r
-      //\r
-      //  Account for the data sent\r
-      //\r
-      pData += LengthInBytes;\r
-      length -= LengthInBytes;\r
-    } while (( 0 != length ) && ( EFI_NOT_READY == Status ) && bBlocking );\r
-  }\r
-\r
-  //\r
-  //  Return the number of data bytes sent, -1 for errors\r
-  //\r
-  return (INT32)LengthInBytes;\r
-}\r