changeset 16928:2be397cd726a

merge of '43641085a7c20c6fca287f571d7662bf3c916f21' and '75611b054205d4ba63f10e5daaba999f3be4e363'
author Richard Laager <rlaager@wiktel.com>
date Sat, 05 May 2007 23:19:27 +0000
parents d0e74d0be43f (diff) 0dcd915899ae (current diff)
children 342107309cf3
files
diffstat 3 files changed, 31 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sat May 05 23:08:20 2007 +0000
+++ b/configure.ac	Sat May 05 23:19:27 2007 +0000
@@ -1922,6 +1922,7 @@
 AC_CHECK_HEADERS(sys/file.h sys/filio.h sys/ioctl.h sys/msgbuf.h)
 AC_CHECK_HEADERS(sys/select.h sys/uio.h sys/utsname.h sys/wait.h)
 AC_CHECK_HEADERS(termios.h)
+AC_CHECK_HEADERS(sys/sysctl.h sys/socket.h)
 AC_VAR_TIMEZONE_EXTERNALS
 
 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
--- a/libpurple/nat-pmp.c	Sat May 05 23:08:20 2007 +0000
+++ b/libpurple/nat-pmp.c	Sat May 05 23:19:27 2007 +0000
@@ -29,64 +29,58 @@
  */
 
 #include "nat-pmp.h"
+#include "internal.h"
 #include "debug.h"
 #include "signals.h"
 #include "network.h"
 
-#include <sys/types.h>
-#ifndef _WIN32
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
+#ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netdb.h>
-#include <err.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 
-#include <errno.h>
+/* We will need sysctl() and NET_RT_DUMP, both of which are not present
+ * on all platforms, to continue. */
+#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP)
 
-#ifdef NET_RT_DUMP
+#include <sys/types.h>
+#include <net/route.h>
 
 #define PMP_DEBUG	1
 
 typedef struct {
-	uint8_t	version;
-	uint8_t opcode;
+	guint8	version;
+	guint8 opcode;
 } PurplePmpIpRequest;
 
 typedef struct {
-	uint8_t		version;
-	uint8_t		opcode; /* 128 + n */
-	uint16_t	resultcode;
-	uint32_t	epoch;
-	uint32_t	address;
+	guint8		version;
+	guint8		opcode; /* 128 + n */
+	guint16		resultcode;
+	guint32		epoch;
+	guint32		address;
 } PurplePmpIpResponse;
 
 typedef struct {
-	uint8_t		version;
-	uint8_t		opcode;
+	guint8		version;
+	guint8		opcode;
 	char		reserved[2];
-	uint16_t	privateport;
-	uint16_t	publicport;
-	uint32_t	lifetime;
+	guint16		privateport;
+	guint16		publicport;
+	guint32		lifetime;
 } PurplePmpMapRequest;
 
 struct _PurplePmpMapResponse {
-	uint8_t		version;
-	uint8_t		opcode;
-	uint16_t	resultcode;
-	uint32_t	epoch;
-	uint16_t	privateport;
-	uint16_t	publicport;
-	uint32_t	lifetime;
+	guint8		version;
+	guint8		opcode;
+	guint16		resultcode;
+	guint32		epoch;
+	guint16		privateport;
+	guint16		publicport;
+	guint32		lifetime;
 };
 
 typedef struct _PurplePmpMapResponse PurplePmpMapResponse;
@@ -549,4 +543,4 @@
 {
 
 }
-#endif /* #ifndef NET_RT_DUMP */
+#endif /* #if !(defined(HAVE_SYS_SYCTL_H) && defined(NET_RT_DUMP)) */
--- a/libpurple/nat-pmp.h	Sat May 05 23:08:20 2007 +0000
+++ b/libpurple/nat-pmp.h	Sat May 05 23:19:27 2007 +0000
@@ -31,7 +31,6 @@
 #ifndef _PURPLE_NAT_PMP_H
 #define _PURPLE_NAT_PMP_H
 
-#include <stdint.h>
 #include <glib.h>
 
 #define PURPLE_PMP_LIFETIME	3600	/* 3600 seconds */