pajoye          Thu Aug 21 23:37:40 2008 UTC

  Added files:                 
    /php-src/win32      inet.c inet.h 

  Modified files:              
    /php-src/ext/ftp    ftp.c 
    /php-src/ext/sockets        php_sockets_win.c sockets.c 
    /php-src/ext/standard       basic_functions.c dns.c flock_compat.c 
    /php-src/main       network.c php_network.h 
    /php-src/win32/build        config.w32 
  Log:
  - drop bindlib usage on windows
  - inet_pton, inet_ntop and inet_aton are always available (VC9 uses the CRT 
implementation, VC6 our own)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/ftp/ftp.c?r1=1.126&r2=1.127&diff_format=u
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.126 php-src/ext/ftp/ftp.c:1.127
--- php-src/ext/ftp/ftp.c:1.126 Sat Jul 12 23:25:42 2008
+++ php-src/ext/ftp/ftp.c       Thu Aug 21 23:37:39 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: ftp.c,v 1.126 2008/07/12 23:25:42 pajoye Exp $ */
+/* $Id: ftp.c,v 1.127 2008/08/21 23:37:39 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -37,6 +37,7 @@
 #include <string.h>
 #include <time.h>
 #ifdef PHP_WIN32
+#include "win32/inet.h"
 #include <winsock2.h>
 #elif defined(NETWARE)
 #ifdef USE_WINSOCK    /* Modified to use Winsock (NOVSOCK2.H), atleast for now 
*/
http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/php_sockets_win.c?r1=1.16&r2=1.17&diff_format=u
Index: php-src/ext/sockets/php_sockets_win.c
diff -u php-src/ext/sockets/php_sockets_win.c:1.16 
php-src/ext/sockets/php_sockets_win.c:1.17
--- php-src/ext/sockets/php_sockets_win.c:1.16  Mon Dec 31 07:12:14 2007
+++ php-src/ext/sockets/php_sockets_win.c       Thu Aug 21 23:37:39 2008
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_sockets_win.c,v 1.16 2007/12/31 07:12:14 sebastian Exp $ */
+/* $Id: php_sockets_win.c,v 1.17 2008/08/21 23:37:39 pajoye Exp $ */
 
 
 #ifdef PHP_WIN32
@@ -72,13 +72,4 @@
        return 0;
 }
 
-int inet_aton(const char *cp, struct in_addr *inp) {
-  inp->s_addr = inet_addr(cp);
-
-  if (inp->s_addr == INADDR_NONE) {
-         return 0;
-  }
-
-  return 1;
-}
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.199&r2=1.200&diff_format=u
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.199 php-src/ext/sockets/sockets.c:1.200
--- php-src/ext/sockets/sockets.c:1.199 Wed Jul 16 14:08:04 2008
+++ php-src/ext/sockets/sockets.c       Thu Aug 21 23:37:39 2008
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: sockets.c,v 1.199 2008/07/16 14:08:04 jani Exp $ */
+/* $Id: sockets.c,v 1.200 2008/08/21 23:37:39 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -33,8 +33,15 @@
 #include "ext/standard/file.h"
 #include "ext/standard/info.h"
 #include "php_ini.h"
-
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+# include "win32/inet.h"
+# include <winsock2.h>
+# include <windows.h>
+# include <Ws2tcpip.h>
+# include "php_sockets.h"
+# include "php_sockets_win.h"
+# define IS_INVALID_SOCKET(a)  (a->bsd_socket == INVALID_SOCKET)
+#else
 # include "php_sockets.h"
 # include <sys/types.h>
 # include <sys/socket.h>
@@ -51,10 +58,6 @@
 # include <sys/uio.h>
 # define IS_INVALID_SOCKET(a)  (a->bsd_socket < 0)
 # define set_errno(a) (errno = a)
-#else /* windows */
-# include "php_sockets.h"
-# include "php_sockets_win.h"
-# define IS_INVALID_SOCKET(a)  (a->bsd_socket == INVALID_SOCKET)
 #endif
 
 ZEND_DECLARE_MODULE_GLOBALS(sockets)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.926&r2=1.927&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.926 
php-src/ext/standard/basic_functions.c:1.927
--- php-src/ext/standard/basic_functions.c:1.926        Thu Aug 21 16:55:31 2008
+++ php-src/ext/standard/basic_functions.c      Thu Aug 21 23:37:40 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.926 2008/08/21 16:55:31 helly Exp $ */
+/* $Id: basic_functions.c,v 1.927 2008/08/21 23:37:40 pajoye Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -61,7 +61,11 @@
 #include <netinet/in.h>
 #endif
 
-#include <netdb.h>
+#ifndef PHP_WIN32
+# include <netdb.h>
+#else
+#include "win32/inet.h"
+#endif
 
 #if HAVE_ARPA_INET_H
 # include <arpa/inet.h>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.93&r2=1.94&diff_format=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.93 php-src/ext/standard/dns.c:1.94
--- php-src/ext/standard/dns.c:1.93     Fri May 23 09:40:19 2008
+++ php-src/ext/standard/dns.c  Thu Aug 21 23:37:40 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dns.c,v 1.93 2008/05/23 09:40:19 mattwil Exp $ */
+/* $Id: dns.c,v 1.94 2008/08/21 23:37:40 pajoye Exp $ */
 
 /* {{{ includes */
 #include "php.h"
@@ -29,23 +29,10 @@
 #endif
 
 #ifdef PHP_WIN32
-#if HAVE_LIBBIND
-#ifndef WINNT
-#define WINNT 1
-#endif
-/* located in www.php.net/extra/bindlib.zip */
-#if HAVE_ARPA_INET_H
-#include "arpa/inet.h"
-#endif
-#include "netdb.h"
-#if HAVE_ARPA_NAMESERV_H
-#include "arpa/nameser.h"
-#endif
-#if HAVE_RESOLV_H
-#include "resolv.h"
-#endif
-#endif /* HAVE_LIBBIND */
-#include <winsock2.h>
+# include "win32/inet.h"
+# include <winsock2.h>
+# include <windows.h>
+# include <Ws2tcpip.h>
 #else  /* This holds good for NetWare too, both for Winsock and Berkeley 
sockets */
 #include <netinet/in.h>
 #if HAVE_ARPA_INET_H
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/flock_compat.c?r1=1.33&r2=1.34&diff_format=u
Index: php-src/ext/standard/flock_compat.c
diff -u php-src/ext/standard/flock_compat.c:1.33 
php-src/ext/standard/flock_compat.c:1.34
--- php-src/ext/standard/flock_compat.c:1.33    Mon Dec 31 07:12:15 2007
+++ php-src/ext/standard/flock_compat.c Thu Aug 21 23:37:40 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: flock_compat.c,v 1.33 2007/12/31 07:12:15 sebastian Exp $ */
+/* $Id: flock_compat.c,v 1.34 2008/08/21 23:37:40 pajoye Exp $ */
 
 #include "php.h"
 #include <errno.h>
@@ -30,6 +30,7 @@
 
 #ifdef PHP_WIN32
 #include <io.h>
+#include "config.w32.h"
 #endif
 
 #ifdef NETWARE
http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.134&r2=1.135&diff_format=u
Index: php-src/main/network.c
diff -u php-src/main/network.c:1.134 php-src/main/network.c:1.135
--- php-src/main/network.c:1.134        Fri Jul 11 13:11:37 2008
+++ php-src/main/network.c      Thu Aug 21 23:37:40 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: network.c,v 1.134 2008/07/11 13:11:37 jani Exp $ */
+/* $Id: network.c,v 1.135 2008/08/21 23:37:40 pajoye Exp $ */
 
 /*#define DEBUG_MAIN_NETWORK 1*/
 
@@ -26,8 +26,9 @@
 #include <stddef.h>
 
 #ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
+# include "win32/inet.h"
+# define O_RDONLY _O_RDONLY
+# include "win32/param.h"
 #elif defined(NETWARE)
 #include <sys/timeval.h>
 #include <sys/param.h>
http://cvs.php.net/viewvc.cgi/php-src/main/php_network.h?r1=1.60&r2=1.61&diff_format=u
Index: php-src/main/php_network.h
diff -u php-src/main/php_network.h:1.60 php-src/main/php_network.h:1.61
--- php-src/main/php_network.h:1.60     Mon Dec 31 07:12:18 2007
+++ php-src/main/php_network.h  Thu Aug 21 23:37:40 2008
@@ -16,26 +16,13 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_network.h,v 1.60 2007/12/31 07:12:18 sebastian Exp $ */
+/* $Id: php_network.h,v 1.61 2008/08/21 23:37:40 pajoye Exp $ */
 
 #ifndef _PHP_NETWORK_H
 #define _PHP_NETWORK_H
 
 #ifdef PHP_WIN32
-# ifndef WINNT
-#  define WINNT 1
-# endif
-# undef FD_SETSIZE
-# include "arpa/inet.h"
-  /* Apache folks decided that strtoul was evil and redefined
-   * it to something that breaks the windows headers */
-# undef strtoul
-/* defines socklen_t and some IPV6 stuff */
-# include <ws2tcpip.h>
-# if HAVE_WSPIAPI_H
-   /* getaddrinfo */
-#  include <wspiapi.h>
-# endif
+# include "win32/inet.h"
 #else
 # undef closesocket
 # define closesocket close
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.82&r2=1.83&diff_format=u
Index: php-src/win32/build/config.w32
diff -u php-src/win32/build/config.w32:1.82 php-src/win32/build/config.w32:1.83
--- php-src/win32/build/config.w32:1.82 Fri Aug  1 11:25:16 2008
+++ php-src/win32/build/config.w32      Thu Aug 21 23:37:40 2008
@@ -1,5 +1,5 @@
 // vim:ft=javascript
-// $Id: config.w32,v 1.82 2008/08/01 11:25:16 pajoye Exp $
+// $Id: config.w32,v 1.83 2008/08/21 23:37:40 pajoye Exp $
 // "Master" config file; think of it as a configure.in
 // equivalent.
 
@@ -247,17 +247,6 @@
                php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
                php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
        }
-
-       p = CHECK_HEADER_ADD_INCLUDE("arpa\\nameser.h", "CFLAGS", 
php_usual_include_suspects);
-
-       // hack to catch common location of libs
-       if (typeof(p) == "string") {
-               p = p.replace(new RegExp("include$"), "lib");
-               ADD_FLAG("LDFLAGS", '/libpath:"' + p + '" ');
-               php_usual_lib_suspects += ";" + p;
-       } else if (!p) {
-               ERROR("We really need that arpa\\nameser.h file - it is part of 
the bindlib package");
-       }
 }
 
 function add_extra_dirs()
@@ -292,12 +281,6 @@
 probe_basic_headers();
 add_extra_dirs();
 
-// We can't probe for libs before this line
-
-if (!(CHECK_LIB("resolv_a.lib") || CHECK_LIB("resolv.lib"))) {
-       ERROR("We really need that arpa\\nameser.h file - it is part of the 
bindlib package");
-}
-
 // Do we want static ICU lib
 ARG_WITH('static-icu', 'Link against the static version of the ICU library', 
'no');
 if (PHP_STATIC_ICU == "yes") {

http://cvs.php.net/viewvc.cgi/php-src/win32/inet.c?view=markup&rev=1.1
Index: php-src/win32/inet.c
+++ php-src/win32/inet.c
#if _MSC_VER < 1500
#include "config.w32.h"
#include "php.h"
#include <winsock2.h>
#include <windows.h>
#include <Ws2tcpip.h>

#include "inet.h"

PHPAPI int
inet_pton(int af, const char* src, void* dst)
{
        int address_length;
        struct sockaddr_storage sa;
        struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;

        switch (af) {
                case AF_INET:
                        address_length = sizeof (struct sockaddr_in);
                        break;

                case AF_INET6:
                        address_length = sizeof (struct sockaddr_in6);
                        break;

                default:
                        return -1;
        }

        if (WSAStringToAddress ((LPTSTR) src, af, NULL, (LPSOCKADDR) &sa, 
&address_length) == 0) {
                switch (af) {
                        case AF_INET:
                                memcpy (dst, &sin->sin_addr, sizeof (struct 
in_addr));
                                break;

                        case AF_INET6:
                                memcpy (dst, &sin6->sin6_addr, sizeof (struct 
in6_addr));
                                break;
                }
                return 1;
        }

        return 0;
}

PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size)
{
        int address_length;
        DWORD string_length = size;
        struct sockaddr_storage sa;
        struct sockaddr_in *sin = (struct sockaddr_in *)&sa;
        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa;

        memset (&sa, 0, sizeof (sa));
        switch (af) {
                case AF_INET:
                        address_length = sizeof (struct sockaddr_in);
                        sin->sin_family = af;
                        memcpy (&sin->sin_addr, src, sizeof (struct in_addr));
                        break;

                case AF_INET6:
                        address_length = sizeof (struct sockaddr_in6);
                        sin6->sin6_family = af;
                        memcpy (&sin6->sin6_addr, src, sizeof (struct 
in6_addr));
                        break;

                default:
                        return NULL;
        }

        if (WSAAddressToString ((LPSOCKADDR) &sa, address_length, NULL, dst, 
&string_length) == 0) {
                return dst;
        }

        return NULL;
}

int inet_aton(const char *cp, struct in_addr *inp) {
  inp->s_addr = inet_addr(cp);

  if (inp->s_addr == INADDR_NONE) {
          return 0;
  }

  return 1;
}
#endif

http://cvs.php.net/viewvc.cgi/php-src/win32/inet.h?view=markup&rev=1.1
Index: php-src/win32/inet.h
+++ php-src/win32/inet.h
#if _MSC_VER >= 1500
# include <In6addr.h>
#endif
#include <Ws2tcpip.h>

#if _MSC_VER < 1500
PHPAPI int inet_pton(int af, const char* src, void* dst);
PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size);
PHPAPI int inet_aton(const char *cp, struct in_addr *inp);
#endif

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to