1// qnetworksession.sip generated by MetaSIP
2//
3// This file is part of the QtNetwork Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23class QNetworkSession : QObject
24{
25%TypeHeaderCode
26#include <qnetworksession.h>
27%End
28
29public:
30    enum State
31    {
32        Invalid,
33        NotAvailable,
34        Connecting,
35        Connected,
36        Closing,
37        Disconnected,
38        Roaming,
39    };
40
41    enum SessionError
42    {
43        UnknownSessionError,
44        SessionAbortedError,
45        RoamingError,
46        OperationNotSupportedError,
47        InvalidConfigurationError,
48    };
49
50    QNetworkSession(const QNetworkConfiguration &connConfig, QObject *parent /TransferThis/ = 0);
51    virtual ~QNetworkSession();
52    bool isOpen() const;
53    QNetworkConfiguration configuration() const;
54    QNetworkInterface interface() const;
55    QNetworkSession::State state() const;
56    QNetworkSession::SessionError error() const;
57    QString errorString() const;
58    QVariant sessionProperty(const QString &key) const;
59    void setSessionProperty(const QString &key, const QVariant &value);
60    quint64 bytesWritten() const;
61    quint64 bytesReceived() const;
62    quint64 activeTime() const;
63    bool waitForOpened(int msecs = 30000) /ReleaseGIL/;
64
65public slots:
66    void open();
67    void close();
68    void stop();
69    void migrate();
70    void ignore();
71    void accept();
72    void reject();
73
74signals:
75    void stateChanged(QNetworkSession::State);
76    void opened();
77    void closed();
78    void error(QNetworkSession::SessionError);
79    void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless);
80    void newConfigurationActivated();
81
82protected:
83    virtual void connectNotify(const QMetaMethod &signal);
84    virtual void disconnectNotify(const QMetaMethod &signal);
85
86public:
87    enum UsagePolicy
88    {
89        NoPolicy,
90        NoBackgroundTrafficPolicy,
91    };
92
93    typedef QFlags<QNetworkSession::UsagePolicy> UsagePolicies;
94    QNetworkSession::UsagePolicies usagePolicies() const;
95
96signals:
97    void usagePoliciesChanged(QNetworkSession::UsagePolicies usagePolicies);
98};
99