forked from qt-creator/qt-creator
zeroconf: fix windows building
Correct exports, fixed commented out ifdef, moved socket including to a separate header. Change-Id: Iadb6f58e2c3dbadee411fc0df7c7519c1d90309d Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -38,9 +38,9 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
//#ifdef Q_OS_LINUX
|
||||
#ifdef Q_OS_LINUX
|
||||
#define AVAHI_LIB
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
#ifdef AVAHI_LIB
|
||||
|
||||
|
||||
@@ -29,14 +29,9 @@
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
#include <qglobal.h>
|
||||
#ifdef Q_OS_LINUX
|
||||
#define EMBEDDED_LIB
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <Winsock2.h>
|
||||
#endif
|
||||
#include "syssocket.h" // this should be the first header included
|
||||
|
||||
#include "servicebrowser_p.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
@@ -45,6 +40,10 @@
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#define EMBEDDED_LIB
|
||||
#endif
|
||||
|
||||
#ifdef EMBEDDED_LIB
|
||||
#include "embed/dnssd_ipc.c"
|
||||
#include "embed/dnssd_clientlib.c"
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "syssocket.h" // this should be the first header included
|
||||
|
||||
#include "servicebrowser.h"
|
||||
#include "servicebrowser_p.h"
|
||||
|
||||
|
||||
@@ -30,19 +30,6 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <Winsock2.h>
|
||||
# ifndef SHUT_RDWR
|
||||
# ifdef SD_BOTH
|
||||
# define SHUT_RDWR SD_BOTH
|
||||
# else
|
||||
# define SHUT_RDWR 2
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include "mdnsderived.h"
|
||||
#include "servicebrowser_p.h"
|
||||
|
||||
@@ -442,16 +429,16 @@ void initLib(LibUsage usage, const QString &libName, const QString &daemonPath)
|
||||
namespace Internal {
|
||||
// ----------------- dns-sd C callbacks -----------------
|
||||
|
||||
extern "C" void cServiceResolveReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *fullname,
|
||||
const char *hosttarget,
|
||||
uint16_t port, /* In network byte order */
|
||||
uint16_t txtLen,
|
||||
const unsigned char *txtRecord,
|
||||
void *context)
|
||||
extern "C" void DNSSD_API cServiceResolveReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *fullname,
|
||||
const char *hosttarget,
|
||||
uint16_t port, /* In network byte order */
|
||||
uint16_t txtLen,
|
||||
const unsigned char *txtRecord,
|
||||
void *context)
|
||||
{
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "cServiceResolveReply(" << ((size_t)sdRef) << ", " << ((quint32)flags) << ", " << interfaceIndex
|
||||
@@ -469,17 +456,17 @@ extern "C" void cServiceResolveReply(DNSServiceRef sdRef,
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void cTxtRecordReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *fullname,
|
||||
uint16_t rrtype,
|
||||
uint16_t rrclass,
|
||||
uint16_t rdlen,
|
||||
const void *rdata,
|
||||
uint32_t ttl,
|
||||
void *context)
|
||||
extern "C" void DNSSD_API cTxtRecordReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *fullname,
|
||||
uint16_t rrtype,
|
||||
uint16_t rrclass,
|
||||
uint16_t rdlen,
|
||||
const void *rdata,
|
||||
uint32_t ttl,
|
||||
void *context)
|
||||
{
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "cTxtRecordReply(" << ((size_t)sdRef) << ", " << ((int)flags) << ", " << interfaceIndex
|
||||
@@ -495,14 +482,14 @@ extern "C" void cTxtRecordReply(DNSServiceRef sdRef,
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void cAddrReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *hostname,
|
||||
const struct sockaddr *address,
|
||||
uint32_t ttl,
|
||||
void *context)
|
||||
extern "C" void DNSSD_API cAddrReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *hostname,
|
||||
const struct sockaddr *address,
|
||||
uint32_t ttl,
|
||||
void *context)
|
||||
{
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "cAddrReply(" << ((size_t)sdRef) << ", " << ((int)flags) << ", " << interfaceIndex
|
||||
@@ -515,14 +502,14 @@ extern "C" void cAddrReply(DNSServiceRef sdRef,
|
||||
}
|
||||
|
||||
/// callback for service browsing
|
||||
extern "C" void cBrowseReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *serviceName,
|
||||
const char *regtype,
|
||||
const char *replyDomain,
|
||||
void *context)
|
||||
extern "C" void DNSSD_API cBrowseReply(DNSServiceRef sdRef,
|
||||
DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex,
|
||||
DNSServiceErrorType errorCode,
|
||||
const char *serviceName,
|
||||
const char *regtype,
|
||||
const char *replyDomain,
|
||||
void *context)
|
||||
{
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "cBrowseReply(" << ((size_t)sdRef) << ", " << flags << ", " << interfaceIndex
|
||||
|
||||
56
src/libs/zeroconf/syssocket.h
Normal file
56
src/libs/zeroconf/syssocket.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef SYSSOCKET_H
|
||||
#define SYSSOCKET_H
|
||||
|
||||
// WARNING:
|
||||
//
|
||||
// we use Winsock2, which means that this header should be included *before*
|
||||
// any other windows header
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <Winsock2.h>
|
||||
# ifndef SHUT_RDWR
|
||||
# ifdef SD_BOTH
|
||||
# define SHUT_RDWR SD_BOTH
|
||||
# else
|
||||
# define SHUT_RDWR 2
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#endif // SYSSOCKET_H
|
||||
@@ -16,7 +16,8 @@ HEADERS += servicebrowser.h \
|
||||
zeroconf_global.h \
|
||||
dns_sd_types.h \
|
||||
servicebrowser_p.h \
|
||||
mdnsderived.h
|
||||
mdnsderived.h \
|
||||
syssocket.h
|
||||
|
||||
include(../../qtcreatorlibrary.pri)
|
||||
|
||||
@@ -25,3 +26,4 @@ win32{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user