network: remove Symbian specific code
removes several files and cleans up the code, removing all Symbian specific #ifdef's etc. Change-Id: Ie457e54cb4b3a992f251383320d47822259c38f1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
49bd825a96
commit
4329030b77
@ -69,11 +69,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 3;
|
|
||||||
#else
|
|
||||||
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
|
const int QHttpNetworkConnectionPrivate::defaultChannelCount = 6;
|
||||||
#endif
|
|
||||||
|
|
||||||
// The pipeline length. So there will be 4 requests in flight.
|
// The pipeline length. So there will be 4 requests in flight.
|
||||||
const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
|
const int QHttpNetworkConnectionPrivate::defaultPipelineLength = 3;
|
||||||
|
@ -160,22 +160,12 @@ static void ensureInitialized()
|
|||||||
upon the platform supporting connection management. The
|
upon the platform supporting connection management. The
|
||||||
\l QNetworkConfigurationManager::NetworkSessionRequired can be used to
|
\l QNetworkConfigurationManager::NetworkSessionRequired can be used to
|
||||||
detect whether QNetworkAccessManager utilizes this feature. Currently only
|
detect whether QNetworkAccessManager utilizes this feature. Currently only
|
||||||
Meego/Harmattan and Symbian platforms provide connection management support.
|
Meego/Harmattan platforms provide connection management support.
|
||||||
|
|
||||||
\note This feature cannot be used in combination with the Bearer Management
|
\note This feature cannot be used in combination with the Bearer Management
|
||||||
API as provided by QtMobility. Applications have to migrate to the Qt version
|
API as provided by QtMobility. Applications have to migrate to the Qt version
|
||||||
of Bearer Management.
|
of Bearer Management.
|
||||||
|
|
||||||
\section1 Symbian Platform Security Requirements
|
|
||||||
|
|
||||||
On Symbian, processes which use this class must have the
|
|
||||||
\c NetworkServices platform security capability. If the client
|
|
||||||
process lacks this capability, operations will result in a panic.
|
|
||||||
|
|
||||||
Platform security capabilities are added via the
|
|
||||||
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
|
|
||||||
qmake variable.
|
|
||||||
|
|
||||||
\sa QNetworkRequest, QNetworkReply, QNetworkProxy
|
\sa QNetworkRequest, QNetworkReply, QNetworkProxy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate()
|
|||||||
works across multiple processes. If the platform session
|
works across multiple processes. If the platform session
|
||||||
support is missing this API can only ensure the above behavior
|
support is missing this API can only ensure the above behavior
|
||||||
for network sessions within the same process.
|
for network sessions within the same process.
|
||||||
In general mobile platforms (such as Symbian/S60) have such
|
In general mobile platforms have such
|
||||||
support whereas most desktop platform lack this capability.
|
support whereas most desktop platform lack this capability.
|
||||||
\value ApplicationLevelRoaming The system gives applications control over the systems roaming
|
\value ApplicationLevelRoaming The system gives applications control over the systems roaming
|
||||||
behavior. Applications can initiate roaming (in case the
|
behavior. Applications can initiate roaming (in case the
|
||||||
|
@ -49,11 +49,6 @@
|
|||||||
#include "qnetworkconfigmanager_p.h"
|
#include "qnetworkconfigmanager_p.h"
|
||||||
#include "qnetworksession_p.h"
|
#include "qnetworksession_p.h"
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
#include <es_sock.h>
|
|
||||||
#include <private/qcore_symbian_p.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -362,9 +357,6 @@ void QNetworkSession::close()
|
|||||||
underlying network interface. This function always changes the session's state() flag to
|
underlying network interface. This function always changes the session's state() flag to
|
||||||
\l Disconnected.
|
\l Disconnected.
|
||||||
|
|
||||||
On Symbian platform, a 'NetworkControl' capability is required for
|
|
||||||
full interface-level stop (without the capability, only the current session is stopped).
|
|
||||||
|
|
||||||
\sa open(), close()
|
\sa open(), close()
|
||||||
*/
|
*/
|
||||||
void QNetworkSession::stop()
|
void QNetworkSession::stop()
|
||||||
@ -391,9 +383,6 @@ QNetworkConfiguration QNetworkSession::configuration() const
|
|||||||
|
|
||||||
The returned interface may change as a result of a roaming process.
|
The returned interface may change as a result of a roaming process.
|
||||||
|
|
||||||
Note: this function does not work in Symbian emulator due to the way the
|
|
||||||
connectivity is emulated on Windows.
|
|
||||||
|
|
||||||
\sa state()
|
\sa state()
|
||||||
*/
|
*/
|
||||||
QNetworkInterface QNetworkSession::interface() const
|
QNetworkInterface QNetworkSession::interface() const
|
||||||
@ -586,7 +575,7 @@ void QNetworkSession::migrate()
|
|||||||
*/
|
*/
|
||||||
void QNetworkSession::ignore()
|
void QNetworkSession::ignore()
|
||||||
{
|
{
|
||||||
// Needed on at least Symbian platform: the roaming must be explicitly
|
// Needed on mobile platforms (was needed for Symbian/S60): the roaming must be explicitly
|
||||||
// ignore()'d or migrate()'d
|
// ignore()'d or migrate()'d
|
||||||
if (d)
|
if (d)
|
||||||
d->ignore();
|
d->ignore();
|
||||||
@ -711,40 +700,6 @@ void QNetworkSession::disconnectNotify(const char *signal)
|
|||||||
d->setALREnabled(false);
|
d->setALREnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
RConnection* QNetworkSessionPrivate::nativeSession(QNetworkSession &s)
|
|
||||||
{
|
|
||||||
if (!s.d)
|
|
||||||
return 0;
|
|
||||||
if (s.thread() != QThread::currentThread())
|
|
||||||
qWarning("QNetworkSessionPrivate::nativeSession called in wrong thread");
|
|
||||||
return s.d->nativeSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
TInt QNetworkSessionPrivate::nativeOpenSocket(QNetworkSession& s, RSocket& sock, TUint family, TUint type, TUint protocol)
|
|
||||||
{
|
|
||||||
if (!s.d)
|
|
||||||
return 0;
|
|
||||||
QMutexLocker lock(&(s.d->mutex));
|
|
||||||
RConnection *con = s.d->nativeSession();
|
|
||||||
if (!con || !con->SubSessionHandle())
|
|
||||||
return KErrNotReady;
|
|
||||||
return sock.Open(qt_symbianGetSocketServer(), family, type, protocol, *con);
|
|
||||||
}
|
|
||||||
|
|
||||||
TInt QNetworkSessionPrivate::nativeOpenHostResolver(QNetworkSession& s, RHostResolver& resolver, TUint family, TUint protocol)
|
|
||||||
{
|
|
||||||
if (!s.d)
|
|
||||||
return 0;
|
|
||||||
QMutexLocker lock(&(s.d->mutex));
|
|
||||||
RConnection *con = s.d->nativeSession();
|
|
||||||
if (!con || !con->SubSessionHandle())
|
|
||||||
return KErrNotReady;
|
|
||||||
return resolver.Open(qt_symbianGetSocketServer(), family, protocol, *con);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "moc_qnetworksession.cpp"
|
#include "moc_qnetworksession.cpp"
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -59,12 +59,6 @@
|
|||||||
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
#ifndef QT_NO_BEARERMANAGEMENT
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
class RConnection;
|
|
||||||
class RSocket;
|
|
||||||
class RHostResolver;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject
|
class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject
|
||||||
@ -109,15 +103,6 @@ public:
|
|||||||
virtual quint64 bytesReceived() const = 0;
|
virtual quint64 bytesReceived() const = 0;
|
||||||
virtual quint64 activeTime() const = 0;
|
virtual quint64 activeTime() const = 0;
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
// get internal RConnection (not thread safe, call only from thread that owns the QNetworkSession)
|
|
||||||
static RConnection* nativeSession(QNetworkSession&);
|
|
||||||
virtual RConnection* nativeSession() = 0;
|
|
||||||
// open socket using the internal RConnection (thread safe)
|
|
||||||
static TInt nativeOpenSocket(QNetworkSession& session, RSocket& socket, TUint family, TUint type, TUint protocol);
|
|
||||||
// open host resolver using the internal RConnection (thread safe)
|
|
||||||
static TInt nativeOpenHostResolver(QNetworkSession& session, RHostResolver& resolver, TUint family, TUint protocol);
|
|
||||||
#endif
|
|
||||||
protected:
|
protected:
|
||||||
inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
|
inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
|
||||||
{
|
{
|
||||||
|
@ -20,15 +20,11 @@ SOURCES += kernel/qauthenticator.cpp \
|
|||||||
kernel/qnetworkproxy.cpp \
|
kernel/qnetworkproxy.cpp \
|
||||||
kernel/qnetworkinterface.cpp
|
kernel/qnetworkinterface.cpp
|
||||||
|
|
||||||
symbian: SOURCES += kernel/qhostinfo_symbian.cpp kernel/qnetworkinterface_symbian.cpp
|
unix:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
|
||||||
unix:!symbian:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
|
|
||||||
win32:SOURCES += kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp
|
win32:SOURCES += kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp
|
||||||
integrity:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
|
integrity:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
|
||||||
|
|
||||||
mac:LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation
|
mac:LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation
|
||||||
mac:SOURCES += kernel/qnetworkproxy_mac.cpp
|
mac:SOURCES += kernel/qnetworkproxy_mac.cpp
|
||||||
else:win32:SOURCES += kernel/qnetworkproxy_win.cpp
|
else:win32:SOURCES += kernel/qnetworkproxy_win.cpp
|
||||||
else:symbian:SOURCES += kernel/qnetworkproxy_symbian.cpp
|
|
||||||
else:SOURCES += kernel/qnetworkproxy_generic.cpp
|
else:SOURCES += kernel/qnetworkproxy_generic.cpp
|
||||||
|
|
||||||
symbian: LIBS += -lcommsdat
|
|
||||||
|
@ -59,11 +59,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
//#define QHOSTINFO_DEBUG
|
//#define QHOSTINFO_DEBUG
|
||||||
|
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager)
|
Q_GLOBAL_STATIC(QHostInfoLookupManager, theHostInfoLookupManager)
|
||||||
#else
|
|
||||||
Q_GLOBAL_STATIC(QSymbianHostInfoLookupManager, theHostInfoLookupManager)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QHostInfo
|
\class QHostInfo
|
||||||
@ -178,7 +174,6 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver,
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
QHostInfoLookupManager *manager = theHostInfoLookupManager();
|
QHostInfoLookupManager *manager = theHostInfoLookupManager();
|
||||||
|
|
||||||
if (manager) {
|
if (manager) {
|
||||||
@ -201,39 +196,6 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver,
|
|||||||
QObject::connect(&runnable->resultEmitter, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection);
|
QObject::connect(&runnable->resultEmitter, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection);
|
||||||
manager->scheduleLookup(runnable);
|
manager->scheduleLookup(runnable);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
QSymbianHostInfoLookupManager *manager = theHostInfoLookupManager();
|
|
||||||
|
|
||||||
if (manager) {
|
|
||||||
// the application is still alive
|
|
||||||
if (manager->cache.isEnabled()) {
|
|
||||||
// check cache first
|
|
||||||
bool valid = false;
|
|
||||||
QHostInfo info = manager->cache.get(name, &valid);
|
|
||||||
if (valid) {
|
|
||||||
info.setLookupId(id);
|
|
||||||
QHostInfoResult result;
|
|
||||||
QObject::connect(&result, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection);
|
|
||||||
result.emitResultsReady(info);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// cache is not enabled or it was not in the cache, do normal lookup
|
|
||||||
#ifndef QT_NO_BEARERMANAGEMENT
|
|
||||||
QSharedPointer<QNetworkSession> networkSession;
|
|
||||||
QVariant v(receiver->property("_q_networksession"));
|
|
||||||
if (v.isValid())
|
|
||||||
networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(v);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSymbianHostResolver *symbianResolver = 0;
|
|
||||||
QT_TRAP_THROWING(symbianResolver = new QSymbianHostResolver(name, id, networkSession));
|
|
||||||
QObject::connect(&symbianResolver->resultEmitter, SIGNAL(resultsReady(QHostInfo)), receiver, member, Qt::QueuedConnection);
|
|
||||||
manager->scheduleLookup(symbianResolver);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,13 +248,10 @@ QHostInfo QHostInfoPrivate::fromName(const QString &name, QSharedPointer<QNetwor
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
// This function has a special implementation for symbian right now in qhostinfo_symbian.cpp but not on other OS.
|
|
||||||
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
|
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession>)
|
||||||
{
|
{
|
||||||
return QHostInfoAgent::fromName(hostName);
|
return QHostInfoAgent::fromName(hostName);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -471,7 +430,6 @@ void QHostInfo::setErrorString(const QString &str)
|
|||||||
\sa hostName()
|
\sa hostName()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
QHostInfoRunnable::QHostInfoRunnable(QString hn, int i) : toBeLookedUp(hn), id(i)
|
QHostInfoRunnable::QHostInfoRunnable(QString hn, int i) : toBeLookedUp(hn), id(i)
|
||||||
{
|
{
|
||||||
setAutoDelete(true);
|
setAutoDelete(true);
|
||||||
@ -699,7 +657,6 @@ void QHostInfoLookupManager::lookupFinished(QHostInfoRunnable *r)
|
|||||||
finishedLookups.append(r);
|
finishedLookups.append(r);
|
||||||
work();
|
work();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// This function returns immediately when we had a result in the cache, else it will later emit a signal
|
// This function returns immediately when we had a result in the cache, else it will later emit a signal
|
||||||
QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id)
|
QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id)
|
||||||
|
@ -72,12 +72,6 @@
|
|||||||
#include <QNetworkSession>
|
#include <QNetworkSession>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
// Symbian Headers
|
|
||||||
#include <es_sock.h>
|
|
||||||
#include <in_sock.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -102,11 +96,6 @@ class QHostInfoAgent : public QObject
|
|||||||
public:
|
public:
|
||||||
static QHostInfo fromName(const QString &hostName);
|
static QHostInfo fromName(const QString &hostName);
|
||||||
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
|
static QHostInfo fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession);
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
static int lookupHost(const QString &name, QObject *receiver, const char *member);
|
|
||||||
static void abortHostLookup(int lookupId);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QHostInfoPrivate
|
class QHostInfoPrivate
|
||||||
@ -188,7 +177,6 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
class QHostInfoLookupManager : public QAbstractHostInfoLookupManager
|
class QHostInfoLookupManager : public QAbstractHostInfoLookupManager
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -225,95 +213,6 @@ private slots:
|
|||||||
void waitForThreadPoolDone() { threadPool.waitForDone(); }
|
void waitForThreadPoolDone() { threadPool.waitForDone(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
class QSymbianHostResolver : public CActive
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QSymbianHostResolver(const QString &hostName, int id, QSharedPointer<QNetworkSession> networkSession);
|
|
||||||
~QSymbianHostResolver();
|
|
||||||
|
|
||||||
void requestHostLookup();
|
|
||||||
void abortHostLookup();
|
|
||||||
int id();
|
|
||||||
|
|
||||||
void returnResults();
|
|
||||||
|
|
||||||
QHostInfoResult resultEmitter;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void DoCancel();
|
|
||||||
void RunL();
|
|
||||||
void run();
|
|
||||||
TInt RunError(TInt aError);
|
|
||||||
|
|
||||||
void processNameResult();
|
|
||||||
void nextNameResult();
|
|
||||||
void processAddressResult();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int iId;
|
|
||||||
|
|
||||||
const QString iHostName;
|
|
||||||
QString iEncodedHostName;
|
|
||||||
TPtrC iHostNamePtr;
|
|
||||||
|
|
||||||
RSocketServ& iSocketServ;
|
|
||||||
RHostResolver iHostResolver;
|
|
||||||
QSharedPointer<QNetworkSession> iNetworkSession;
|
|
||||||
|
|
||||||
TNameEntry iNameResult;
|
|
||||||
TInetAddr IpAdd;
|
|
||||||
|
|
||||||
QHostAddress iAddress;
|
|
||||||
|
|
||||||
QHostInfo iResults;
|
|
||||||
|
|
||||||
QList<QHostAddress> iHostAddresses;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
EIdle,
|
|
||||||
EGetByName,
|
|
||||||
EGetByAddress,
|
|
||||||
ECompleteFromCache,
|
|
||||||
EError
|
|
||||||
} iState;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QSymbianHostInfoLookupManager : public QAbstractHostInfoLookupManager
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
QSymbianHostInfoLookupManager();
|
|
||||||
~QSymbianHostInfoLookupManager();
|
|
||||||
|
|
||||||
static QSymbianHostInfoLookupManager* globalInstance();
|
|
||||||
|
|
||||||
int id();
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
// called from QHostInfo
|
|
||||||
void scheduleLookup(QSymbianHostResolver *r);
|
|
||||||
void abortLookup(int id);
|
|
||||||
|
|
||||||
// called from QSymbianHostResolver
|
|
||||||
void lookupFinished(QSymbianHostResolver *r);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void runNextLookup();
|
|
||||||
|
|
||||||
// this is true for single threaded use, with multiple threads the max is ((number of threads) + KMaxConcurrentLookups - 1)
|
|
||||||
static const int KMaxConcurrentLookups = 5;
|
|
||||||
|
|
||||||
QList<QSymbianHostResolver*> iCurrentLookups;
|
|
||||||
QList<QSymbianHostResolver*> iScheduledLookups;
|
|
||||||
|
|
||||||
QMutex mutex;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QHOSTINFO_P_H
|
#endif // QHOSTINFO_P_H
|
||||||
|
@ -1,600 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtNetwork module of the Qt 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
//#define QHOSTINFO_DEBUG
|
|
||||||
|
|
||||||
// Qt Headers
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
#include "qplatformdefs.h"
|
|
||||||
|
|
||||||
#include "qhostinfo_p.h"
|
|
||||||
#include <private/qcore_symbian_p.h>
|
|
||||||
#include <private/qsystemerror_p.h>
|
|
||||||
#include <private/qnetworksession_p.h>
|
|
||||||
|
|
||||||
// Header does not exist in the S60 5.0 SDK
|
|
||||||
//#include <networking/dnd_err.h>
|
|
||||||
const TInt KErrDndNameNotFound = -5120; // Returned when no data found for GetByName
|
|
||||||
const TInt KErrDndAddrNotFound = -5121; // Returned when no data found for GetByAddr
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
static void setError_helper(QHostInfo &info, TInt symbianError)
|
|
||||||
{
|
|
||||||
switch (symbianError) {
|
|
||||||
case KErrDndNameNotFound:
|
|
||||||
case KErrDndAddrNotFound:
|
|
||||||
case KErrNotFound:
|
|
||||||
case KErrEof:
|
|
||||||
// various "no more results" error codes
|
|
||||||
info.setError(QHostInfo::HostNotFound);
|
|
||||||
info.setErrorString(QObject::tr("Host not found"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Unknown error
|
|
||||||
info.setError(QHostInfo::UnknownError);
|
|
||||||
info.setErrorString(QSystemError(symbianError, QSystemError::NativeError).toString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QHostInfo QHostInfoAgent::fromName(const QString &hostName, QSharedPointer<QNetworkSession> networkSession)
|
|
||||||
{
|
|
||||||
QHostInfo results;
|
|
||||||
|
|
||||||
// Connect to ESOCK
|
|
||||||
RSocketServ socketServ(qt_symbianGetSocketServer());
|
|
||||||
RHostResolver hostResolver;
|
|
||||||
|
|
||||||
|
|
||||||
int err;
|
|
||||||
if (networkSession)
|
|
||||||
err = QNetworkSessionPrivate::nativeOpenHostResolver(*networkSession, hostResolver, KAfInet, KProtocolInetUdp);
|
|
||||||
else
|
|
||||||
err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp);
|
|
||||||
if (err) {
|
|
||||||
setError_helper(results, err);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
TNameEntry nameResult;
|
|
||||||
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("QHostInfoAgent::fromName(%s) looking up...",
|
|
||||||
hostName.toLatin1().constData());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QHostAddress address;
|
|
||||||
if (address.setAddress(hostName)) {
|
|
||||||
// Reverse lookup
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("(reverse lookup)");
|
|
||||||
#endif
|
|
||||||
TInetAddr IpAdd;
|
|
||||||
IpAdd.Input(qt_QString2TPtrC(hostName));
|
|
||||||
|
|
||||||
// Synchronous request. nameResult returns Host Name.
|
|
||||||
err = hostResolver.GetByAddress(IpAdd, nameResult);
|
|
||||||
if (err) {
|
|
||||||
//for behavioural compatibility with Qt 4.7 and unix/windows
|
|
||||||
//backends: don't report error, return ip address as host name
|
|
||||||
results.setHostName(address.toString());
|
|
||||||
} else {
|
|
||||||
results.setHostName(qt_TDesC2QString(nameResult().iName));
|
|
||||||
}
|
|
||||||
results.setAddresses(QList<QHostAddress>() << address);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
// IDN support
|
|
||||||
QByteArray aceHostname = QUrl::toAce(hostName);
|
|
||||||
results.setHostName(hostName);
|
|
||||||
if (aceHostname.isEmpty()) {
|
|
||||||
results.setError(QHostInfo::HostNotFound);
|
|
||||||
results.setErrorString(hostName.isEmpty() ?
|
|
||||||
QCoreApplication::translate("QHostInfoAgent", "No host name given") :
|
|
||||||
QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Call RHostResolver::GetByAddress, and place all IPv4 addresses at the start and
|
|
||||||
// the IPv6 addresses at the end of the address list in results.
|
|
||||||
|
|
||||||
// Synchronous request.
|
|
||||||
err = hostResolver.GetByName(qt_QString2TPtrC(QString::fromLatin1(aceHostname)), nameResult);
|
|
||||||
if (err) {
|
|
||||||
setError_helper(results, err);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QHostAddress> hostAddresses;
|
|
||||||
|
|
||||||
TInetAddr hostAdd = nameResult().iAddr;
|
|
||||||
// 39 is the maximum length of an IPv6 address.
|
|
||||||
TBuf<39> ipAddr;
|
|
||||||
|
|
||||||
// Fill ipAddr with the IP address from hostAdd
|
|
||||||
hostAdd.Output(ipAddr);
|
|
||||||
if (ipAddr.Length() > 0)
|
|
||||||
hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr)));
|
|
||||||
|
|
||||||
// Check if there's more than one IP address linkd to this name
|
|
||||||
while (hostResolver.Next(nameResult) == KErrNone) {
|
|
||||||
hostAdd = nameResult().iAddr;
|
|
||||||
hostAdd.Output(ipAddr);
|
|
||||||
|
|
||||||
// Ensure that record is valid (not an alias and with length greater than 0)
|
|
||||||
if (!(nameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) {
|
|
||||||
hostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hostResolver.Close();
|
|
||||||
|
|
||||||
results.setAddresses(hostAddresses);
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
|
|
||||||
{
|
|
||||||
// null shared pointer
|
|
||||||
QSharedPointer<QNetworkSession> networkSession;
|
|
||||||
return fromName(hostName, networkSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QHostInfo::localHostName()
|
|
||||||
{
|
|
||||||
// Connect to ESOCK
|
|
||||||
RSocketServ socketServ(qt_symbianGetSocketServer());
|
|
||||||
RHostResolver hostResolver;
|
|
||||||
|
|
||||||
// RConnection not required to get the host name
|
|
||||||
int err = hostResolver.Open(socketServ, KAfInet, KProtocolInetUdp);
|
|
||||||
if (err)
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
THostName hostName;
|
|
||||||
err = hostResolver.GetHostName(hostName);
|
|
||||||
if (err)
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
hostResolver.Close();
|
|
||||||
|
|
||||||
return qt_TDesC2QString(hostName);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QHostInfo::localDomainName()
|
|
||||||
{
|
|
||||||
// This concept does not exist on Symbian OS because the device can be on
|
|
||||||
// multiple networks with multiple "local domain" names.
|
|
||||||
// For now, return a null string.
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QSymbianHostResolver::QSymbianHostResolver(const QString &hostName, int identifier, QSharedPointer<QNetworkSession> networkSession)
|
|
||||||
: CActive(CActive::EPriorityStandard), iHostName(hostName),
|
|
||||||
iSocketServ(qt_symbianGetSocketServer()), iNetworkSession(networkSession), iResults(identifier)
|
|
||||||
{
|
|
||||||
CActiveScheduler::Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSymbianHostResolver::~QSymbianHostResolver()
|
|
||||||
{
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::~QSymbianHostResolver" << id();
|
|
||||||
#endif
|
|
||||||
Cancel();
|
|
||||||
iHostResolver.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Async equivalent to QHostInfoAgent::fromName()
|
|
||||||
void QSymbianHostResolver::requestHostLookup()
|
|
||||||
{
|
|
||||||
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("QSymbianHostResolver::requestHostLookup(%s) looking up... (id = %d)",
|
|
||||||
iHostName.toLatin1().constData(), id());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager *manager = QSymbianHostInfoLookupManager::globalInstance();
|
|
||||||
if (manager->cache.isEnabled()) {
|
|
||||||
//check if name has been put in the cache while this request was queued
|
|
||||||
bool valid;
|
|
||||||
QHostInfo cachedResult = manager->cache.get(iHostName, &valid);
|
|
||||||
if (valid) {
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("...found in cache");
|
|
||||||
#endif
|
|
||||||
iResults = cachedResult;
|
|
||||||
iState = ECompleteFromCache;
|
|
||||||
SetActive();
|
|
||||||
TRequestStatus* stat = &iStatus;
|
|
||||||
User::RequestComplete(stat, KErrNone);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int err;
|
|
||||||
if (iNetworkSession) {
|
|
||||||
err = QNetworkSessionPrivate::nativeOpenHostResolver(*iNetworkSession, iHostResolver, KAfInet, KProtocolInetUdp);
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("using resolver from session (err = %d)", err);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
err = iHostResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp);
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug("using default resolver (err = %d)", err);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (err) {
|
|
||||||
setError_helper(iResults, err);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (iAddress.setAddress(iHostName)) {
|
|
||||||
// Reverse lookup
|
|
||||||
IpAdd.Input(qt_QString2TPtrC(iHostName));
|
|
||||||
|
|
||||||
// Asynchronous request.
|
|
||||||
iHostResolver.GetByAddress(IpAdd, iNameResult, iStatus); // <---- ASYNC
|
|
||||||
iState = EGetByAddress;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// IDN support
|
|
||||||
QByteArray aceHostname = QUrl::toAce(iHostName);
|
|
||||||
iResults.setHostName(iHostName);
|
|
||||||
if (aceHostname.isEmpty()) {
|
|
||||||
iResults.setError(QHostInfo::HostNotFound);
|
|
||||||
iResults.setErrorString(iHostName.isEmpty() ?
|
|
||||||
QCoreApplication::translate("QHostInfoAgent", "No host name given") :
|
|
||||||
QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));
|
|
||||||
|
|
||||||
err = KErrArgument;
|
|
||||||
} else {
|
|
||||||
iEncodedHostName = QString::fromLatin1(aceHostname);
|
|
||||||
iHostNamePtr.Set(qt_QString2TPtrC(iEncodedHostName));
|
|
||||||
|
|
||||||
// Asynchronous request.
|
|
||||||
iHostResolver.GetByName(iHostNamePtr, iNameResult, iStatus);
|
|
||||||
iState = EGetByName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetActive();
|
|
||||||
if (err) {
|
|
||||||
iHostResolver.Close();
|
|
||||||
|
|
||||||
//self complete so that RunL can inform manager without causing recursion
|
|
||||||
iState = EError;
|
|
||||||
TRequestStatus* stat = &iStatus;
|
|
||||||
User::RequestComplete(stat, err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::abortHostLookup()
|
|
||||||
{
|
|
||||||
if (resultEmitter.thread() == QThread::currentThread()) {
|
|
||||||
#ifdef QHOSTINFO_DEBUG
|
|
||||||
qDebug("QSymbianHostResolver::abortHostLookup - deleting %d", id());
|
|
||||||
#endif
|
|
||||||
//normal case, abort from same thread it was started
|
|
||||||
delete this; //will cancel outstanding request
|
|
||||||
} else {
|
|
||||||
#ifdef QHOSTINFO_DEBUG
|
|
||||||
qDebug("QSymbianHostResolver::abortHostLookup - detaching %d", id());
|
|
||||||
#endif
|
|
||||||
//abort from different thread, carry on but don't report the results
|
|
||||||
resultEmitter.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::DoCancel()
|
|
||||||
{
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostResolver::DoCancel" << QThread::currentThreadId() << id() << (int)iState << this;
|
|
||||||
#endif
|
|
||||||
if (iState == EGetByAddress || iState == EGetByName) {
|
|
||||||
//these states have made an async request to host resolver
|
|
||||||
iHostResolver.Cancel();
|
|
||||||
} else {
|
|
||||||
//for the self completing states there is nothing to cancel
|
|
||||||
Q_ASSERT(iState == EError || iState == ECompleteFromCache);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::RunL()
|
|
||||||
{
|
|
||||||
QT_TRYCATCH_LEAVING(run());
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::run()
|
|
||||||
{
|
|
||||||
switch (iState) {
|
|
||||||
case EGetByName:
|
|
||||||
processNameResult();
|
|
||||||
break;
|
|
||||||
case EGetByAddress:
|
|
||||||
processAddressResult();
|
|
||||||
break;
|
|
||||||
case ECompleteFromCache:
|
|
||||||
case EError:
|
|
||||||
returnResults();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qWarning("QSymbianHostResolver internal error, bad state in run()");
|
|
||||||
iResults.setError(QHostInfo::UnknownError);
|
|
||||||
iResults.setErrorString(QSystemError(KErrCorrupt,QSystemError::NativeError).toString());
|
|
||||||
returnResults();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::returnResults()
|
|
||||||
{
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostResolver::returnResults" << iResults.error() << iResults.errorString();
|
|
||||||
foreach (QHostAddress addr, iResults.addresses())
|
|
||||||
qDebug() << addr;
|
|
||||||
#endif
|
|
||||||
iState = EIdle;
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager *manager = QSymbianHostInfoLookupManager::globalInstance();
|
|
||||||
if (manager->cache.isEnabled()) {
|
|
||||||
manager->cache.put(iHostName, iResults);
|
|
||||||
}
|
|
||||||
manager->lookupFinished(this);
|
|
||||||
|
|
||||||
resultEmitter.emitResultsReady(iResults);
|
|
||||||
|
|
||||||
delete this;
|
|
||||||
}
|
|
||||||
|
|
||||||
TInt QSymbianHostResolver::RunError(TInt aError)
|
|
||||||
{
|
|
||||||
QT_TRY {
|
|
||||||
iState = EIdle;
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager *manager = QSymbianHostInfoLookupManager::globalInstance();
|
|
||||||
manager->lookupFinished(this);
|
|
||||||
|
|
||||||
setError_helper(iResults, aError);
|
|
||||||
|
|
||||||
resultEmitter.emitResultsReady(iResults);
|
|
||||||
}
|
|
||||||
QT_CATCH(...) {}
|
|
||||||
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return KErrNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::processNameResult()
|
|
||||||
{
|
|
||||||
if (iStatus.Int() == KErrNone) {
|
|
||||||
TInetAddr hostAdd = iNameResult().iAddr;
|
|
||||||
// 39 is the maximum length of an IPv6 address.
|
|
||||||
TBuf<39> ipAddr;
|
|
||||||
|
|
||||||
hostAdd.Output(ipAddr);
|
|
||||||
|
|
||||||
// Ensure that record is valid (not an alias and with length greater than 0)
|
|
||||||
if (!(iNameResult().iFlags & TNameRecord::EAlias) && !(hostAdd.IsUnspecified())) {
|
|
||||||
iHostAddresses.append(QHostAddress(qt_TDesC2QString(ipAddr)));
|
|
||||||
}
|
|
||||||
|
|
||||||
iState = EGetByName;
|
|
||||||
iHostResolver.Next(iNameResult, iStatus);
|
|
||||||
SetActive();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// No more addresses, so return the results (or an error if there aren't any).
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostResolver::processNameResult with err=" << iStatus.Int() << "count=" << iHostAddresses.count();
|
|
||||||
#endif
|
|
||||||
if (iHostAddresses.count() > 0) {
|
|
||||||
iResults.setAddresses(iHostAddresses);
|
|
||||||
} else {
|
|
||||||
iState = EError;
|
|
||||||
setError_helper(iResults, iStatus.Int());
|
|
||||||
}
|
|
||||||
returnResults();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostResolver::processAddressResult()
|
|
||||||
{
|
|
||||||
TInt err = iStatus.Int();
|
|
||||||
|
|
||||||
if (err < 0) {
|
|
||||||
//For behavioural compatibility with Qt 4.7, don't report errors on reverse lookup,
|
|
||||||
//return the address as a string (same as unix/windows backends)
|
|
||||||
iResults.setHostName(iAddress.toString());
|
|
||||||
} else {
|
|
||||||
iResults.setHostName(qt_TDesC2QString(iNameResult().iName));
|
|
||||||
}
|
|
||||||
iResults.setAddresses(QList<QHostAddress>() << iAddress);
|
|
||||||
returnResults();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int QSymbianHostResolver::id()
|
|
||||||
{
|
|
||||||
return iResults.lookupId();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager::QSymbianHostInfoLookupManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager::~QSymbianHostInfoLookupManager()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostInfoLookupManager::clear()
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::clear" << QThread::currentThreadId();
|
|
||||||
#endif
|
|
||||||
foreach (QSymbianHostResolver *hr, iCurrentLookups)
|
|
||||||
hr->abortHostLookup();
|
|
||||||
iCurrentLookups.clear();
|
|
||||||
qDeleteAll(iScheduledLookups);
|
|
||||||
cache.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostInfoLookupManager::lookupFinished(QSymbianHostResolver *r)
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::lookupFinished" << QThread::currentThreadId() << r->id() << "current" << iCurrentLookups.count() << "queued" << iScheduledLookups.count();
|
|
||||||
#endif
|
|
||||||
// remove finished lookup from array and destroy
|
|
||||||
TInt count = iCurrentLookups.count();
|
|
||||||
for (TInt i = 0; i < count; i++) {
|
|
||||||
if (iCurrentLookups[i]->id() == r->id()) {
|
|
||||||
iCurrentLookups.removeAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
runNextLookup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostInfoLookupManager::runNextLookup()
|
|
||||||
{
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::runNextLookup" << QThread::currentThreadId() << "current" << iCurrentLookups.count() << "queued" << iScheduledLookups.count();
|
|
||||||
#endif
|
|
||||||
// check to see if there are any scheduled lookups
|
|
||||||
for (int i=0; i<iScheduledLookups.count(); i++) {
|
|
||||||
QSymbianHostResolver* hostResolver = iScheduledLookups.at(i);
|
|
||||||
if (hostResolver->resultEmitter.thread() == QThread::currentThread()) {
|
|
||||||
// if so, move one to the current lookups and run it
|
|
||||||
iCurrentLookups.append(hostResolver);
|
|
||||||
iScheduledLookups.removeAt(i);
|
|
||||||
hostResolver->requestHostLookup();
|
|
||||||
// if spare capacity, try to start another one
|
|
||||||
if (iCurrentLookups.count() >= KMaxConcurrentLookups)
|
|
||||||
break;
|
|
||||||
i--; //compensate for removeAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// called from QHostInfo
|
|
||||||
void QSymbianHostInfoLookupManager::scheduleLookup(QSymbianHostResolver* r)
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::scheduleLookup" << QThread::currentThreadId() << r->id() << "current" << iCurrentLookups.count() << "queued" << iScheduledLookups.count();
|
|
||||||
#endif
|
|
||||||
// Check to see if we have space on the current lookups pool.
|
|
||||||
bool defer = false;
|
|
||||||
if (iCurrentLookups.count() >= KMaxConcurrentLookups) {
|
|
||||||
// busy, defer unless there are no request in this thread
|
|
||||||
// at least one active request per thread with queued requests is needed
|
|
||||||
for (int i=0; i < iCurrentLookups.count();i++) {
|
|
||||||
if (iCurrentLookups.at(i)->resultEmitter.thread() == QThread::currentThread()) {
|
|
||||||
defer = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (defer) {
|
|
||||||
// If no, schedule for later.
|
|
||||||
iScheduledLookups.append(r);
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug(" - scheduled");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
// If yes, add it to the current lookups.
|
|
||||||
iCurrentLookups.append(r);
|
|
||||||
|
|
||||||
// ... and trigger the async call.
|
|
||||||
r->requestHostLookup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSymbianHostInfoLookupManager::abortLookup(int id)
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
|
|
||||||
#if defined(QHOSTINFO_DEBUG)
|
|
||||||
qDebug() << "QSymbianHostInfoLookupManager::abortLookup" << QThread::currentThreadId() << id << "current" << iCurrentLookups.count() << "queued" << iScheduledLookups.count();
|
|
||||||
#endif
|
|
||||||
int i = 0;
|
|
||||||
// Find the aborted lookup by ID.
|
|
||||||
// First in the current lookups.
|
|
||||||
for (i = 0; i < iCurrentLookups.count(); i++) {
|
|
||||||
if (id == iCurrentLookups[i]->id()) {
|
|
||||||
QSymbianHostResolver* r = iCurrentLookups.at(i);
|
|
||||||
iCurrentLookups.removeAt(i);
|
|
||||||
r->abortHostLookup();
|
|
||||||
runNextLookup();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Then in the scheduled lookups.
|
|
||||||
for (i = 0; i < iScheduledLookups.count(); i++) {
|
|
||||||
if (id == iScheduledLookups[i]->id()) {
|
|
||||||
QSymbianHostResolver* r = iScheduledLookups.at(i);
|
|
||||||
iScheduledLookups.removeAt(i);
|
|
||||||
delete r;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QSymbianHostInfoLookupManager* QSymbianHostInfoLookupManager::globalInstance()
|
|
||||||
{
|
|
||||||
return static_cast<QSymbianHostInfoLookupManager*>
|
|
||||||
(QAbstractHostInfoLookupManager::globalInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
@ -1,266 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtNetwork of the Qt 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
//#define QNETWORKINTERFACE_DEBUG
|
|
||||||
|
|
||||||
#include "qnetworkinterface.h"
|
|
||||||
#include "qnetworkinterface_p.h"
|
|
||||||
#include <private/qcore_symbian_p.h>
|
|
||||||
|
|
||||||
#ifndef QT_NO_NETWORKINTERFACE
|
|
||||||
|
|
||||||
#include <in_sock.h>
|
|
||||||
#include <in_iface.h>
|
|
||||||
#include <es_sock.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
return flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: share this, at least QHostInfo needs to do the same thing
|
|
||||||
static QHostAddress qt_QHostAddressFromTInetAddr(const TInetAddr& addr)
|
|
||||||
{
|
|
||||||
//TODO: do we want to call v4 mapped addresses v4 or v6 outside of this file?
|
|
||||||
if (addr.IsV4Mapped() || addr.Family() == KAfInet) {
|
|
||||||
//convert v4 host address
|
|
||||||
return QHostAddress(addr.Address());
|
|
||||||
} else {
|
|
||||||
//convert v6 host address
|
|
||||||
return QHostAddress((quint8 *)(addr.Ip6Address().u.iAddr8));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QList<QNetworkInterfacePrivate *> interfaceListing()
|
|
||||||
{
|
|
||||||
TInt err(KErrNone);
|
|
||||||
QList<QNetworkInterfacePrivate *> interfaces;
|
|
||||||
QList<QHostAddress> addressesWithEstimatedNetmasks;
|
|
||||||
|
|
||||||
// Open dummy socket for interface queries
|
|
||||||
RSocket socket;
|
|
||||||
err = socket.Open(qt_symbianGetSocketServer(), _L("udp"));
|
|
||||||
if (err) {
|
|
||||||
return interfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ask socket to start enumerating interfaces
|
|
||||||
err = socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl);
|
|
||||||
if (err) {
|
|
||||||
socket.Close();
|
|
||||||
return interfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ifindex = 0;
|
|
||||||
TPckgBuf<TSoInetInterfaceInfo> infoPckg;
|
|
||||||
TSoInetInterfaceInfo &info = infoPckg();
|
|
||||||
while (socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, infoPckg) == KErrNone) {
|
|
||||||
if (info.iName != KNullDesC) {
|
|
||||||
TName address;
|
|
||||||
QNetworkAddressEntry entry;
|
|
||||||
QNetworkInterfacePrivate *iface = 0;
|
|
||||||
|
|
||||||
iface = new QNetworkInterfacePrivate;
|
|
||||||
iface->index = ifindex++;
|
|
||||||
interfaces << iface;
|
|
||||||
iface->name = qt_TDesC2QString(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 = qt_TDesC2QString(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the address of the interface
|
|
||||||
entry.setIp(qt_QHostAddressFromTInetAddr(info.iAddress));
|
|
||||||
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "address is" << info.iAddress.Family() << entry.ip();
|
|
||||||
qDebug() << "netmask is" << info.iNetMask.Family() << qt_QHostAddressFromTInetAddr( info.iNetMask );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get the interface netmask
|
|
||||||
if (info.iNetMask.IsUnspecified()) {
|
|
||||||
// For some reason netmask is always 0.0.0.0 for IPv4 interfaces
|
|
||||||
// and loopback interfaces (which we statically know)
|
|
||||||
if (info.iAddress.IsV4Mapped()) {
|
|
||||||
if (info.iFeatures & KIfIsLoopback) {
|
|
||||||
entry.setPrefixLength(32);
|
|
||||||
} else {
|
|
||||||
// Workaround: Let Symbian determine netmask based on IP address class (IPv4 only API)
|
|
||||||
TInetAddr netmask;
|
|
||||||
netmask.NetMask(info.iAddress);
|
|
||||||
entry.setNetmask(QHostAddress(netmask.Address())); //binary convert v4 address
|
|
||||||
addressesWithEstimatedNetmasks << entry.ip();
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "address class determined netmask" << entry.netmask();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// For IPv6 interfaces
|
|
||||||
if (info.iFeatures & KIfIsLoopback) {
|
|
||||||
entry.setPrefixLength(128);
|
|
||||||
} else if (info.iNetMask.IsUnspecified()) {
|
|
||||||
//Don't see this error for IPv6, but try to handle it if it happens
|
|
||||||
entry.setPrefixLength(64); //most common
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "total guess netmask" << entry.netmask();
|
|
||||||
#endif
|
|
||||||
addressesWithEstimatedNetmasks << entry.ip();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//Expected code path for IPv6 non loopback interfaces (IPv4 could come here if symbian is fixed)
|
|
||||||
entry.setNetmask(qt_QHostAddressFromTInetAddr(info.iNetMask));
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "reported netmask" << entry.netmask();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// broadcast address is determined from the netmask in postProcess()
|
|
||||||
|
|
||||||
// Add new entry to interface address entries
|
|
||||||
iface->addressEntries << entry;
|
|
||||||
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug("\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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we didn't have to guess any netmasks, then we're done.
|
|
||||||
if (addressesWithEstimatedNetmasks.isEmpty()) {
|
|
||||||
socket.Close();
|
|
||||||
return interfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
// we will try to use routing info to detect more precisely
|
|
||||||
// estimated netmasks and then ::postProcess() should calculate
|
|
||||||
// broadcast addresses
|
|
||||||
|
|
||||||
// use dummy socket to start enumerating routes
|
|
||||||
err = socket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl);
|
|
||||||
if (err) {
|
|
||||||
socket.Close();
|
|
||||||
// return what we have
|
|
||||||
// up to this moment
|
|
||||||
return interfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
TSoInetRouteInfo routeInfo;
|
|
||||||
TPckg<TSoInetRouteInfo> routeInfoPkg(routeInfo);
|
|
||||||
while (socket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone) {
|
|
||||||
// get interface address
|
|
||||||
QHostAddress ifAddr(qt_QHostAddressFromTInetAddr(routeInfo.iIfAddr));
|
|
||||||
if (ifAddr.isNull())
|
|
||||||
continue;
|
|
||||||
if (!addressesWithEstimatedNetmasks.contains(ifAddr)) {
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "skipping route from" << ifAddr << "because it wasn't an estimated netmask";
|
|
||||||
#endif
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QHostAddress destination(qt_QHostAddressFromTInetAddr(routeInfo.iDstAddr));
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << "route from" << ifAddr << "to" << destination;
|
|
||||||
#endif
|
|
||||||
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 (!routeInfo.iNetMask.IsUnspecified()) {
|
|
||||||
//the route may also return 0.0.0.0 netmask, in which case don't use it.
|
|
||||||
QHostAddress netmask(qt_QHostAddressFromTInetAddr(routeInfo.iNetMask));
|
|
||||||
entry.setNetmask(netmask);
|
|
||||||
#if defined(QNETWORKINTERFACE_DEBUG)
|
|
||||||
qDebug() << " - route netmask" << routeInfo.iNetMask.Family() << netmask << " (using route determined netmask)";
|
|
||||||
#endif
|
|
||||||
iface->addressEntries.replace(eindex, entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.Close();
|
|
||||||
|
|
||||||
return interfaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QNetworkInterfacePrivate *> QNetworkInterfaceManager::scan()
|
|
||||||
{
|
|
||||||
return interfaceListing();
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif // QT_NO_NETWORKINTERFACE
|
|
@ -1,272 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the FOO module of the Qt 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some notes about the code:
|
|
||||||
*
|
|
||||||
* ** It is assumed that the system proxies are for url based requests
|
|
||||||
* ie. HTTP/HTTPS based.
|
|
||||||
* ** It is assumed that proxies don't use authentication.
|
|
||||||
* ** It is assumed that there is no exceptions to proxy use (Symbian side
|
|
||||||
* does have the field for it but it is not user modifiable by default).
|
|
||||||
* ** There is no checking for protocol name.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <QtNetwork/qnetworkproxy.h>
|
|
||||||
|
|
||||||
#ifndef QT_NO_NETWORKPROXY
|
|
||||||
|
|
||||||
#include <metadatabase.h> // CMDBSession
|
|
||||||
#include <commsdattypeinfov1_1.h> // CCDIAPRecord, CCDProxiesRecord
|
|
||||||
#include <commsdattypesv1_1.h> // KCDTIdIAPRecord, KCDTIdProxiesRecord
|
|
||||||
#include <QtNetwork/QNetworkConfigurationManager>
|
|
||||||
#include <QtNetwork/QNetworkConfiguration>
|
|
||||||
#include <QFlags>
|
|
||||||
|
|
||||||
using namespace CommsDat;
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
class SymbianIapId
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum State{
|
|
||||||
NotValid,
|
|
||||||
Valid
|
|
||||||
};
|
|
||||||
Q_DECLARE_FLAGS(States, State)
|
|
||||||
SymbianIapId() {}
|
|
||||||
~SymbianIapId() {}
|
|
||||||
void setIapId(TUint32 iapId) { iapState |= Valid; id = iapId; }
|
|
||||||
bool isValid() { return iapState == Valid; }
|
|
||||||
TUint32 iapId() { return id; }
|
|
||||||
private:
|
|
||||||
QFlags<States> iapState;
|
|
||||||
TUint32 id;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SymbianIapId::States)
|
|
||||||
|
|
||||||
class SymbianProxyQuery
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static QNetworkConfiguration findCurrentConfiguration(QNetworkConfigurationManager& configurationManager);
|
|
||||||
static SymbianIapId getIapId(QNetworkConfigurationManager &configurationManager, const QNetworkProxyQuery &query);
|
|
||||||
static CCDIAPRecord *getIapRecordLC(TUint32 aIAPId, CMDBSession &aDb);
|
|
||||||
static CMDBRecordSet<CCDProxiesRecord> *prepareQueryLC(TUint32 serviceId, TDesC& serviceType);
|
|
||||||
static QList<QNetworkProxy> proxyQueryL(TUint32 aIAPId, const QNetworkProxyQuery &query);
|
|
||||||
};
|
|
||||||
|
|
||||||
QNetworkConfiguration SymbianProxyQuery::findCurrentConfiguration(QNetworkConfigurationManager& configurationManager)
|
|
||||||
{
|
|
||||||
QList<QNetworkConfiguration> activeConfigurations = configurationManager.allConfigurations(
|
|
||||||
QNetworkConfiguration::Active);
|
|
||||||
QNetworkConfiguration currentConfig;
|
|
||||||
if (activeConfigurations.count() > 0) {
|
|
||||||
currentConfig = activeConfigurations.at(0);
|
|
||||||
} else {
|
|
||||||
// No active configurations, try default one
|
|
||||||
QNetworkConfiguration defaultConfiguration = configurationManager.defaultConfiguration();
|
|
||||||
if (defaultConfiguration.isValid()) {
|
|
||||||
switch (defaultConfiguration.type()) {
|
|
||||||
case QNetworkConfiguration::InternetAccessPoint:
|
|
||||||
currentConfig = defaultConfiguration;
|
|
||||||
break;
|
|
||||||
case QNetworkConfiguration::ServiceNetwork:
|
|
||||||
{
|
|
||||||
// Note: This code assumes that the only unambigious way to
|
|
||||||
// find current proxy config is if there is only one access point
|
|
||||||
// or if the found access point is immediately usable.
|
|
||||||
QList<QNetworkConfiguration> childConfigurations = defaultConfiguration.children();
|
|
||||||
if (childConfigurations.count() == 1) {
|
|
||||||
currentConfig = childConfigurations.at(0);
|
|
||||||
} else {
|
|
||||||
for (int index = 0; index < childConfigurations.count(); index++) {
|
|
||||||
QNetworkConfiguration childConfig = childConfigurations.at(index);
|
|
||||||
if (childConfig.isValid() && childConfig.state() == QNetworkConfiguration::Discovered) {
|
|
||||||
currentConfig = childConfig;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QNetworkConfiguration::UserChoice:
|
|
||||||
// User choice is not a valid configuration for proxy discovery
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return currentConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
SymbianIapId SymbianProxyQuery::getIapId(QNetworkConfigurationManager& configurationManager, const QNetworkProxyQuery &query)
|
|
||||||
{
|
|
||||||
SymbianIapId iapId;
|
|
||||||
|
|
||||||
QNetworkConfiguration currentConfig = query.networkConfiguration();
|
|
||||||
if (!currentConfig.isValid()) {
|
|
||||||
//If config is not specified, then try to find out an active or default one
|
|
||||||
currentConfig = findCurrentConfiguration(configurationManager);
|
|
||||||
}
|
|
||||||
if (currentConfig.isValid()) {
|
|
||||||
// Note: the following code assumes that the identifier is in format
|
|
||||||
// I_xxxx where xxxx is the identifier of IAP. This is meant as a
|
|
||||||
// temporary solution until there is a support for returning
|
|
||||||
// implementation specific identifier.
|
|
||||||
const int generalPartLength = 2;
|
|
||||||
const int identifierNumberLength = currentConfig.identifier().length() - generalPartLength;
|
|
||||||
QString idString(currentConfig.identifier().right(identifierNumberLength));
|
|
||||||
bool success;
|
|
||||||
uint id = idString.toUInt(&success);
|
|
||||||
if (success)
|
|
||||||
iapId.setIapId(id);
|
|
||||||
else
|
|
||||||
qWarning() << "Failed to convert identifier to access point identifier: "
|
|
||||||
<< currentConfig.identifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
return iapId;
|
|
||||||
}
|
|
||||||
|
|
||||||
CCDIAPRecord *SymbianProxyQuery::getIapRecordLC(TUint32 aIAPId, CMDBSession &aDb)
|
|
||||||
{
|
|
||||||
CCDIAPRecord *iap = static_cast<CCDIAPRecord*> (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord));
|
|
||||||
CleanupStack::PushL(iap);
|
|
||||||
iap->SetRecordId(aIAPId);
|
|
||||||
iap->LoadL(aDb);
|
|
||||||
return iap;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMDBRecordSet<CCDProxiesRecord> *SymbianProxyQuery::prepareQueryLC(TUint32 serviceId, TDesC& serviceType)
|
|
||||||
{
|
|
||||||
// Create a recordset of type CCDProxiesRecord
|
|
||||||
// for priming search.
|
|
||||||
// This will ultimately contain record(s)
|
|
||||||
// matching the priming record attributes
|
|
||||||
CMDBRecordSet<CCDProxiesRecord> *proxyRecords = new (ELeave) CMDBRecordSet<CCDProxiesRecord> (
|
|
||||||
KCDTIdProxiesRecord);
|
|
||||||
CleanupStack::PushL(proxyRecords);
|
|
||||||
|
|
||||||
CCDProxiesRecord *primingProxyRecord =
|
|
||||||
static_cast<CCDProxiesRecord *> (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord));
|
|
||||||
CleanupStack::PushL(primingProxyRecord);
|
|
||||||
|
|
||||||
primingProxyRecord->iServiceType.SetMaxLengthL(serviceType.Length());
|
|
||||||
primingProxyRecord->iServiceType = serviceType;
|
|
||||||
primingProxyRecord->iService = serviceId;
|
|
||||||
primingProxyRecord->iUseProxyServer = ETrue;
|
|
||||||
|
|
||||||
proxyRecords->iRecords.AppendL(primingProxyRecord);
|
|
||||||
// Ownership of primingProxyRecord is transferred to
|
|
||||||
// proxyRecords, just remove it from the CleanupStack
|
|
||||||
CleanupStack::Pop(primingProxyRecord);
|
|
||||||
return proxyRecords;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QNetworkProxy> SymbianProxyQuery::proxyQueryL(TUint32 aIAPId, const QNetworkProxyQuery &query)
|
|
||||||
{
|
|
||||||
QList<QNetworkProxy> foundProxies;
|
|
||||||
if (query.queryType() != QNetworkProxyQuery::UrlRequest) {
|
|
||||||
return foundProxies;
|
|
||||||
}
|
|
||||||
|
|
||||||
CMDBSession *iDb = CMDBSession::NewLC(KCDVersion1_1);
|
|
||||||
CCDIAPRecord *iap = getIapRecordLC(aIAPId, *iDb);
|
|
||||||
|
|
||||||
// Read service table id and service type
|
|
||||||
// from the IAP record found
|
|
||||||
TUint32 serviceId = iap->iService;
|
|
||||||
RBuf serviceType;
|
|
||||||
serviceType.CreateL(iap->iServiceType);
|
|
||||||
CleanupStack::PopAndDestroy(iap);
|
|
||||||
CleanupClosePushL(serviceType);
|
|
||||||
|
|
||||||
CMDBRecordSet<CCDProxiesRecord> *proxyRecords = prepareQueryLC(serviceId, serviceType);
|
|
||||||
|
|
||||||
// Now to find a proxy table matching our criteria
|
|
||||||
if (proxyRecords->FindL(*iDb)) {
|
|
||||||
TInt count = proxyRecords->iRecords.Count();
|
|
||||||
for(TInt index = 0; index < count; index++) {
|
|
||||||
CCDProxiesRecord *proxyRecord = static_cast<CCDProxiesRecord *> (proxyRecords->iRecords[index]);
|
|
||||||
RBuf serverName;
|
|
||||||
serverName.CreateL(proxyRecord->iServerName);
|
|
||||||
CleanupClosePushL(serverName);
|
|
||||||
if (serverName.Length() == 0)
|
|
||||||
User::Leave(KErrNotFound);
|
|
||||||
QString serverNameQt((const QChar*)serverName.Ptr(), serverName.Length());
|
|
||||||
CleanupStack::Pop(); // serverName
|
|
||||||
TUint32 port = proxyRecord->iPortNumber;
|
|
||||||
|
|
||||||
QNetworkProxy proxy(QNetworkProxy::HttpProxy, serverNameQt, port);
|
|
||||||
foundProxies.append(proxy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CleanupStack::PopAndDestroy(proxyRecords);
|
|
||||||
CleanupStack::Pop(); // serviceType
|
|
||||||
CleanupStack::PopAndDestroy(iDb);
|
|
||||||
|
|
||||||
return foundProxies;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
|
|
||||||
{
|
|
||||||
QList<QNetworkProxy> proxies;
|
|
||||||
SymbianIapId iapId;
|
|
||||||
TInt error;
|
|
||||||
QNetworkConfigurationManager manager;
|
|
||||||
iapId = SymbianProxyQuery::getIapId(manager, query);
|
|
||||||
if (iapId.isValid()) {
|
|
||||||
TRAP(error, proxies = SymbianProxyQuery::proxyQueryL(iapId.iapId(), query))
|
|
||||||
if (error != KErrNone) {
|
|
||||||
qWarning() << "Error while retrieving proxies: '" << error << '"';
|
|
||||||
proxies.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proxies << QNetworkProxy::NoProxy;
|
|
||||||
|
|
||||||
return proxies;
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif
|
|
@ -31,9 +31,3 @@ include(socket/socket.pri)
|
|||||||
include(ssl/ssl.pri)
|
include(ssl/ssl.pri)
|
||||||
|
|
||||||
QMAKE_LIBS += $$QMAKE_LIBS_NETWORK
|
QMAKE_LIBS += $$QMAKE_LIBS_NETWORK
|
||||||
|
|
||||||
|
|
||||||
symbian {
|
|
||||||
TARGET.UID3=0x2001B2DE
|
|
||||||
LIBS += -lesock -linsock -lcertstore -lefsrv -lctframework
|
|
||||||
}
|
|
||||||
|
@ -41,11 +41,7 @@
|
|||||||
|
|
||||||
#include "qabstractsocketengine_p.h"
|
#include "qabstractsocketengine_p.h"
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
#include "qsymbiansocketengine_p.h"
|
|
||||||
#else
|
|
||||||
#include "qnativesocketengine_p.h"
|
#include "qnativesocketengine_p.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "qmutex.h"
|
#include "qmutex.h"
|
||||||
#include "qnetworkproxy.h"
|
#include "qnetworkproxy.h"
|
||||||
@ -119,11 +115,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
return new QSymbianSocketEngine(parent);
|
|
||||||
#else
|
|
||||||
return new QNativeSocketEngine(parent);
|
return new QNativeSocketEngine(parent);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(int socketDescripter, QObject *parent)
|
QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(int socketDescripter, QObject *parent)
|
||||||
@ -133,11 +125,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(int socketDescr
|
|||||||
if (QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketDescripter, parent))
|
if (QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketDescripter, parent))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
return new QSymbianSocketEngine(parent);
|
|
||||||
#else
|
|
||||||
return new QNativeSocketEngine(parent);
|
return new QNativeSocketEngine(parent);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractSocket::SocketError QAbstractSocketEngine::error() const
|
QAbstractSocket::SocketError QAbstractSocketEngine::error() const
|
||||||
|
@ -275,10 +275,6 @@ QLocalSocket *QLocalServer::nextPendingConnection()
|
|||||||
return 0;
|
return 0;
|
||||||
QLocalSocket *nextSocket = d->pendingConnections.dequeue();
|
QLocalSocket *nextSocket = d->pendingConnections.dequeue();
|
||||||
#ifndef QT_LOCALSOCKET_TCP
|
#ifndef QT_LOCALSOCKET_TCP
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
if(!d->socketNotifier)
|
|
||||||
return nextSocket;
|
|
||||||
#endif
|
|
||||||
if (d->pendingConnections.size() <= d->maxPendingConnections)
|
if (d->pendingConnections.size() <= d->maxPendingConnections)
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
d->socketNotifier->setEnabled(true);
|
d->socketNotifier->setEnabled(true);
|
||||||
|
@ -111,24 +111,6 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
|
|||||||
::memcpy(addr.sun_path, fullServerName.toLatin1().data(),
|
::memcpy(addr.sun_path, fullServerName.toLatin1().data(),
|
||||||
fullServerName.toLatin1().size() + 1);
|
fullServerName.toLatin1().size() + 1);
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
// In SYMBIAN OS it can currently happen that accept is called twice,
|
|
||||||
// once from waitForNewConnection and once via QSocketNotfier activity
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
// synchronization problem is implemented.
|
|
||||||
int flags = fcntl(listenSocket, F_GETFL, 0);
|
|
||||||
if (-1 == flags
|
|
||||||
|| -1 == (fcntl(listenSocket, F_SETFL, flags | O_NONBLOCK))) {
|
|
||||||
setError(QLatin1String("QLocalServer::listen"));
|
|
||||||
closeServer();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// bind
|
// bind
|
||||||
if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
|
if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) {
|
||||||
setError(QLatin1String("QLocalServer::listen"));
|
setError(QLatin1String("QLocalServer::listen"));
|
||||||
|
@ -242,7 +242,6 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
|
|||||||
QLatin1String("QLocalSocket::connectToServer"));
|
QLatin1String("QLocalSocket::connectToServer"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifndef Q_OS_SYMBIAN
|
|
||||||
// set non blocking so we can try to connect and it wont wait
|
// set non blocking so we can try to connect and it wont wait
|
||||||
int flags = fcntl(d->connectingSocket, F_GETFL, 0);
|
int flags = fcntl(d->connectingSocket, F_GETFL, 0);
|
||||||
if (-1 == flags
|
if (-1 == flags
|
||||||
@ -251,7 +250,6 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
|
|||||||
QLatin1String("QLocalSocket::connectToServer"));
|
QLatin1String("QLocalSocket::connectToServer"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// _q_connectToSocket does the actual connecting
|
// _q_connectToSocket does the actual connecting
|
||||||
d->connectingName = name;
|
d->connectingName = name;
|
||||||
@ -538,14 +536,7 @@ bool QLocalSocket::waitForConnected(int msec)
|
|||||||
timer.start();
|
timer.start();
|
||||||
while (state() == ConnectingState
|
while (state() == ConnectingState
|
||||||
&& (-1 == msec || timer.elapsed() < msec)) {
|
&& (-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?
|
|
||||||
result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout);
|
|
||||||
#else
|
|
||||||
result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
|
result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
|
||||||
#endif
|
|
||||||
if (-1 == result && errno != EINTR) {
|
if (-1 == result && errno != EINTR) {
|
||||||
d->errorOccurred( QLocalSocket::UnknownSocketError,
|
d->errorOccurred( QLocalSocket::UnknownSocketError,
|
||||||
QLatin1String("QLocalSocket::waitForConnected"));
|
QLatin1String("QLocalSocket::waitForConnected"));
|
||||||
|
@ -60,11 +60,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
static const int MaxWriteBufferSize = 4*1024;
|
|
||||||
#else
|
|
||||||
static const int MaxWriteBufferSize = 128*1024;
|
static const int MaxWriteBufferSize = 128*1024;
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define QSOCKS5SOCKETLAYER_DEBUG
|
//#define QSOCKS5SOCKETLAYER_DEBUG
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,258 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
** All rights reserved.
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** This file is part of the QtNetwork module of the Qt 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.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Nokia gives you certain additional
|
|
||||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU General
|
|
||||||
** Public License version 3.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
||||||
** file. Please review the following information to ensure the GNU General
|
|
||||||
** Public License version 3.0 requirements will be met:
|
|
||||||
** http://www.gnu.org/copyleft/gpl.html.
|
|
||||||
**
|
|
||||||
** Other Usage
|
|
||||||
** Alternatively, this file may be used in accordance with the terms and
|
|
||||||
** conditions contained in a signed written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QSYMBIANSOCKETENGINE_P_H
|
|
||||||
#define QSYMBIANSOCKETENGINE_P_H
|
|
||||||
|
|
||||||
//
|
|
||||||
// W A R N I N G
|
|
||||||
// -------------
|
|
||||||
//
|
|
||||||
// This file is not part of the Qt 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 "private/qabstractsocketengine_p.h"
|
|
||||||
#include "qplatformdefs.h"
|
|
||||||
|
|
||||||
#include <private/qeventdispatcher_symbian_p.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <es_sock.h>
|
|
||||||
#include <in_sock.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
|
|
||||||
class QSymbianSocketEnginePrivate;
|
|
||||||
class QNetworkInterface;
|
|
||||||
|
|
||||||
class Q_AUTOTEST_EXPORT QSymbianSocketEngine : public QAbstractSocketEngine
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
friend class QAsyncSelect;
|
|
||||||
public:
|
|
||||||
QSymbianSocketEngine(QObject *parent = 0);
|
|
||||||
~QSymbianSocketEngine();
|
|
||||||
|
|
||||||
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 connectToHostByName(const QString &name, quint16 port);
|
|
||||||
bool bind(const QHostAddress &address, quint16 port);
|
|
||||||
bool listen();
|
|
||||||
int accept();
|
|
||||||
void close();
|
|
||||||
|
|
||||||
bool joinMulticastGroup(const QHostAddress &groupAddress,
|
|
||||||
const QNetworkInterface &iface);
|
|
||||||
bool leaveMulticastGroup(const QHostAddress &groupAddress,
|
|
||||||
const QNetworkInterface &iface);
|
|
||||||
QNetworkInterface multicastInterface() const;
|
|
||||||
bool setMulticastInterface(const QNetworkInterface &iface);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
qint64 receiveBufferSize() const;
|
|
||||||
void setReceiveBufferSize(qint64 bufferSize);
|
|
||||||
|
|
||||||
qint64 sendBufferSize() const;
|
|
||||||
void setSendBufferSize(qint64 bufferSize);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
bool event(QEvent* ev);
|
|
||||||
|
|
||||||
Q_INVOKABLE void startNotifications();
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
// TODO: Why do we do this? This is private Qt implementation stuff anyway, no need for it
|
|
||||||
// non-virtual override;
|
|
||||||
void connectionNotification();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DECLARE_PRIVATE(QSymbianSocketEngine)
|
|
||||||
Q_DISABLE_COPY(QSymbianSocketEngine)
|
|
||||||
};
|
|
||||||
|
|
||||||
class QSocketNotifier;
|
|
||||||
|
|
||||||
class QReadNotifier;
|
|
||||||
class QWriteNotifier;
|
|
||||||
class QExceptionNotifier;
|
|
||||||
class QAsyncSelect : public QActiveObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QAsyncSelect(QEventDispatcherSymbian *dispatcher, RSocket& sock, QSymbianSocketEngine *parent);
|
|
||||||
~QAsyncSelect();
|
|
||||||
|
|
||||||
void deleteLater();
|
|
||||||
void IssueRequest();
|
|
||||||
|
|
||||||
void refresh();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void DoCancel();
|
|
||||||
void RunL();
|
|
||||||
void run();
|
|
||||||
TInt RunError(TInt aError);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_inSocketEvent;
|
|
||||||
bool m_deleteLater;
|
|
||||||
RSocket &m_socket;
|
|
||||||
|
|
||||||
TUint m_selectFlags;
|
|
||||||
TPckgBuf<TUint> m_selectBuf; //in & out IPC buffer
|
|
||||||
QSymbianSocketEngine *engine;
|
|
||||||
};
|
|
||||||
|
|
||||||
class QSymbianSocketEnginePrivate : public QAbstractSocketEnginePrivate
|
|
||||||
{
|
|
||||||
Q_DECLARE_PUBLIC(QSymbianSocketEngine)
|
|
||||||
public:
|
|
||||||
QSymbianSocketEnginePrivate();
|
|
||||||
~QSymbianSocketEnginePrivate();
|
|
||||||
|
|
||||||
int socketDescriptor;
|
|
||||||
mutable RSocket nativeSocket;
|
|
||||||
// From QtCore:
|
|
||||||
RSocketServ& socketServer;
|
|
||||||
mutable RTimer selectTimer;
|
|
||||||
|
|
||||||
bool readNotificationsEnabled;
|
|
||||||
bool writeNotificationsEnabled;
|
|
||||||
bool exceptNotificationsEnabled;
|
|
||||||
QAsyncSelect* asyncSelect;
|
|
||||||
|
|
||||||
mutable QByteArray receivedDataBuffer;
|
|
||||||
mutable bool hasReceivedBufferedDatagram;
|
|
||||||
// FIXME this is duplicated from qnativesocketengine_p.h
|
|
||||||
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,
|
|
||||||
//symbian specific
|
|
||||||
InvalidAddressErrorString,
|
|
||||||
SessionNotOpenErrorString,
|
|
||||||
|
|
||||||
UnknownSocketErrorString = -1
|
|
||||||
};
|
|
||||||
void setError(QAbstractSocket::SocketError error, ErrorString errorString) const;
|
|
||||||
|
|
||||||
void getPortAndAddress(const TInetAddr& a, quint16 *port, QHostAddress *addr);
|
|
||||||
void setPortAndAddress(TInetAddr& nativeAddr, quint16 port, const QHostAddress &addr);
|
|
||||||
void setError(TInt symbianError);
|
|
||||||
|
|
||||||
int nativeSelect(int timeout, bool selectForRead) const;
|
|
||||||
int nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
|
||||||
bool *selectForRead, bool *selectForWrite) const;
|
|
||||||
|
|
||||||
bool createNewSocket(QAbstractSocket::SocketType socketType,
|
|
||||||
QAbstractSocket::NetworkLayerProtocol socketProtocol);
|
|
||||||
|
|
||||||
bool checkProxy(const QHostAddress &address);
|
|
||||||
bool fetchConnectionParameters();
|
|
||||||
|
|
||||||
bool multicastGroupMembershipHelper(const QHostAddress &groupAddress,
|
|
||||||
const QNetworkInterface &iface,
|
|
||||||
TUint operation);
|
|
||||||
static bool translateSocketOption(QAbstractSocketEngine::SocketOption opt, TUint &n, TUint &level);
|
|
||||||
};
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif // QSYMBIANSOCKETENGINE_P_H
|
|
@ -79,16 +79,6 @@
|
|||||||
use waitForNewConnection(), which blocks until either a
|
use waitForNewConnection(), which blocks until either a
|
||||||
connection is available or a timeout expires.
|
connection is available or a timeout expires.
|
||||||
|
|
||||||
\section1 Symbian Platform Security Requirements
|
|
||||||
|
|
||||||
On Symbian, processes which use this class must have the
|
|
||||||
\c NetworkServices platform security capability. If the client
|
|
||||||
process lacks this capability, it will lead to a panic.
|
|
||||||
|
|
||||||
Platform security capabilities are added via the
|
|
||||||
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
|
|
||||||
qmake variable.
|
|
||||||
|
|
||||||
\sa QTcpSocket, {Fortune Server Example}, {Threaded Fortune Server Example},
|
\sa QTcpSocket, {Fortune Server Example}, {Threaded Fortune Server Example},
|
||||||
{Loopback Example}, {Torrent Example}
|
{Loopback Example}, {Torrent Example}
|
||||||
*/
|
*/
|
||||||
|
@ -60,16 +60,6 @@
|
|||||||
|
|
||||||
\bold{Note:} TCP sockets cannot be opened in QIODevice::Unbuffered mode.
|
\bold{Note:} TCP sockets cannot be opened in QIODevice::Unbuffered mode.
|
||||||
|
|
||||||
\section1 Symbian Platform Security Requirements
|
|
||||||
|
|
||||||
On Symbian, processes which use this class must have the
|
|
||||||
\c NetworkServices platform security capability. If the client
|
|
||||||
process lacks this capability, it will result in a panic.
|
|
||||||
|
|
||||||
Platform security capabilities are added via the
|
|
||||||
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
|
|
||||||
qmake variable.
|
|
||||||
|
|
||||||
\sa QTcpServer, QUdpSocket, QFtp, QNetworkAccessManager,
|
\sa QTcpServer, QUdpSocket, QFtp, QNetworkAccessManager,
|
||||||
{Fortune Server Example}, {Fortune Client Example},
|
{Fortune Server Example}, {Fortune Client Example},
|
||||||
{Threaded Fortune Server Example}, {Blocking Fortune Client Example},
|
{Threaded Fortune Server Example}, {Blocking Fortune Client Example},
|
||||||
|
@ -95,16 +95,6 @@
|
|||||||
\l{network/multicastreceiver}{Multicast Receiver} examples illustrate how
|
\l{network/multicastreceiver}{Multicast Receiver} examples illustrate how
|
||||||
to use QUdpSocket in applications.
|
to use QUdpSocket in applications.
|
||||||
|
|
||||||
\section1 Symbian Platform Security Requirements
|
|
||||||
|
|
||||||
On Symbian, processes which use this class must have the
|
|
||||||
\c NetworkServices platform security capability. If the client
|
|
||||||
process lacks this capability, operations will result in a panic.
|
|
||||||
|
|
||||||
Platform security capabilities are added via the
|
|
||||||
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
|
|
||||||
qmake variable.
|
|
||||||
|
|
||||||
\sa QTcpSocket
|
\sa QTcpSocket
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -23,26 +23,15 @@ SOURCES += socket/qabstractsocketengine.cpp \
|
|||||||
socket/qlocalsocket.cpp \
|
socket/qlocalsocket.cpp \
|
||||||
socket/qlocalserver.cpp
|
socket/qlocalserver.cpp
|
||||||
|
|
||||||
# On Symbian we use QSymbianSocketEngine
|
SOURCES += socket/qnativesocketengine.cpp
|
||||||
symbian:SOURCES += socket/qsymbiansocketengine.cpp
|
HEADERS += socket/qnativesocketengine_p.h
|
||||||
symbian:HEADERS += socket/qsymbiansocketengine_p.h
|
|
||||||
# On others we use QNativeSocketEngine
|
|
||||||
!symbian:SOURCES += socket/qnativesocketengine.cpp
|
|
||||||
!symbian:HEADERS += socket/qnativesocketengine_p.h
|
|
||||||
|
|
||||||
unix:!symbian: {
|
unix: {
|
||||||
SOURCES += socket/qnativesocketengine_unix.cpp \
|
SOURCES += socket/qnativesocketengine_unix.cpp \
|
||||||
socket/qlocalsocket_unix.cpp \
|
socket/qlocalsocket_unix.cpp \
|
||||||
socket/qlocalserver_unix.cpp
|
socket/qlocalserver_unix.cpp
|
||||||
}
|
}
|
||||||
|
|
||||||
symbian: {
|
|
||||||
SOURCES += socket/qlocalsocket_tcp.cpp \
|
|
||||||
socket/qlocalserver_tcp.cpp
|
|
||||||
|
|
||||||
DEFINES += QT_LOCALSOCKET_TCP
|
|
||||||
}
|
|
||||||
|
|
||||||
unix:HEADERS += \
|
unix:HEADERS += \
|
||||||
socket/qnet_unix_p.h
|
socket/qnet_unix_p.h
|
||||||
|
|
||||||
|
@ -165,16 +165,6 @@
|
|||||||
is being encrypted and encryptedBytesWritten()
|
is being encrypted and encryptedBytesWritten()
|
||||||
will get emitted as soon as data has been written to the TCP socket.
|
will get emitted as soon as data has been written to the TCP socket.
|
||||||
|
|
||||||
\section1 Symbian Platform Security Requirements
|
|
||||||
|
|
||||||
On Symbian, processes which use this class must have the
|
|
||||||
\c NetworkServices platform security capability. If the client
|
|
||||||
process lacks this capability, operations will fail.
|
|
||||||
|
|
||||||
Platform security capabilities are added via the
|
|
||||||
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
|
|
||||||
qmake variable.
|
|
||||||
|
|
||||||
\sa QSslCertificate, QSslCipher, QSslError
|
\sa QSslCertificate, QSslCipher, QSslError
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -60,12 +60,6 @@
|
|||||||
#include <QtCore/qvarlengtharray.h>
|
#include <QtCore/qvarlengtharray.h>
|
||||||
#include <QLibrary> // for loading the security lib for the CA store
|
#include <QLibrary> // for loading the security lib for the CA store
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
|
|
||||||
// Symbian does not seem to have the symbol for SNI defined
|
|
||||||
#ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
|
||||||
#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
@ -77,11 +71,6 @@ QT_BEGIN_NAMESPACE
|
|||||||
PtrCertOpenSystemStoreW QSslSocketPrivate::ptrCertOpenSystemStoreW = 0;
|
PtrCertOpenSystemStoreW QSslSocketPrivate::ptrCertOpenSystemStoreW = 0;
|
||||||
PtrCertFindCertificateInStore QSslSocketPrivate::ptrCertFindCertificateInStore = 0;
|
PtrCertFindCertificateInStore QSslSocketPrivate::ptrCertFindCertificateInStore = 0;
|
||||||
PtrCertCloseStore QSslSocketPrivate::ptrCertCloseStore = 0;
|
PtrCertCloseStore QSslSocketPrivate::ptrCertCloseStore = 0;
|
||||||
#elif defined(Q_OS_SYMBIAN)
|
|
||||||
#include <e32base.h>
|
|
||||||
#include <e32std.h>
|
|
||||||
#include <e32debug.h>
|
|
||||||
#include <QtCore/private/qcore_symbian_p.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool QSslSocketPrivate::s_libraryLoaded = false;
|
bool QSslSocketPrivate::s_libraryLoaded = false;
|
||||||
@ -595,7 +584,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
|
|||||||
} else {
|
} else {
|
||||||
qWarning("could not load crypt32 library"); // should never happen
|
qWarning("could not load crypt32 library"); // should never happen
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_MAC)
|
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
// check whether we can enable on-demand root-cert loading (i.e. check whether the sym links are there)
|
// check whether we can enable on-demand root-cert loading (i.e. check whether the sym links are there)
|
||||||
QList<QByteArray> dirs = unixRootCertDirectories();
|
QList<QByteArray> dirs = unixRootCertDirectories();
|
||||||
QStringList symLinkFilter;
|
QStringList symLinkFilter;
|
||||||
@ -678,180 +667,6 @@ void QSslSocketPrivate::resetDefaultCiphers()
|
|||||||
setDefaultCiphers(ciphers);
|
setDefaultCiphers(ciphers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_SYMBIAN)
|
|
||||||
|
|
||||||
CSymbianCertificateRetriever::CSymbianCertificateRetriever() : CActive(CActive::EPriorityStandard),
|
|
||||||
iCertificatePtr(0,0,0), iSequenceError(KErrNone)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CSymbianCertificateRetriever::~CSymbianCertificateRetriever()
|
|
||||||
{
|
|
||||||
iThread.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
CSymbianCertificateRetriever* CSymbianCertificateRetriever::NewL()
|
|
||||||
{
|
|
||||||
CSymbianCertificateRetriever* self = new (ELeave) CSymbianCertificateRetriever();
|
|
||||||
CleanupStack::PushL(self);
|
|
||||||
self->ConstructL();
|
|
||||||
CleanupStack::Pop();
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSymbianCertificateRetriever::GetCertificates(QList<QByteArray> &certificates)
|
|
||||||
{
|
|
||||||
iCertificates = &certificates;
|
|
||||||
|
|
||||||
TRequestStatus status;
|
|
||||||
iThread.Logon(status);
|
|
||||||
iThread.Resume();
|
|
||||||
User::WaitForRequest(status);
|
|
||||||
if (iThread.ExitType() == EExitKill)
|
|
||||||
return KErrDied;
|
|
||||||
else
|
|
||||||
return status.Int(); // Logon() completes with the thread's exit value
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSymbianCertificateRetriever::doThreadEntryL()
|
|
||||||
{
|
|
||||||
CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler;
|
|
||||||
CleanupStack::PushL(activeScheduler);
|
|
||||||
CActiveScheduler::Install(activeScheduler);
|
|
||||||
|
|
||||||
CActiveScheduler::Add(this);
|
|
||||||
|
|
||||||
// These aren't deleted in the destructor so leaving the to CS is ok
|
|
||||||
iCertStore = CUnifiedCertStore::NewLC(qt_s60GetRFs(), EFalse);
|
|
||||||
iCertFilter = CCertAttributeFilter::NewLC();
|
|
||||||
|
|
||||||
// only interested in CA certs
|
|
||||||
iCertFilter->SetOwnerType(ECACertificate);
|
|
||||||
// only interested in X.509 format (we don't support WAP formats)
|
|
||||||
iCertFilter->SetFormat(EX509Certificate);
|
|
||||||
|
|
||||||
// Kick off the sequence by initializing the cert store
|
|
||||||
iState = Initializing;
|
|
||||||
iCertStore->Initialize(iStatus);
|
|
||||||
SetActive();
|
|
||||||
|
|
||||||
CActiveScheduler::Start();
|
|
||||||
|
|
||||||
// Sequence complete, clean up
|
|
||||||
|
|
||||||
// These MUST be cleaned up before the installed CActiveScheduler is destroyed and can't be left to the
|
|
||||||
// destructor of CSymbianCertificateRetriever. Otherwise the destructor of CActiveScheduler will get
|
|
||||||
// stuck.
|
|
||||||
iCertInfos.Close();
|
|
||||||
CleanupStack::PopAndDestroy(3); // activeScheduler, iCertStore, iCertFilter
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TInt CSymbianCertificateRetriever::ThreadEntryPoint(TAny* aParams)
|
|
||||||
{
|
|
||||||
User::SetCritical(User::EProcessCritical);
|
|
||||||
CTrapCleanup* cleanupStack = CTrapCleanup::New();
|
|
||||||
|
|
||||||
CSymbianCertificateRetriever* self = (CSymbianCertificateRetriever*) aParams;
|
|
||||||
TRAPD(err, self->doThreadEntryL());
|
|
||||||
delete cleanupStack;
|
|
||||||
|
|
||||||
// doThreadEntryL() can leave only before the retrieval sequence is started
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
else
|
|
||||||
return self->iSequenceError; // return any error that occurred during the retrieval
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSymbianCertificateRetriever::ConstructL()
|
|
||||||
{
|
|
||||||
TInt err;
|
|
||||||
int i=0;
|
|
||||||
QString name(QLatin1String("CertWorkerThread-%1"));
|
|
||||||
//recently closed thread names remain in use for a while until all handles have been closed
|
|
||||||
//including users of RUndertaker
|
|
||||||
do {
|
|
||||||
err = iThread.Create(qt_QString2TPtrC(name.arg(i++)),
|
|
||||||
CSymbianCertificateRetriever::ThreadEntryPoint, 16384, NULL, this);
|
|
||||||
} while (err == KErrAlreadyExists);
|
|
||||||
User::LeaveIfError(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSymbianCertificateRetriever::DoCancel()
|
|
||||||
{
|
|
||||||
switch(iState) {
|
|
||||||
case Initializing:
|
|
||||||
iCertStore->CancelInitialize();
|
|
||||||
break;
|
|
||||||
case Listing:
|
|
||||||
iCertStore->CancelList();
|
|
||||||
break;
|
|
||||||
case RetrievingCertificates:
|
|
||||||
iCertStore->CancelGetCert();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TInt CSymbianCertificateRetriever::RunError(TInt aError)
|
|
||||||
{
|
|
||||||
// If something goes wrong in the sequence, abort the sequence
|
|
||||||
iSequenceError = aError; // this gets reported to the client in the TRequestStatus
|
|
||||||
CActiveScheduler::Stop();
|
|
||||||
return KErrNone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSymbianCertificateRetriever::GetCertificateL()
|
|
||||||
{
|
|
||||||
if (iCurrentCertIndex < iCertInfos.Count()) {
|
|
||||||
CCTCertInfo* certInfo = iCertInfos[iCurrentCertIndex++];
|
|
||||||
iCertificateData = QByteArray();
|
|
||||||
QT_TRYCATCH_LEAVING(iCertificateData.resize(certInfo->Size()));
|
|
||||||
iCertificatePtr.Set((TUint8*)iCertificateData.data(), 0, iCertificateData.size());
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qDebug() << "getting " << qt_TDesC2QString(certInfo->Label()) << " size=" << certInfo->Size();
|
|
||||||
qDebug() << "format=" << certInfo->CertificateFormat();
|
|
||||||
qDebug() << "ownertype=" << certInfo->CertificateOwnerType();
|
|
||||||
qDebug() << "type=" << hex << certInfo->Type().iUid;
|
|
||||||
#endif
|
|
||||||
iCertStore->Retrieve(*certInfo, iCertificatePtr, iStatus);
|
|
||||||
iState = RetrievingCertificates;
|
|
||||||
SetActive();
|
|
||||||
} else {
|
|
||||||
//reached end of list
|
|
||||||
CActiveScheduler::Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSymbianCertificateRetriever::RunL()
|
|
||||||
{
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qDebug() << "CSymbianCertificateRetriever::RunL status " << iStatus.Int() << " count " << iCertInfos.Count() << " index " << iCurrentCertIndex;
|
|
||||||
#endif
|
|
||||||
switch (iState) {
|
|
||||||
case Initializing:
|
|
||||||
User::LeaveIfError(iStatus.Int()); // initialise fail means pointless to continue
|
|
||||||
iState = Listing;
|
|
||||||
iCertStore->List(iCertInfos, *iCertFilter, iStatus);
|
|
||||||
SetActive();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Listing:
|
|
||||||
User::LeaveIfError(iStatus.Int()); // listing fail means pointless to continue
|
|
||||||
iCurrentCertIndex = 0;
|
|
||||||
GetCertificateL();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RetrievingCertificates:
|
|
||||||
if (iStatus.Int() == KErrNone)
|
|
||||||
iCertificates->append(iCertificateData);
|
|
||||||
else
|
|
||||||
qWarning() << "CSymbianCertificateRetriever: failed to retrieve a certificate, error " << iStatus.Int();
|
|
||||||
GetCertificateL();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // defined(Q_OS_SYMBIAN)
|
|
||||||
|
|
||||||
QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
||||||
{
|
{
|
||||||
ensureInitialized();
|
ensureInitialized();
|
||||||
@ -921,7 +736,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
|||||||
ptrCertCloseStore(hSystemStore, 0);
|
ptrCertCloseStore(hSystemStore, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
|
#elif defined(Q_OS_UNIX)
|
||||||
QSet<QString> certFiles;
|
QSet<QString> certFiles;
|
||||||
QList<QByteArray> directories = unixRootCertDirectories();
|
QList<QByteArray> directories = unixRootCertDirectories();
|
||||||
QDir currentDir;
|
QDir currentDir;
|
||||||
@ -943,21 +758,6 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
|
|||||||
}
|
}
|
||||||
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora, Mandriva
|
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora, Mandriva
|
||||||
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/share/certs/ca-root-nss.crt"), QSsl::Pem)); // FreeBSD's ca_root_nss
|
systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/share/certs/ca-root-nss.crt"), QSsl::Pem)); // FreeBSD's ca_root_nss
|
||||||
|
|
||||||
#elif defined(Q_OS_SYMBIAN)
|
|
||||||
QList<QByteArray> certs;
|
|
||||||
QScopedPointer<CSymbianCertificateRetriever> retriever(CSymbianCertificateRetriever::NewL());
|
|
||||||
|
|
||||||
retriever->GetCertificates(certs);
|
|
||||||
foreach (const QByteArray &encodedCert, certs) {
|
|
||||||
QSslCertificate cert(encodedCert, QSsl::Der);
|
|
||||||
if (!cert.isNull()) {
|
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
|
||||||
qDebug() << "imported certificate: " << cert.issuerInfo(QSslCertificate::CommonName);
|
|
||||||
#endif
|
|
||||||
systemCerts.append(cert);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef QSSLSOCKET_DEBUG
|
#ifdef QSSLSOCKET_DEBUG
|
||||||
qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms";
|
qDebug() << "systemCaCertificates retrieval time " << timer.elapsed() << "ms";
|
||||||
|
@ -126,61 +126,6 @@ public:
|
|||||||
static QString getErrorsFromOpenSsl();
|
static QString getErrorsFromOpenSsl();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(Q_OS_SYMBIAN)
|
|
||||||
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <e32base.h>
|
|
||||||
#include <f32file.h>
|
|
||||||
#include <unifiedcertstore.h> // link against certstore.lib
|
|
||||||
#include <ccertattributefilter.h> // link against ctframework.lib
|
|
||||||
|
|
||||||
// The purpose of this class is to wrap the asynchronous API of Symbian certificate store to one
|
|
||||||
// synchronizable call. The user of this class needs to provide a TRequestStatus object which can
|
|
||||||
// be used with User::WaitForRequest() unlike with the calls of the certificate store API.
|
|
||||||
// A thread is used instead of a CActiveSchedulerWait scheme, because that would make the call
|
|
||||||
// asynchronous (other events might be processed during the call even though the call would be seemingly
|
|
||||||
// synchronous).
|
|
||||||
|
|
||||||
class CSymbianCertificateRetriever : public CActive
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static CSymbianCertificateRetriever* NewL();
|
|
||||||
~CSymbianCertificateRetriever();
|
|
||||||
|
|
||||||
int GetCertificates(QList<QByteArray> &aCertificates);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ConstructL();
|
|
||||||
CSymbianCertificateRetriever();
|
|
||||||
static TInt ThreadEntryPoint(TAny* aParams);
|
|
||||||
void doThreadEntryL();
|
|
||||||
void GetCertificateL();
|
|
||||||
void DoCancel();
|
|
||||||
void RunL();
|
|
||||||
TInt RunError(TInt aError);
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum {
|
|
||||||
Initializing,
|
|
||||||
Listing,
|
|
||||||
RetrievingCertificates
|
|
||||||
} iState;
|
|
||||||
|
|
||||||
RThread iThread;
|
|
||||||
CUnifiedCertStore* iCertStore;
|
|
||||||
RMPointerArray<CCTCertInfo> iCertInfos;
|
|
||||||
CCertAttributeFilter* iCertFilter;
|
|
||||||
TInt iCurrentCertIndex;
|
|
||||||
QByteArray iCertificateData;
|
|
||||||
TPtr8 iCertificatePtr;
|
|
||||||
QList<QByteArray>* iCertificates;
|
|
||||||
TInt iSequenceError;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -293,16 +293,10 @@ DEFINEFUNC3(int, SSL_CTX_load_verify_locations, SSL_CTX *ctx, ctx, const char *C
|
|||||||
DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return)
|
DEFINEFUNC(long, SSLeay, void, DUMMYARG, return 0, return)
|
||||||
DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return)
|
DEFINEFUNC(const char *, SSLeay_version, int a, a, return 0, return)
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
#define RESOLVEFUNC(func, ordinal, lib) \
|
|
||||||
if (!(_q_##func = _q_PTR_##func(lib->resolve(#ordinal)))) \
|
|
||||||
qWarning("QSslSocket: cannot resolve "#func);
|
|
||||||
#else
|
|
||||||
#define RESOLVEFUNC(func) \
|
#define RESOLVEFUNC(func) \
|
||||||
if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \
|
if (!(_q_##func = _q_PTR_##func(libs.first->resolve(#func))) \
|
||||||
&& !(_q_##func = _q_PTR_##func(libs.second->resolve(#func)))) \
|
&& !(_q_##func = _q_PTR_##func(libs.second->resolve(#func)))) \
|
||||||
qWarning("QSslSocket: cannot resolve "#func);
|
qWarning("QSslSocket: cannot resolve "#func);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined QT_LINKED_OPENSSL
|
#if !defined QT_LINKED_OPENSSL
|
||||||
|
|
||||||
@ -412,25 +406,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
|
|||||||
pair.first = 0;
|
pair.first = 0;
|
||||||
pair.second = 0;
|
pair.second = 0;
|
||||||
|
|
||||||
# if defined(Q_OS_SYMBIAN)
|
# if defined(Q_OS_UNIX)
|
||||||
QLibrary *libssl = new QLibrary(QLatin1String("libssl"));
|
|
||||||
if (!libssl->load()) {
|
|
||||||
// Cannot find ssleay32.dll
|
|
||||||
delete libssl;
|
|
||||||
return pair;
|
|
||||||
}
|
|
||||||
|
|
||||||
QLibrary *libcrypto = new QLibrary(QLatin1String("libcrypto"));
|
|
||||||
if (!libcrypto->load()) {
|
|
||||||
delete libcrypto;
|
|
||||||
delete libssl;
|
|
||||||
return pair;
|
|
||||||
}
|
|
||||||
|
|
||||||
pair.first = libssl;
|
|
||||||
pair.second = libcrypto;
|
|
||||||
return pair;
|
|
||||||
# elif defined(Q_OS_UNIX)
|
|
||||||
QLibrary *&libssl = pair.first;
|
QLibrary *&libssl = pair.first;
|
||||||
QLibrary *&libcrypto = pair.second;
|
QLibrary *&libcrypto = pair.second;
|
||||||
libssl = new QLibrary;
|
libssl = new QLibrary;
|
||||||
@ -536,141 +512,6 @@ bool q_resolveOpenSslSymbols()
|
|||||||
// failed to load them
|
// failed to load them
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef Q_OS_SYMBIAN
|
|
||||||
#ifdef SSLEAY_MACROS
|
|
||||||
RESOLVEFUNC(ASN1_dup, 125, libs.second )
|
|
||||||
#endif
|
|
||||||
RESOLVEFUNC(ASN1_INTEGER_get, 48, libs.second )
|
|
||||||
RESOLVEFUNC(ASN1_STRING_data, 71, libs.second )
|
|
||||||
RESOLVEFUNC(ASN1_STRING_length, 76, libs.second )
|
|
||||||
RESOLVEFUNC(ASN1_STRING_to_UTF8, 86, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_ctrl, 184, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_free, 209, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_new, 222, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_new_mem_buf, 230, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_read, 244, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_s_mem, 251, libs.second )
|
|
||||||
RESOLVEFUNC(BIO_write, 269, libs.second )
|
|
||||||
RESOLVEFUNC(BN_num_bits, 387, libs.second )
|
|
||||||
RESOLVEFUNC(CRYPTO_free, 469, libs.second )
|
|
||||||
RESOLVEFUNC(CRYPTO_num_locks, 500, libs.second )
|
|
||||||
RESOLVEFUNC(CRYPTO_set_id_callback, 513, libs.second )
|
|
||||||
RESOLVEFUNC(CRYPTO_set_locking_callback, 516, libs.second )
|
|
||||||
RESOLVEFUNC(DSA_free, 594, libs.second )
|
|
||||||
RESOLVEFUNC(ERR_error_string, 744, libs.second )
|
|
||||||
RESOLVEFUNC(ERR_get_error, 749, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_des_ede3_cbc, 919, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_assign, 859, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_set1_RSA, 880, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_set1_DSA, 879, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_free, 867, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_get1_DSA, 869, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_get1_RSA, 870, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_new, 876, libs.second )
|
|
||||||
RESOLVEFUNC(EVP_PKEY_type, 882, libs.second )
|
|
||||||
RESOLVEFUNC(OBJ_nid2sn, 1036, libs.second )
|
|
||||||
RESOLVEFUNC(OBJ_obj2nid, 1037, libs.second )
|
|
||||||
#ifdef SSLEAY_MACROS // ### verify
|
|
||||||
RESOLVEFUNC(PEM_ASN1_read_bio, 1180, libs.second )
|
|
||||||
#else
|
|
||||||
RESOLVEFUNC(PEM_read_bio_DSAPrivateKey, 1219, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_read_bio_RSAPrivateKey, 1228, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_write_bio_DSAPrivateKey, 1260, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_write_bio_RSAPrivateKey, 1271, libs.second )
|
|
||||||
#endif
|
|
||||||
RESOLVEFUNC(PEM_read_bio_DSA_PUBKEY, 1220, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_read_bio_RSA_PUBKEY, 1230, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_write_bio_DSA_PUBKEY, 1261, libs.second )
|
|
||||||
RESOLVEFUNC(PEM_write_bio_RSA_PUBKEY, 1273, libs.second )
|
|
||||||
RESOLVEFUNC(RAND_seed, 1426, libs.second )
|
|
||||||
RESOLVEFUNC(RAND_status, 1429, libs.second )
|
|
||||||
RESOLVEFUNC(RSA_free, 1450, libs.second )
|
|
||||||
RESOLVEFUNC(sk_free, 2571, libs.second )
|
|
||||||
RESOLVEFUNC(sk_num, 2576, libs.second )
|
|
||||||
RESOLVEFUNC(sk_pop_free, 2578, libs.second )
|
|
||||||
RESOLVEFUNC(sk_value, 2585, libs.second )
|
|
||||||
RESOLVEFUNC(SSL_CIPHER_description, 11, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_check_private_key, 21, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_ctrl, 22, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_free, 24, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_new, 35, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_set_cipher_list, 40, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_set_default_verify_paths, 44, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_set_verify, 56, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_set_verify_depth, 57, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_use_certificate, 64, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_use_certificate_file, 67, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_use_PrivateKey, 58, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_use_RSAPrivateKey, 61, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_use_PrivateKey_file, 60, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_accept, 82, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_clear, 92, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_connect, 93, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_free, 99, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_ciphers, 104, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_current_cipher, 106, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_error, 110, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_peer_cert_chain, 117, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_peer_certificate, 118, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_get_verify_result, 132, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_library_init, 137, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_load_error_strings, 139, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_new, 140, libs.first )
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
|
|
||||||
RESOLVEFUNC(SSL_ctrl, 95, libs.first )
|
|
||||||
#endif
|
|
||||||
RESOLVEFUNC(SSL_read, 143, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_set_accept_state, 148, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_set_bio, 149, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_set_connect_state, 152, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_shutdown, 173, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_write, 188, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv2_client_method, 192, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv3_client_method, 195, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv23_client_method, 189, libs.first )
|
|
||||||
RESOLVEFUNC(TLSv1_client_method, 198, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv2_server_method, 194, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv3_server_method, 197, libs.first )
|
|
||||||
RESOLVEFUNC(SSLv23_server_method, 191, libs.first )
|
|
||||||
RESOLVEFUNC(TLSv1_server_method, 200, libs.first )
|
|
||||||
RESOLVEFUNC(SSL_CTX_load_verify_locations, 34, libs.first )
|
|
||||||
RESOLVEFUNC(X509_NAME_entry_count, 1821, libs.second )
|
|
||||||
RESOLVEFUNC(X509_NAME_get_entry, 1823, libs.second )
|
|
||||||
RESOLVEFUNC(X509_NAME_ENTRY_get_data, 1808, libs.second )
|
|
||||||
RESOLVEFUNC(X509_NAME_ENTRY_get_object, 1809, libs.second )
|
|
||||||
RESOLVEFUNC(X509_PUBKEY_get, 1844, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_free, 1939, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_new, 1942, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_add_cert, 1936, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_CTX_free, 1907, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_CTX_init, 1919, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_CTX_new, 1920, libs.second )
|
|
||||||
RESOLVEFUNC(X509_STORE_CTX_set_purpose, 1931, libs.second )
|
|
||||||
RESOLVEFUNC(X509_cmp, 1992, libs.second )
|
|
||||||
#ifndef SSLEAY_MACROS
|
|
||||||
RESOLVEFUNC(X509_dup, 1997, libs.second )
|
|
||||||
#endif
|
|
||||||
RESOLVEFUNC(X509_print, 2046, libs.second )
|
|
||||||
RESOLVEFUNC(X509_EXTENSION_get_object, 1785, libs.second )
|
|
||||||
RESOLVEFUNC(X509_free, 2001, libs.second )
|
|
||||||
RESOLVEFUNC(X509_get_ext, 2012, libs.second )
|
|
||||||
RESOLVEFUNC(X509_get_ext_count, 2016, libs.second )
|
|
||||||
RESOLVEFUNC(X509_get_ext_d2i, 2017, libs.second )
|
|
||||||
RESOLVEFUNC(X509_get_issuer_name, 2018, libs.second )
|
|
||||||
RESOLVEFUNC(X509_get_subject_name, 2022, libs.second )
|
|
||||||
RESOLVEFUNC(X509_verify_cert, 2069, libs.second )
|
|
||||||
RESOLVEFUNC(d2i_X509, 2309, libs.second )
|
|
||||||
RESOLVEFUNC(i2d_X509, 2489, libs.second )
|
|
||||||
#ifdef SSLEAY_MACROS
|
|
||||||
RESOLVEFUNC(i2d_DSAPrivateKey, 2395, libs.second )
|
|
||||||
RESOLVEFUNC(i2d_RSAPrivateKey, 2476, libs.second )
|
|
||||||
RESOLVEFUNC(d2i_DSAPrivateKey, 2220, libs.second )
|
|
||||||
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(SSLeay, 1504, libs.second )
|
|
||||||
#else // Q_OS_SYMBIAN
|
|
||||||
#ifdef SSLEAY_MACROS
|
#ifdef SSLEAY_MACROS
|
||||||
RESOLVEFUNC(ASN1_dup)
|
RESOLVEFUNC(ASN1_dup)
|
||||||
#endif
|
#endif
|
||||||
@ -817,7 +658,7 @@ bool q_resolveOpenSslSymbols()
|
|||||||
RESOLVEFUNC(SSL_CTX_load_verify_locations)
|
RESOLVEFUNC(SSL_CTX_load_verify_locations)
|
||||||
RESOLVEFUNC(SSLeay)
|
RESOLVEFUNC(SSLeay)
|
||||||
RESOLVEFUNC(SSLeay_version)
|
RESOLVEFUNC(SSLeay_version)
|
||||||
#endif // Q_OS_SYMBIAN
|
|
||||||
symbolsResolved = true;
|
symbolsResolved = true;
|
||||||
delete libs.first;
|
delete libs.first;
|
||||||
delete libs.second;
|
delete libs.second;
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
|
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 \
|
HEADERS += ssl/qssl.h \
|
||||||
ssl/qsslcertificate.h \
|
ssl/qsslcertificate.h \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user