1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Alex Trotsenko <alex1973tr@gmail.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QTCPSERVER_P_H
6#define QTCPSERVER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtNetwork/private/qtnetworkglobal_p.h>
20#include "QtNetwork/qtcpserver.h"
21#include "private/qobject_p.h"
22#include "private/qabstractsocketengine_p.h"
23#include "QtNetwork/qabstractsocket.h"
24#include "qnetworkproxy.h"
25#include "QtCore/qlist.h"
26#include "qhostaddress.h"
27
28QT_BEGIN_NAMESPACE
29
30class Q_NETWORK_EXPORT QTcpServerPrivate : public QObjectPrivate,
31 public QAbstractSocketEngineReceiver
32{
33 Q_DECLARE_PUBLIC(QTcpServer)
34public:
35 QTcpServerPrivate();
36 ~QTcpServerPrivate();
37
38 QList<QTcpSocket *> pendingConnections;
39
40 quint16 port;
41 QHostAddress address;
42
43 QAbstractSocket::SocketType socketType;
44 QAbstractSocket::SocketState state;
45 QAbstractSocketEngine *socketEngine;
46
47 QAbstractSocket::SocketError serverSocketError;
48 QString serverSocketErrorString;
49
50 int listenBacklog = 50;
51 int maxConnections;
52
53#ifndef QT_NO_NETWORKPROXY
54 QNetworkProxy proxy;
55 QNetworkProxy resolveProxy(const QHostAddress &address, quint16 port);
56#endif
57
58 virtual void configureCreatedSocket();
59 virtual int totalPendingConnections() const;
60
61 // from QAbstractSocketEngineReceiver
62 void readNotification() override;
63 void closeNotification() override { readNotification(); }
64 void writeNotification() override {}
65 void exceptionNotification() override {}
66 void connectionNotification() override {}
67#ifndef QT_NO_NETWORKPROXY
68 void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *) override {}
69#endif
70
71};
72
73QT_END_NAMESPACE
74
75#endif // QTCPSERVER_P_H
76

source code of qtbase/src/network/socket/qtcpserver_p.h