提交 e0eb284e authored 作者: Jeff Lenk's avatar Jeff Lenk

ldns initial round for windows compatibility

上级 710fc7a7
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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>
......
......@@ -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
......
#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
\ No newline at end of file
#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
\ No newline at end of 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
......
......@@ -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>
......
......@@ -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. */
......
......@@ -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
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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" {
......
......@@ -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" {
......
......@@ -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);
......
......@@ -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
......
......@@ -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" },
......
......@@ -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
......
......@@ -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>
......
......@@ -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
......
......@@ -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))))
......
......@@ -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>
......
......@@ -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>
......
......@@ -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
......
......@@ -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>
......
......@@ -10,7 +10,11 @@
#include <ldns/ldns.h>
#ifdef _MSC_VER
#include <string.h>
#else
#include <strings.h>
#endif
#include <limits.h>
ldns_rr *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论