227 #ifndef QT_NO_NETWORKPROXY 229 #include "private/qnetworkproxy_p.h" 230 #include "private/qsocks5socketengine_p.h" 231 #include "private/qhttpsocketengine_p.h" 237 #ifndef QT_NO_BEARERMANAGEMENT 238 #include <QtNetwork/QNetworkConfiguration> 256 #ifdef QT_USE_SYSTEM_PROXIES 339 qWarning(
"QNetworkProxyFactory: factory %p has returned an empty result set",
349 template<
bool>
struct StaticAssertTest;
350 template<>
struct StaticAssertTest<true> {
enum { Value = 1 }; };
354 #define q_static_assert(expr) qt_noop_with_arg(sizeof(StaticAssertTest< expr >::Value)) 360 static const int defaults[] =
390 return QNetworkProxy::Capabilities(defaults[
int(type)]);
413 capabilitiesSet(false)
418 return type == other.
type &&
419 port == other.
port &&
421 user == other.
user &&
429 if (
d &&
d->ref == 1)
432 :
new QNetworkProxyPrivate);
434 if (
d && !
d->ref.deref())
451 globalNetworkProxy();
469 globalNetworkProxy();
496 return d == other.
d || (
d && other.
d && *
d == *other.
d);
718 if (globalNetworkProxy()) {
723 globalNetworkProxy()->setApplicationProxy(networkProxy);
738 if (globalNetworkProxy())
752 return type == other.
type &&
760 #ifndef QT_NO_BEARERMANAGEMENT 767 if (
d &&
d->
ref == 1)
770 :
new QNetworkProxyQueryPrivate);
919 d->remote = requestUrl;
934 d->remote.setScheme(protocolTag);
935 d->remote.setHost(hostname);
936 d->remote.setPort(port);
955 d->remote.setScheme(protocolTag);
956 d->localPort = bindPort;
960 #ifndef QT_NO_BEARERMANAGEMENT 976 d->config = networkConfiguration;
977 d->remote = requestUrl;
997 const QString &hostname,
int port,
1001 d->config = networkConfiguration;
1002 d->remote.setScheme(protocolTag);
1003 d->remote.setHost(hostname);
1004 d->remote.setPort(port);
1005 d->
type = queryType;
1030 d->config = networkConfiguration;
1031 d->remote.setScheme(protocolTag);
1032 d->localPort = bindPort;
1033 d->
type = queryType;
1068 return d == other.
d || (
d && other.
d && *
d == *other.
d);
1254 #ifndef QT_NO_BEARERMANAGEMENT 1373 setApplicationProxyFactory(0);
1397 if (globalNetworkProxy())
1398 globalNetworkProxy()->setApplicationProxyFactory(factory);
1494 if (!globalNetworkProxy())
1496 return globalNetworkProxy()->proxyForQuery(query);
1501 #endif // QT_NO_NETWORKPROXY virtual ~QNetworkProxyFactory()
Destroys the QNetworkProxyFactory object.
QNetworkProxy::ProxyType type() const
Returns the proxy type for this instance.
void setProtocolTag(const QString &protocolTag)
Sets the protocol tag for this QNetworkProxyQuery object to be protocolTag.
int peerPort() const
Returns the port number for the outgoing request or -1 if the port number is not known.
bool operator==(const QNetworkProxyPrivate &other) const
QNetworkProxyQuery()
Constructs a default QNetworkProxyQuery object.
~QNetworkProxy()
Destroys the QNetworkProxy object.
QHttpSocketEngineHandler * httpSocketEngineHandler
bool operator==(const QNetworkProxyQuery &other) const
Returns true if this QNetworkProxyQuery object contains the same data as other.
QNetworkProxy & operator=(const QNetworkProxy &other)
Assigns the value of the network proxy other to this network proxy.
bool operator==(const QNetworkProxyQueryPrivate &other) const
#define QT_END_NAMESPACE
This macro expands to.
QNetworkProxy applicationProxy()
The QMutex class provides access serialization between threads.
QNetworkProxyPrivate(QNetworkProxy::ProxyType t=QNetworkProxy::DefaultProxy, const QString &h=QString(), quint16 p=0, const QString &u=QString(), const QString &pw=QString())
void setPeerHostName(const QString &hostname)
Sets the hostname of the outgoing connection being requested to hostname.
QNetworkProxy()
Constructs a QNetworkProxy with DefaultProxy type; the proxy type is determined by applicationProxy()...
QString peerHostName() const
Returns the host name or IP address being of the outgoing connection being requested, or an empty string if the remote hostname is not known.
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
QNetworkProxy * applicationLevelProxy
QSharedDataPointer< QNetworkProxyPrivate > d
bool isCachingProxy() const
Returns true if this proxy supports the QNetworkProxy::CachingCapability capability.
void setQueryType(QueryType type)
Sets the query type of this object to be type.
virtual QList< QNetworkProxy > queryProxy(const QNetworkProxyQuery &query=QNetworkProxyQuery())=0
This function takes the query request, query, examines the details of the type of socket or request a...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QSocks5SocketEngineHandler * socks5SocketEngineHandler
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setUser(const QString &userName)
Sets the user name for proxy authentication to be user.
bool ref()
Atomically increments the value of this QAtomicInt.
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QNetworkProxyFactory class provides fine-grained proxy selection.
QString host() const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
void setHost(const QString &host)
Sets the host of the URL to host.
static QList< QNetworkProxy > proxyForQuery(const QNetworkProxyQuery &query)
This function takes the query request, query, examines the details of the type of socket or request a...
QueryType
Describes the type of one QNetworkProxyQuery query.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
int localPort() const
Returns the port number of the socket that will accept incoming packets from remote servers or -1 if ...
int port() const
Returns the port of the URL, or -1 if the port is unspecified.
static QNetworkProxy applicationProxy()
Returns the application level network proxying.
void setNetworkConfiguration(const QNetworkConfiguration &networkConfiguration)
Sets the network configuration component of this QNetworkProxyQuery object to be networkConfiguration...
QNetworkProxyFactory * applicationLevelProxyFactory
The QNetworkProxy class provides a network layer proxy.
QueryType queryType() const
Returns the query type.
The QNetworkConfiguration class provides an abstraction of one or more access point configurations...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString protocolTag() const
Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol...
QSharedDataPointer< QNetworkProxyQueryPrivate > d
Capabilities capabilities() const
Returns the capabilities of this proxy server.
void setApplicationProxy(const QNetworkProxy &proxy)
static void setApplicationProxyFactory(QNetworkProxyFactory *factory)
Sets the application-wide proxy factory to be factory.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
bool operator==(const QNetworkProxy &other) const
bool deref()
Atomically decrements the value of this QAtomicInt.
void setApplicationProxyFactory(QNetworkProxyFactory *factory)
static void qt_noop_with_arg(int)
Q_CORE_EXPORT void qWarning(const char *,...)
void setUrl(const QUrl &url)
Sets the URL component of this QNetworkProxyQuery object to be url.
void setHostName(const QString &hostName)
Sets the host name of the proxy host to be hostName.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
void setLocalPort(int port)
Sets the port number that the socket wishes to use locally to accept incoming packets from remote ser...
static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::ProxyType type)
QNetworkProxyQueryPrivate()
QNetworkProxy::ProxyType type
QList< QNetworkProxy > proxyForQuery(const QNetworkProxyQuery &query)
The QNetworkProxyQuery class is used to query the proxy settings for a socket.
T & first()
Returns a reference to the first item in the list.
QNetworkProxyFactory()
Creates a QNetworkProxyFactory object.
void setPeerPort(int port)
Sets the requested port number for the outgoing connection to be port.
QNetworkConfiguration networkConfiguration() const
Returns the network configuration of the proxy query.
QString scheme() const
Returns the scheme of the URL.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
void setPort(int port)
Sets the port of the URL to port.
#define q_static_assert(expr)
void setAddress(quint32 ip4Addr)
Set the IPv4 address specified by ip4Addr.
The QSharedData class is a base class for shared data objects.
void setCapabilities(Capabilities capab)
Sets the capabilities of this proxy to capabilities.
QNetworkProxyQuery & operator=(const QNetworkProxyQuery &other)
Copies the contents of other.
static void setApplicationProxy(const QNetworkProxy &proxy)
Sets the application level network proxying to be networkProxy.
~QNetworkProxyQuery()
Destroys this QNetworkProxyQuery object.
static void setUseSystemConfiguration(bool enable)
Enables the use of the platform-specific proxy settings, and only those.
bool isTransparentProxy() const
Returns true if this proxy supports transparent tunneling of TCP connections.
quint16 port() const
Returns the port of the proxy host.
static QReadWriteLock lock
void setType(QNetworkProxy::ProxyType type)
Sets the proxy type for this instance to be type.
void setScheme(const QString &scheme)
Sets the scheme of the URL to scheme.
QUrl url() const
Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQ...
QString password() const
Returns the password used for authentication.
QNetworkProxyQuery::QueryType type
The QHostAddress class provides an IP address.
QString user() const
Returns the user name used for authentication.
void setPassword(const QString &password)
Sets the password for proxy authentication to be password.
void setPort(quint16 port)
Sets the port of the proxy host to be port.
QNetworkProxy::Capabilities capabilities
ProxyType
This enum describes the types of network proxying provided in Qt.
QNetworkConfiguration config
QString hostName() const
Returns the host name of the proxy host.