From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:41:38 +0000 (-0700) Subject: Remove AsyncSocket_SendTo X-Git-Tag: 2013.09.16-1328054~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d6386468f1189621245bc99d0b4a55b4253a97b;p=thirdparty%2Fopen-vm-tools.git Remove AsyncSocket_SendTo Nobody is using it anymore. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c index 7214d8f92..dda81d742 100644 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c @@ -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; -} - /* *---------------------------------------------------------------------------- diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h index e2219ee81..87858470a 100644 --- a/open-vm-tools/lib/include/asyncsocket.h +++ b/open-vm-tools/lib/include/asyncsocket.h @@ -66,15 +66,6 @@ #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);