summaryrefslogtreecommitdiffstats
path: root/konversation/src/sslsocket.h
blob: aa15de0f5cc503955dab56eaf14649d2afb0bebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef SSL_SOCKET_H
#define SSL_SOCKET_H
/*
    KDE SSL Socket

    Copyright (c) 2004,2005 by İsmail Dönmez <ismail.donmez@boun.edu.tr>

    based on the code by:
    Copyright (c) 2004      by Jason Keirstead <jason@keirstead.org>
    Kopete    (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
* This program is free software; you can redistribute it and/or modify  *
* it under the terms of the GNU General Public License as published by  *
* the Free Software Foundation; either version 2 of the License, or     *
* (at your option) any later version.                                   *
*                                                                       *
*************************************************************************
*/

#include <kstreamsocket.h>
using namespace KNetwork;

struct SSLSocketPrivate;

class SSLSocket : public KStreamSocket
{
    Q_OBJECT

    public:
        explicit SSLSocket(QWidget* serverParent, QObject* parent = 0L, const char* name = 0L);
        ~SSLSocket();

        void showInfoDialog();
        const QString details();

        Q_LONG writeBlock (const char *data, Q_ULONG len);
        Q_LONG readBlock  (char *data, Q_ULONG maxlen);

    protected:
        void stateChanging (KClientSocketBase::SocketState newState);

        signals:
        /** Emitted when there is a problem with SSL
         *  @param reason An error string that has already been through i18n
         */
        void sslFailure(const QString& reason);
        void sslInitDone();

    private:
        void connected();
        int verifyCertificate();
        void showSSLInfoDialog();

        QWidget* m_serverParent;

        SSLSocketPrivate* d;
};
#endif