]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ldns initial round for windows compatibility
authorJeff Lenk <jeff@jefflenk.com>
Fri, 25 Mar 2011 16:46:58 +0000 (11:46 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Fri, 25 Mar 2011 16:46:58 +0000 (11:46 -0500)
31 files changed:
libs/ldns/compat/b32_ntop.c
libs/ldns/compat/b32_pton.c
libs/ldns/compat/b64_ntop.c
libs/ldns/compat/b64_pton.c
libs/ldns/compat/fake-rfc2553.c
libs/ldns/compat/fake-rfc2553.h
libs/ldns/compat/gettimeofday.c [new file with mode: 0644]
libs/ldns/compat/gettimeofday.h [new file with mode: 0644]
libs/ldns/compat/inet_aton.c
libs/ldns/compat/inet_ntop.c
libs/ldns/compat/malloc.c
libs/ldns/compat/memmove.c
libs/ldns/compat/realloc.c
libs/ldns/dnssec.c
libs/ldns/dnssec_sign.c
libs/ldns/dnssec_verify.c
libs/ldns/host2str.c
libs/ldns/ldns/packet.h
libs/ldns/ldns/resolver.h
libs/ldns/net.c
libs/ldns/packet.c
libs/ldns/parse.c
libs/ldns/resolver.c
libs/ldns/rr.c
libs/ldns/rr_functions.c
libs/ldns/sha1.c
libs/ldns/tsig.c
libs/ldns/update.c
libs/ldns/util.c
libs/ldns/wire2host.c
libs/ldns/zone.c

index 038ebdc95806e6521f71a4146b42642e790dd7e1..f6fa95c58c6ae1616add6f3a0190c2d51c4388e4 100644 (file)
@@ -42,7 +42,9 @@
 #include <ldns/config.h>
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 9c261e615b98c2882d866afa1d4b857d8330a057..766f5fa4b474c05701cb3fe1760325e18aab9633 100644 (file)
@@ -42,7 +42,9 @@
 #include <ldns/config.h>
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index d0b52b514bdf8a5886f36ea56a882becff3b1f94..c9f605e901c99c9550b8447161955dce98f211b8 100644 (file)
@@ -42,7 +42,9 @@
 #include <ldns/config.h>
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index aa637d227549ef008f6cdcbc3c1fd437fd3a7608..98fdddb6d3efbd1b985a881dcd7ae28b9225552b 100644 (file)
@@ -42,7 +42,9 @@
 #include <ldns/config.h>
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
index 431e04a2156ad00060be99a1fb6d4838ba1b2646..28e8b4211f02a9984b191683d90228fad7d3c17a 100644 (file)
@@ -38,7 +38,9 @@
 
 #include <ldns/config.h>
 #include <ldns/common.h>
+#ifndef _MSC_VER
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
index 4c277ee902db47267d72e90c258d5b764ac6c68b..2eab0c8bc4acd3d3a52ef7284fd80524b31838c7 100644 (file)
 #define _FAKE_RFC2553_H
 
 #include <sys/types.h>
+#ifdef _MSC_VER
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
 #include <netdb.h>
+#endif
 #include <limits.h>
 
 #ifdef __cplusplus
diff --git a/libs/ldns/compat/gettimeofday.c b/libs/ldns/compat/gettimeofday.c
new file mode 100644 (file)
index 0000000..3d1fb12
--- /dev/null
@@ -0,0 +1,50 @@
+#include <ldns/config.h>\r
+\r
+#ifndef HAVE_GETTIMEOFDAY\r
+\r
+#include < time.h >\r
+#include < windows.h>\r
+#include <compat/gettimeofday.h>\r
+\r
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)\r
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64\r
+#else\r
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL\r
+#endif\r
\r
+int gettimeofday(struct timeval *tv, struct timezone *tz)\r
+{\r
+       FILETIME ft;\r
+       unsigned __int64 tmpres = 0;\r
+       static int tzflag;\r
+        \r
+       if (NULL != tv)\r
+       {\r
+               GetSystemTimeAsFileTime(&ft);\r
+                \r
+               tmpres |= ft.dwHighDateTime;\r
+               tmpres <<= 32;\r
+               tmpres |= ft.dwLowDateTime;\r
+                \r
+               /*converting file time to unix epoch*/\r
+               tmpres /= 10;  /*convert into microseconds*/\r
+               tmpres -= DELTA_EPOCH_IN_MICROSECS;\r
+               tv->tv_sec = (long)(tmpres / 1000000UL);\r
+               tv->tv_usec = (long)(tmpres % 1000000UL);\r
+       }\r
+        \r
+       if (NULL != tz)\r
+       {\r
+               if (!tzflag)\r
+               {\r
+                       _tzset();\r
+                       tzflag++;\r
+               }\r
+               tz->tz_minuteswest = _timezone / 60;\r
+               tz->tz_dsttime = _daylight;\r
+       }\r
+        \r
+       return 0;\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/libs/ldns/compat/gettimeofday.h b/libs/ldns/compat/gettimeofday.h
new file mode 100644 (file)
index 0000000..5a929fe
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef HAVE_GETTIMEOFDAY\r
+\r
+struct timezone\r
+{\r
+       int  tz_minuteswest; /* minutes W of Greenwich */\r
+       int  tz_dsttime;     /* type of dst correction */\r
+};\r
\r
+int gettimeofday(struct timeval *tv, struct timezone *tz);\r
+\r
+#endif
\ No newline at end of file
index e8c3a57b9ac1392fa51a7180f1e637764a3513ca..86cd1125a5e2952de1573002b99c09072e81507c 100644 (file)
@@ -55,7 +55,9 @@
 #if !defined(HAVE_INET_ATON)
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
index 57509c7c98aab6e511244ea73f0409bd07a8c791..bb7b067ec3752768851d3f44620371d0d80ea0dd 100644 (file)
@@ -21,7 +21,9 @@
 
 #ifndef HAVE_INET_NTOP
 
+#ifndef _MSC_VER
 #include <sys/param.h>
+#endif
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
index bbc632e4f63f43e5331e901df755a82915a3f665..d51d4b0a9243101fc1a2dd1616ac474841055026 100644 (file)
@@ -8,7 +8,9 @@
 
 #include <sys/types.h>
 
+#ifndef _MSC_VER
 void *malloc ();
+#endif
 
 /* Allocate an N-byte block of memory from the heap.
    If N is zero, allocate a 1-byte block.  */
index e458092c33f73e71f694fa8eeb1b42b24d50ad05..8f3f54f5cc78b8b13ccef990993f973af85b22f6 100644 (file)
@@ -9,6 +9,7 @@
 #include <ldns/config.h>
 #include <stdlib.h>
 
+#ifndef _MSC_VER
 void *memmove(void *dest, const void *src, size_t n);
 
 void *memmove(void *dest, const void *src, size_t n)
@@ -41,3 +42,4 @@ void *memmove(void *dest, const void *src, size_t n)
        memcpy(dest, src, n);
        return dest;
 }
+#endif
index bdaf76d0268ff8f6fc34b127df741aa37bc99477..348d3a28f411a50d9b6128e6ce57a196f6bbdbf8 100644 (file)
@@ -8,8 +8,10 @@
 
 #include <sys/types.h>
 
+#ifndef _MSC_VER
 void *realloc (void*, size_t);
 void *malloc (size_t);
+#endif
 
 /* Changes allocation to new sizes, copies over old data.
  * if oldptr is NULL, does a malloc.
index ce02ef36fdc11631b2a741df2e2afcd9ff0f2998..9a444cf9c3059757599c2bd666356a00df37c4e9 100644 (file)
 #include <ldns/ldns.h>
 #include <ldns/dnssec.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <time.h>
 
 #ifdef HAVE_SSL
index b21094465fe91fd32785b74cbfbd36182c355ed2..4da125ee311696a59795221909ec87aba6c44c82 100644 (file)
@@ -5,7 +5,11 @@
 #include <ldns/dnssec.h>
 #include <ldns/dnssec_sign.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <time.h>
 
 #ifdef HAVE_SSL
index 352e44066b15eb40feecb9e87f21498a297e181d..23d9a43d8ae4ac7c2e2114f95c2d6260f5f8db4c 100644 (file)
@@ -2,7 +2,11 @@
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <time.h>
 
 #ifdef HAVE_SSL
index 6942f6aa3c93965d7c67551d7521999fcbd477f2..7f2ed574fa5e2acf217d6e31811ecdf37a33976f 100644 (file)
@@ -26,7 +26,9 @@
 #include <netdb.h>
 #endif
 #include <time.h>
+#ifndef _MSC_VER
 #include <sys/time.h>
+#endif
 
 #ifndef INET_ADDRSTRLEN
 #define INET_ADDRSTRLEN 16
index 687a6a259579be0051b84891d23ad745e42e0a1a..35d5832d763fe14fb792597d80d8e96a082d1719 100644 (file)
 #include <ldns/error.h>
 #include <ldns/common.h>
 #include <ldns/rr.h>
+#ifdef _MSC_VER
+#include <time.h>
+#else
 #include <sys/time.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
index f887aaf676e90b2c9e7af486cb6f3dcc1c3f1b3d..d61f524d844f81f9dca266926bfee85a7489d6f5 100644 (file)
 #include <ldns/tsig.h>
 #include <ldns/rdata.h>
 #include <ldns/packet.h>
+#ifdef _MSC_VER
+#include <time.h>
+#else
 #include <sys/time.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
index f613ac30833d971e1fb40db841d62f83af6a07d5..5523a6f0f5d967bfca5649c6edfefb002df74171 100644 (file)
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
+#ifdef _MSC_VER
+#include <compat/gettimeofday.h>
+#include <time.h>
+#else
 #include <sys/time.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
 
@@ -275,7 +280,7 @@ ldns_sock_wait(int sockfd, struct timeval timeout, int write)
        fd_set fds;
 #ifndef S_SPLINT_S
        FD_ZERO(&fds);
-       FD_SET(FD_SET_T sockfd, &fds);
+       FD_SET(sockfd, &fds);
 #endif
        if(write)
                ret = select(sockfd+1, NULL, &fds, NULL, &timeout);
index 0ac5ca8ba31dd0c588582d7bdce733eb52497a11..3bced3b69e4534f6e3884c5d3726ee7b4f89324c 100644 (file)
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <limits.h>
 
 #ifdef HAVE_SSL
index 0487873520ecbe62c490bbf74cce84adb90b11e5..56c05be47c00c2c750266172be5c163fe2fa83e4 100644 (file)
 #include <ldns/ldns.h>
 
 #include <limits.h>
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 
 ldns_lookup_table ldns_directive_types[] = {
         { LDNS_DIR_TTL, "$TTL" },
index ace59f6944e5aba9f59055ab7aa4b0da252d0353..4aca06830067a8e930eb0f446229f725d0fcba23 100644 (file)
 #include <ldns/config.h>
 
 #include <ldns/ldns.h>
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 
 /* Access function for reading
  * and setting the different Resolver
index 7b799b9b56551e5b8fc2cb7321289aa6dda51440..25c7cc72ff771a57f4a07cc2388c0d850b47e4f2 100644 (file)
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <limits.h>
 
 #include <errno.h>
index 700372b91c85dff0a25fbda135357ab72d7d7b53..1a4a75868daf98317ccfc1831611e09021dd2da2 100644 (file)
 #include <ldns/ldns.h>
 
 #include <limits.h>
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 
 /**
  * return a specific rdf
index 5dec680a1b795211570bada532e92024f5f89428..89da614c102028982df30934c469b48b382c3cb0 100644 (file)
 
 #include <ldns/config.h>
 #include <ldns/ldns.h>
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
index 7fcf21da0ea7fde29b825e48689e139f8ab293b2..c9001a99944eb99138256172d2ccc9a0c66e7129 100644 (file)
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 
 #ifdef HAVE_SSL
 #include <openssl/hmac.h>
index 01e67aa0691699a760934eeaa22e0a82a16ad000..a6b2abc9027ecdb5fea331cd34015ae6ea7e9807 100644 (file)
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <stdlib.h>
 #include <limits.h>
 
index eb24f81dbefe99db0c4b13f375ac5492538d5bdf..355da14e8e57fa49ac6c82a6673d61ec435f03ca 100644 (file)
 #include <ldns/rdata.h>
 #include <ldns/rr.h>
 #include <ldns/util.h>
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
+#ifndef _MSC_VER
 #include <sys/time.h>
+#else
+#include <compat/gettimeofday.h>
+#endif
 #include <time.h>
 
 #ifdef HAVE_SSL
index e87fcdf5df64725d891079752778411bbd6ddb82..9b94046c6101a34f7c96e24738796f76c91263c9 100644 (file)
 #include <ldns/ldns.h>
 /*#include <ldns/wire2host.h>*/
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <limits.h>
 
 
index 917af8befccb4295a9f4a1c4e91bb108b18b0f2d..c71f123e58976567d165b8095497bca0201fc0cf 100644 (file)
 
 #include <ldns/ldns.h>
 
+#ifdef _MSC_VER
+#include <string.h>
+#else
 #include <strings.h>
+#endif
 #include <limits.h>
 
 ldns_rr *