Re: Windows port of your libwebsocket
authorPeter Hinz <cerebusrc@gmail.com>
Thu, 10 Mar 2011 18:14:01 +0000 (18:14 +0000)
committerAndy Green <andy.green@linaro.org>
Thu, 10 Mar 2011 18:14:01 +0000 (18:14 +0000)
The latest code changed need some win32 fixes:

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
lib/libwebsockets.c
win32port/win32helpers/websock-w32.h

index d4e5435..717f6c0 100644 (file)
@@ -402,17 +402,22 @@ libwebsockets_get_peer_addresses(int fd, char *name, int name_len,
                p = (unsigned char *)host1->h_addr_list[n++];
                if (p == NULL)
                        continue;
-               if ((host1->h_addrtype != AF_INET) &&
-                                               (host1->h_addrtype != AF_LOCAL))
+               if ((host1->h_addrtype != AF_INET)
+#ifdef AF_LOCAL
+                       && (host1->h_addrtype != AF_LOCAL)
+#endif
+                       )
                        continue;
 
                if (host1->h_addrtype == AF_INET)
                        sprintf(ip, "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
+#ifdef AF_LOCAL
                else {
                        un = (struct sockaddr_un *)p;
                        strncpy(ip, un->sun_path, sizeof(ip) -1);
                        ip[sizeof(ip) - 1] = '\0';
                }
+#endif
                p = NULL;
                strncpy(rip, ip, rip_len);
                rip[rip_len - 1] = '\0';
index 8b2ebe5..88222ab 100644 (file)
@@ -7,11 +7,15 @@
 #define DEBUG 1
 #endif
 
+#pragma warning(disable : 4996)
+
 #define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
 
 #define MSG_NOSIGNAL 0
 #define SHUT_RDWR SD_BOTH
 
+#define SOL_TCP IPPROTO_TCP
+
 #define random rand
 #define usleep _sleep
 #define poll WSAPoll