summaryrefslogtreecommitdiffstats
path: root/ipxrelay.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipxrelay.c')
-rw-r--r--ipxrelay.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/ipxrelay.c b/ipxrelay.c
index 72eca97..adb4007 100644
--- a/ipxrelay.c
+++ b/ipxrelay.c
@@ -1,21 +1,25 @@
-#include <stdbool.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
-#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <string.h>
#include <signal.h>
-#include <sysexits.h>
#include <inttypes.h>
#include <time.h>
+#ifdef __WIN32__
+#include "sysexits.h"
+#include <winsock2.h>
+#else
+#include <sysexits.h>
+#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
+#endif
#define VERSION_STRING "0.2"
@@ -52,13 +56,13 @@ struct opts {
const char *pidfile;
unsigned int port;
unsigned int timeout;
- bool foreground;
+ int foreground;
} opt = {
.address = NULL,
.pidfile = NULL,
.port = 231,
.timeout = 900,
- .foreground = false,
+ .foreground = 0,
};
@@ -76,11 +80,11 @@ struct ipx_addr {
uint16_t ip_port;
} __attribute__((packed));
-static inline bool is_ipx_null(const struct ipx_addr *addr)
+static int is_ipx_null(const struct ipx_addr *addr)
{
return addr->ip_addr == 0 && addr->ip_port == 0;
}
-static inline bool is_ipx_bcst(const struct ipx_addr *addr)
+static int is_ipx_bcst(const struct ipx_addr *addr)
{
return addr->ip_addr == 0xffffffff && addr->ip_port == 0xffff;
}
@@ -124,7 +128,7 @@ static void enable_timeout(int fd)
timeout.tv_sec = opt.timeout;
timeout.tv_usec = 0;
- setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof timeout);
}
static void disable_timeout(int fd)
@@ -134,7 +138,7 @@ static void disable_timeout(int fd)
timeout.tv_sec = 0;
timeout.tv_usec = 0;
- setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
+ setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, sizeof timeout);
}
static void cleanup_timeouts(int fd, time_t now)
@@ -398,7 +402,7 @@ int main(int argc, char *argv[])
}
break;
case 'F':
- opt.foreground = true;
+ opt.foreground = 1;
break;
case 'P':
opt.pidfile = optarg;