2
* securestream.h - combines a ByteStream with TLS and SASL
3
* Copyright (C) 2004 Justin Karneges
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#ifndef SECURESTREAM_H
22
#define SECURESTREAM_H
25
#include "bytestream.h"
27
#define USE_TLSHANDLER
36
class CompressionHandler;
38
class SecureStream : public ByteStream
42
enum Error { ErrTLS = ErrCustom, ErrSASL };
43
SecureStream(ByteStream *s);
46
void startTLSClient(QCA::TLS *t, const QByteArray &spare=QByteArray());
47
void startTLSServer(QCA::TLS *t, const QByteArray &spare=QByteArray());
48
void setLayerCompress(const QByteArray &spare=QByteArray());
49
void setLayerSASL(QCA::SASL *s, const QByteArray &spare=QByteArray());
51
void startTLSClient(XMPP::TLSHandler *t, const QString &server, const QByteArray &spare=QByteArray());
55
int errorCode() const;
59
void write(const QByteArray &);
60
int bytesToWrite() const;
68
void bs_bytesWritten(int);
70
void layer_tlsHandshaken();
71
void layer_tlsClosed(const QByteArray &);
72
void layer_readyRead(const QByteArray &);
73
void layer_needWrite(const QByteArray &);
74
void layer_error(int);
77
void linkLayer(QObject *);
78
int calcPrebytes() const;
79
void insertData(const QByteArray &a);
80
void writeRawData(const QByteArray &a);
81
void incomingData(const QByteArray &a);