/pidgin/main: 7012c84d4d3b: Backport part of Tomasz' e5cc097d6c8...

Daniel Atallah datallah at pidgin.im
Tue Dec 16 18:06:55 EST 2014


Changeset: 7012c84d4d3b8546b4121f60f23ab917dd3bdd63
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2014-12-16 18:06 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/7012c84d4d3b

Description:

Backport part of Tomasz' e5cc097d6c82 so that we don't need to pull dns_sd.h from Apple's hard to download SDK.

 * Also eliminate unused direct linking to the dnssd library

Fixes #16507

diffstat:

 libpurple/protocols/bonjour/Makefile.mingw |   7 --
 libpurple/protocols/bonjour/dns_sd_proxy.h |  95 +++++++++++++++++++++++++++--
 libpurple/win32/global.mak                 |   1 -
 3 files changed, 86 insertions(+), 17 deletions(-)

diffs (149 lines):

diff --git a/libpurple/protocols/bonjour/Makefile.mingw b/libpurple/protocols/bonjour/Makefile.mingw
--- a/libpurple/protocols/bonjour/Makefile.mingw
+++ b/libpurple/protocols/bonjour/Makefile.mingw
@@ -29,7 +29,6 @@ INCLUDE_PATHS +=	-I. \
 			-I$(GTK_TOP)/include \
 			-I$(GTK_TOP)/include/glib-2.0 \
 			-I$(GTK_TOP)/lib/glib-2.0/include \
-			-I$(BONJOUR_TOP)/Include \
 			-I$(LIBXML2_TOP)/include/libxml2 \
 			-I$(PURPLE_TOP) \
 			-I$(PURPLE_TOP)/win32 \
@@ -64,12 +63,6 @@ LIBS =	\
 			-lxml2 \
 			-lpurple
 
-ifeq ($(LINK_DNS_SD_DIRECTLY), 1)
-	CFLAGS += -DLINK_DNS_SD_DIRECTLY
-	LIB_PATHS += -L$(BONJOUR_TOP)/lib/win32 -L$(BONJOUR_TOP)/lib
-	LIBS += -ldnssd
-endif
-
 include $(PIDGIN_COMMON_RULES)
 
 ##
diff --git a/libpurple/protocols/bonjour/dns_sd_proxy.h b/libpurple/protocols/bonjour/dns_sd_proxy.h
--- a/libpurple/protocols/bonjour/dns_sd_proxy.h
+++ b/libpurple/protocols/bonjour/dns_sd_proxy.h
@@ -26,17 +26,96 @@
 #include <stdint.h>
 #endif
 
-/* fixup to make pidgin compile against win32 bonjour */
-#if defined(_WIN32) && !defined(_MSC_VER)
-#define _MSL_STDINT_H
-#endif
+/* The following is a subset of Apple's dns_sd.h file
+ * http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-333.10/mDNSShared/dns_sd.h
+ *
+ * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright notice,
+ *     this list of conditions and the following disclaimer in the documentation
+ *     and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
+ *     contributors may be used to endorse or promote products derived from this
+ *     software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 
-#include <dns_sd.h>
+#  if defined(_WIN32) && !defined(EFI32) && !defined(EFI64)
+#    define DNSSD_API __stdcall
+#  else
+#    define DNSSD_API
+#  endif
+
+#  define kDNSServiceInterfaceIndexAny 0
+#  define kDNSServiceMaxDomainName 1009
+
+typedef gint32 DNSServiceErrorType;
+typedef guint32 DNSServiceFlags;
+typedef struct _DNSServiceRef_t *DNSServiceRef;
+typedef struct _DNSRecordRef_t *DNSRecordRef;
+typedef guint32 DNSServiceProtocol;
+
+typedef union _TXTRecordRef_t {
+	gchar PrivateData[16];
+	gchar *ForceNaturalAlignment;
+} TXTRecordRef;
+
+typedef void (DNSSD_API *DNSServiceBrowseReply)();
+typedef void (DNSSD_API *DNSServiceGetAddrInfoReply)();
+typedef void (DNSSD_API *DNSServiceQueryRecordReply)(
+	DNSServiceRef sdRef, DNSServiceFlags flags, guint32 interfaceIndex,
+	DNSServiceErrorType errorCode, const gchar *fullname,
+	guint16 rrtype, guint16 rrclass, guint16 rdlen, const void *rdata,
+	guint32 ttl, void *context);
+typedef void (DNSSD_API *DNSServiceRegisterReply)();
+typedef void (DNSSD_API *DNSServiceResolveReply)(
+	DNSServiceRef sdRef, DNSServiceFlags flags, guint32 interfaceIndex,
+	DNSServiceErrorType errorCode, const gchar *fullname,
+	const gchar *hosttarget, guint16 port, guint16 txtLen,
+	const guchar *txtRecord, void *context);
+
+enum {
+	kDNSServiceErr_NoError = 0,
+	kDNSServiceErr_Unknown = -65537,
+};
+
+enum {
+	kDNSServiceFlagsAdd = 0x2,
+	kDNSServiceFlagsLongLivedQuery = 0x100,
+};
+
+enum {
+	kDNSServiceType_NULL = 10,
+	kDNSServiceType_TXT = 16,
+};
+
+enum {
+	kDNSServiceClass_IN = 1,
+};
+
+enum {
+	kDNSServiceProtocol_IPv4 = 0x01,
+};
+
+/* End dns_sd.h subset */
 
 gboolean dns_sd_available(void);
 
-#ifndef LINK_DNS_SD_DIRECTLY
-
 DNSServiceErrorType _wpurple_DNSServiceAddRecord(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags,
 	uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl);
 #define DNSServiceAddRecord(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl) \
@@ -117,6 +196,4 @@ DNSServiceErrorType _wpurple_TXTRecordSe
 #define TXTRecordSetValue(txtRecord, key, valueSize, value) \
 	_wpurple_TXTRecordSetValue(txtRecord, key, valueSize, value)
 
-#endif /*LINK_DNS_SD_DIRECTLY*/
-
 #endif
diff --git a/libpurple/win32/global.mak b/libpurple/win32/global.mak
--- a/libpurple/win32/global.mak
+++ b/libpurple/win32/global.mak
@@ -14,7 +14,6 @@ GTKSPELL_TOP ?= $(WIN32_DEV_TOP)/gtkspel
 ENCHANT_TOP ?= $(WIN32_DEV_TOP)/enchant_1.6.0_win32
 GTK_TOP ?= $(WIN32_DEV_TOP)/gtk_2_0-2.14
 GTK_BIN ?= $(GTK_TOP)/bin
-BONJOUR_TOP ?= $(WIN32_DEV_TOP)/Bonjour_SDK
 LIBXML2_TOP ?= $(WIN32_DEV_TOP)/libxml2-2.9.0
 MEANWHILE_TOP ?= $(WIN32_DEV_TOP)/meanwhile-1.0.2_daa3
 NSS_TOP ?= $(WIN32_DEV_TOP)/nss-3.17.1-nspr-4.10.7



More information about the Commits mailing list