diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
commit | be212bf108e71ba3b5b75802b1f4de6613ba315c (patch) | |
tree | c541ad12e8698f04e8fe386c2e1b94e8baca6c1b /src/network | |
parent | 67ae1b0dac175f48875507f3187ed49276a29ddf (diff) | |
parent | e6bb00250b321b149dd80259dc4f479088d5949b (diff) | |
download | Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2 |
Merge commit 'origin/master'
Conflicts:
src/corelib/global/qglobal.h
src/corelib/kernel/qmetatype.cpp
src/corelib/kernel/qobject.cpp
src/corelib/thread/qthread_unix.cpp
src/gui/graphicsview/qgraphicssceneevent.h
src/gui/itemviews/qheaderview.h
src/gui/kernel/qapplication_qws.cpp
src/gui/kernel/qgesture.h
src/gui/kernel/qgesturerecognizer.h
src/gui/painting/qpaintengine_raster.cpp
src/network/access/qhttpnetworkreply.cpp
src/network/access/qnetworkcookie.h
src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'src/network')
32 files changed, 201 insertions, 162 deletions
diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h index 40f2313..38ebb69 100644 --- a/src/network/access/qabstractnetworkcache.h +++ b/src/network/access/qabstractnetworkcache.h @@ -130,7 +130,7 @@ protected: QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent); private: - Q_DECLARE_PRIVATE(QAbstractNetworkCache) + Q_DECLARE_SCOPED_PRIVATE(QAbstractNetworkCache) Q_DISABLE_COPY(QAbstractNetworkCache) }; diff --git a/src/network/access/qftp.h b/src/network/access/qftp.h index c6aaea4..8e4af9f 100644 --- a/src/network/access/qftp.h +++ b/src/network/access/qftp.h @@ -162,7 +162,7 @@ public: private: Q_DISABLE_COPY(QFtp) - Q_DECLARE_PRIVATE(QFtp) + Q_DECLARE_SCOPED_PRIVATE(QFtp) Q_PRIVATE_SLOT(d_func(), void _q_startNextCommand()) Q_PRIVATE_SLOT(d_func(), void _q_piFinished(const QString&)) diff --git a/src/network/access/qhttp.h b/src/network/access/qhttp.h index e524350..c1fda0e 100644 --- a/src/network/access/qhttp.h +++ b/src/network/access/qhttp.h @@ -112,7 +112,7 @@ protected: QScopedPointer<QHttpHeaderPrivate> d_ptr; private: - Q_DECLARE_PRIVATE(QHttpHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpHeader) }; class QHttpResponseHeaderPrivate; @@ -139,7 +139,7 @@ protected: bool parseLine(const QString &line, int number); private: - Q_DECLARE_PRIVATE(QHttpResponseHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpResponseHeader) friend class QHttpPrivate; }; @@ -167,7 +167,7 @@ protected: bool parseLine(const QString &line, int number); private: - Q_DECLARE_PRIVATE(QHttpRequestHeader) + Q_DECLARE_SCOPED_PRIVATE(QHttpRequestHeader) }; class Q_NETWORK_EXPORT QHttp : public QObject @@ -282,7 +282,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QHttp) - Q_DECLARE_PRIVATE(QHttp) + Q_DECLARE_SCOPED_PRIVATE(QHttp) Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest()) Q_PRIVATE_SLOT(d_func(), void _q_slotReadyRead()) diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index db6a140..eb7a955 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -135,7 +135,7 @@ Q_SIGNALS: void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); private: - Q_DECLARE_PRIVATE(QHttpNetworkConnection) + Q_DECLARE_SCOPED_PRIVATE(QHttpNetworkConnection) Q_DISABLE_COPY(QHttpNetworkConnection) friend class QHttpNetworkReply; diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 575e824..0982685 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -146,7 +146,7 @@ Q_SIGNALS: void dataSendProgress(qint64 done, qint64 total); private: - Q_DECLARE_PRIVATE(QHttpNetworkReply) + Q_DECLARE_SCOPED_PRIVATE(QHttpNetworkReply) friend class QHttpNetworkConnection; friend class QHttpNetworkConnectionPrivate; }; diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index f7967f6..01f09cf 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -119,7 +119,7 @@ protected: private: friend class QNetworkReplyImplPrivate; - Q_DECLARE_PRIVATE(QNetworkAccessManager) + Q_DECLARE_SCOPED_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) }; diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index 922a6f5..35c7095 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -67,7 +67,7 @@ public: Full }; - QNetworkCookie(); + QNetworkCookie(); QNetworkCookie(const QByteArray &name ); QNetworkCookie(const QByteArray &name, const QByteArray &value ); QNetworkCookie(const QNetworkCookie &other); diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h index 2d04564..8827bfb 100644 --- a/src/network/access/qnetworkdiskcache.h +++ b/src/network/access/qnetworkdiskcache.h @@ -84,7 +84,7 @@ protected: virtual qint64 expire(); private: - Q_DECLARE_PRIVATE(QNetworkDiskCache) + Q_DECLARE_SCOPED_PRIVATE(QNetworkDiskCache) Q_DISABLE_COPY(QNetworkDiskCache) }; diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 679ab71..854111f 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -165,7 +165,7 @@ protected: void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); private: - Q_DECLARE_PRIVATE(QNetworkReply) + Q_DECLARE_SCOPED_PRIVATE(QNetworkReply) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index fba8d34..eb63e62 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -92,7 +92,7 @@ public: Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors); #endif - Q_DECLARE_PRIVATE(QNetworkReplyImpl) + Q_DECLARE_SCOPED_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index a53aed3..cf06f7c 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -89,7 +89,7 @@ public: explicit QNetworkRequest(); - explicit QNetworkRequest(const QUrl &url); + explicit QNetworkRequest(const QUrl &url); QNetworkRequest(const QNetworkRequest &other); ~QNetworkRequest(); QNetworkRequest &operator=(const QNetworkRequest &other); diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 953722c..e588c18 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -128,7 +128,7 @@ QString QNetworkInterfacePrivate::makeHwAddress(int len, uchar *data) for (int i = 0; i < len; ++i) { if (i) result += QLatin1Char(':'); - + char buf[3]; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 sprintf_s(buf, 3, "%02hX", ushort(data[i])); @@ -603,13 +603,13 @@ QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface) << ", hardware address = " << networkInterface.hardwareAddress() << ", flags = "; flagsDebug(debug, networkInterface.flags()); -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // RVCT gets confused with << networkInterface.addressEntries(), reason unknown. debug.nospace() << ")\n"; #else debug.nospace() << ", entries = " << networkInterface.addressEntries() << ")\n"; -#endif +#endif return debug.space(); } #endif diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index 59f1c02..f2ded36 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -41,12 +41,8 @@ //#define QNETWORKINTERFACE_DEBUG -//#include "qset.h" #include "qnetworkinterface.h" #include "qnetworkinterface_p.h" -//#include <private/qnativesocketengine_p.h> -//#include "qalgorithms.h" - #ifndef QT_NO_NETWORKINTERFACE @@ -54,142 +50,185 @@ #include <in_iface.h> #include <es_sock.h> -//#include <sys/types.h> -//#include <sys/socket.h> -//#include <errno.h> -//#include <net/if.h> -//#include <qplatformdefs.h> - QT_BEGIN_NAMESPACE -static QNetworkInterface::InterfaceFlags convertFlags( const TSoInetInterfaceInfo& aInfo ) +static QNetworkInterface::InterfaceFlags convertFlags(const TSoInetInterfaceInfo& aInfo) { QNetworkInterface::InterfaceFlags flags = 0; flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0); // We do not have separate flag for running in Symbian OS flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures & KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); return flags; } -QString qstringFromDesc( const TDesC& aData ) +QString qstringFromDesc(const TDesC& aData) { return QString::fromUtf16(aData.Ptr(), aData.Length()); } static QList<QNetworkInterfacePrivate *> interfaceListing() { - TInt err( KErrNone ); + TInt err(KErrNone); QList<QNetworkInterfacePrivate *> interfaces; - + // Connect to Native socket server RSocketServ socketServ; err = socketServ.Connect(); - if( err ) + if (err) return interfaces; - + // Open dummy socket for interface queries RSocket socket; - err = socket.Open( socketServ, _L("udp")); - if( err ) - { + err = socket.Open(socketServ, _L("udp")); + if (err) { socketServ.Close(); - return interfaces; + return interfaces; } // Ask socket to start enumerating interfaces - err = socket.SetOpt( KSoInetEnumInterfaces, KSolInetIfCtrl ); - if( err ) - { + err = socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); + if (err) { socket.Close(); socketServ.Close(); - return interfaces; - } + return interfaces; + } int ifindex = 0; TPckgBuf<TSoInetInterfaceInfo> infoPckg; TSoInetInterfaceInfo &info = infoPckg(); - while( socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone ) - { + while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone) { // Do not include IPv6 addresses because netmask and broadcast address cannot be determined correctly - if( info.iName != KNullDesC && info.iAddress.IsV4Mapped() ) - { - TName address; - QNetworkAddressEntry entry; - QNetworkInterfacePrivate *iface = 0; - - iface = new QNetworkInterfacePrivate; + if (info.iName != KNullDesC && info.iAddress.IsV4Mapped()) { + TName address; + QNetworkAddressEntry entry; + QNetworkInterfacePrivate *iface = 0; + + iface = new QNetworkInterfacePrivate; iface->index = ifindex++; interfaces << iface; - iface->name = qstringFromDesc( info.iName ); - iface->flags = convertFlags( info ); - - if( /*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec ) - { - for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) - { + iface->name = qstringFromDesc(info.iName); + iface->flags = convertFlags(info); + + if (/*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec) { + for (TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++) { address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2); - if( ( i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen() ) - address.Append( _L(":") ); - } - address.UpperCase(); - iface->hardwareAddress = qstringFromDesc( address ); + if ((i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen()) + address.Append(_L(":")); + } + address.UpperCase(); + iface->hardwareAddress = qstringFromDesc(address); } - + // Get the address of the interface info.iAddress.Output(address); - entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); + entry.setIp(QHostAddress(qstringFromDesc(address))); + + // Get the interface netmask + // For some reason netmask is always 0.0.0.0 + // info.iNetMask.Output(address); + // entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - // Get the interface netmask - // TODO: For some reason netmask is always 0.0.0.0 - //info.iNetMask.Output(address); - //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - // Workaround: Let Symbian determine netmask based on IP address class - // TODO: works only for IPv4 + // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr netmask; - netmask.NetMask( info.iAddress ); + netmask.NetMask(info.iAddress); netmask.Output(address); - entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - + entry.setNetmask(QHostAddress(qstringFromDesc(address))); + // Get the interface broadcast address - if (iface->flags & QNetworkInterface::CanBroadcast) - { + if (iface->flags & QNetworkInterface::CanBroadcast) { // For some reason broadcast address is always 0.0.0.0 // info.iBrdAddr.Output(address); - // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); - + // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); + // Workaround: Let Symbian determine broadcast address based on IP address - // TODO: works only for IPv4 + // TODO: Works only for IPv4 - Task: 259128 Implement IPv6 support TInetAddr broadcast; - broadcast.NetBroadcast( info.iAddress ); + broadcast.NetBroadcast(info.iAddress); broadcast.Output(address); - entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); - } - + entry.setBroadcast(QHostAddress(qstringFromDesc(address))); + } + // Add new entry to interface address entries - iface->addressEntries << entry; - -#if defined(QNETWORKINTERFACE_DEBUG) - qDebug("\n Found network interface %s, interface flags:\n\ + iface->addressEntries << entry; + +#if defined(QNETWORKINTERFACE_DEBUG) + printf("\n Found network interface %s, interface flags:\n\ IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\ IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\ ip = %s, netmask = %s, broadcast = %s,\n\ - hwaddress = %s", - iface->name.toLatin1().constData(), - iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, - iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, - entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), - iface->hardwareAddress.toLatin1().constData()); -#endif + hwaddress = %s", + iface->name.toLatin1().constData(), + iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, + iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, + entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), + iface->hardwareAddress.toLatin1().constData()); +#endif } } + + // we will try to use routing info to detect more precisely + // netmask and then ::postProcess() should calculate + // broadcast addresses + + // use dummy socket to start enumerating routes + err = socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl); + if (err) { + socket.Close(); + socketServ.Close(); + // return what we have + // up to this moment + return interfaces; + } + + TSoInetRouteInfo routeInfo; + TPckg<TSoInetRouteInfo> routeInfoPkg(routeInfo); + while (socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone) { + TName address; + + // get interface address + routeInfo.iIfAddr.Output(address); + QHostAddress ifAddr(qstringFromDesc(address)); + if (ifAddr.isNull()) + continue; + + routeInfo.iDstAddr.Output(address); + QHostAddress destination(qstringFromDesc(address)); + if (destination.isNull() || destination != ifAddr) + continue; + + // search interfaces + for (int ifindex = 0; ifindex < interfaces.size(); ++ifindex) { + QNetworkInterfacePrivate *iface = interfaces.at(ifindex); + for (int eindex = 0; eindex < iface->addressEntries.size(); ++eindex) { + QNetworkAddressEntry entry = iface->addressEntries.at(eindex); + if (entry.ip() != ifAddr) { + continue; + } else if (entry.ip().protocol() != QAbstractSocket::IPv4Protocol) { + // skip if not IPv4 address (e.g. IPv6) + // as results not reliable on Symbian + continue; + } else { + routeInfo.iNetMask.Output(address); + QHostAddress netmask(qstringFromDesc(address)); + entry.setNetmask(netmask); + // NULL boradcast address for + // ::postProcess to have effect + entry.setBroadcast(QHostAddress()); + iface->addressEntries.replace(eindex, entry); + } + } + } + } + socket.Close(); - socketServ.Close(); + socketServ.Close(); + return interfaces; } diff --git a/src/network/network.pro b/src/network/network.pro index 59cffd0..e890b94 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -28,4 +28,3 @@ symbian { TARGET.UID3=0x2001B2DE LIBS += -lesock -linsock } - diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 50a38bb..42e3ffd 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -209,7 +209,7 @@ protected: QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = 0); private: - Q_DECLARE_PRIVATE(QAbstractSocket) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocket) Q_DISABLE_COPY(QAbstractSocket) Q_PRIVATE_SLOT(d_func(), void _q_connectToNextAddress()) diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index 39c00cc..3a6aa62 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -177,7 +177,7 @@ protected: void setPeerPort(quint16 port); private: - Q_DECLARE_PRIVATE(QAbstractSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QAbstractSocketEngine) Q_DISABLE_COPY(QAbstractSocketEngine) }; diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index bc7e47a..f4d29cf 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -144,7 +144,7 @@ private: void emitWriteNotification(); void emitConnectionNotification(); - Q_DECLARE_PRIVATE(QHttpSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QHttpSocketEngine) Q_DISABLE_COPY(QHttpSocketEngine) }; diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h index 24b69a8..10dd62f 100644 --- a/src/network/socket/qlocalserver.h +++ b/src/network/socket/qlocalserver.h @@ -58,7 +58,7 @@ class QLocalServerPrivate; class Q_NETWORK_EXPORT QLocalServer : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalServer) + Q_DECLARE_SCOPED_PRIVATE(QLocalServer) Q_SIGNALS: void newConnection(); diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 14a0c78..aa1f7da 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -117,7 +117,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) // // As an workaround, we set the socket to non blocking so possible // subsequent call to accept will not block in any case - // + // // This change can be removed once more generic fix to select thread // syncronization problem is implemented. int flags = fcntl(listenSocket, F_GETFL, 0); @@ -125,10 +125,10 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) || -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) { setError(QLatin1String("QLocalServer::listen")); closeServer(); - return false; - } -#endif - + return false; + } +#endif + // bind if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { setError(QLatin1String("QLocalServer::listen")); diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index 4bff62e..6a07d74 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -58,7 +58,7 @@ class QLocalSocketPrivate; class Q_NETWORK_EXPORT QLocalSocket : public QIODevice { Q_OBJECT - Q_DECLARE_PRIVATE(QLocalSocket) + Q_DECLARE_SCOPED_PRIVATE(QLocalSocket) public: enum LocalSocketError diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 835b922..22873d6 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -306,7 +306,7 @@ void QLocalSocketPrivate::_q_connectToSocket() case ETIMEDOUT: errorOccurred(QLocalSocket::SocketTimeoutError, function); break; - case EINPROGRESS: + case EINPROGRESS: case EAGAIN: // Try again later, all of the sockets listening are full if (!delayConnect) { @@ -539,14 +539,14 @@ bool QLocalSocket::waitForConnected(int msec) timer.start(); while (state() == ConnectingState && (-1 == msec || timer.elapsed() < msec)) { -#ifdef Q_OS_SYMBIAN - // On Symbian, ready-to-write is signaled when non-blocking socket - // connect is finised. Is ready-to-read really used on other - // UNIX paltforms when using non-blocking AF_UNIX socket? +#ifdef Q_OS_SYMBIAN + // On Symbian, ready-to-write is signaled when non-blocking socket + // connect is finised. Is ready-to-read really used on other + // UNIX paltforms when using non-blocking AF_UNIX socket? result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout); #else - result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); -#endif + result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout); +#endif if (-1 == result && errno != EINTR) { d->errorOccurred( QLocalSocket::UnknownSocketError, QLatin1String("QLocalSocket::waitForConnected")); diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 666c86e..f88094a 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -381,13 +381,13 @@ bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAb return false; } - + // Make sure we receive out-of-band data // On Symbian OS this works only with native IP stack, not with WinSock if (socketType == QAbstractSocket::TcpSocket && !setOption(ReceiveOutOfBandData, 1)) { qWarning("QNativeSocketEngine::initialize unable to inline out-of-band data"); - } + } // Set the send and receive buffer sizes to a magic size, found // most optimal for our platforms. @@ -913,7 +913,7 @@ bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWri d_func()->fetchConnectionParameters(); return true; } -#endif +#endif if (ret == 0) { if (timedOut) *timedOut = true; @@ -1094,7 +1094,7 @@ bool QExceptionNotifier::event(QEvent *e) engine->exceptionNotification(); return true; } - return QSocketNotifier::event(e); + return QSocketNotifier::event(e); } void QNativeSocketEngine::setReadNotificationEnabled(bool enable) diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 0a5c19d..e26e9cb 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -288,7 +288,7 @@ public Q_SLOTS: void connectionNotification(); private: - Q_DECLARE_PRIVATE(QNativeSocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QNativeSocketEngine) Q_DISABLE_COPY(QNativeSocketEngine) }; @@ -317,8 +317,8 @@ public: struct sockaddr_storage aa; #else struct sockaddr_in aa; -#endif - +#endif + QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier; #ifdef Q_OS_WIN diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 7584357..5df9769 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -337,8 +337,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 { #ifdef QNATIVESOCKETENGINE_DEBUG qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor); -#endif - +#endif + struct sockaddr_in sockAddrIPv4; struct sockaddr *sockAddrPtr = 0; QT_SOCKLEN_T sockAddrSize = 0; @@ -678,23 +678,23 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #if !defined(QT_NO_IPV6) struct sockaddr_in6 sockAddrIPv6; if (host.protocol() == QAbstractSocket::IPv6Protocol) { - memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); - sockAddrIPv6.sin6_family = AF_INET6; - sockAddrIPv6.sin6_port = htons(port); - - Q_IPV6ADDR tmp = host.toIPv6Address(); - memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); - sockAddrSize = sizeof(sockAddrIPv6); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; + memset(&sockAddrIPv6, 0, sizeof(sockAddrIPv6)); + sockAddrIPv6.sin6_family = AF_INET6; + sockAddrIPv6.sin6_port = htons(port); + + Q_IPV6ADDR tmp = host.toIPv6Address(); + memcpy(&sockAddrIPv6.sin6_addr.s6_addr, &tmp, sizeof(tmp)); + sockAddrSize = sizeof(sockAddrIPv6); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv6; } else #endif if (host.protocol() == QAbstractSocket::IPv4Protocol) { - memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); - sockAddrIPv4.sin_family = AF_INET; - sockAddrIPv4.sin_port = htons(port); - sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); - sockAddrSize = sizeof(sockAddrIPv4); - sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; + memset(&sockAddrIPv4, 0, sizeof(sockAddrIPv4)); + sockAddrIPv4.sin_family = AF_INET; + sockAddrIPv4.sin_port = htons(port); + sockAddrIPv4.sin_addr.s_addr = htonl(host.toIPv4Address()); + sockAddrSize = sizeof(sockAddrIPv4); + sockAddrPtr = (struct sockaddr *)&sockAddrIPv4; } // ignore the SIGPIPE signal @@ -916,15 +916,16 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co #ifndef Q_OS_SYMBIAN retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv); #else - retval = qt_safe_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); + retval = qt_socket_select(socketDescriptor + 1, &fds, 0, &fdexec, timeout < 0 ? 0 : &tv); #endif else #ifndef Q_OS_SYMBIAN retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv); #else - retval = qt_safe_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); + retval = qt_socket_select(socketDescriptor + 1, 0, &fds, &fdexec, timeout < 0 ? 0 : &tv); #endif + #ifdef Q_OS_SYMBIAN bool selectForExec = false; if(retval != 0) { @@ -934,16 +935,16 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) co selectForExec = FD_ISSET(socketDescriptor, &fdexec); } if(selectForExec) { - qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", + qWarning("nativeSelect (selectForRead %d, retVal %d, errno %d) Unexpected expectfds ready in fd %d", selectForRead, retval, errno, socketDescriptor); - } + } #endif return retval; } int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, - bool *selectForRead, bool *selectForWrite) const + bool *selectForRead, bool *selectForWrite) const { fd_set fdread; FD_ZERO(&fdread); diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 19560f0..04c6280 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -117,7 +117,7 @@ public: void setExceptionNotificationEnabled(bool enable); private: - Q_DECLARE_PRIVATE(QSocks5SocketEngine) + Q_DECLARE_SCOPED_PRIVATE(QSocks5SocketEngine) Q_DISABLE_COPY(QSocks5SocketEngine) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected()) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification()) diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h index 19f2a45..697f998 100644 --- a/src/network/socket/qtcpserver.h +++ b/src/network/socket/qtcpserver.h @@ -99,7 +99,7 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QTcpServer) - Q_DECLARE_PRIVATE(QTcpServer) + Q_DECLARE_SCOPED_PRIVATE(QTcpServer) }; QT_END_NAMESPACE diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h index 4e1003a..b0bb80f 100644 --- a/src/network/socket/qtcpsocket.h +++ b/src/network/socket/qtcpsocket.h @@ -65,7 +65,7 @@ protected: private: Q_DISABLE_COPY(QTcpSocket) - Q_DECLARE_PRIVATE(QTcpSocket) + Q_DECLARE_SCOPED_PRIVATE(QTcpSocket) }; QT_END_NAMESPACE diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index 32f72df..71a71cb 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -94,12 +94,12 @@ This enum describes the different flags you can pass to modify the behavior of QUdpSocket::bind(). - + \note On Symbian OS bind flags behaviour depends on process capabilties. - If process has NetworkControl capability, the bind attempt with + If process has NetworkControl capability, the bind attempt with ReuseAddressHint will always succeed even the address and port is already - bound by another socket with any flags. If process does not have - NetworkControl capability, the bind attempt to address and port already + bound by another socket with any flags. If process does not have + NetworkControl capability, the bind attempt to address and port already bound by another socket will always fail. \value ShareAddress Allow other services to bind to the same address @@ -356,7 +356,7 @@ qint64 QUdpSocket::pendingDatagramSize() const as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination. - + \warning In S60 5.0 and earlier versions, the writeDatagram return value is not reliable for large datagrams. @@ -386,8 +386,8 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre // As an workaround, we just set sent = size if( sent == 0 ) sent = size; - } -#endif + } +#endif d->cachedSocketDescriptor = d->socketEngine->socketDescriptor(); if (sent >= 0) { @@ -400,7 +400,7 @@ qint64 QUdpSocket::writeDatagram(const char *data, qint64 size, const QHostAddre return sent; } -/*! +/*! \fn qint64 QUdpSocket::writeDatagram(const QByteArray &datagram, const QHostAddress &host, quint16 port) \overload diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h index 078b8ad..ea0c42c 100644 --- a/src/network/socket/qudpsocket.h +++ b/src/network/socket/qudpsocket.h @@ -85,7 +85,7 @@ public: private: Q_DISABLE_COPY(QUdpSocket) - Q_DECLARE_PRIVATE(QUdpSocket) + Q_DECLARE_SCOPED_PRIVATE(QUdpSocket) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QUdpSocket::BindMode) diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h index cab0667..f3600bf 100644 --- a/src/network/ssl/qsslsocket.h +++ b/src/network/ssl/qsslsocket.h @@ -193,7 +193,7 @@ protected: qint64 writeData(const char *data, qint64 len); private: - Q_DECLARE_PRIVATE(QSslSocket) + Q_DECLARE_SCOPED_PRIVATE(QSslSocket) Q_DISABLE_COPY(QSslSocket) Q_PRIVATE_SLOT(d_func(), void _q_connectedSlot()) Q_PRIVATE_SLOT(d_func(), void _q_hostFoundSlot()) diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 6b777e3..2199a58 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -602,7 +602,7 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(d2i_RSAPrivateKey, 2296, libs.second ) #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf, 1153, libs.second ) - RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) + RESOLVEFUNC(OPENSSL_add_all_algorithms_conf, 1152, libs.second ) #else // Q_OS_SYMBIAN #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) @@ -723,7 +723,7 @@ bool q_resolveOpenSslSymbols() #endif RESOLVEFUNC(OPENSSL_add_all_algorithms_noconf) RESOLVEFUNC(OPENSSL_add_all_algorithms_conf) -#endif // Q_OS_SYMBIAN +#endif // Q_OS_SYMBIAN symbolsResolved = true; delete libs.first; delete libs.second; diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri index 6021d5d..d07f406 100644 --- a/src/network/ssl/ssl.pri +++ b/src/network/ssl/ssl.pri @@ -1,11 +1,11 @@ # OpenSSL support; compile in QSslSocket. contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) { - + symbian { INCLUDEPATH *= $$OS_LAYER_SSL_SYSTEMINCLUDE } else { - include($$QT_SOURCE_TREE/config.tests/unix/openssl/openssl.pri) + include($$QT_SOURCE_TREE/config.tests/unix/openssl/openssl.pri) } HEADERS += ssl/qssl.h \ |