From 16d30832c4904176ed3da24722479af76ff9768d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:28:39 +0100
Subject: Haiku got no IP_MREQN


diff --git a/minissdpc.c b/minissdpc.c
index 35128a0..9b5ec9a 100644
--- a/minissdpc.c
+++ b/minissdpc.c
@@ -62,7 +62,7 @@ struct sockaddr_un {
 
 #include "miniupnpc_socketdef.h"
 
-#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__)
+#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) && !defined(__HAIKU__)
 #define HAS_IP_MREQN
 #endif
 
-- 
2.16.4


From 6469b592119544458368771223bfbf58ae8e8b7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:35:06 +0100
Subject: On Haiku SIOCGIFADDR lives in sys/sockio.h


diff --git a/minissdpc.c b/minissdpc.c
index 9b5ec9a..c58acc1 100644
--- a/minissdpc.c
+++ b/minissdpc.c
@@ -70,6 +70,8 @@ struct sockaddr_un {
 #include <sys/ioctl.h>
 #if defined(__sun)
 #include <sys/sockio.h>
+#elif defined(__HAIKU__)
+#include <sys/sockio.h>
 #endif
 #endif
 
-- 
2.16.4


From ced64c1ef646fdce2a7a674514a4fba93ba33e0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:38:06 +0100
Subject: atoui was already taken


diff --git a/portlistingparse.c b/portlistingparse.c
index d1954f5..ac0ced7 100644
--- a/portlistingparse.c
+++ b/portlistingparse.c
@@ -31,7 +31,7 @@ static const struct {
 
 /* Helper function */
 static UNSIGNED_INTEGER
-atoui(const char * p, int l)
+atoui2(const char * p, int l)
 {
 	UNSIGNED_INTEGER r = 0;
 	while(l > 0 && *p)
@@ -107,7 +107,7 @@ data(void * d, const char * data, int l)
 		pm->remoteHost[l] = '\0';
 		break;
 	case NewExternalPort:
-		pm->externalPort = (unsigned short)atoui(data, l);
+		pm->externalPort = (unsigned short)atoui2(data, l);
 		break;
 	case NewProtocol:
 		if(l > 3)
@@ -116,21 +116,21 @@ data(void * d, const char * data, int l)
 		pm->protocol[l] = '\0';
 		break;
 	case NewInternalPort:
-		pm->internalPort = (unsigned short)atoui(data, l);
+		pm->internalPort = (unsigned short)atoui2(data, l);
 		break;
 	case NewInternalClient:
 		memcpy(pm->internalClient, data, l);
 		pm->internalClient[l] = '\0';
 		break;
 	case NewEnabled:
-		pm->enabled = (unsigned char)atoui(data, l);
+		pm->enabled = (unsigned char)atoui2(data, l);
 		break;
 	case NewDescription:
 		memcpy(pm->description, data, l);
 		pm->description[l] = '\0';
 		break;
 	case NewLeaseTime:
-		pm->leaseTime = atoui(data, l);
+		pm->leaseTime = atoui2(data, l);
 		break;
 	default:
 		break;
-- 
2.16.4


From adbacfa365ac35160e44a485b50c5113301eb859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 4 Nov 2017 12:41:17 +0100
Subject: Haiku got networking stuffs in -lnetwork


diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1061b1..83f197e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,10 @@ option (UPNPC_BUILD_TESTS "Build test executables" TRUE)
 option (UPNPC_BUILD_SAMPLE "Build sample executables" TRUE)
 option (NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE)
 
+if (HAIKU)
+  list(APPEND LDLIBS -lnetwork)
+endif (HAIKU)
+
 if (NOT UPNPC_BUILD_STATIC AND NOT UPNPC_BUILD_SHARED)
     message (FATAL "Both shared and static libraries are disabled!")
 endif ()
-- 
2.16.4

