mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
merge QNativeSocketEngine into QAbstractSocketEngine, it doesn't do proxies so drop support for that while at it [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
17a3651600
commit
3cea79e9f4
36 changed files with 1199 additions and 5288 deletions
|
@ -717,8 +717,6 @@ katie_generate_obsolete(QMutableStringListIterator QtCore qstringlist.h)
|
|||
katie_generate_obsolete(QMutableVectorIterator QtCore qvector.h)
|
||||
katie_generate_obsolete(QMutexLocker QtCore qmutex.h)
|
||||
katie_generate_obsolete(QNetworkAddressEntry QtNetwork qnetworkinterface.h)
|
||||
katie_generate_obsolete(QNetworkProxyFactory QtNetwork qnetworkproxy.h)
|
||||
katie_generate_obsolete(QNetworkProxyQuery QtNetwork qnetworkproxy.h)
|
||||
katie_generate_obsolete(QNoDebug QtCore qdebug.h)
|
||||
katie_generate_obsolete(QObjectData QtCore qobject.h)
|
||||
katie_generate_obsolete(QObjectList QtCore qobject.h)
|
||||
|
|
|
@ -1121,7 +1121,6 @@ include/katie/QtGui/qworkspace.h
|
|||
include/katie/QtGui/qx11embed_x11.h
|
||||
include/katie/QtGui/qx11info_x11.h
|
||||
include/katie/QtNetwork/QAbstractSocket
|
||||
include/katie/QtNetwork/QAuthenticator
|
||||
include/katie/QtNetwork/QCryptographicHash
|
||||
include/katie/QtNetwork/QHostAddress
|
||||
include/katie/QtNetwork/QHostInfo
|
||||
|
@ -1130,23 +1129,18 @@ include/katie/QtNetwork/QLocalServer
|
|||
include/katie/QtNetwork/QLocalSocket
|
||||
include/katie/QtNetwork/QNetworkAddressEntry
|
||||
include/katie/QtNetwork/QNetworkInterface
|
||||
include/katie/QtNetwork/QNetworkProxy
|
||||
include/katie/QtNetwork/QNetworkProxyFactory
|
||||
include/katie/QtNetwork/QNetworkProxyQuery
|
||||
include/katie/QtNetwork/QTcpServer
|
||||
include/katie/QtNetwork/QTcpSocket
|
||||
include/katie/QtNetwork/QUdpSocket
|
||||
include/katie/QtNetwork/Q_IPV6ADDR
|
||||
include/katie/QtNetwork/QtNetwork
|
||||
include/katie/QtNetwork/qabstractsocket.h
|
||||
include/katie/QtNetwork/qauthenticator.h
|
||||
include/katie/QtNetwork/qcryptographichash.h
|
||||
include/katie/QtNetwork/qhostaddress.h
|
||||
include/katie/QtNetwork/qhostinfo.h
|
||||
include/katie/QtNetwork/qlocalserver.h
|
||||
include/katie/QtNetwork/qlocalsocket.h
|
||||
include/katie/QtNetwork/qnetworkinterface.h
|
||||
include/katie/QtNetwork/qnetworkproxy.h
|
||||
include/katie/QtNetwork/qtcpserver.h
|
||||
include/katie/QtNetwork/qtcpsocket.h
|
||||
include/katie/QtNetwork/qudpsocket.h
|
||||
|
|
|
@ -1124,7 +1124,6 @@ include/katie/QtGui/qworkspace.h
|
|||
include/katie/QtGui/qx11embed_x11.h
|
||||
include/katie/QtGui/qx11info_x11.h
|
||||
include/katie/QtNetwork/QAbstractSocket
|
||||
include/katie/QtNetwork/QAuthenticator
|
||||
include/katie/QtNetwork/QCryptographicHash
|
||||
include/katie/QtNetwork/QHostAddress
|
||||
include/katie/QtNetwork/QHostInfo
|
||||
|
@ -1133,23 +1132,18 @@ include/katie/QtNetwork/QLocalServer
|
|||
include/katie/QtNetwork/QLocalSocket
|
||||
include/katie/QtNetwork/QNetworkAddressEntry
|
||||
include/katie/QtNetwork/QNetworkInterface
|
||||
include/katie/QtNetwork/QNetworkProxy
|
||||
include/katie/QtNetwork/QNetworkProxyFactory
|
||||
include/katie/QtNetwork/QNetworkProxyQuery
|
||||
include/katie/QtNetwork/QTcpServer
|
||||
include/katie/QtNetwork/QTcpSocket
|
||||
include/katie/QtNetwork/QUdpSocket
|
||||
include/katie/QtNetwork/Q_IPV6ADDR
|
||||
include/katie/QtNetwork/QtNetwork
|
||||
include/katie/QtNetwork/qabstractsocket.h
|
||||
include/katie/QtNetwork/qauthenticator.h
|
||||
include/katie/QtNetwork/qcryptographichash.h
|
||||
include/katie/QtNetwork/qhostaddress.h
|
||||
include/katie/QtNetwork/qhostinfo.h
|
||||
include/katie/QtNetwork/qlocalserver.h
|
||||
include/katie/QtNetwork/qlocalsocket.h
|
||||
include/katie/QtNetwork/qnetworkinterface.h
|
||||
include/katie/QtNetwork/qnetworkproxy.h
|
||||
include/katie/QtNetwork/qtcpserver.h
|
||||
include/katie/QtNetwork/qtcpsocket.h
|
||||
include/katie/QtNetwork/qudpsocket.h
|
||||
|
|
|
@ -1130,7 +1130,6 @@ include/katie/QtGui/qx11embed_x11.h
|
|||
include/katie/QtGui/qx11info_x11.h
|
||||
include/katie/QtNetwork/
|
||||
include/katie/QtNetwork/QAbstractSocket
|
||||
include/katie/QtNetwork/QAuthenticator
|
||||
include/katie/QtNetwork/QCryptographicHash
|
||||
include/katie/QtNetwork/QHostAddress
|
||||
include/katie/QtNetwork/QHostInfo
|
||||
|
@ -1139,23 +1138,18 @@ include/katie/QtNetwork/QLocalServer
|
|||
include/katie/QtNetwork/QLocalSocket
|
||||
include/katie/QtNetwork/QNetworkAddressEntry
|
||||
include/katie/QtNetwork/QNetworkInterface
|
||||
include/katie/QtNetwork/QNetworkProxy
|
||||
include/katie/QtNetwork/QNetworkProxyFactory
|
||||
include/katie/QtNetwork/QNetworkProxyQuery
|
||||
include/katie/QtNetwork/QTcpServer
|
||||
include/katie/QtNetwork/QTcpSocket
|
||||
include/katie/QtNetwork/QUdpSocket
|
||||
include/katie/QtNetwork/Q_IPV6ADDR
|
||||
include/katie/QtNetwork/QtNetwork
|
||||
include/katie/QtNetwork/qabstractsocket.h
|
||||
include/katie/QtNetwork/qauthenticator.h
|
||||
include/katie/QtNetwork/qcryptographichash.h
|
||||
include/katie/QtNetwork/qhostaddress.h
|
||||
include/katie/QtNetwork/qhostinfo.h
|
||||
include/katie/QtNetwork/qlocalserver.h
|
||||
include/katie/QtNetwork/qlocalsocket.h
|
||||
include/katie/QtNetwork/qnetworkinterface.h
|
||||
include/katie/QtNetwork/qnetworkproxy.h
|
||||
include/katie/QtNetwork/qtcpserver.h
|
||||
include/katie/QtNetwork/qtcpsocket.h
|
||||
include/katie/QtNetwork/qudpsocket.h
|
||||
|
|
|
@ -334,8 +334,6 @@ incmap = {
|
|||
'QtNetwork': {
|
||||
'QIPv6Address': 'qhostaddress.h',
|
||||
'QNetworkAddressEntry': 'qnetworkinterface.h',
|
||||
'QNetworkProxyFactory': 'qnetworkproxy.h',
|
||||
'QNetworkProxyQuery': 'qnetworkproxy.h',
|
||||
'Q_IPV6ADDR': 'qhostaddress.h',
|
||||
},
|
||||
'QtTest': {
|
||||
|
|
|
@ -38,7 +38,6 @@ classlist = [
|
|||
"QArgument",
|
||||
"QAtomicInt",
|
||||
"QAtomicPointer",
|
||||
"QAuthenticator",
|
||||
"QBasicAtomicInt",
|
||||
"QBasicTimer",
|
||||
"QBitArray",
|
||||
|
@ -392,9 +391,6 @@ classlist = [
|
|||
"QMutexLocker",
|
||||
"QNetworkAddressEntry",
|
||||
"QNetworkInterface",
|
||||
"QNetworkProxy",
|
||||
"QNetworkProxyFactory",
|
||||
"QNetworkProxyQuery",
|
||||
"QNoDebug",
|
||||
"QObject",
|
||||
"QObjectCleanupHandler",
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
#define QT_NO_NETWORKDISKCACHE
|
||||
#define QT_NO_SOCKS5
|
||||
#define QT_NO_URLINFO
|
||||
#define QT_NO_NETWORKPROXY
|
||||
|
||||
// Not supported, used to bootstrap
|
||||
#cmakedefine QT_NO_QOBJECT
|
||||
|
@ -236,7 +237,6 @@
|
|||
#cmakedefine QT_NO_MESSAGEBOX
|
||||
#cmakedefine QT_NO_MOVIE
|
||||
#cmakedefine QT_NO_NETWORKINTERFACE
|
||||
#cmakedefine QT_NO_NETWORKPROXY
|
||||
#cmakedefine QT_NO_PDF
|
||||
#cmakedefine QT_NO_PLUGIN_CHECK
|
||||
#cmakedefine QT_NO_PRINTDIALOG
|
||||
|
|
|
@ -3,13 +3,11 @@ set(EXTRA_NETWORK_LIBS KtCore)
|
|||
|
||||
set(NETWORK_PUBLIC_HEADERS
|
||||
QAbstractSocket
|
||||
QAuthenticator
|
||||
QHostAddress
|
||||
QHostInfo
|
||||
QLocalServer
|
||||
QLocalSocket
|
||||
QNetworkInterface
|
||||
QNetworkProxy
|
||||
QTcpServer
|
||||
QTcpSocket
|
||||
QUdpSocket
|
||||
|
@ -26,14 +24,11 @@ include_directories(
|
|||
)
|
||||
|
||||
set(NETWORK_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qauthenticator.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qauthenticator_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qcryptographichash.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostaddress.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostaddress_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostinfo.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostinfo_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkproxy.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkinterface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkinterface_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qabstractsocketengine_p.h
|
||||
|
@ -47,28 +42,24 @@ set(NETWORK_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalserver_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalsocket.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalsocket_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qnativesocketengine_p.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qnet_unix_p.h
|
||||
)
|
||||
|
||||
set(NETWORK_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qauthenticator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qcryptographichash.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostaddress.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostinfo.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkproxy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkinterface.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qhostinfo_unix.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qnetworkinterface_unix.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qabstractsocketengine.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qabstractsocketengine_unix.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qabstractsocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qtcpsocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qudpsocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qtcpserver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalsocket.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalserver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qnativesocketengine.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qnativesocketengine_unix.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalsocket_unix.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/socket/qlocalserver_unix.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/3rdparty/md4/md4.c
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QAUTHENTICATOR_H
|
||||
#define QAUTHENTICATOR_H
|
||||
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QAuthenticatorPrivate;
|
||||
class QUrl;
|
||||
|
||||
class Q_NETWORK_EXPORT QAuthenticator
|
||||
{
|
||||
public:
|
||||
QAuthenticator();
|
||||
~QAuthenticator();
|
||||
|
||||
QAuthenticator(const QAuthenticator &other);
|
||||
QAuthenticator &operator=(const QAuthenticator &other);
|
||||
|
||||
bool operator==(const QAuthenticator &other) const;
|
||||
inline bool operator!=(const QAuthenticator &other) const { return !operator==(other); }
|
||||
|
||||
QString user() const;
|
||||
void setUser(const QString &user);
|
||||
|
||||
QString password() const;
|
||||
void setPassword(const QString &password);
|
||||
|
||||
QString realm() const;
|
||||
|
||||
QVariant option(const QString &opt) const;
|
||||
QVariantHash options() const;
|
||||
void setOption(const QString &opt, const QVariant &value);
|
||||
|
||||
bool isNull() const;
|
||||
private:
|
||||
void detach();
|
||||
|
||||
QAuthenticatorPrivate *d;
|
||||
|
||||
friend class QAuthenticatorPrivate;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif
|
|
@ -1,91 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QAUTHENTICATOR_P_H
|
||||
#define QAUTHENTICATOR_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Katie API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qhash.h"
|
||||
#include "qbytearray.h"
|
||||
#include "qstring.h"
|
||||
#include "qauthenticator.h"
|
||||
#include "qvariant.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_AUTOTEST_EXPORT QAuthenticatorPrivate
|
||||
{
|
||||
public:
|
||||
enum Method { None, Basic, Ntlm, DigestMd5 };
|
||||
QAuthenticatorPrivate();
|
||||
~QAuthenticatorPrivate();
|
||||
|
||||
QString user;
|
||||
QString extractedUser;
|
||||
QString password;
|
||||
QVariantHash options;
|
||||
Method method;
|
||||
QString realm;
|
||||
QByteArray challenge;
|
||||
bool hasFailed; //credentials have been tried but rejected by server.
|
||||
|
||||
enum Phase {
|
||||
Start,
|
||||
Phase2,
|
||||
Done,
|
||||
Invalid
|
||||
};
|
||||
Phase phase;
|
||||
|
||||
// digest specific
|
||||
QByteArray cnonce;
|
||||
int nonceCount;
|
||||
|
||||
// ntlm specific
|
||||
QString workstation;
|
||||
QString userDomain;
|
||||
|
||||
QByteArray calculateResponse(const QByteArray &method, const QByteArray &path);
|
||||
|
||||
inline static QAuthenticatorPrivate *getPrivate(QAuthenticator &auth) { return auth.d; }
|
||||
inline static const QAuthenticatorPrivate *getPrivate(const QAuthenticator &auth) { return auth.d; }
|
||||
|
||||
QByteArray digestMd5Response(const QByteArray &challenge, const QByteArray &method, const QByteArray &path);
|
||||
static QHash<QByteArray, QByteArray> parseDigestAuthenticationChallenge(const QByteArray &challenge);
|
||||
|
||||
void parseHttpResponse(const QList<QPair<QByteArray, QByteArray> >&, bool isProxy);
|
||||
void updateCredentials();
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
|
@ -25,7 +25,6 @@
|
|||
#include "qplatformdefs.h"
|
||||
#include "qstringlist.h"
|
||||
#include "qendian.h"
|
||||
#include "qnativesocketengine_p.h"
|
||||
#include "qcorecommon_p.h"
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "qplatformdefs.h"
|
||||
|
||||
#include "qhostinfo_p.h"
|
||||
#include "qnativesocketengine_p.h"
|
||||
#include "qiodevice.h"
|
||||
#include "qbytearray.h"
|
||||
#include "qurl.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,162 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNETWORKPROXY_H
|
||||
#define QNETWORKPROXY_H
|
||||
|
||||
#include <QtNetwork/qhostaddress.h>
|
||||
#include <QtCore/qshareddata.h>
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QUrl;
|
||||
|
||||
class QNetworkProxyQueryPrivate;
|
||||
class Q_NETWORK_EXPORT QNetworkProxyQuery
|
||||
{
|
||||
public:
|
||||
enum QueryType {
|
||||
TcpSocket,
|
||||
UdpSocket,
|
||||
TcpServer = 100,
|
||||
UrlRequest
|
||||
};
|
||||
|
||||
QNetworkProxyQuery();
|
||||
QNetworkProxyQuery(const QUrl &requestUrl, QueryType queryType = UrlRequest);
|
||||
QNetworkProxyQuery(const QString &hostname, int port, const QString &protocolTag = QString(),
|
||||
QueryType queryType = TcpSocket);
|
||||
QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(),
|
||||
QueryType queryType = TcpServer);
|
||||
QNetworkProxyQuery(const QNetworkProxyQuery &other);
|
||||
~QNetworkProxyQuery();
|
||||
QNetworkProxyQuery &operator=(const QNetworkProxyQuery &other);
|
||||
bool operator==(const QNetworkProxyQuery &other) const;
|
||||
inline bool operator!=(const QNetworkProxyQuery &other) const
|
||||
{ return !(*this == other); }
|
||||
|
||||
QueryType queryType() const;
|
||||
void setQueryType(QueryType type);
|
||||
|
||||
int peerPort() const;
|
||||
void setPeerPort(int port);
|
||||
|
||||
QString peerHostName() const;
|
||||
void setPeerHostName(const QString &hostname);
|
||||
|
||||
int localPort() const;
|
||||
void setLocalPort(int port);
|
||||
|
||||
QString protocolTag() const;
|
||||
void setProtocolTag(const QString &protocolTag);
|
||||
|
||||
QUrl url() const;
|
||||
void setUrl(const QUrl &url);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<QNetworkProxyQueryPrivate> d;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QNetworkProxyQuery, Q_MOVABLE_TYPE);
|
||||
|
||||
class QNetworkProxyPrivate;
|
||||
|
||||
class Q_NETWORK_EXPORT QNetworkProxy
|
||||
{
|
||||
public:
|
||||
enum ProxyType {
|
||||
DefaultProxy,
|
||||
Socks5Proxy,
|
||||
NoProxy,
|
||||
HttpProxy,
|
||||
HttpCachingProxy,
|
||||
FtpCachingProxy
|
||||
};
|
||||
|
||||
enum Capability {
|
||||
TunnelingCapability = 0x0001,
|
||||
ListeningCapability = 0x0002,
|
||||
UdpTunnelingCapability = 0x0004,
|
||||
CachingCapability = 0x0008,
|
||||
HostNameLookupCapability = 0x0010
|
||||
};
|
||||
Q_DECLARE_FLAGS(Capabilities, Capability)
|
||||
|
||||
QNetworkProxy();
|
||||
QNetworkProxy(ProxyType type, const QString &hostName = QString(), quint16 port = 0,
|
||||
const QString &user = QString(), const QString &password = QString());
|
||||
QNetworkProxy(const QNetworkProxy &other);
|
||||
QNetworkProxy &operator=(const QNetworkProxy &other);
|
||||
~QNetworkProxy();
|
||||
bool operator==(const QNetworkProxy &other) const;
|
||||
inline bool operator!=(const QNetworkProxy &other) const
|
||||
{ return !(*this == other); }
|
||||
|
||||
void setType(QNetworkProxy::ProxyType type);
|
||||
QNetworkProxy::ProxyType type() const;
|
||||
|
||||
void setCapabilities(Capabilities capab);
|
||||
Capabilities capabilities() const;
|
||||
bool isCachingProxy() const;
|
||||
bool isTransparentProxy() const;
|
||||
|
||||
void setUser(const QString &userName);
|
||||
QString user() const;
|
||||
|
||||
void setPassword(const QString &password);
|
||||
QString password() const;
|
||||
|
||||
void setHostName(const QString &hostName);
|
||||
QString hostName() const;
|
||||
|
||||
void setPort(quint16 port);
|
||||
quint16 port() const;
|
||||
|
||||
static void setApplicationProxy(const QNetworkProxy &proxy);
|
||||
static QNetworkProxy applicationProxy();
|
||||
|
||||
private:
|
||||
QSharedDataPointer<QNetworkProxyPrivate> d;
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkProxy::Capabilities)
|
||||
|
||||
class Q_NETWORK_EXPORT QNetworkProxyFactory
|
||||
{
|
||||
public:
|
||||
QNetworkProxyFactory();
|
||||
virtual ~QNetworkProxyFactory();
|
||||
|
||||
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0;
|
||||
|
||||
static void setUseSystemConfiguration(bool enable);
|
||||
static void setApplicationProxyFactory(QNetworkProxyFactory *factory);
|
||||
static QList<QNetworkProxy> proxyForQuery(const QNetworkProxyQuery &query);
|
||||
static QList<QNetworkProxy> systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery());
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QT_NO_NETWORKPROXY
|
||||
|
||||
#endif // QHOSTINFO_H
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 David Faure <dfaure@kdab.net>
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNETWORKPROXY_P_H
|
||||
#define QNETWORKPROXY_P_H
|
||||
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Katie API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QSystemConfigurationProxyFactory : public QNetworkProxyFactory
|
||||
{
|
||||
public:
|
||||
QSystemConfigurationProxyFactory() : QNetworkProxyFactory() {}
|
||||
|
||||
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery& query)
|
||||
{
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(query);
|
||||
|
||||
// Make sure NoProxy is in the list, so that QTcpServer can work:
|
||||
// it searches for the first proxy that can has the ListeningCapability capability
|
||||
// if none have (as is the case with HTTP proxies), it fails to bind.
|
||||
// NoProxy allows it to fallback to the 'no proxy' case and bind.
|
||||
proxies.append(QNetworkProxy::NoProxy);
|
||||
|
||||
return proxies;
|
||||
}
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_NETWORKINTERFACE
|
||||
|
||||
#endif
|
||||
|
|
@ -209,22 +209,6 @@
|
|||
\sa state(), {Creating Custom Qt Types}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAbstractSocket::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
|
||||
\since 4.3
|
||||
|
||||
This signal can be emitted when a \a proxy that requires
|
||||
authentication is used. The \a authenticator object can then be
|
||||
filled in with the required details to allow authentication and
|
||||
continue the connection.
|
||||
|
||||
\note It is not possible to use a QueuedConnection to connect to
|
||||
this signal, as the connection will fail if the authenticator has
|
||||
not been filled in with new information when the signal returns.
|
||||
|
||||
\sa QAuthenticator, QNetworkProxy
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QAbstractSocket::NetworkLayerProtocol
|
||||
|
||||
|
@ -278,24 +262,9 @@
|
|||
\value UnsupportedSocketOperationError The requested socket operation is
|
||||
not supported by the local operating system (e.g., lack of
|
||||
IPv6 support).
|
||||
\value ProxyAuthenticationRequiredError The socket is using a proxy, and
|
||||
the proxy requires authentication.
|
||||
\value UnfinishedSocketOperationError Used by QAbstractSocketEngine only,
|
||||
The last operation attempted has not finished yet (still in progress in
|
||||
the background). (This value was introduced in 4.4.)
|
||||
\value ProxyConnectionRefusedError Could not contact the proxy server because
|
||||
the connection to that server was denied (This value was introduced in 4.5.)
|
||||
\value ProxyConnectionClosedError The connection to the proxy server was closed
|
||||
unexpectedly (before the connection to the final peer was established)
|
||||
(This value was introduced in 4.5.)
|
||||
\value ProxyConnectionTimeoutError The connection to the proxy server timed out
|
||||
or the proxy server stopped responding in the authentication phase.
|
||||
(This value was introduced in 4.5.)
|
||||
\value ProxyNotFoundError The proxy address set with setProxy() (or the application
|
||||
proxy) was not found. (This value was introduced in 4.5.)
|
||||
\value ProxyProtocolError The connection negotiation with the proxy server
|
||||
because the response from the proxy server could not be understood.
|
||||
(This value was introduced in 4.5.)
|
||||
|
||||
\value UnknownSocketError An unidentified error occurred.
|
||||
\sa QAbstractSocket::error()
|
||||
|
@ -371,21 +340,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static bool isProxyError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
switch (error) {
|
||||
case QAbstractSocket::ProxyAuthenticationRequiredError:
|
||||
case QAbstractSocket::ProxyConnectionRefusedError:
|
||||
case QAbstractSocket::ProxyConnectionClosedError:
|
||||
case QAbstractSocket::ProxyConnectionTimeoutError:
|
||||
case QAbstractSocket::ProxyNotFoundError:
|
||||
case QAbstractSocket::ProxyProtocolError:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
||||
Constructs a QAbstractSocketPrivate. Initializes all members.
|
||||
|
@ -457,11 +411,6 @@ void QAbstractSocketPrivate::resetSocketLayer()
|
|||
*/
|
||||
bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol)
|
||||
{
|
||||
#ifdef QT_NO_NETWORKPROXY
|
||||
// this is here to avoid a duplication of the call to createSocketEngine below
|
||||
static const QNetworkProxy &proxyInUse = *(QNetworkProxy *)0;
|
||||
#endif
|
||||
|
||||
Q_Q(QAbstractSocket);
|
||||
#if defined (QABSTRACTSOCKET_DEBUG)
|
||||
QString typeStr;
|
||||
|
@ -475,16 +424,12 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
|
|||
#endif
|
||||
|
||||
resetSocketLayer();
|
||||
socketEngine = QAbstractSocketEngine::createSocketEngine(q->socketType(), proxyInUse, q);
|
||||
socketEngine = new QAbstractSocketEngine(q);
|
||||
if (!socketEngine) {
|
||||
socketError = QAbstractSocket::UnsupportedSocketOperationError;
|
||||
q->setErrorString(QAbstractSocket::tr("Operation on socket is not supported"));
|
||||
return false;
|
||||
}
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
//copy user agent to socket engine (if it has been set)
|
||||
socketEngine->setProperty("_q_user-agent", q->property("_q_user-agent"));
|
||||
#endif
|
||||
if (!socketEngine->initialize(q->socketType(), protocol)) {
|
||||
#if defined (QABSTRACTSOCKET_DEBUG)
|
||||
qDebug("QAbstractSocketPrivate::initSocketLayer(%s, %s) failed (%s)",
|
||||
|
@ -703,85 +648,6 @@ bool QAbstractSocketPrivate::flush()
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
/*! \internal
|
||||
|
||||
Resolve the proxy to its final value.
|
||||
*/
|
||||
void QAbstractSocketPrivate::resolveProxy(const QString &hostname, quint16 port)
|
||||
{
|
||||
QList<QNetworkProxy> proxies;
|
||||
|
||||
if (proxy.type() != QNetworkProxy::DefaultProxy) {
|
||||
// a non-default proxy was set with setProxy
|
||||
proxies << proxy;
|
||||
} else {
|
||||
// try the application settings instead
|
||||
QNetworkProxyQuery query(hostname, port, QString(),
|
||||
socketType == QAbstractSocket::TcpSocket ?
|
||||
QNetworkProxyQuery::TcpSocket :
|
||||
QNetworkProxyQuery::UdpSocket);
|
||||
proxies = QNetworkProxyFactory::proxyForQuery(query);
|
||||
}
|
||||
|
||||
// return the first that we can use
|
||||
foreach (const QNetworkProxy &p, proxies) {
|
||||
if (socketType == QAbstractSocket::UdpSocket &&
|
||||
(p.capabilities() & QNetworkProxy::UdpTunnelingCapability) == 0)
|
||||
continue;
|
||||
|
||||
if (socketType == QAbstractSocket::TcpSocket &&
|
||||
(p.capabilities() & QNetworkProxy::TunnelingCapability) == 0)
|
||||
continue;
|
||||
|
||||
proxyInUse = p;
|
||||
return;
|
||||
}
|
||||
|
||||
// no proxy found
|
||||
// DefaultProxy here will raise an error
|
||||
proxyInUse = QNetworkProxy();
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Starts the connection to \a host, like _q_startConnecting below,
|
||||
but without hostname resolution.
|
||||
*/
|
||||
void QAbstractSocketPrivate::startConnectingByName(const QString &host)
|
||||
{
|
||||
Q_Q(QAbstractSocket);
|
||||
if (state == QAbstractSocket::ConnectingState || state == QAbstractSocket::ConnectedState)
|
||||
return;
|
||||
|
||||
#if defined(QABSTRACTSOCKET_DEBUG)
|
||||
qDebug("QAbstractSocketPrivate::startConnectingByName(host == %s)", qPrintable(host));
|
||||
#endif
|
||||
|
||||
// ### Let the socket engine drive this?
|
||||
state = QAbstractSocket::ConnectingState;
|
||||
emit q->stateChanged(state);
|
||||
|
||||
if (initSocketLayer(QAbstractSocket::UnknownNetworkLayerProtocol)) {
|
||||
if (socketEngine->state() == QAbstractSocket::ConnectingState) {
|
||||
cachedSocketDescriptor = socketEngine->socketDescriptor();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// failed to connect
|
||||
socketError = socketEngine->error();
|
||||
q->setErrorString(socketEngine->errorString());
|
||||
}
|
||||
|
||||
state = QAbstractSocket::UnconnectedState;
|
||||
emit q->error(socketError);
|
||||
emit q->stateChanged(state);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*! \internal
|
||||
|
||||
Slot connected to QHostInfo::lookupHost() in connectToHost(). This
|
||||
|
@ -967,10 +833,6 @@ void QAbstractSocketPrivate::_q_testConnection()
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// don't retry the other addresses if we had a proxy error
|
||||
if (isProxyError(socketEngine->error()))
|
||||
addresses.clear();
|
||||
}
|
||||
|
||||
if (threadData->eventDispatcher) {
|
||||
|
@ -1254,18 +1116,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
|
|||
d->hostLookupId = -1;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
// Get the proxy information
|
||||
d->resolveProxy(hostName, port);
|
||||
if (d->proxyInUse.type() == QNetworkProxy::DefaultProxy) {
|
||||
// failed to setup the proxy
|
||||
d->socketError = QAbstractSocket::UnsupportedSocketOperationError;
|
||||
setErrorString(QAbstractSocket::tr("Operation on socket is not supported"));
|
||||
emit error(d->socketError);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (openMode & QIODevice::Unbuffered)
|
||||
d->isBuffered = false; // Unbuffered QTcpSocket
|
||||
else if (!d_func()->isBuffered)
|
||||
|
@ -1280,12 +1130,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
|
|||
QHostInfo info;
|
||||
info.setAddresses(QList<QHostAddress>() << temp);
|
||||
d->_q_startConnecting(info);
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
} else if (d->proxyInUse.capabilities() & QNetworkProxy::HostNameLookupCapability) {
|
||||
// the proxy supports connection by name, so use it
|
||||
d->startConnectingByName(hostName);
|
||||
return;
|
||||
#endif
|
||||
} else {
|
||||
if (d->threadData->eventDispatcher) {
|
||||
d->hostLookupId = -1;
|
||||
|
@ -1436,9 +1280,6 @@ bool QAbstractSocket::canReadLine() const
|
|||
Returns the native socket descriptor of the QAbstractSocket object
|
||||
if this is available; otherwise returns -1.
|
||||
|
||||
If the socket is using QNetworkProxy, the returned descriptor
|
||||
may not be usable with native socket functions.
|
||||
|
||||
The socket descriptor is not available when QAbstractSocket is in
|
||||
UnconnectedState.
|
||||
|
||||
|
@ -1467,12 +1308,7 @@ bool QAbstractSocket::setSocketDescriptor(int socketDescriptor, SocketState sock
|
|||
{
|
||||
Q_D(QAbstractSocket);
|
||||
d->resetSocketLayer();
|
||||
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this);
|
||||
if (!d->socketEngine) {
|
||||
d->socketError = UnsupportedSocketOperationError;
|
||||
setErrorString(tr("Operation on socket is not supported"));
|
||||
return false;
|
||||
}
|
||||
d->socketEngine = new QAbstractSocketEngine(this);
|
||||
bool result = d->socketEngine->initialize(socketDescriptor, socketState);
|
||||
if (!result) {
|
||||
d->socketError = d->socketEngine->error();
|
||||
|
@ -2453,49 +2289,6 @@ void QAbstractSocket::setSocketError(SocketError socketError)
|
|||
d_func()->socketError = socketError;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Sets the explicit network proxy for this socket to \a networkProxy.
|
||||
|
||||
To disable the use of a proxy for this socket, use the
|
||||
QNetworkProxy::NoProxy proxy type:
|
||||
|
||||
\snippet doc/src/snippets/code/src_network_socket_qabstractsocket.cpp 3
|
||||
|
||||
The default value for the proxy is QNetworkProxy::DefaultProxy,
|
||||
which means the socket will use the application settings: if a
|
||||
proxy is set with QNetworkProxy::setApplicationProxy, it will use
|
||||
that; otherwise, if a factory is set with
|
||||
QNetworkProxyFactory::setApplicationProxyFactory, it will query
|
||||
that factory with type QNetworkProxyQuery::TcpSocket.
|
||||
|
||||
\sa proxy(), QNetworkProxy, QNetworkProxyFactory::queryProxy()
|
||||
*/
|
||||
void QAbstractSocket::setProxy(const QNetworkProxy &networkProxy)
|
||||
{
|
||||
Q_D(QAbstractSocket);
|
||||
d->proxy = networkProxy;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Returns the network proxy for this socket.
|
||||
By default QNetworkProxy::DefaultProxy is used, which means this
|
||||
socket will query the default proxy settings for the application.
|
||||
|
||||
\sa setProxy(), QNetworkProxy, QNetworkProxyFactory
|
||||
*/
|
||||
QNetworkProxy QAbstractSocket::proxy() const
|
||||
{
|
||||
Q_D(const QAbstractSocket);
|
||||
return d->proxy;
|
||||
}
|
||||
#endif // QT_NO_NETWORKPROXY
|
||||
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError error)
|
||||
{
|
||||
|
@ -2536,24 +2329,6 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError er
|
|||
case QAbstractSocket::UnfinishedSocketOperationError:
|
||||
debug << "QAbstractSocket::UnfinishedSocketOperationError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyAuthenticationRequiredError:
|
||||
debug << "QAbstractSocket::ProxyAuthenticationRequiredError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyConnectionRefusedError:
|
||||
debug << "QAbstractSocket::ProxyConnectionRefusedError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyConnectionClosedError:
|
||||
debug << "QAbstractSocket::ProxyConnectionClosedError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyConnectionTimeoutError:
|
||||
debug << "QAbstractSocket::ProxyConnectionTimeoutError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyNotFoundError:
|
||||
debug << "QAbstractSocket::ProxyNotFoundError";
|
||||
break;
|
||||
case QAbstractSocket::ProxyProtocolError:
|
||||
debug << "QAbstractSocket::ProxyProtocolError";
|
||||
break;
|
||||
case QAbstractSocket::UnknownSocketError:
|
||||
debug << "QAbstractSocket::UnknownSocketError";
|
||||
break;
|
||||
|
|
|
@ -33,11 +33,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
|
||||
class QHostAddress;
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
class QNetworkProxy;
|
||||
#endif
|
||||
class QAbstractSocketPrivate;
|
||||
class QAuthenticator;
|
||||
|
||||
class Q_NETWORK_EXPORT QAbstractSocket : public QIODevice
|
||||
{
|
||||
|
@ -67,12 +63,6 @@ public:
|
|||
SocketAddressNotAvailableError,
|
||||
UnsupportedSocketOperationError, /* 10 */
|
||||
UnfinishedSocketOperationError,
|
||||
ProxyAuthenticationRequiredError,
|
||||
ProxyConnectionRefusedError,
|
||||
ProxyConnectionClosedError,
|
||||
ProxyConnectionTimeoutError, /* 15 */
|
||||
ProxyNotFoundError,
|
||||
ProxyProtocolError,
|
||||
|
||||
UnknownSocketError = -1
|
||||
};
|
||||
|
@ -140,20 +130,12 @@ public:
|
|||
bool waitForBytesWritten(int msecs = 30000);
|
||||
virtual bool waitForDisconnected(int msecs = 30000);
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void setProxy(const QNetworkProxy &networkProxy);
|
||||
QNetworkProxy proxy() const;
|
||||
#endif
|
||||
|
||||
Q_SIGNALS:
|
||||
void hostFound();
|
||||
void connected();
|
||||
void disconnected();
|
||||
void stateChanged(QAbstractSocket::SocketState);
|
||||
void error(QAbstractSocket::SocketError);
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
qint64 readData(char *data, qint64 maxlen);
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "qringbuffer_p.h"
|
||||
#include "qiodevice_p.h"
|
||||
#include "qabstractsocketengine_p.h"
|
||||
#include "qnetworkproxy.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -58,12 +57,6 @@ public:
|
|||
inline void writeNotification() { canWriteNotification(); }
|
||||
inline void exceptionNotification() {}
|
||||
void connectionNotification();
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) {
|
||||
Q_Q(QAbstractSocket);
|
||||
q->proxyAuthenticationRequired(proxy, authenticator);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool canReadNotification();
|
||||
bool canWriteNotification();
|
||||
|
@ -100,20 +93,10 @@ public:
|
|||
QAbstractSocketEngine *socketEngine;
|
||||
int cachedSocketDescriptor;
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
QNetworkProxy proxy;
|
||||
QNetworkProxy proxyInUse;
|
||||
void resolveProxy(const QString &hostName, quint16 port);
|
||||
#else
|
||||
inline void resolveProxy(const QString &, quint16) { }
|
||||
#endif
|
||||
inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); }
|
||||
|
||||
void resetSocketLayer();
|
||||
bool flush();
|
||||
|
||||
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
void startConnectingByName(const QString &host);
|
||||
void fetchConnectionParameters();
|
||||
void setupSocketNotifiers();
|
||||
bool readFromSocket();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -39,12 +39,11 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAuthenticator;
|
||||
class QAbstractSocketEnginePrivate;
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
class QNetworkInterface;
|
||||
#endif
|
||||
class QNetworkProxy;
|
||||
class QSocketNotifier;
|
||||
|
||||
class QAbstractSocketEngineReceiver {
|
||||
public:
|
||||
|
@ -53,9 +52,6 @@ public:
|
|||
virtual void writeNotification()= 0;
|
||||
virtual void exceptionNotification()= 0;
|
||||
virtual void connectionNotification()= 0;
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
virtual void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)= 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
class Q_AUTOTEST_EXPORT QAbstractSocketEngine : public QObject
|
||||
|
@ -63,10 +59,8 @@ class Q_AUTOTEST_EXPORT QAbstractSocketEngine : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType, const QNetworkProxy &, QObject *parent);
|
||||
static QAbstractSocketEngine *createSocketEngine(int socketDescripter, QObject *parent);
|
||||
|
||||
QAbstractSocketEngine(QObject *parent = nullptr);
|
||||
~QAbstractSocketEngine();
|
||||
|
||||
enum SocketOption {
|
||||
NonBlockingSocketOption,
|
||||
|
@ -79,53 +73,53 @@ public:
|
|||
MulticastLoopbackOption
|
||||
};
|
||||
|
||||
virtual bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) = 0;
|
||||
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
|
||||
|
||||
virtual bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) = 0;
|
||||
bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
|
||||
virtual int socketDescriptor() const = 0;
|
||||
int socketDescriptor() const;
|
||||
|
||||
virtual bool isValid() const = 0;
|
||||
bool isValid() const;
|
||||
|
||||
virtual bool connectToHost(const QHostAddress &address, quint16 port) = 0;
|
||||
virtual bool bind(const QHostAddress &address, quint16 port) = 0;
|
||||
virtual bool listen() = 0;
|
||||
virtual int accept() = 0;
|
||||
virtual void close() = 0;
|
||||
bool connectToHost(const QHostAddress &address, quint16 port);
|
||||
bool bind(const QHostAddress &address, quint16 port);
|
||||
bool listen();
|
||||
int accept();
|
||||
void close();
|
||||
|
||||
virtual qint64 bytesAvailable() const = 0;
|
||||
qint64 bytesAvailable() const;
|
||||
|
||||
virtual qint64 read(char *data, qint64 maxlen) = 0;
|
||||
virtual qint64 write(const char *data, qint64 len) = 0;
|
||||
qint64 read(char *data, qint64 maxlen);
|
||||
qint64 write(const char *data, qint64 len);
|
||||
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
virtual bool joinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface) = 0;
|
||||
virtual bool leaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface) = 0;
|
||||
virtual QNetworkInterface multicastInterface() const = 0;
|
||||
virtual bool setMulticastInterface(const QNetworkInterface &iface) = 0;
|
||||
bool joinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
bool leaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
QNetworkInterface multicastInterface() const;
|
||||
bool setMulticastInterface(const QNetworkInterface &iface);
|
||||
#endif // QT_NO_NETWORKINTERFACE
|
||||
|
||||
virtual qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
|
||||
quint16 *port = 0) = 0;
|
||||
virtual qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr,
|
||||
quint16 port) = 0;
|
||||
virtual bool hasPendingDatagrams() const = 0;
|
||||
virtual qint64 pendingDatagramSize() const = 0;
|
||||
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
|
||||
quint16 *port = 0);
|
||||
qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr,
|
||||
quint16 port);
|
||||
bool hasPendingDatagrams() const;
|
||||
qint64 pendingDatagramSize() const;
|
||||
#endif // QT_NO_UDPSOCKET
|
||||
|
||||
virtual qint64 bytesToWrite() const = 0;
|
||||
qint64 bytesToWrite() const ;
|
||||
|
||||
virtual int option(SocketOption option) const = 0;
|
||||
virtual bool setOption(SocketOption option, int value) = 0;
|
||||
int option(SocketOption option) const;
|
||||
bool setOption(SocketOption option, int value);
|
||||
|
||||
virtual bool waitForRead(int msecs = 30000, bool *timedOut = 0) = 0;
|
||||
virtual bool waitForWrite(int msecs = 30000, bool *timedOut = 0) = 0;
|
||||
virtual bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
|
||||
bool checkRead, bool checkWrite,
|
||||
int msecs = 30000, bool *timedOut = 0) = 0;
|
||||
bool waitForRead(int msecs = 30000, bool *timedOut = 0);
|
||||
bool waitForWrite(int msecs = 30000, bool *timedOut = 0);
|
||||
bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
|
||||
bool checkRead, bool checkWrite,
|
||||
int msecs = 30000, bool *timedOut = 0);
|
||||
|
||||
QAbstractSocket::SocketError error() const;
|
||||
QString errorString() const;
|
||||
|
@ -138,21 +132,18 @@ public:
|
|||
QHostAddress peerAddress() const;
|
||||
quint16 peerPort() const;
|
||||
|
||||
virtual bool isReadNotificationEnabled() const = 0;
|
||||
virtual void setReadNotificationEnabled(bool enable) = 0;
|
||||
virtual bool isWriteNotificationEnabled() const = 0;
|
||||
virtual void setWriteNotificationEnabled(bool enable) = 0;
|
||||
virtual bool isExceptionNotificationEnabled() const = 0;
|
||||
virtual void setExceptionNotificationEnabled(bool enable) = 0;
|
||||
bool isReadNotificationEnabled() const;
|
||||
void setReadNotificationEnabled(bool enable);
|
||||
bool isWriteNotificationEnabled() const;
|
||||
void setWriteNotificationEnabled(bool enable);
|
||||
bool isExceptionNotificationEnabled() const;
|
||||
void setExceptionNotificationEnabled(bool enable);
|
||||
|
||||
public Q_SLOTS:
|
||||
void readNotification();
|
||||
void writeNotification();
|
||||
void exceptionNotification();
|
||||
void connectionNotification();
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
|
||||
#endif
|
||||
|
||||
public:
|
||||
void setReceiver(QAbstractSocketEngineReceiver *receiver);
|
||||
|
@ -178,7 +169,77 @@ class QAbstractSocketEnginePrivate : public QObjectPrivate
|
|||
Q_DECLARE_PUBLIC(QAbstractSocketEngine)
|
||||
public:
|
||||
QAbstractSocketEnginePrivate();
|
||||
~QAbstractSocketEnginePrivate();
|
||||
|
||||
enum ErrorString {
|
||||
NonBlockingInitFailedErrorString,
|
||||
BroadcastingInitFailedErrorString,
|
||||
NoIpV6ErrorString,
|
||||
RemoteHostClosedErrorString,
|
||||
TimeOutErrorString,
|
||||
ResourceErrorString,
|
||||
OperationUnsupportedErrorString,
|
||||
ProtocolUnsupportedErrorString,
|
||||
InvalidSocketErrorString,
|
||||
HostUnreachableErrorString,
|
||||
NetworkUnreachableErrorString,
|
||||
AccessErrorString,
|
||||
ConnectionTimeOutErrorString,
|
||||
ConnectionRefusedErrorString,
|
||||
AddressInuseErrorString,
|
||||
AddressNotAvailableErrorString,
|
||||
AddressProtectedErrorString,
|
||||
DatagramTooLargeErrorString,
|
||||
SendDatagramErrorString,
|
||||
ReceiveDatagramErrorString,
|
||||
WriteErrorString,
|
||||
ReadErrorString,
|
||||
PortInuseErrorString,
|
||||
NotSocketErrorString,
|
||||
|
||||
UnknownSocketErrorString = -1
|
||||
};
|
||||
|
||||
void setError(QAbstractSocket::SocketError error, ErrorString errorString);
|
||||
|
||||
// native functions
|
||||
int option(QAbstractSocketEngine::SocketOption option) const;
|
||||
bool setOption(QAbstractSocketEngine::SocketOption option, int value);
|
||||
|
||||
bool createNewSocket(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
|
||||
bool nativeConnect(const QHostAddress &address, quint16 port);
|
||||
bool nativeBind(const QHostAddress &address, quint16 port);
|
||||
bool nativeListen();
|
||||
int nativeAccept();
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
bool nativeJoinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
bool nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
QNetworkInterface nativeMulticastInterface() const;
|
||||
bool nativeSetMulticastInterface(const QNetworkInterface &iface);
|
||||
#endif
|
||||
qint64 nativeBytesAvailable() const;
|
||||
|
||||
bool nativeHasPendingDatagrams() const;
|
||||
qint64 nativePendingDatagramSize() const;
|
||||
qint64 nativeReceiveDatagram(char *data, qint64 maxLength,
|
||||
QHostAddress *address, quint16 *port);
|
||||
qint64 nativeSendDatagram(const char *data, qint64 length,
|
||||
const QHostAddress &host, quint16 port);
|
||||
qint64 nativeRead(char *data, qint64 maxLength);
|
||||
qint64 nativeWrite(const char *data, qint64 length);
|
||||
int nativeSelect(int timeout, bool selectForRead) const;
|
||||
int nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||
bool *selectForRead, bool *selectForWrite) const;
|
||||
|
||||
void nativeClose();
|
||||
|
||||
bool fetchConnectionParameters();
|
||||
|
||||
int socketDescriptor;
|
||||
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
|
||||
QAbstractSocket::SocketError socketError;
|
||||
bool hasSetSocketError;
|
||||
QString socketErrorString;
|
||||
|
|
|
@ -19,19 +19,22 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
//#define QNATIVESOCKETENGINE_DEBUG
|
||||
#include "qnativesocketengine_p.h"
|
||||
//#define QABSTRACTSOCKETENGINE_DEBUG
|
||||
|
||||
#include "qabstractsocketengine_p.h"
|
||||
#include "qnet_unix_p.h"
|
||||
#include "qiodevice.h"
|
||||
#include "qhostaddress.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "qnetworkinterface.h"
|
||||
#include "qplatformdefs.h"
|
||||
#include "qcorecommon_p.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
@ -85,7 +88,7 @@ static inline void qt_socket_getPortAndAddress(const struct sockaddr_storage *ss
|
|||
Creates and returns a new socket descriptor of type \a socketType
|
||||
and \a socketProtocol. Returns -1 on failure.
|
||||
*/
|
||||
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType,
|
||||
bool QAbstractSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType,
|
||||
QAbstractSocket::NetworkLayerProtocol socketProtocol)
|
||||
{
|
||||
#ifndef QT_NO_IPV6
|
||||
|
@ -128,9 +131,9 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
|
|||
/*
|
||||
Returns the value of the socket option \a opt.
|
||||
*/
|
||||
int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) const
|
||||
int QAbstractSocketEnginePrivate::option(QAbstractSocketEngine::SocketOption opt) const
|
||||
{
|
||||
Q_Q(const QNativeSocketEngine);
|
||||
Q_Q(const QAbstractSocketEngine);
|
||||
if (!q->isValid())
|
||||
return -1;
|
||||
|
||||
|
@ -138,25 +141,25 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
|
|||
int level = SOL_SOCKET; // default
|
||||
|
||||
switch (opt) {
|
||||
case QNativeSocketEngine::NonBlockingSocketOption:
|
||||
case QAbstractSocketEngine::NonBlockingSocketOption:
|
||||
break;
|
||||
case QNativeSocketEngine::BroadcastSocketOption:
|
||||
case QAbstractSocketEngine::BroadcastSocketOption:
|
||||
n = SO_BROADCAST;
|
||||
break;
|
||||
case QNativeSocketEngine::AddressReusable:
|
||||
case QAbstractSocketEngine::AddressReusable:
|
||||
n = SO_REUSEADDR;
|
||||
break;
|
||||
case QNativeSocketEngine::ReceiveOutOfBandData:
|
||||
case QAbstractSocketEngine::ReceiveOutOfBandData:
|
||||
n = SO_OOBINLINE;
|
||||
break;
|
||||
case QNativeSocketEngine::LowDelayOption:
|
||||
case QAbstractSocketEngine::LowDelayOption:
|
||||
level = IPPROTO_TCP;
|
||||
n = TCP_NODELAY;
|
||||
break;
|
||||
case QNativeSocketEngine::KeepAliveOption:
|
||||
case QAbstractSocketEngine::KeepAliveOption:
|
||||
n = SO_KEEPALIVE;
|
||||
break;
|
||||
case QNativeSocketEngine::MulticastTtlOption:
|
||||
case QAbstractSocketEngine::MulticastTtlOption:
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
level = IPPROTO_IPV6;
|
||||
|
@ -167,7 +170,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
|
|||
level = IPPROTO_IP;
|
||||
n = IP_MULTICAST_TTL;
|
||||
break;
|
||||
case QNativeSocketEngine::MulticastLoopbackOption:
|
||||
case QAbstractSocketEngine::MulticastLoopbackOption:
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
level = IPPROTO_IPV6;
|
||||
|
@ -192,9 +195,9 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
|
|||
/*
|
||||
Sets the socket option \a opt to \a v.
|
||||
*/
|
||||
bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt, int v)
|
||||
bool QAbstractSocketEnginePrivate::setOption(QAbstractSocketEngine::SocketOption opt, int v)
|
||||
{
|
||||
Q_Q(QNativeSocketEngine);
|
||||
Q_Q(QAbstractSocketEngine);
|
||||
if (!q->isValid())
|
||||
return false;
|
||||
|
||||
|
@ -202,40 +205,40 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
|
|||
int level = SOL_SOCKET; // default
|
||||
|
||||
switch (opt) {
|
||||
case QNativeSocketEngine::BroadcastSocketOption:
|
||||
case QAbstractSocketEngine::BroadcastSocketOption:
|
||||
n = SO_BROADCAST;
|
||||
break;
|
||||
case QNativeSocketEngine::NonBlockingSocketOption: {
|
||||
case QAbstractSocketEngine::NonBlockingSocketOption: {
|
||||
// Make the socket nonblocking.
|
||||
int flags = ::fcntl(socketDescriptor, F_GETFL, 0);
|
||||
if (flags == -1) {
|
||||
#ifdef QNATIVESOCKETENGINE_DEBUG
|
||||
perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_GETFL) failed");
|
||||
#ifdef QABSTRACTSOCKETENGINE_DEBUG
|
||||
perror("QAbstractSocketEnginePrivate::setOption(): fcntl(F_GETFL) failed");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
if (::fcntl(socketDescriptor, F_SETFL, flags | O_NONBLOCK) == -1) {
|
||||
#ifdef QNATIVESOCKETENGINE_DEBUG
|
||||
perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_SETFL) failed");
|
||||
#ifdef QABSTRACTSOCKETENGINE_DEBUG
|
||||
perror("QAbstractSocketEnginePrivate::setOption(): fcntl(F_SETFL) failed");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case QNativeSocketEngine::AddressReusable:
|
||||
case QAbstractSocketEngine::AddressReusable:
|
||||
n = SO_REUSEADDR;
|
||||
break;
|
||||
case QNativeSocketEngine::ReceiveOutOfBandData:
|
||||
case QAbstractSocketEngine::ReceiveOutOfBandData:
|
||||
n = SO_OOBINLINE;
|
||||
break;
|
||||
case QNativeSocketEngine::LowDelayOption:
|
||||
case QAbstractSocketEngine::LowDelayOption:
|
||||
level = IPPROTO_TCP;
|
||||
n = TCP_NODELAY;
|
||||
break;
|
||||
case QNativeSocketEngine::KeepAliveOption:
|
||||
case QAbstractSocketEngine::KeepAliveOption:
|
||||
n = SO_KEEPALIVE;
|
||||
break;
|
||||
case QNativeSocketEngine::MulticastTtlOption:
|
||||
case QAbstractSocketEngine::MulticastTtlOption:
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
level = IPPROTO_IPV6;
|
||||
|
@ -246,7 +249,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
|
|||
level = IPPROTO_IP;
|
||||
n = IP_MULTICAST_TTL;
|
||||
break;
|
||||
case QNativeSocketEngine::MulticastLoopbackOption:
|
||||
case QAbstractSocketEngine::MulticastLoopbackOption:
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
level = IPPROTO_IPV6;
|
||||
|
@ -262,10 +265,10 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
|
|||
return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port)
|
||||
bool QAbstractSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port)
|
||||
{
|
||||
#ifdef QNATIVESOCKETENGINE_DEBUG
|
||||
qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor);
|
||||
#ifdef QABSTRACTSOCKETENGINE_DEBUG
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor);
|
||||
#endif
|
||||
|
||||
struct sockaddr_in sockAddrIPv4;
|
||||
|
@ -352,8 +355,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
|
|||
}
|
||||
|
||||
if (socketState != QAbstractSocket::ConnectedState) {
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeConnect(%s, %i) == false (%s)",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeConnect(%s, %i) == false (%s)",
|
||||
addr.toString().toLatin1().constData(), port,
|
||||
socketState == QAbstractSocket::ConnectingState
|
||||
? "Connection in progress" : socketErrorString.toLatin1().constData());
|
||||
|
@ -362,8 +365,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeConnect(%s, %i) == true",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeConnect(%s, %i) == true",
|
||||
addr.toString().toLatin1().constData(), port);
|
||||
#endif
|
||||
|
||||
|
@ -371,7 +374,7 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 port)
|
||||
bool QAbstractSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 port)
|
||||
{
|
||||
struct sockaddr_in sockAddrIPv4;
|
||||
struct sockaddr *sockAddrPtr = 0;
|
||||
|
@ -424,23 +427,23 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16
|
|||
break;
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == false (%s)",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeBind(%s, %i) == false (%s)",
|
||||
address.toString().toLatin1().constData(), port, socketErrorString.toLatin1().constData());
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeBind(%s, %i) == true",
|
||||
address.toString().toLatin1().constData(), port);
|
||||
#endif
|
||||
socketState = QAbstractSocket::BoundState;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeListen()
|
||||
bool QAbstractSocketEnginePrivate::nativeListen()
|
||||
{
|
||||
if (::listen(socketDescriptor, SOMAXCONN) < 0) {
|
||||
switch (errno) {
|
||||
|
@ -456,22 +459,22 @@ bool QNativeSocketEnginePrivate::nativeListen()
|
|||
break;
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == false (%s)",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeListen(%i) == false (%s)",
|
||||
SOMAXCONN, socketErrorString.toLatin1().constData());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == true", SOMAXCONN);
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeListen(%i) == true", SOMAXCONN);
|
||||
#endif
|
||||
|
||||
socketState = QAbstractSocket::ListeningState;
|
||||
return true;
|
||||
}
|
||||
|
||||
int QNativeSocketEnginePrivate::nativeAccept()
|
||||
int QAbstractSocketEnginePrivate::nativeAccept()
|
||||
{
|
||||
int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0);
|
||||
if (acceptedDescriptor == -1) {
|
||||
|
@ -490,7 +493,7 @@ int QNativeSocketEnginePrivate::nativeAccept()
|
|||
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
|
||||
static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,
|
||||
static bool multicastMembershipHelper(QAbstractSocketEnginePrivate *d,
|
||||
int how6,
|
||||
int how4,
|
||||
const QHostAddress &groupAddress,
|
||||
|
@ -531,7 +534,7 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,
|
|||
mreq4.imr_interface.s_addr = htonl(firstIP.toIPv4Address());
|
||||
} else {
|
||||
d->setError(QAbstractSocket::NetworkError,
|
||||
QNativeSocketEnginePrivate::NetworkUnreachableErrorString);
|
||||
QAbstractSocketEnginePrivate::NetworkUnreachableErrorString);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -540,7 +543,7 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,
|
|||
} else {
|
||||
// unreachable
|
||||
d->setError(QAbstractSocket::UnsupportedSocketOperationError,
|
||||
QNativeSocketEnginePrivate::ProtocolUnsupportedErrorString);
|
||||
QAbstractSocketEnginePrivate::ProtocolUnsupportedErrorString);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -549,15 +552,15 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,
|
|||
switch (errno) {
|
||||
case ENOPROTOOPT:
|
||||
d->setError(QAbstractSocket::UnsupportedSocketOperationError,
|
||||
QNativeSocketEnginePrivate::OperationUnsupportedErrorString);
|
||||
QAbstractSocketEnginePrivate::OperationUnsupportedErrorString);
|
||||
break;
|
||||
case EADDRNOTAVAIL:
|
||||
d->setError(QAbstractSocket::SocketAddressNotAvailableError,
|
||||
QNativeSocketEnginePrivate::AddressNotAvailableErrorString);
|
||||
QAbstractSocketEnginePrivate::AddressNotAvailableErrorString);
|
||||
break;
|
||||
default:
|
||||
d->setError(QAbstractSocket::UnknownSocketError,
|
||||
QNativeSocketEnginePrivate::UnknownSocketErrorString);
|
||||
QAbstractSocketEnginePrivate::UnknownSocketErrorString);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
@ -565,7 +568,7 @@ static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress,
|
||||
bool QAbstractSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &interface)
|
||||
{
|
||||
return multicastMembershipHelper(this,
|
||||
|
@ -579,7 +582,7 @@ bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &gr
|
|||
interface);
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
bool QAbstractSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &interface)
|
||||
{
|
||||
return multicastMembershipHelper(this,
|
||||
|
@ -593,7 +596,7 @@ bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &g
|
|||
interface);
|
||||
}
|
||||
|
||||
QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const
|
||||
QNetworkInterface QAbstractSocketEnginePrivate::nativeMulticastInterface() const
|
||||
{
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
|
@ -625,7 +628,7 @@ QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const
|
|||
return QNetworkInterface();
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInterface &iface)
|
||||
bool QAbstractSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInterface &iface)
|
||||
{
|
||||
#ifndef QT_NO_IPV6
|
||||
if (socketProtocol == QAbstractSocket::IPv6Protocol) {
|
||||
|
@ -656,7 +659,7 @@ bool QNativeSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInter
|
|||
|
||||
#endif // QT_NO_NETWORKINTERFACE
|
||||
|
||||
qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
|
||||
qint64 QAbstractSocketEnginePrivate::nativeBytesAvailable() const
|
||||
{
|
||||
int nbytes = 0;
|
||||
// gives shorter than true amounts on Unix domain sockets.
|
||||
|
@ -664,13 +667,13 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
|
|||
if (::ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0)
|
||||
available = (qint64) nbytes;
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeBytesAvailable() == %lli", available);
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeBytesAvailable() == %lli", available);
|
||||
#endif
|
||||
return available;
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
|
||||
bool QAbstractSocketEnginePrivate::nativeHasPendingDatagrams() const
|
||||
{
|
||||
// Create a sockaddr struct and reset its port number.
|
||||
struct sockaddr_storage ss;
|
||||
|
@ -688,14 +691,14 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
|
|||
// pending datagram.
|
||||
bool result = (readBytes != -1) || errno == EMSGSIZE;
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeHasPendingDatagrams() == %s",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeHasPendingDatagrams() == %s",
|
||||
result ? "true" : "false");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
|
||||
qint64 QAbstractSocketEnginePrivate::nativePendingDatagramSize() const
|
||||
{
|
||||
ssize_t udpMessagePeekBufferSize = QT_BUFFSIZE;
|
||||
ssize_t recvResult = -1;
|
||||
|
@ -714,14 +717,14 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
|
|||
udpMessagePeekBufferSize = (udpMessagePeekBufferSize * 2);
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult);
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult);
|
||||
#endif
|
||||
|
||||
return qint64(recvResult);
|
||||
}
|
||||
|
||||
qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxSize,
|
||||
qint64 QAbstractSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxSize,
|
||||
QHostAddress *address, quint16 *port)
|
||||
{
|
||||
struct sockaddr_storage ss;
|
||||
|
@ -740,8 +743,8 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
|
|||
qt_socket_getPortAndAddress(&ss, port, address);
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli",
|
||||
data, qt_prettyDebug(data, qMin(recvFromResult, ssize_t(16)), recvFromResult).data(), maxSize,
|
||||
address ? address->toString().toLatin1().constData() : "(nil)",
|
||||
port ? *port : 0, (qint64) recvFromResult);
|
||||
|
@ -750,7 +753,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
|
|||
return qint64(maxSize ? recvFromResult : recvFromResult == -1 ? -1 : 0);
|
||||
}
|
||||
|
||||
qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 len,
|
||||
qint64 QAbstractSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 len,
|
||||
const QHostAddress &host, quint16 port)
|
||||
{
|
||||
struct sockaddr_in sockAddrIPv4;
|
||||
|
@ -800,8 +803,8 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,
|
||||
qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len, host.toString().toLatin1().constData(),
|
||||
port, (qint64) sentBytes);
|
||||
#endif
|
||||
|
@ -809,7 +812,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
|
|||
return qint64(sentBytes);
|
||||
}
|
||||
|
||||
bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
||||
bool QAbstractSocketEnginePrivate::fetchConnectionParameters()
|
||||
{
|
||||
localPort = 0;
|
||||
localAddress.clear();
|
||||
|
@ -864,7 +867,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
|||
else
|
||||
socketType = QAbstractSocket::UnknownSocketType;
|
||||
}
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
QString socketProtocolStr = "UnknownProtocol";
|
||||
if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = "IPv4Protocol";
|
||||
else if (socketProtocol == QAbstractSocket::IPv6Protocol) socketProtocolStr = "IPv6Protocol";
|
||||
|
@ -873,7 +876,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
|||
if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = "TcpSocket";
|
||||
else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = "UdpSocket";
|
||||
|
||||
qDebug("QNativeSocketEnginePrivate::fetchConnectionParameters() local == %s:%i,"
|
||||
qDebug("QAbstractSocketEnginePrivate::fetchConnectionParameters() local == %s:%i,"
|
||||
" peer == %s:%i, socket == %s - %s",
|
||||
localAddress.toString().toLatin1().constData(), localPort,
|
||||
peerAddress.toString().toLatin1().constData(), peerPort,socketTypeStr.toLatin1().constData(),
|
||||
|
@ -882,18 +885,18 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
|
|||
return true;
|
||||
}
|
||||
|
||||
void QNativeSocketEnginePrivate::nativeClose()
|
||||
void QAbstractSocketEnginePrivate::nativeClose()
|
||||
{
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEngine::nativeClose()");
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEngine::nativeClose()");
|
||||
#endif
|
||||
|
||||
qt_safe_close(socketDescriptor);
|
||||
}
|
||||
|
||||
qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
|
||||
qint64 QAbstractSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
|
||||
{
|
||||
Q_Q(QNativeSocketEngine);
|
||||
Q_Q(QAbstractSocketEngine);
|
||||
|
||||
qint64 writtenBytes = qt_safe_write_nosignal(socketDescriptor, data, len);
|
||||
|
||||
|
@ -916,8 +919,8 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %llu) == %i",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeWrite(%p \"%s\", %llu) == %i",
|
||||
data, qt_prettyDebug(data, qMin((int) len, 16),
|
||||
(int) len).data(), len, (int) writtenBytes);
|
||||
#endif
|
||||
|
@ -926,11 +929,11 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)
|
|||
}
|
||||
/*
|
||||
*/
|
||||
qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
||||
qint64 QAbstractSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
||||
{
|
||||
Q_Q(QNativeSocketEngine);
|
||||
Q_Q(QAbstractSocketEngine);
|
||||
if (!q->isValid()) {
|
||||
qWarning("QNativeSocketEngine::nativeRead: Invalid socket");
|
||||
qWarning("QAbstractSocketEngine::nativeRead: Invalid socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -959,8 +962,8 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (QNATIVESOCKETENGINE_DEBUG)
|
||||
qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %llu) == %i",
|
||||
#if defined (QABSTRACTSOCKETENGINE_DEBUG)
|
||||
qDebug("QAbstractSocketEnginePrivate::nativeRead(%p \"%s\", %llu) == %i",
|
||||
data, qt_prettyDebug(data, qMin(r, qint64(16)), r).data(),
|
||||
maxSize, r);
|
||||
#endif
|
||||
|
@ -968,7 +971,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
|||
return r;
|
||||
}
|
||||
|
||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||
int QAbstractSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||
{
|
||||
struct pollfd fds;
|
||||
::memset(&fds, 0, sizeof(struct pollfd));
|
||||
|
@ -977,7 +980,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co
|
|||
return qt_safe_poll(&fds, 1, timeout);
|
||||
}
|
||||
|
||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||
int QAbstractSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||
bool *selectForRead, bool *selectForWrite) const
|
||||
{
|
||||
struct pollfd fds;
|
File diff suppressed because it is too large
Load diff
|
@ -1,201 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNATIVESOCKETENGINE_P_H
|
||||
#define QNATIVESOCKETENGINE_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Katie API. It exists for the convenience
|
||||
// of the QLibrary class. This header file may change from
|
||||
// version to version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
#include "QtNetwork/qhostaddress.h"
|
||||
#include "qabstractsocketengine_p.h"
|
||||
#include "qplatformdefs.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QNativeSocketEnginePrivate;
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
class QNetworkInterface;
|
||||
#endif
|
||||
|
||||
class Q_AUTOTEST_EXPORT QNativeSocketEngine : public QAbstractSocketEngine
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QNativeSocketEngine(QObject *parent = nullptr);
|
||||
~QNativeSocketEngine();
|
||||
|
||||
bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol);
|
||||
bool initialize(int socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState);
|
||||
|
||||
int socketDescriptor() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
bool connectToHost(const QHostAddress &address, quint16 port);
|
||||
bool bind(const QHostAddress &address, quint16 port);
|
||||
bool listen();
|
||||
int accept();
|
||||
void close();
|
||||
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
bool joinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
bool leaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
QNetworkInterface multicastInterface() const;
|
||||
bool setMulticastInterface(const QNetworkInterface &iface);
|
||||
#endif
|
||||
|
||||
qint64 bytesAvailable() const;
|
||||
|
||||
qint64 read(char *data, qint64 maxlen);
|
||||
qint64 write(const char *data, qint64 len);
|
||||
|
||||
qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0,
|
||||
quint16 *port = 0);
|
||||
qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr,
|
||||
quint16 port);
|
||||
bool hasPendingDatagrams() const;
|
||||
qint64 pendingDatagramSize() const;
|
||||
|
||||
qint64 bytesToWrite() const;
|
||||
|
||||
int option(SocketOption option) const;
|
||||
bool setOption(SocketOption option, int value);
|
||||
|
||||
bool waitForRead(int msecs = 30000, bool *timedOut = 0);
|
||||
bool waitForWrite(int msecs = 30000, bool *timedOut = 0);
|
||||
bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
|
||||
bool checkRead, bool checkWrite,
|
||||
int msecs = 30000, bool *timedOut = 0);
|
||||
|
||||
bool isReadNotificationEnabled() const;
|
||||
void setReadNotificationEnabled(bool enable);
|
||||
bool isWriteNotificationEnabled() const;
|
||||
void setWriteNotificationEnabled(bool enable);
|
||||
bool isExceptionNotificationEnabled() const;
|
||||
void setExceptionNotificationEnabled(bool enable);
|
||||
|
||||
public Q_SLOTS:
|
||||
// non-virtual override;
|
||||
void connectionNotification();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QNativeSocketEngine)
|
||||
Q_DISABLE_COPY(QNativeSocketEngine)
|
||||
};
|
||||
|
||||
class QSocketNotifier;
|
||||
|
||||
class QNativeSocketEnginePrivate : public QAbstractSocketEnginePrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QNativeSocketEngine)
|
||||
public:
|
||||
QNativeSocketEnginePrivate();
|
||||
~QNativeSocketEnginePrivate();
|
||||
|
||||
int socketDescriptor;
|
||||
|
||||
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
|
||||
|
||||
enum ErrorString {
|
||||
NonBlockingInitFailedErrorString,
|
||||
BroadcastingInitFailedErrorString,
|
||||
NoIpV6ErrorString,
|
||||
RemoteHostClosedErrorString,
|
||||
TimeOutErrorString,
|
||||
ResourceErrorString,
|
||||
OperationUnsupportedErrorString,
|
||||
ProtocolUnsupportedErrorString,
|
||||
InvalidSocketErrorString,
|
||||
HostUnreachableErrorString,
|
||||
NetworkUnreachableErrorString,
|
||||
AccessErrorString,
|
||||
ConnectionTimeOutErrorString,
|
||||
ConnectionRefusedErrorString,
|
||||
AddressInuseErrorString,
|
||||
AddressNotAvailableErrorString,
|
||||
AddressProtectedErrorString,
|
||||
DatagramTooLargeErrorString,
|
||||
SendDatagramErrorString,
|
||||
ReceiveDatagramErrorString,
|
||||
WriteErrorString,
|
||||
ReadErrorString,
|
||||
PortInuseErrorString,
|
||||
NotSocketErrorString,
|
||||
InvalidProxyTypeString,
|
||||
|
||||
UnknownSocketErrorString = -1
|
||||
};
|
||||
|
||||
void setError(QAbstractSocket::SocketError error, ErrorString errorString);
|
||||
|
||||
// native functions
|
||||
int option(QNativeSocketEngine::SocketOption option) const;
|
||||
bool setOption(QNativeSocketEngine::SocketOption option, int value);
|
||||
|
||||
bool createNewSocket(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol);
|
||||
|
||||
bool nativeConnect(const QHostAddress &address, quint16 port);
|
||||
bool nativeBind(const QHostAddress &address, quint16 port);
|
||||
bool nativeListen();
|
||||
int nativeAccept();
|
||||
#ifndef QT_NO_NETWORKINTERFACE
|
||||
bool nativeJoinMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
bool nativeLeaveMulticastGroup(const QHostAddress &groupAddress,
|
||||
const QNetworkInterface &iface);
|
||||
QNetworkInterface nativeMulticastInterface() const;
|
||||
bool nativeSetMulticastInterface(const QNetworkInterface &iface);
|
||||
#endif
|
||||
qint64 nativeBytesAvailable() const;
|
||||
|
||||
bool nativeHasPendingDatagrams() const;
|
||||
qint64 nativePendingDatagramSize() const;
|
||||
qint64 nativeReceiveDatagram(char *data, qint64 maxLength,
|
||||
QHostAddress *address, quint16 *port);
|
||||
qint64 nativeSendDatagram(const char *data, qint64 length,
|
||||
const QHostAddress &host, quint16 port);
|
||||
qint64 nativeRead(char *data, qint64 maxLength);
|
||||
qint64 nativeWrite(const char *data, qint64 length);
|
||||
int nativeSelect(int timeout, bool selectForRead) const;
|
||||
int nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||
bool *selectForRead, bool *selectForWrite) const;
|
||||
|
||||
void nativeClose();
|
||||
|
||||
bool checkProxy(const QHostAddress &address);
|
||||
bool fetchConnectionParameters();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QNATIVESOCKETENGINE_P_H
|
|
@ -82,7 +82,6 @@
|
|||
#include "qabstractsocketengine_p.h"
|
||||
#include "qtcpserver.h"
|
||||
#include "qtcpsocket.h"
|
||||
#include "qnetworkproxy.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -111,20 +110,11 @@ public:
|
|||
|
||||
int maxConnections;
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
QNetworkProxy proxy;
|
||||
QNetworkProxy resolveProxy(const QHostAddress &address, quint16 port);
|
||||
#endif
|
||||
|
||||
// from QAbstractSocketEngineReceiver
|
||||
void readNotification();
|
||||
inline void writeNotification() {}
|
||||
inline void exceptionNotification() {}
|
||||
inline void connectionNotification() {}
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
inline void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *) {}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/*! \internal
|
||||
|
@ -144,39 +134,6 @@ QTcpServerPrivate::~QTcpServerPrivate()
|
|||
{
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
/*! \internal
|
||||
|
||||
Resolve the proxy to its final value.
|
||||
*/
|
||||
QNetworkProxy QTcpServerPrivate::resolveProxy(const QHostAddress &address, quint16 port)
|
||||
{
|
||||
if (address == QHostAddress::LocalHost ||
|
||||
address == QHostAddress::LocalHostIPv6)
|
||||
return QNetworkProxy::NoProxy;
|
||||
|
||||
QList<QNetworkProxy> proxies;
|
||||
if (proxy.type() != QNetworkProxy::DefaultProxy) {
|
||||
// a non-default proxy was set with setProxy
|
||||
proxies << proxy;
|
||||
} else {
|
||||
// try the application settings instead
|
||||
QNetworkProxyQuery query(port, QString(), QNetworkProxyQuery::TcpServer);
|
||||
proxies = QNetworkProxyFactory::proxyForQuery(query);
|
||||
}
|
||||
|
||||
// return the first that we can use
|
||||
foreach (const QNetworkProxy &p, proxies) {
|
||||
if (p.capabilities() & QNetworkProxy::ListeningCapability)
|
||||
return p;
|
||||
}
|
||||
|
||||
// no proxy found
|
||||
// DefaultProxy will raise an error
|
||||
return QNetworkProxy(QNetworkProxy::DefaultProxy);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
void QTcpServerPrivate::readNotification()
|
||||
|
@ -251,22 +208,15 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
|
|||
return false;
|
||||
}
|
||||
|
||||
QAbstractSocket::NetworkLayerProtocol proto = address.protocol();
|
||||
|
||||
#ifdef QT_NO_NETWORKPROXY
|
||||
static const QNetworkProxy &proxy = *(QNetworkProxy *)0;
|
||||
#else
|
||||
QNetworkProxy proxy = d->resolveProxy(address, port);
|
||||
#endif
|
||||
|
||||
delete d->socketEngine;
|
||||
d->socketEngine = QAbstractSocketEngine::createSocketEngine(QAbstractSocket::TcpSocket, proxy, this);
|
||||
d->socketEngine = nullptr;
|
||||
d->socketEngine = new QAbstractSocketEngine(this);
|
||||
if (!d->socketEngine) {
|
||||
d->serverSocketError = QAbstractSocket::UnsupportedSocketOperationError;
|
||||
d->serverSocketErrorString = tr("Operation on socket is not supported");
|
||||
return false;
|
||||
}
|
||||
if (!d->socketEngine->initialize(QAbstractSocket::TcpSocket, proto)) {
|
||||
if (!d->socketEngine->initialize(QAbstractSocket::TcpSocket, address.protocol())) {
|
||||
d->serverSocketError = d->socketEngine->error();
|
||||
d->serverSocketErrorString = d->socketEngine->errorString();
|
||||
return false;
|
||||
|
@ -347,9 +297,6 @@ void QTcpServer::close()
|
|||
Returns the native socket descriptor the server uses to listen
|
||||
for incoming instructions, or -1 if the server is not listening.
|
||||
|
||||
If the server is using QNetworkProxy, the returned descriptor may
|
||||
not be usable with native socket functions.
|
||||
|
||||
\sa setSocketDescriptor(), isListening()
|
||||
*/
|
||||
int QTcpServer::socketDescriptor() const
|
||||
|
@ -378,12 +325,7 @@ bool QTcpServer::setSocketDescriptor(int socketDescriptor)
|
|||
|
||||
if (d->socketEngine)
|
||||
delete d->socketEngine;
|
||||
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this);
|
||||
if (!d->socketEngine) {
|
||||
d->serverSocketError = QAbstractSocket::UnsupportedSocketOperationError;
|
||||
d->serverSocketErrorString = tr("Operation on socket is not supported");
|
||||
return false;
|
||||
}
|
||||
d->socketEngine = new QAbstractSocketEngine(this);
|
||||
if (!d->socketEngine->initialize(socketDescriptor, QAbstractSocket::ListeningState)) {
|
||||
d->serverSocketError = d->socketEngine->error();
|
||||
d->serverSocketErrorString = d->socketEngine->errorString();
|
||||
|
@ -525,10 +467,6 @@ QTcpSocket *QTcpServer::nextPendingConnection()
|
|||
Reimplement this function to alter the server's behavior when a
|
||||
connection is available.
|
||||
|
||||
If this server is using QNetworkProxy then the \a socketDescriptor
|
||||
may not be usable with native socket functions, and should only be
|
||||
used with QTcpSocket::setSocketDescriptor().
|
||||
|
||||
\note If you want to handle an incoming connection as a new QTcpSocket
|
||||
object in another thread you have to pass the socketDescriptor
|
||||
to the other thread and create the QTcpSocket object there and
|
||||
|
@ -615,43 +553,6 @@ QString QTcpServer::errorString() const
|
|||
return d_func()->serverSocketErrorString;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Sets the explicit network proxy for this socket to \a networkProxy.
|
||||
|
||||
To disable the use of a proxy for this socket, use the
|
||||
QNetworkProxy::NoProxy proxy type:
|
||||
|
||||
\snippet doc/src/snippets/code/src_network_socket_qtcpserver.cpp 0
|
||||
|
||||
\sa proxy(), QNetworkProxy
|
||||
*/
|
||||
void QTcpServer::setProxy(const QNetworkProxy &networkProxy)
|
||||
{
|
||||
Q_D(QTcpServer);
|
||||
d->proxy = networkProxy;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Returns the network proxy for this socket.
|
||||
By default QNetworkProxy::DefaultProxy is used.
|
||||
|
||||
\sa setProxy(), QNetworkProxy
|
||||
*/
|
||||
QNetworkProxy QTcpServer::proxy() const
|
||||
{
|
||||
Q_D(const QTcpServer);
|
||||
return d->proxy;
|
||||
}
|
||||
#endif // QT_NO_NETWORKPROXY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
|
||||
|
||||
#include "moc_qtcpserver.h"
|
||||
|
|
|
@ -29,11 +29,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QTcpServerPrivate;
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
class QNetworkProxy;
|
||||
#endif
|
||||
class QTcpSocket;
|
||||
|
||||
class Q_NETWORK_EXPORT QTcpServer : public QObject
|
||||
|
@ -64,11 +60,6 @@ public:
|
|||
QAbstractSocket::SocketError serverError() const;
|
||||
QString errorString() const;
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void setProxy(const QNetworkProxy &networkProxy);
|
||||
QNetworkProxy proxy() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void incomingConnection(int handle);
|
||||
void addPendingConnection(QTcpSocket* socket);
|
||||
|
|
|
@ -178,7 +178,6 @@ bool QUdpSocketPrivate::doEnsureInitialized(const QHostAddress &bindAddress, qui
|
|||
|
||||
// now check if the socket engine is initialized and to the right type
|
||||
if (!socketEngine || !socketEngine->isValid()) {
|
||||
resolveProxy(remoteAddress.toString(), bindPort);
|
||||
if (!initSocketLayer(address->protocol()))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ static const struct ClassTblData {
|
|||
{ QLatin1String("QApplication"), QLatin1String("QtGui/qapplication.h") },
|
||||
{ QLatin1String("QAtomicInt"), QLatin1String("QtCore/qatomic.h") },
|
||||
{ QLatin1String("QAtomicPointer"), QLatin1String("QtCore/qatomic.h") },
|
||||
{ QLatin1String("QAuthenticator"), QLatin1String("QtNetwork/qauthenticator.h") },
|
||||
{ QLatin1String("QBasicTimer"), QLatin1String("QtCore/qbasictimer.h") },
|
||||
{ QLatin1String("QBenchmarkIterationController"), QLatin1String("QtTest/qbenchmark.h") },
|
||||
{ QLatin1String("QBitArray"), QLatin1String("QtCore/qbitarray.h") },
|
||||
|
@ -384,9 +383,6 @@ static const struct ClassTblData {
|
|||
{ QLatin1String("QMutexLocker"), QLatin1String("QtCore/qmutex.h") },
|
||||
{ QLatin1String("QNetworkAddressEntry"), QLatin1String("QtNetwork/qnetworkinterface.h") },
|
||||
{ QLatin1String("QNetworkInterface"), QLatin1String("QtNetwork/qnetworkinterface.h") },
|
||||
{ QLatin1String("QNetworkProxy"), QLatin1String("QtNetwork/qnetworkproxy.h") },
|
||||
{ QLatin1String("QNetworkProxyFactory"), QLatin1String("QtNetwork/qnetworkproxy.h") },
|
||||
{ QLatin1String("QNetworkProxyQuery"), QLatin1String("QtNetwork/qnetworkproxy.h") },
|
||||
{ QLatin1String("QObject"), QLatin1String("QtCore/qobject.h") },
|
||||
{ QLatin1String("QObjectCleanupHandler"), QLatin1String("QtCore/qobjectcleanuphandler.h") },
|
||||
{ QLatin1String("QPageSetupDialog"), QLatin1String("QtGui/qpagesetupdialog.h") },
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
katie_test(tst_qnetworkproxy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tst_qnetworkproxy.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(tst_qnetworkproxy KtNetwork)
|
|
@ -1,99 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the test suite of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qdebug.h>
|
||||
#include <qnetworkproxy.h>
|
||||
|
||||
//TESTED_CLASS=
|
||||
//TESTED_FILES=
|
||||
|
||||
class tst_QNetworkProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QNetworkProxy();
|
||||
virtual ~tst_QNetworkProxy();
|
||||
|
||||
private slots:
|
||||
void getSetCheck();
|
||||
void capabilitiesPerType();
|
||||
};
|
||||
|
||||
tst_QNetworkProxy::tst_QNetworkProxy()
|
||||
{
|
||||
}
|
||||
|
||||
tst_QNetworkProxy::~tst_QNetworkProxy()
|
||||
{
|
||||
}
|
||||
|
||||
// Testing get/set functions
|
||||
void tst_QNetworkProxy::getSetCheck()
|
||||
{
|
||||
QNetworkProxy obj1;
|
||||
// quint16 QNetworkProxy::port()
|
||||
// void QNetworkProxy::setPort(quint16)
|
||||
obj1.setPort(quint16(0));
|
||||
QCOMPARE(quint16(0), obj1.port());
|
||||
obj1.setPort(quint16(0xffff));
|
||||
QCOMPARE(quint16(0xffff), obj1.port());
|
||||
|
||||
obj1.setType(QNetworkProxy::DefaultProxy);
|
||||
QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy);
|
||||
obj1.setType(QNetworkProxy::HttpProxy);
|
||||
QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy);
|
||||
obj1.setType(QNetworkProxy::Socks5Proxy);
|
||||
QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy);
|
||||
}
|
||||
|
||||
void tst_QNetworkProxy::capabilitiesPerType()
|
||||
{
|
||||
QNetworkProxy proxy(QNetworkProxy::Socks5Proxy);
|
||||
QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability);
|
||||
QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
|
||||
QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
|
||||
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
// verify that the capabilities changed
|
||||
QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability));
|
||||
QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability);
|
||||
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability);
|
||||
QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability));
|
||||
|
||||
// now set the capabilities on stone:
|
||||
proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
|
||||
QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
|
||||
|
||||
// changing the type shouldn't change the capabilities any more
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QNetworkProxy)
|
||||
|
||||
#include "moc_tst_qnetworkproxy.cpp"
|
|
@ -1,5 +0,0 @@
|
|||
katie_test(tst_qnetworkproxyfactory
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tst_qnetworkproxyfactory.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(tst_qnetworkproxyfactory KtNetwork)
|
|
@ -1,243 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the test suite of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtTest/QTest>
|
||||
#include <QtTest/QTestEventLoop>
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qdebug.h>
|
||||
#include <qnetworkproxy.h>
|
||||
#include <QNetworkInterface>
|
||||
#include <QList>
|
||||
#include <QThread>
|
||||
|
||||
Q_DECLARE_METATYPE(QList<QNetworkProxy>);
|
||||
|
||||
class tst_QNetworkProxyFactory : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QNetworkProxyFactory();
|
||||
|
||||
class QDebugProxyFactory : public QNetworkProxyFactory
|
||||
{
|
||||
public:
|
||||
virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery())
|
||||
{
|
||||
returnedList = QNetworkProxyFactory::systemProxyForQuery(query);
|
||||
requestCounter++;
|
||||
return returnedList;
|
||||
}
|
||||
QList<QNetworkProxy> returnedList;
|
||||
int requestCounter;
|
||||
};
|
||||
|
||||
private slots:
|
||||
void systemProxyForQueryCalledFromThread();
|
||||
void systemProxyForQuery_data();
|
||||
void systemProxyForQuery() const;
|
||||
|
||||
private:
|
||||
QString formatProxyName(const QNetworkProxy & proxy) const;
|
||||
QDebugProxyFactory *factory;
|
||||
};
|
||||
|
||||
tst_QNetworkProxyFactory::tst_QNetworkProxyFactory()
|
||||
{
|
||||
factory = new QDebugProxyFactory;
|
||||
QNetworkProxyFactory::setApplicationProxyFactory(factory);
|
||||
}
|
||||
|
||||
QString tst_QNetworkProxyFactory::formatProxyName(const QNetworkProxy & proxy) const
|
||||
{
|
||||
QString proxyName;
|
||||
if (!proxy.user().isNull())
|
||||
proxyName = QString::fromLatin1("%1:%2@").arg(proxy.user(), proxy.password());
|
||||
proxyName.append(QString("%1:%2").arg(proxy.hostName()).arg(proxy.port()));
|
||||
proxyName.append(QString(" (type=%1, capabilities=%2)").arg(proxy.type()).arg(proxy.capabilities()));
|
||||
|
||||
return proxyName;
|
||||
}
|
||||
|
||||
void tst_QNetworkProxyFactory::systemProxyForQuery_data()
|
||||
{
|
||||
QTest::addColumn<int>("type");
|
||||
QTest::addColumn<QUrl>("url");
|
||||
QTest::addColumn<QString>("tag");
|
||||
QTest::addColumn<QString>("hostName");
|
||||
QTest::addColumn<int>("port");
|
||||
QTest::addColumn<int>("requiredCapabilities");
|
||||
|
||||
//URLs
|
||||
QTest::newRow("http") << (int)QNetworkProxyQuery::UrlRequest << QUrl("http://qt-project.org") << QString() << QString() << 0 << 0;
|
||||
//windows: "intranet" should be bypassed if "bypass proxy server for local addresses" is ticked
|
||||
QTest::newRow("intranet") << (int)QNetworkProxyQuery::UrlRequest << QUrl("http://qt-test-server") << QString() << QString() << 0 << 0;
|
||||
//windows: "intranet2" should be bypassed if "*.local" is in the exceptions list (advanced settings)
|
||||
QTest::newRow("intranet2") << (int)QNetworkProxyQuery::UrlRequest << QUrl("http://qt-test-server.local") << QString() << QString() << 0 << 0;
|
||||
QTest::newRow("https") << (int)QNetworkProxyQuery::UrlRequest << QUrl("https://qt-project.org") << QString() << QString() << 0 << (int)QNetworkProxy::TunnelingCapability;
|
||||
QTest::newRow("ftp") << (int)QNetworkProxyQuery::UrlRequest << QUrl("ftp://qt-project.org") << QString() << QString() << 0 << 0;
|
||||
|
||||
//TCP
|
||||
QTest::newRow("imap") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString() << QString("qt-project.org") << 0 << (int)QNetworkProxy::TunnelingCapability;
|
||||
QTest::newRow("autobind-server") << (int)QNetworkProxyQuery::TcpServer << QUrl() << QString() << QString() << 0 << (int)QNetworkProxy::ListeningCapability;
|
||||
QTest::newRow("web-server") << (int)QNetworkProxyQuery::TcpServer << QUrl() << QString() << QString() << 80 << (int)QNetworkProxy::ListeningCapability;
|
||||
//windows: these should be bypassed if "bypass proxy server for local addresses" is ticked
|
||||
foreach (QHostAddress address, QNetworkInterface::allAddresses()) {
|
||||
QTest::newRow(qPrintable(address.toString())) << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString() << address.toString() << 0 << 0;
|
||||
}
|
||||
|
||||
//UDP
|
||||
QTest::newRow("udp") << (int)QNetworkProxyQuery::UdpSocket << QUrl() << QString() << QString() << 0 << (int)QNetworkProxy::UdpTunnelingCapability;
|
||||
|
||||
//Protocol tags
|
||||
QTest::newRow("http-tag") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString("http") << QString("qt-project.org") << 80 << (int)QNetworkProxy::TunnelingCapability;
|
||||
QTest::newRow("ftp-tag") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString("ftp") << QString("qt-project.org") << 21 << (int)QNetworkProxy::TunnelingCapability;
|
||||
QTest::newRow("https-tag") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString("https") << QString("qt-project.org") << 443 << (int)QNetworkProxy::TunnelingCapability;
|
||||
#if 0
|
||||
//in Qt 4.8, "socks" would get the socks proxy, but we dont want to enforce that for all platforms
|
||||
QTest::newRow("socks-tag") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString("socks") << QString("qt-project.org") << 21 << (int)(QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability);
|
||||
#endif
|
||||
//windows: ssh is not a tag provided by the os, but any tunneling proxy is acceptable
|
||||
QTest::newRow("ssh-tag") << (int)QNetworkProxyQuery::TcpSocket << QUrl() << QString("ssh") << QString("qt-project.org") << 22 << (int)QNetworkProxy::TunnelingCapability;
|
||||
|
||||
//Server protocol tags (ftp/http proxies are no good, we need socks or nothing)
|
||||
QTest::newRow("http-server-tag") << (int)QNetworkProxyQuery::TcpServer << QUrl() << QString("http") << QString() << 80 << (int)QNetworkProxy::ListeningCapability;
|
||||
QTest::newRow("ftp-server-tag") << (int)QNetworkProxyQuery::TcpServer << QUrl() << QString("ftp") << QString() << 21 << (int)QNetworkProxy::ListeningCapability;
|
||||
QTest::newRow("imap-server-tag") << (int)QNetworkProxyQuery::TcpServer << QUrl() << QString("imap") << QString() << 143 << (int)QNetworkProxy::ListeningCapability;
|
||||
|
||||
//UDP protocol tag
|
||||
QTest::newRow("sip-udp-tag") << (int)QNetworkProxyQuery::UdpSocket << QUrl() << QString("sip") << QString("qt-project.org") << 5061 << (int)QNetworkProxy::UdpTunnelingCapability;
|
||||
}
|
||||
|
||||
//This function is added to QtNetwork in 5.0, but new exports aren't allowed in patch releases
|
||||
QT_BEGIN_NAMESPACE
|
||||
QDebug operator<<(QDebug debug, const QNetworkProxy &proxy)
|
||||
{
|
||||
QNetworkProxy::ProxyType type = proxy.type();
|
||||
switch (type) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
debug << "NoProxy ";
|
||||
break;
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
debug << "DefaultProxy ";
|
||||
break;
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
debug << "Socks5Proxy ";
|
||||
break;
|
||||
case QNetworkProxy::HttpProxy:
|
||||
debug << "HttpProxy ";
|
||||
break;
|
||||
case QNetworkProxy::HttpCachingProxy:
|
||||
debug << "HttpCachingProxy ";
|
||||
break;
|
||||
case QNetworkProxy::FtpCachingProxy:
|
||||
debug << "FtpCachingProxy ";
|
||||
break;
|
||||
default:
|
||||
debug << "Unknown proxy " << int(type);
|
||||
break;
|
||||
}
|
||||
debug << "\"" << proxy.hostName() << ":" << proxy.port() << "\" ";
|
||||
QNetworkProxy::Capabilities caps = proxy.capabilities();
|
||||
QStringList scaps;
|
||||
if (caps & QNetworkProxy::TunnelingCapability)
|
||||
scaps << QLatin1String("Tunnel");
|
||||
if (caps & QNetworkProxy::ListeningCapability)
|
||||
scaps << QLatin1String("Listen");
|
||||
if (caps & QNetworkProxy::UdpTunnelingCapability)
|
||||
scaps << QLatin1String("UDP");
|
||||
if (caps & QNetworkProxy::CachingCapability)
|
||||
scaps << QLatin1String("Caching");
|
||||
if (caps & QNetworkProxy::HostNameLookupCapability)
|
||||
scaps << QLatin1String("NameLookup");
|
||||
debug << "[" << scaps.join(QLatin1String(" ")) << "]";
|
||||
return debug;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
void tst_QNetworkProxyFactory::systemProxyForQuery() const
|
||||
{
|
||||
QFETCH(int, type);
|
||||
QFETCH(QUrl, url);
|
||||
QFETCH(QString, tag);
|
||||
QFETCH(QString, hostName);
|
||||
QFETCH(int, port);
|
||||
QFETCH(int, requiredCapabilities);
|
||||
|
||||
QNetworkProxyQuery query;
|
||||
|
||||
switch (type) {
|
||||
case QNetworkProxyQuery::UrlRequest:
|
||||
query = QNetworkProxyQuery(url);
|
||||
break;
|
||||
case QNetworkProxyQuery::TcpSocket:
|
||||
case QNetworkProxyQuery::UdpSocket:
|
||||
query = QNetworkProxyQuery(hostName, port, tag, QNetworkProxyQuery::QueryType(type));
|
||||
break;
|
||||
case QNetworkProxyQuery::TcpServer:
|
||||
query = QNetworkProxyQuery(quint16(port), tag);
|
||||
break;
|
||||
}
|
||||
|
||||
QElapsedTimer sw;
|
||||
sw.start();
|
||||
QList<QNetworkProxy> systemProxyList = QNetworkProxyFactory::systemProxyForQuery(query);
|
||||
qDebug() << sw.elapsed() << "ms";
|
||||
QVERIFY(!systemProxyList.isEmpty());
|
||||
|
||||
// for manual comparison with system
|
||||
qDebug() << systemProxyList;
|
||||
|
||||
foreach (const QNetworkProxy &proxy, systemProxyList) {
|
||||
QVERIFY((requiredCapabilities == 0) || (proxy.capabilities() & requiredCapabilities));
|
||||
}
|
||||
}
|
||||
|
||||
class QSPFQThread : public QThread
|
||||
{
|
||||
protected:
|
||||
virtual void run()
|
||||
{
|
||||
proxies = QNetworkProxyFactory::systemProxyForQuery(query);
|
||||
}
|
||||
public:
|
||||
QNetworkProxyQuery query;
|
||||
QList<QNetworkProxy> proxies;
|
||||
};
|
||||
|
||||
//regression test for QTBUG-18799
|
||||
void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread()
|
||||
{
|
||||
QUrl url(QLatin1String("http://qt.nokia.com"));
|
||||
QNetworkProxyQuery query(url);
|
||||
QSPFQThread thread;
|
||||
thread.query = query;
|
||||
connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
thread.start();
|
||||
QTestEventLoop::instance().enterLoop(5);
|
||||
QVERIFY(thread.isFinished());
|
||||
QCOMPARE(thread.proxies, QNetworkProxyFactory::systemProxyForQuery(query));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QNetworkProxyFactory)
|
||||
|
||||
#include "moc_tst_qnetworkproxyfactory.cpp"
|
|
@ -27,7 +27,7 @@
|
|||
#include <QtCore/QTimer>
|
||||
#include <QtNetwork/QTcpServer>
|
||||
#include <QtNetwork/QTcpSocket>
|
||||
#include "qnativesocketengine_p.h"
|
||||
#include "qabstractsocketengine_p.h"
|
||||
#include "qnet_unix_p.h"
|
||||
|
||||
#include <sys/select.h>
|
||||
|
@ -58,10 +58,10 @@ class UnexpectedDisconnectTester : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QNativeSocketEngine *readEnd1, *readEnd2;
|
||||
QAbstractSocketEngine *readEnd1, *readEnd2;
|
||||
int sequence;
|
||||
|
||||
UnexpectedDisconnectTester(QNativeSocketEngine *s1, QNativeSocketEngine *s2)
|
||||
UnexpectedDisconnectTester(QAbstractSocketEngine *s1, QAbstractSocketEngine *s2)
|
||||
: readEnd1(s1), readEnd2(s2), sequence(0)
|
||||
{
|
||||
QSocketNotifier *notifier1 =
|
||||
|
@ -111,7 +111,7 @@ void tst_QSocketNotifier::unexpectedDisconnection()
|
|||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress::LocalHost, 0));
|
||||
|
||||
QNativeSocketEngine readEnd1;
|
||||
QAbstractSocketEngine readEnd1;
|
||||
readEnd1.initialize(QAbstractSocket::TcpSocket);
|
||||
bool b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
|
||||
QVERIFY(readEnd1.waitForWrite());
|
||||
|
@ -122,7 +122,7 @@ void tst_QSocketNotifier::unexpectedDisconnection()
|
|||
QTcpSocket *writeEnd1 = server.nextPendingConnection();
|
||||
QVERIFY(writeEnd1 != 0);
|
||||
|
||||
QNativeSocketEngine readEnd2;
|
||||
QAbstractSocketEngine readEnd2;
|
||||
readEnd2.initialize(QAbstractSocket::TcpSocket);
|
||||
b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
|
||||
QVERIFY(readEnd2.waitForWrite());
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#include <qstringlist.h>
|
||||
#include <qplatformdefs.h>
|
||||
#include <qhostinfo.h>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
Q_DECLARE_METATYPE(QNetworkProxy)
|
||||
Q_DECLARE_METATYPE(QList<QNetworkProxy>)
|
||||
|
||||
#include "../../../../auto/network-settings.h"
|
||||
|
||||
|
@ -69,37 +65,19 @@ tst_QTcpServer::~tst_QTcpServer()
|
|||
|
||||
void tst_QTcpServer::initTestCase_data()
|
||||
{
|
||||
QTest::addColumn<bool>("setProxy");
|
||||
QTest::addColumn<int>("proxyType");
|
||||
|
||||
QTest::newRow("WithoutProxy") << false << 0;
|
||||
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
|
||||
QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
|
||||
}
|
||||
|
||||
void tst_QTcpServer::init()
|
||||
{
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy) {
|
||||
QFETCH_GLOBAL(int, proxyType);
|
||||
if (proxyType == QNetworkProxy::Socks5Proxy) {
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QTcpServer::cleanup()
|
||||
{
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void tst_QTcpServer::ipv4LoopbackPerformanceTest()
|
||||
{
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy)
|
||||
return;
|
||||
|
||||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress::LocalHost));
|
||||
|
||||
|
@ -149,10 +127,6 @@ void tst_QTcpServer::ipv4LoopbackPerformanceTest()
|
|||
//----------------------------------------------------------------------------------
|
||||
void tst_QTcpServer::ipv6LoopbackPerformanceTest()
|
||||
{
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy)
|
||||
return;
|
||||
|
||||
QTcpServer server;
|
||||
if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
|
||||
QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
|
||||
|
@ -207,11 +181,6 @@ void tst_QTcpServer::ipv4PerformanceTest()
|
|||
QTcpServer server;
|
||||
QVERIFY(server.listen(probeSocket.localAddress(), 0));
|
||||
|
||||
QFETCH_GLOBAL(int, proxyType);
|
||||
//For http proxy, only the active connection can be proxied and not the server socket
|
||||
if (proxyType == QNetworkProxy::HttpProxy)
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128));
|
||||
|
||||
QTcpSocket clientA;
|
||||
clientA.connectToHost(server.serverAddress(), server.serverPort());
|
||||
QVERIFY(clientA.waitForConnected(5000));
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-02-21 15:18+0200\n"
|
||||
"POT-Creation-Date: 2022-02-23 23:10+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -44,7 +44,7 @@ msgstr ""
|
|||
|
||||
#: src/core/plugin/qlibrary.cpp:799 src/core/plugin/qpluginloader.cpp:278
|
||||
#: src/core/io/qiodevice.cpp:1517
|
||||
#: src/network/socket/qnativesocketengine.cpp:249
|
||||
#: src/network/socket/qabstractsocketengine.cpp:439
|
||||
#: src/uitools/formscriptrunner.cpp:104
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
@ -4594,28 +4594,26 @@ msgctxt "QHostInfo"
|
|||
msgid "No host name given"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:87
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:171
|
||||
#: src/network/socket/qabstractsocket.cpp:827
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:86
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:170
|
||||
#: src/network/socket/qabstractsocket.cpp:691
|
||||
msgid "Host not found"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:105
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:104
|
||||
msgid "No host name given"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:107
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:106
|
||||
msgid "Invalid hostname"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:159
|
||||
#: src/network/kernel/qhostinfo_unix.cpp:158
|
||||
msgid "Unknown address type"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qtcpserver.cpp:266 src/network/socket/qtcpserver.cpp:384
|
||||
#: src/network/socket/qabstractsocket.cpp:482
|
||||
#: src/network/socket/qabstractsocket.cpp:1265
|
||||
#: src/network/socket/qabstractsocket.cpp:1475
|
||||
#: src/network/socket/qtcpserver.cpp:216
|
||||
#: src/network/socket/qabstractsocket.cpp:430
|
||||
msgid "Operation on socket is not supported"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4633,157 +4631,153 @@ msgid "%1: Address in use"
|
|||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalserver_unix.cpp:204
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:141
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:140
|
||||
msgid "%1: Unknown error %2"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qabstractsocket.cpp:869
|
||||
#: src/network/socket/qnativesocketengine.cpp:213
|
||||
#: src/network/socket/qabstractsocket.cpp:733
|
||||
#: src/network/socket/qabstractsocketengine.cpp:406
|
||||
msgid "Connection refused"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qabstractsocket.cpp:1011
|
||||
#: src/network/socket/qnativesocketengine.cpp:210
|
||||
#: src/network/socket/qabstractsocket.cpp:871
|
||||
#: src/network/socket/qabstractsocketengine.cpp:403
|
||||
msgid "Connection timed out"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qabstractsocket.cpp:1643
|
||||
#: src/network/socket/qabstractsocket.cpp:1477
|
||||
msgid "Socket operation timed out"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qabstractsocket.cpp:2053
|
||||
#: src/network/socket/qabstractsocket.cpp:1887
|
||||
msgid "Socket is not connected"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:174
|
||||
#: src/network/socket/qabstractsocketengine.cpp:367
|
||||
msgid "Unable to initialize non-blocking socket"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:177
|
||||
#: src/network/socket/qabstractsocketengine.cpp:370
|
||||
msgid "Unable to initialize broadcast socket"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:180
|
||||
#: src/network/socket/qabstractsocketengine.cpp:373
|
||||
msgid "Attempt to use IPv6 socket on a platform with no IPv6 support"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:183
|
||||
#: src/network/socket/qabstractsocketengine.cpp:376
|
||||
msgid "The remote host closed the connection"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:186
|
||||
#: src/network/socket/qabstractsocketengine.cpp:379
|
||||
msgid "Network operation timed out"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:189
|
||||
#: src/network/socket/qabstractsocketengine.cpp:382
|
||||
msgid "Out of resources"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:192
|
||||
#: src/network/socket/qabstractsocketengine.cpp:385
|
||||
msgid "Unsupported socket operation"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:195
|
||||
#: src/network/socket/qabstractsocketengine.cpp:388
|
||||
msgid "Protocol type not supported"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:198
|
||||
#: src/network/socket/qabstractsocketengine.cpp:391
|
||||
msgid "Invalid socket descriptor"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:201
|
||||
#: src/network/socket/qabstractsocketengine.cpp:394
|
||||
msgid "Host unreachable"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:204
|
||||
#: src/network/socket/qabstractsocketengine.cpp:397
|
||||
msgid "Network unreachable"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:207
|
||||
#: src/network/socket/qabstractsocketengine.cpp:400
|
||||
msgid "Permission denied"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:216
|
||||
#: src/network/socket/qabstractsocketengine.cpp:409
|
||||
msgid "The bound address is already in use"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:219
|
||||
#: src/network/socket/qabstractsocketengine.cpp:412
|
||||
msgid "The address is not available"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:222
|
||||
#: src/network/socket/qabstractsocketengine.cpp:415
|
||||
msgid "The address is protected"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:225
|
||||
#: src/network/socket/qabstractsocketengine.cpp:418
|
||||
msgid "Datagram was too large to send"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:228
|
||||
#: src/network/socket/qabstractsocketengine.cpp:421
|
||||
msgid "Unable to send a message"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:231
|
||||
#: src/network/socket/qabstractsocketengine.cpp:424
|
||||
msgid "Unable to receive a message"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:234
|
||||
#: src/network/socket/qabstractsocketengine.cpp:427
|
||||
msgid "Unable to write"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:237
|
||||
#: src/network/socket/qabstractsocketengine.cpp:430
|
||||
msgid "Network error"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:240
|
||||
#: src/network/socket/qabstractsocketengine.cpp:433
|
||||
msgid "Another socket is already listening on the same port"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:243
|
||||
#: src/network/socket/qabstractsocketengine.cpp:436
|
||||
msgid "Operation on non-socket"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qnativesocketengine.cpp:246
|
||||
msgid "The proxy type is invalid for this operation"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:113
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:112
|
||||
msgid "%1: Connection refused"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:116
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:115
|
||||
msgid "%1: Remote closed"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:119
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:118
|
||||
msgid "%1: Invalid name"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:122
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:121
|
||||
msgid "%1: Socket access error"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:125
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:124
|
||||
msgid "%1: Socket resource error"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:128
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:127
|
||||
msgid "%1: Socket operation timed out"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:131
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:130
|
||||
msgid "%1: Datagram too large"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:134
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:133
|
||||
msgid "%1: Connection error"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:137
|
||||
#: src/network/socket/qlocalsocket_unix.cpp:136
|
||||
msgid "%1: The socket operation is not supported"
|
||||
msgstr ""
|
||||
|
||||
#: src/network/socket/qudpsocket.cpp:181
|
||||
#: src/network/socket/qudpsocket.cpp:174
|
||||
msgid "This platform does not support IPv6"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-02-21 15:18+0200\n"
|
||||
"POT-Creation-Date: 2022-02-23 23:10+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue