]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Allow for future use of AF_UNSPEC in AsyncSocket library
authorVMware, Inc <>
Wed, 18 Sep 2013 03:42:24 +0000 (20:42 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Sep 2013 05:30:01 +0000 (22:30 -0700)
Create a socketFamily switch in AsyncSocket_Connect and
AsyncSocket_ConnectWebSocket for future IPv6 integration.

Allow for future use of AF_UNSPEC when a connection does not care if it is
AF_INET or AF_INET6. Since AsyncSocket does not fully support AF_INET6 yet and
our AF_INET6 test bed is not yet completed, hard code all callers to AF_INET.

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

index d10b527abce3b9c317ec3ed674a8f8e194727e24..6eedc4ed5d868efa33bae5abefdfc2bf6a6734ca 100644 (file)
@@ -1051,8 +1051,8 @@ error:
  *
  * AsyncSocket_Connect --
  *
- *      AsyncSocket AF_INET constructor.  This is just a wrapper for ConnectIP
- *      that does hostname -> IP address lookup.
+ *      AsyncSocket AF_INET/AF_INET6 constructor.  This is just a wrapper for
+ *      ConnectIP that does hostname -> IP address lookup.
  *
  *      NOTE: This function can block.
  *
@@ -1067,7 +1067,8 @@ error:
  */
 
 AsyncSocket *
-AsyncSocket_Connect(const char *hostname,
+AsyncSocket_Connect(int socketFamily,
+                    const char *hostname,
                     unsigned short port,
                     AsyncSocketConnectFn connectFn,
                     void *clientData,
@@ -1091,7 +1092,7 @@ AsyncSocket_Connect(const char *hostname,
     * Resolve the hostname.  Handles dotted decimal strings, too.
     */
 
-   getaddrinfoError = AsyncSocketResolveAddr(hostname, port, AF_INET,
+   getaddrinfoError = AsyncSocketResolveAddr(hostname, port, socketFamily,
                                              SOCK_STREAM, &addr, &ipString);
    if (0 != getaddrinfoError) {
       Log(ASOCKPREFIX "Failed to resolve address '%s' and port %u\n",
index 87858470adfeeee2a0c1777cd8da242157b4da97..b352eac9b7b18a376d89d4d4210fd87e66f5f90c 100644 (file)
@@ -239,7 +239,8 @@ AsyncSocket *AsyncSocket_BindUDP(unsigned short port,
 /*
  * Connect to address:port and fire callback with new asock
  */
-AsyncSocket *AsyncSocket_Connect(const char *hostname,
+AsyncSocket *AsyncSocket_Connect(int socketFamily,
+                                 const char *hostname,
                                  unsigned short port,
                                  AsyncSocketConnectFn connectFn,
                                  void *clientData,
@@ -282,7 +283,8 @@ AsyncSocket_ConnectNamedPipe(char *pipeName,
                              AsyncSocketPollParams *pollParams,
                              int *outError);
 #endif
-AsyncSocket *AsyncSocket_ConnectWebSocket(const char *url,
+AsyncSocket *AsyncSocket_ConnectWebSocket(int socketFamily,
+                                          const char *url,
                                           Bool permitUnverifiedSSL,
                                           const char *cookies,
                                           AsyncSocketConnectFn connectFn,