]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Remove AsyncSocket_SendTo
authorVMware, Inc <>
Wed, 18 Sep 2013 03:41:38 +0000 (20:41 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Sep 2013 05:30:00 +0000 (22:30 -0700)
Nobody is using it anymore.

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/asyncsocket/asyncsocket.c
open-vm-tools/lib/include/asyncsocket.h

index 7214d8f92eb72840bf28912e1b31110c1d596b01..dda81d742231789dc9f973cacbce0fe8e8d9122a 100644 (file)
@@ -2479,126 +2479,6 @@ outHaveLock:
    return retVal;
 }
 
-/*
- *----------------------------------------------------------------------------
- *
- * AsyncSocket_SendTo --
- *
- *      Sends a UDP Packet.
- *
- *      Usage:
- *      AsyncSocket_SendTo(asock, b, sizeof(b), ASOCKADDR_HOSTNAME,
- *                                                       "localhost", 8081);
- *      AsyncSocket_SendTo(asock, b, sizeof(b), ASOCKADDR_IPADDRESS,
- *                                                       uint32Ip, 8081);
- *      AsyncSocket_SendTo(asock, b, sizeof(b), ASOCKADDR_SOCKADDR,
- *                                                   &sockaddrInStruct,
- *                                                   sizeof(sockaddrInStruct));
- *
- *      Note: When used with type==HOSTNAME, this function may block while
- *      performing DNS resolution.
- *
- * Results:
- *      ASOCKERR_SUCCESS or ASOCKERR_GENERIC.
- *
- * Side effects:
- *      None.
- *
- *----------------------------------------------------------------------------
- */
-
-int
-AsyncSocket_SendTo(AsyncSocket *asock, void *buf, int len,
-                   AsyncSocketSendToType type, ... )
-{
-   va_list ap;
-   char *hostname;
-   uint32 ip;
-   int port;
-   struct sockaddr_in addr;
-   struct sockaddr_in *addrPointer = NULL;
-   int getaddrinfoError;
-   int sendToRet;
-   int ret = ASOCKERR_GENERIC;
-   int sockaddrSize = sizeof(struct sockaddr_in);
-
-   ASSERT(asock);
-   ASSERT(buf);
-   ASSERT(SOCK_DGRAM == asock->type);
-   ASSERT(asock->asockType != ASYNCSOCKET_TYPE_NAMEDPIPE);
-
-   va_start(ap, type);
-
-   switch (type) {
-   case ASOCKADDR_HOSTNAME:
-      hostname = va_arg(ap, char *);
-      port     = va_arg(ap, int);
-      ASSERT( 0 < port && port < 65536);
-
-      /*
-       * Resolve the hostname.  Handles dotted decimal strings, too.
-       */
-
-      getaddrinfoError = AsyncSocketResolveAddr(hostname, port,
-                                                asock->type, &addr);
-      if (0 != getaddrinfoError) {
-         goto bye;
-      }
-      break;
-
-   case ASOCKADDR_IPADDRESS:
-      ip   = va_arg(ap, uint32);
-      port = va_arg(ap, int);
-      ASSERT( 0 < port && port < 65536);
-
-      addr.sin_family = AF_INET;
-      addr.sin_port = htons(port);
-      addr.sin_addr.s_addr = htonl(ip);
-      break;
-
-   case ASOCKADDR_SOCKADDR:
-      addrPointer = va_arg(ap, struct sockaddr_in *);
-      addr = *addrPointer;
-      sockaddrSize = va_arg(ap, socklen_t);
-      break;
-
-   default:
-      /*
-       * Unsupported send type.
-       */
-
-      NOT_REACHED();
-   }
-
-   /*
-    * If the socket is in non-blocking mode and the kernel does not
-    * have enough resources to store/send this packet, sendto() could return
-    * EAGAIN,EWOULDBLOCK on linux or WSAEWOULDBLOCK on Win32.
-    * But this is UDP, an unreliable transport.  If that happens, just
-    * drop the packet and let the application layer handle the
-    * congestion control.
-    */
-
-   sendToRet = sendto(asock->fd, buf, len, 0,
-                      (struct sockaddr *) &addr, sockaddrSize);
-
-   ret = (-1 == sendToRet) ? ASOCKERR_GENERIC : ASOCKERR_SUCCESS;
-   if (ASOCKERR_GENERIC == ret) {
-      int sysErr = ASOCK_LASTERROR();
-
-      Warning(ASOCKPREFIX "sendto() failed on socket with error %d: %s\n",
-              sysErr, Err_Errno2String(sysErr));
-   }
-
-bye:
-   va_end(ap);
-   if (ret == ASOCKERR_GENERIC) {
-      asock->genericErrno = ASOCK_LASTERROR();
-   }
-
-   return ret;
-}
-
 
 /*
  *----------------------------------------------------------------------------
index e2219ee818f97a82c892914ce6bf848b81a9d15f..87858470adfeeee2a0c1777cd8da242157b4da97 100644 (file)
 #define ASOCKERR_BINDADDRINUSE     11
 #define ASOCKERR_LISTEN            12
 
-/*
- * Address types to use with AsyncSocket_SendTo().
- */
-typedef enum {
-   ASOCKADDR_HOSTNAME = 0,
-   ASOCKADDR_IPADDRESS,
-   ASOCKADDR_SOCKADDR
-} AsyncSocketSendToType;
-
 /*
  * Flags passed into AsyncSocket_Connect*().
  * Default value is '0'.
@@ -394,9 +385,6 @@ int AsyncSocket_SendBlocking(AsyncSocket *asock,
 int AsyncSocket_Send(AsyncSocket *asock, void *buf, int len,
                       AsyncSocketSendFn sendFn, void *clientData);
 
-int AsyncSocket_SendTo(AsyncSocket *asock, void *buf, int len,
-                       AsyncSocketSendToType type, ... );
-
 int AsyncSocket_IsSendBufferFull(AsyncSocket *asock);
 int AsyncSocket_CancelRecv(AsyncSocket *asock, int *partialRecvd, void **recvBuf,
                            void **recvFn);