ldns initial round for windows compatibility

This commit is contained in:
Jeff Lenk 2011-03-25 11:46:58 -05:00
parent 710fc7a775
commit e0eb284ef4
31 changed files with 161 additions and 1 deletions

View 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

View 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

View 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

View 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

View 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>

View File

@ -40,8 +40,12 @@
#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

View File

@ -0,0 +1,50 @@
#include <ldns/config.h>
#ifndef HAVE_GETTIMEOFDAY
#include < time.h >
#include < windows.h>
#include <compat/gettimeofday.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
int gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag;
if (NULL != tv)
{
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch*/
tmpres /= 10; /*convert into microseconds*/
tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL);
}
if (NULL != tz)
{
if (!tzflag)
{
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
}
#endif

View File

@ -0,0 +1,11 @@
#ifndef HAVE_GETTIMEOFDAY
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
#endif

View 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

View 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>

View 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. */

View 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

View 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.

View File

@ -14,7 +14,11 @@
#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

View 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

View 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

View 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

View File

@ -35,7 +35,11 @@
#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" {

View File

@ -26,7 +26,11 @@
#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" {

View File

@ -27,7 +27,12 @@
#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);

View File

@ -14,7 +14,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <limits.h>
#ifdef HAVE_SSL

View File

@ -11,7 +11,11 @@
#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" },

View File

@ -13,7 +13,11 @@
#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

View File

@ -11,7 +11,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <limits.h>
#include <errno.h>

View File

@ -18,7 +18,11 @@
#include <ldns/ldns.h>
#include <limits.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
/**
* return a specific rdf

View File

@ -19,7 +19,11 @@
#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))))

View File

@ -11,7 +11,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#ifdef HAVE_SSL
#include <openssl/hmac.h>

View File

@ -11,7 +11,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <stdlib.h>
#include <limits.h>

View File

@ -15,10 +15,18 @@
#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

View File

@ -19,7 +19,11 @@
#include <ldns/ldns.h>
/*#include <ldns/wire2host.h>*/
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <limits.h>

View File

@ -10,7 +10,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <limits.h>
ldns_rr *