mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 10:05:08 +00:00
Make it build and fix tests in cygwin
This commit is contained in:
parent
352d75131f
commit
97bf71e944
@ -15,7 +15,11 @@
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
@ -38,7 +42,7 @@
|
||||
#include "common.h"
|
||||
|
||||
/* daemon(3) exists only in 4.4BSD or later, and in GNU libc */
|
||||
#if !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
|
||||
#if !(defined(__CYGWIN__)) && !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
|
||||
static int daemon(int nochdir, int noclose)
|
||||
{
|
||||
int fd, i;
|
||||
|
@ -15,7 +15,11 @@
|
||||
*/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
#endif
|
||||
|
@ -32,7 +32,11 @@
|
||||
#include <pwd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <zlib.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
#endif
|
||||
|
@ -36,7 +36,11 @@
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <zlib.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
#endif
|
||||
@ -799,6 +803,7 @@ read_dns(int fd, struct query *q)
|
||||
memcpy((struct sockaddr*)&q->from, (struct sockaddr*)&from, addrlen);
|
||||
q->fromlen = addrlen;
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
|
||||
cmsg = CMSG_NXTHDR(&msg, cmsg)) {
|
||||
|
||||
@ -809,7 +814,7 @@ read_dns(int fd, struct query *q)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return strlen(q->name);
|
||||
} else if (r < 0) {
|
||||
/* Error */
|
||||
|
49
src/windows.h
Normal file
49
src/windows.h
Normal file
@ -0,0 +1,49 @@
|
||||
#define T_A 1
|
||||
#define T_NS 2
|
||||
#define T_NULL 10
|
||||
|
||||
#define C_IN 1
|
||||
|
||||
#define NOERROR 0
|
||||
#define SERVFAIL 2
|
||||
#define NXDOMAIN 3
|
||||
#define NOTIMP 4
|
||||
#define REFUSED 5
|
||||
|
||||
typedef struct {
|
||||
unsigned id :16; /* query identification number */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
/* fields in third byte */
|
||||
unsigned qr: 1; /* response flag */
|
||||
unsigned opcode: 4; /* purpose of message */
|
||||
unsigned aa: 1; /* authoritive answer */
|
||||
unsigned tc: 1; /* truncated message */
|
||||
unsigned rd: 1; /* recursion desired */
|
||||
/* fields in fourth byte */
|
||||
unsigned ra: 1; /* recursion available */
|
||||
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned ad: 1; /* authentic data from named */
|
||||
unsigned cd: 1; /* checking disabled by resolver */
|
||||
unsigned rcode :4; /* response code */
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
|
||||
/* fields in third byte */
|
||||
unsigned rd :1; /* recursion desired */
|
||||
unsigned tc :1; /* truncated message */
|
||||
unsigned aa :1; /* authoritive answer */
|
||||
unsigned opcode :4; /* purpose of message */
|
||||
unsigned qr :1; /* response flag */
|
||||
/* fields in fourth byte */
|
||||
unsigned rcode :4; /* response code */
|
||||
unsigned cd: 1; /* checking disabled by resolver */
|
||||
unsigned ad: 1; /* authentic data from named */
|
||||
unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
|
||||
unsigned ra :1; /* recursion available */
|
||||
#endif
|
||||
/* remaining bytes */
|
||||
unsigned qdcount :16; /* number of question entries */
|
||||
unsigned ancount :16; /* number of answer entries */
|
||||
unsigned nscount :16; /* number of authority entries */
|
||||
unsigned arcount :16; /* number of resource entries */
|
||||
} HEADER;
|
||||
|
@ -23,5 +23,5 @@ $(TEST): $(OBJS) $(SRCOBJS)
|
||||
|
||||
clean:
|
||||
@echo "Cleaning tests/"
|
||||
@rm -f *~ *.core $(TEST) $(OBJS)
|
||||
@rm -f *~ *.core $(TEST){,exe} $(OBJS)
|
||||
|
||||
|
@ -23,7 +23,11 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
#include "dns.h"
|
||||
|
@ -18,7 +18,11 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef __CYGWIN__
|
||||
#include <arpa/nameser.h>
|
||||
#else
|
||||
#include "windows.h"
|
||||
#endif
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user