Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtNetwork.QNetworkProxyQuery Class Reference

The QNetworkProxyQuery class is used to query the proxy settings for a socket More...

Inheritance diagram for QtNetwork.QNetworkProxyQuery:
Collaboration diagram for QtNetwork.QNetworkProxyQuery:

Public Types

enum  QueryType { TcpServer = 100, TcpSocket = 0, UdpSocket = 1, UrlRequest = 101 }
  More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QNetworkProxyQuery ()
 
 
 QNetworkProxyQuery (QNetworkProxyQuery other)
 
 
 QNetworkProxyQuery (QNetworkConfiguration networkConfiguration, QUrl requestUrl, QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.UrlRequest)
 
 
 QNetworkProxyQuery (QUrl requestUrl, QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.UrlRequest)
 
 
 QNetworkProxyQuery (QNetworkConfiguration networkConfiguration, ushort bindPort, string protocolTag="", QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.TcpServer)
 
 
 QNetworkProxyQuery (QNetworkConfiguration networkConfiguration, string hostname, int port, string protocolTag="", QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.TcpSocket)
 
 
 QNetworkProxyQuery (ushort bindPort, string protocolTag="", QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.TcpServer)
 
 
 QNetworkProxyQuery (string hostname, int port, string protocolTag="", QNetworkProxyQuery.QueryType queryType=QNetworkProxyQuery.QueryType.TcpSocket)
 
 
virtual void CreateProxy ()
 
new void Dispose ()
 

Static Public Member Functions

static bool operator!= (QNetworkProxyQuery arg1, QNetworkProxyQuery arg2)
 
 
static bool operator== (QNetworkProxyQuery arg1, QNetworkProxyQuery arg2)
 
 

Protected Member Functions

 QNetworkProxyQuery (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new int LocalPort [get, set]
 
 
new QNetworkConfiguration NetworkConfiguration [get, set]
 
 
new string PeerHostName [get, set]
 
 
new int PeerPort [get, set]
 
 
new string ProtocolTag [get, set]
 
 
new QNetworkProxyQuery.QueryType queryType [get, set]
 
 
new QUrl Url [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QNetworkProxyQuery class is used to query the proxy settings for a socket

QNetworkProxyQuery holds the details of a socket being created or request being made. It is used by QNetworkProxy and QNetworkProxyFactory to allow applications to have a more fine-grained control over which proxy servers are used, depending on the details of the query. This allows an application to apply different settings, according to the protocol or destination hostname, for instance.

QNetworkProxyQuery supports the following criteria for selecting the proxy:

the type of query

the local port number to use

the destination host name

the destination port number

the protocol name, such as "http" or "ftp"

the URL being requested

The destination host name is the host in the connection in the case of outgoing connection sockets. It is the hostName parameter passed to QTcpSocket::connectToHost() or the host component of a URL requested with QNetworkRequest.

The destination port number is the requested port to connect to in the case of outgoing sockets, while the local port number is the port the socket wishes to use locally before attempting the external connection. In most cases, the local port number is used by listening sockets only (QTcpSocket) or by datagram sockets (QUdpSocket).

The protocol name is an arbitrary string that indicates the type of connection being attempted. For example, it can match the scheme of a URL, like "http", "https" and "ftp". In most cases, the proxy selection will not change depending on the protocol, but this information is provided in case a better choice can be made, like choosing an caching HTTP proxy for HTTP-based connections, but a more powerful SOCKSv5 proxy for all others.

The network configuration specifies which configuration to use, when bearer management is used. For example on a mobile phone the proxy settings are likely to be different for the cellular network vs WLAN.

Some of the criteria may not make sense in all of the types of query. The following table lists the criteria that are most commonly used, according to the type of query.

Query typeDescription

TcpSocket Normal sockets requesting a connection to a remote server, like QTcpSocket. The peer hostname and peer port match the values passed to QTcpSocket::connectToHost(). The local port is usually -1, indicating the socket has no preference in which port should be used. The URL component is not used.

UdpSocket Datagram-based sockets, which can both send and receive. The local port, remote host or remote port fields can all be used or be left unused, depending on the characteristics of the socket. The URL component is not used.

TcpServer Passive server sockets that listen on a port and await incoming connections from the network. Normally, only the local port is used, but the remote address could be used in specific circumstances, for example to indicate which remote host a connection is expected from. The URL component is not used.

UrlRequest A more high-level request, such as those coming from QNetworkAccessManager. These requests will inevitably use an outgoing TCP socket, but the this query type is provided to indicate that more detailed information is present in the URL component. For ease of implementation, the URL's host and port are set as the destination address.

It should be noted that any of the criteria may be missing or unknown (an empty QString for the hostname or protocol name, -1 for the port numbers). If that happens, the functions executing the query should make their best guess or apply some implementation-defined default values.

See also QNetworkProxy, QNetworkProxyFactory, QNetworkAccessManager, and QAbstractSocket::setProxy().

Member Enumeration Documentation

Describes the type of one QNetworkProxyQuery query.

See also queryType() and setQueryType().

Enumerator:
TcpServer 

A TCP server that listens for incoming connections from the network

TcpSocket 

A normal, outgoing TCP socket

UdpSocket 

A datagram-based UDP socket, which could send to multiple destinations

UrlRequest 

A more complex request which involves loading of a URL

Constructor & Destructor Documentation

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( System.Type  dummy)
protected
QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( )

Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( QNetworkProxyQuery  other)

Constructs a QNetworkProxyQuery object that is a copy of other.

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( QNetworkConfiguration  networkConfiguration,
QUrl  requestUrl,
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.UrlRequest 
)

Constructs a QNetworkProxyQuery with the URL requestUrl and sets the query type to queryType. The specified networkConfiguration is used to resolve the proxy settings.

This function was introduced in Qt 4.8.

See also protocolTag(), peerHostName(), peerPort(), and networkConfiguration().

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( QUrl  requestUrl,
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.UrlRequest 
)

Constructs a QNetworkProxyQuery with the URL requestUrl and sets the query type to queryType.

See also protocolTag(), peerHostName(), and peerPort().

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( QNetworkConfiguration  networkConfiguration,
ushort  bindPort,
string  protocolTag = "",
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.TcpServer 
)

Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( QNetworkConfiguration  networkConfiguration,
string  hostname,
int  port,
string  protocolTag = "",
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.TcpSocket 
)

Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( ushort  bindPort,
string  protocolTag = "",
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.TcpServer 
)

Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.

QtNetwork.QNetworkProxyQuery.QNetworkProxyQuery ( string  hostname,
int  port,
string  protocolTag = "",
QNetworkProxyQuery.QueryType  queryType = QNetworkProxyQuery.QueryType.TcpSocket 
)

Constructs a default QNetworkProxyQuery object. By default, the query type will be QNetworkProxyQuery::TcpSocket.

Member Function Documentation

virtual void QtNetwork.QNetworkProxyQuery.CreateProxy ( )
virtual
new void QtNetwork.QNetworkProxyQuery.Dispose ( )
override bool QtNetwork.QNetworkProxyQuery.Equals ( object  o)
override int QtNetwork.QNetworkProxyQuery.GetHashCode ( )
static bool QtNetwork.QNetworkProxyQuery.operator!= ( QNetworkProxyQuery  arg1,
QNetworkProxyQuery  arg2 
)
static

Returns true if this QNetworkProxyQuery object does not contain the same data as other.

static bool QtNetwork.QNetworkProxyQuery.operator== ( QNetworkProxyQuery  arg1,
QNetworkProxyQuery  arg2 
)
static

Returns true if this QNetworkProxyQuery object contains the same data as other.

Member Data Documentation

SmokeInvocation QtNetwork.QNetworkProxyQuery.interceptor
protected

Property Documentation

new int QtNetwork.QNetworkProxyQuery.LocalPort
getset

Returns the port number of the socket that will accept incoming packets from remote servers or -1 if the port is not known.

Sets the port number that the socket wishes to use locally to accept incoming packets from remote servers to port. The local port is most often used with the QNetworkProxyQuery::TcpServer and QNetworkProxyQuery::UdpSocket query types.

Valid values are 0 to 65535 (with 0 indicating that any port number will be acceptable) or -1, which means the local port number is unknown or not applicable.

In some circumstances, for special protocols, it's the local port number can also be used with a query of type QNetworkProxyQuery::TcpSocket. When that happens, the socket is indicating it wishes to use the port number port when connecting to a remote host.

new QNetworkConfiguration QtNetwork.QNetworkProxyQuery.NetworkConfiguration
getset

Returns the network configuration of the proxy query.

Sets the network configuration component of this QNetworkProxyQuery object to be networkConfiguration. The network configuration can be used to return different proxy settings based on the network in use, for example WLAN vs cellular networks on a mobile phone.

In the case of "user choice" or "service network" configurations, you should first start the QNetworkSession and obtain the active configuration from its properties.

This function was introduced in Qt 4.8.

new string QtNetwork.QNetworkProxyQuery.PeerHostName
getset

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.

If the query type is QNetworkProxyQuery::UrlRequest, this function returns the host component of the URL being requested.

Sets the hostname of the outgoing connection being requested to hostname. An empty hostname can be used to indicate that the remote host is unknown.

The peer host name can also be used to indicate the expected source address of an incoming connection in the case of QNetworkProxyQuery::UdpSocket or QNetworkProxyQuery::TcpServer query types.

new int QtNetwork.QNetworkProxyQuery.PeerPort
getset

Returns the port number for the outgoing request or -1 if the port number is not known.

If the query type is QNetworkProxyQuery::UrlRequest, this function returns the port number of the URL being requested. In general, frameworks will fill in the port number from their default values.

Sets the requested port number for the outgoing connection to be port. Valid values are 1 to 65535, or -1 to indicate that the remote port number is unknown.

The peer port number can also be used to indicate the expected port number of an incoming connection in the case of QNetworkProxyQuery::UdpSocket or QNetworkProxyQuery::TcpServer query types.

new string QtNetwork.QNetworkProxyQuery.ProtocolTag
getset

Returns the protocol tag for this QNetworkProxyQuery object, or an empty QString in case the protocol tag is unknown.

In the case of queries of type QNetworkProxyQuery::UrlRequest, this function returns the value of the scheme component of the URL.

Sets the protocol tag for this QNetworkProxyQuery object to be protocolTag.

The protocol tag is an arbitrary string that indicates which protocol is being talked over the socket, such as "http", "xmpp", "telnet", etc. The protocol tag is used by the backend to return a request that is more specific to the protocol in question: for example, a HTTP connection could be use a caching HTTP proxy server, while all other connections use a more powerful SOCKSv5 proxy server.

new QNetworkProxyQuery.QueryType QtNetwork.QNetworkProxyQuery.queryType
getset

Returns the query type.

Sets the query type of this object to be type.

virtual System.IntPtr QtNetwork.QNetworkProxyQuery.SmokeObject
getset
new QUrl QtNetwork.QNetworkProxyQuery.Url
getset

Returns the URL component of this QNetworkProxyQuery object in case of a query of type QNetworkProxyQuery::UrlRequest.

Sets the URL component of this QNetworkProxyQuery object to be url. Setting the URL will also set the protocol tag, the remote host name and port number. This is done so as to facilitate the implementation of the code that determines the proxy server to be used.