Qt 4.8
qabstractsocket_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtNetwork module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QABSTRACTSOCKET_P_H
43 #define QABSTRACTSOCKET_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists for the convenience
50 // of the QAbstractSocket class. This header file may change from
51 // version to version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "QtNetwork/qabstractsocket.h"
57 #include "QtCore/qbytearray.h"
58 #include "QtCore/qlist.h"
59 #include "QtCore/qtimer.h"
60 #include "private/qringbuffer_p.h"
61 #include "private/qiodevice_p.h"
62 #include "private/qabstractsocketengine_p.h"
63 #include "qnetworkproxy.h"
64 
66 
67 class QHostInfo;
68 
70 {
72 public:
74  virtual ~QAbstractSocketPrivate();
75 
76  // from QAbstractSocketEngineReceiver
79  inline void exceptionNotification() {}
81 #ifndef QT_NO_NETWORKPROXY
82  inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) {
84  q->proxyAuthenticationRequired(proxy, authenticator);
85  }
86 #endif
87 
88  bool canReadNotification();
89  bool canWriteNotification();
90 
91  // slots
93  void _q_startConnecting(const QHostInfo &hostInfo);
94  void _q_testConnection();
96  void _q_forceDisconnect();
97 
101 
104 
108 
113 
119 
122 
123 #ifndef QT_NO_NETWORKPROXY
126  void resolveProxy(const QString &hostName, quint16 port);
127 #else
128  inline void resolveProxy(const QString &, quint16) { }
129 #endif
130  inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); }
131 
132  void resetSocketLayer();
133  bool flush();
134 
136  void startConnectingByName(const QString &host);
138  void setupSocketNotifiers();
139  bool readFromSocket();
140 
144 
147 
151 
153 
156 
158 
165 };
166 
168 
169 #endif // QABSTRACTSOCKET_P_H
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
SocketType
This enum describes the transport layer protocol.
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
QList< QHostAddress > addresses
bool readFromSocket()
Reads data from the socket layer into the read buffer.
static void resumeSocketNotifiers(QAbstractSocket *)
void resetSocketLayer()
Resets the socket layer, clears the read and write buffers and deletes any socket notifiers...
NetworkLayerProtocol
This enum describes the network layer protocol values used in Qt.
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_Q(Class)
Definition: qglobal.h:2483
SocketState
This enum describes the different states in which a socket can be.
void startConnectingByName(const QString &host)
Starts the connection to host, like _q_startConnecting below, but without hostname resolution...
QAbstractSocket::SocketState state
virtual ~QAbstractSocketPrivate()
Destructs the QAbstractSocket.
The QNetworkProxy class provides a network layer proxy.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void _q_startConnecting(const QHostInfo &hostInfo)
Slot connected to QHostInfo::lookupHost() in connectToHost().
SocketError
This enum describes the socket errors that can occur.
unsigned short quint16
Definition: qglobal.h:936
QAbstractSocket::SocketError socketError
static QAbstractSocketEngine * getSocketEngine(QAbstractSocket *)
The QHostInfo class provides static functions for host name lookups.
Definition: qhostinfo.h:58
__int64 qint64
Definition: qglobal.h:942
void _q_abortConnectionAttempt()
This function is called after a certain number of seconds has passed while waiting for a connection...
The QAuthenticator class provides an authentication object.
void resolveProxy(quint16 port)
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
void connectionNotification()
Slot connected to a notification of connection status change.
void _q_connectToNextAddress()
Called by a queued or direct connection from _q_startConnecting() or _q_testConnection(), this function takes the first address of the pending addresses list and tries to connect to it.
QAbstractSocketEngine * socketEngine
QAbstractSocket::SocketType socketType
void fetchConnectionParameters()
Sets up the internal state after the connection has succeeded.
bool flush()
Writes pending data in the write buffers to the socket.
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol)
Initializes the socket layer to by of type type, using the network layer protocol protocol...
void resolveProxy(const QString &hostName, quint16 port)
Resolve the proxy to its final value.
QAbstractSocketPrivate()
Constructs a QAbstractSocketPrivate.
The QHostAddress class provides an IP address.
Definition: qhostaddress.h:70
void _q_testConnection()
Tests if a connection has been established.
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
static void pauseSocketNotifiers(QAbstractSocket *)
bool canReadNotification()
Slot connected to the read socket notifier.
bool canWriteNotification()
Slot connected to the write socket notifier.
The QAbstractSocket class provides the base functionality common to all socket types.