diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-12-08 11:14:26 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-12-08 11:14:26 (GMT) |
commit | fc3f909c0cbbe15f2079edefe66ce52eb127a326 (patch) | |
tree | f101095c8a2ccf7f85cfa5b050022f81428f9800 /src | |
parent | f71a7c4ef3c4c5a02730544d93200ef96d777aa0 (diff) | |
download | Qt-fc3f909c0cbbe15f2079edefe66ce52eb127a326.zip Qt-fc3f909c0cbbe15f2079edefe66ce52eb127a326.tar.gz Qt-fc3f909c0cbbe15f2079edefe66ce52eb127a326.tar.bz2 |
QSymbianSocketEngine: Always support IPv6
Diffstat (limited to 'src')
-rw-r--r-- | src/network/kernel/qnetworkproxy_symbian.cpp | 17 | ||||
-rw-r--r-- | src/network/socket/qsymbiansocketengine.cpp | 37 |
2 files changed, 11 insertions, 43 deletions
diff --git a/src/network/kernel/qnetworkproxy_symbian.cpp b/src/network/kernel/qnetworkproxy_symbian.cpp index 62266d1..7f53b4d 100644 --- a/src/network/kernel/qnetworkproxy_symbian.cpp +++ b/src/network/kernel/qnetworkproxy_symbian.cpp @@ -48,14 +48,17 @@ QT_BEGIN_NAMESPACE QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &) { // TODO: Get the current QNetworkSession which has the Symbian RConnection we use - // I am wondering if we already have a connected QNetworkSession when the code - // is run that retrieves the proxy (for QNetworkAccessManager it's somewhere called - // from createRequest() which might be too early...) - - // TODO: Get the proxy from that RConnection + // I am wondering if we already have a connected QNetworkSession when the code + // is run that retrieves the proxy (for QNetworkAccessManager it's somewhere called + // from createRequest() which might be too early...) - // See http://bugreports.qt.nokia.com/browse/QTBUG-13857 and http://bugreports.qt.nokia.com/browse/QTBUG-11016 - // and the mails we have received. + // TODO: Get the proxy from that RConnection + + // The QNetworkProxyQuery could have a QNetworkSession and then take the RConnection + // from there. If it does not have one, we have to use the "global RConnection". + + // See http://bugreports.qt.nokia.com/browse/QTBUG-13857 and http://bugreports.qt.nokia.com/browse/QTBUG-11016 + // and the mails we have received. // Default case: No network proxy found/needed return QList<QNetworkProxy>() << QNetworkProxy::NoProxy; diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp index 43f0a36..a937f7c 100644 --- a/src/network/socket/qsymbiansocketengine.cpp +++ b/src/network/socket/qsymbiansocketengine.cpp @@ -49,9 +49,7 @@ #include "qnetworkinterface.h" #include <es_sock.h> #include <in_sock.h> -#ifndef QT_NO_IPV6IFNAME #include <net/if.h> -#endif #include <private/qcore_symbian_p.h> @@ -112,7 +110,6 @@ static QByteArray qt_prettyDebug(const char *data, int len, int maxSize) void QSymbianSocketEnginePrivate::getPortAndAddress(const TInetAddr& a, quint16 *port, QHostAddress *addr) { -#if !defined(QT_NO_IPV6) if (a.Family() == KAfInet6) { Q_IPV6ADDR tmp; memcpy(&tmp, a.Ip6Address().u.iAddr8, sizeof(tmp)); @@ -120,21 +117,18 @@ void QSymbianSocketEnginePrivate::getPortAndAddress(const TInetAddr& a, quint16 QHostAddress tmpAddress; tmpAddress.setAddress(tmp); *addr = tmpAddress; -#ifndef QT_NO_IPV6IFNAME TPckgBuf<TSoInetIfQuery> query; query().iSrcAddr = a; TInt err = nativeSocket.GetOpt(KSoInetIfQueryBySrcAddr, KSolInetIfQuery, query); if(!err) addr->setScopeId(qt_TDesC2QString(query().iName)); else -#endif addr->setScopeId(QString::number(a.Scope())); } if (port) *port = a.Port(); return; } -#endif if (port) *port = a.Port(); if (addr) { @@ -152,12 +146,7 @@ bool QSymbianSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType so QAbstractSocket::NetworkLayerProtocol socketProtocol) { Q_Q(QSymbianSocketEngine); -#ifndef QT_NO_IPV6 TUint family = (socketProtocol == QAbstractSocket::IPv6Protocol) ? KAfInet6 : KAfInet; -#else - Q_UNUSED(socketProtocol); - TUint family = KAfInet; -#endif TUint type = (socketType == QAbstractSocket::UdpSocket) ? KSockDatagram : KSockStream; TUint protocol = (socketType == QAbstractSocket::UdpSocket) ? KProtocolInetUdp : KProtocolInetTcp; TInt err = nativeSocket.Open(socketServer, family, type, protocol, *connection); @@ -189,9 +178,7 @@ bool QSymbianSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType so void QSymbianSocketEnginePrivate::setPortAndAddress(TInetAddr& nativeAddr, quint16 port, const QHostAddress &addr) { nativeAddr.SetPort(port); -#if !defined(QT_NO_IPV6) if (addr.protocol() == QAbstractSocket::IPv6Protocol) { -#ifndef QT_NO_IPV6IFNAME TPckgBuf<TSoInetIfQuery> query; query().iName = qt_QString2TPtrC(addr.scopeId()); TInt err = nativeSocket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, query); @@ -199,16 +186,11 @@ void QSymbianSocketEnginePrivate::setPortAndAddress(TInetAddr& nativeAddr, quint nativeAddr.SetScope(query().iIndex); else nativeAddr.SetScope(0); -#else - nativeAddr.SetScope(addr.scopeId().toInt()); -#endif Q_IPV6ADDR ip6 = addr.toIPv6Address(); TIp6Addr v6addr; memcpy(v6addr.u.iAddr8, ip6.c, 16); nativeAddr.SetAddress(v6addr); - } else -#endif - if (addr.protocol() == QAbstractSocket::IPv4Protocol) { + } else if (addr.protocol() == QAbstractSocket::IPv4Protocol) { nativeAddr.SetAddress(addr.toIPv4Address()); } else { qWarning("unsupported network protocol (%d)", addr.protocol()); @@ -259,14 +241,6 @@ bool QSymbianSocketEngine::initialize(QAbstractSocket::SocketType socketType, QA if (isValid()) close(); -#if defined(QT_NO_IPV6) - if (protocol == QAbstractSocket::IPv6Protocol) { - d->setError(QAbstractSocket::UnsupportedSocketOperationError, - d->NoIpV6ErrorString); - return false; - } -#endif - // Create the socket if (!d->createNewSocket(socketType, protocol)) { #if defined (QNATIVESOCKETENGINE_DEBUG) @@ -521,13 +495,6 @@ bool QSymbianSocketEngine::connectToHost(const QHostAddress &addr, quint16 port) qDebug("QSymbianSocketEngine::connectToHost() : %d ", d->socketDescriptor); #endif -#if defined (QT_NO_IPV6) - if (addr.protocol() == QAbstractSocket::IPv6Protocol) { - d->setError(QAbstractSocket::UnsupportedSocketOperationError, - d->NoIpV6ErrorString); - return false; - } -#endif if (!d->checkProxy(addr)) return false; @@ -808,11 +775,9 @@ bool QSymbianSocketEnginePrivate::fetchConnectionParameters() case KAfInet: socketProtocol = QAbstractSocket::IPv4Protocol; break; -#if !defined (QT_NO_IPV6) case KAfInet6: socketProtocol = QAbstractSocket::IPv6Protocol; break; -#endif default: socketProtocol = QAbstractSocket::UnknownNetworkLayerProtocol; break; |