⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtsslsocket.h

📁 Qtopia下的邮件处理程序
💻 H
字号:
/******************************************************************************** Copyright (C) 2000-2006 TROLLTECH ASA. All rights reserved.**** This file is part of the Phone Edition of the Qtopia Toolkit.**** Licensees holding a valid license agreement from Trolltech or any of its** authorized distributors may use this file in accordance with** the License Agreement provided with the Licensed Software.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Trolltech's Commercial License Agreements.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.********** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QTSSLSOCKET_H#define QTSSLSOCKET_H#include <QtNetwork/QTcpSocket>#if defined(Q_WS_WIN)#  if !defined(QT_QTSSLSOCKET_EXPORT) && !defined(QT_QTSSLSOCKET_IMPORT)#    define QT_QTSSLSOCKET_EXPORT#  elif defined(QT_QTSSLSOCKET_IMPORT)#    if defined(QT_QTSSLSOCKET_EXPORT)#      undef QT_QTSSLSOCKET_EXPORT#    endif#    define QT_QTSSLSOCKET_EXPORT __declspec(dllimport)#  elif defined(QT_QTSSLSOCKET_EXPORT)#    undef QT_QTSSLSOCKET_EXPORT#    define QT_QTSSLSOCKET_EXPORT __declspec(dllexport)#  endif#else#  define QT_QTSSLSOCKET_EXPORT#endifclass QtSslSocketPrivate;class SSLLibrary;class QT_QTSSLSOCKET_EXPORT QtSslSocket : public QTcpSocket{    Q_OBJECTpublic:    enum VerifyResult {        VerifyOk,        SelfSigned,        Expired,        NotYetValid,        UnableToVerify    };    enum Mode {        Client,        Server    };    QtSslSocket(Mode mode = Client, QObject *parent = 0);    ~QtSslSocket();    void connectToHost(const QString &hostName, quint16 port,		       OpenMode openMode = QIODevice::ReadWrite);    void disconnectFromHost();    void setPathToCertificate(const QString &path);    QString pathToCertificate() const;    void setPathToPrivateKey(const QString &path);    QString pathToPrivateKey() const;    void setPathToCACertFile(const QString &path);    QString pathToCACertFile() const;    void setPathToCACertDir(const QString &path);    QString pathToCACertDir() const;    void setCiphers(const QString &ciphers);    QString ciphers() const;    QString localCertificate() const;    QString peerCertificate() const;    qint64 bytesAvailable() const;    qint64 bytesToWrite() const;    bool canReadLine() const;    void close();    bool isSequential() const;    bool waitForReadyRead(int msecs = 30000);    bool waitForBytesWritten(int msecs = 30000);    QTcpSocket *socket() const;    void setSocket(QTcpSocket *socket);public slots:    bool sslConnect();    bool sslAccept();signals:    void connectionVerificationDone(QtSslSocket::VerifyResult result,                                    bool hostNameMatched,                                    const QString &description);protected slots:    void connectToHostImplementation(const QString &hostName, quint16 port,                                     OpenMode openMode);    void disconnectFromHostImplementation();protected:    qint64 readData(char *data, qint64 maxSize);    qint64 readLineData(char *data, qint64 maxSize);    qint64 writeData(const char *data, qint64 size);private slots:    void handleSocketError(QAbstractSocket::SocketError error);    void readFromSocket();    void writeToSocket();    void socketBytesWritten(qint64 bytes);private:    QString verifyErrorString(int err);    bool sslAcceptOrConnect(bool accept);    bool initSsl();    SSLLibrary* lib;    QtSslSocketPrivate *d;    friend class QtSslSocketPrivate;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -