diff options
author | VMware, Inc <> | 2013-09-17 20:41:38 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-09-22 22:30:00 -0700 |
commit | 6d6386468f1189621245bc99d0b4a55b4253a97b (patch) | |
tree | 9805127dd7a300eb86c667c05952c12acd99bf7e | |
parent | bf72ff33d02e9c1b0d6d2d3ab0a9b13c7a2747a9 (diff) |
Remove AsyncSocket_SendTo
Nobody is using it anymore.
Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
-rw-r--r-- | open-vm-tools/lib/asyncsocket/asyncsocket.c | 120 | ||||
-rw-r--r-- | open-vm-tools/lib/include/asyncsocket.h | 12 |
2 files changed, 0 insertions, 132 deletions
diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c index 7214d8f9..dda81d74 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 e2219ee8..87858470 100644 --- a/open-vm-tools/lib/include/asyncsocket.h +++ b/open-vm-tools/lib/include/asyncsocket.h @@ -67,15 +67,6 @@ #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'. * The first two flags allow explicitly selecting @@ -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); |