KIO
tcpslavebase.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _TCP_SLAVEBASE_H
00026 #define _TCP_SLAVEBASE_H
00027
00028 #include <sys/types.h>
00029 #include <stdio.h>
00030
00031 #include <kio/slavebase.h>
00032
00033 class QIODevice;
00034
00035 namespace KIO {
00036
00046 class KIO_EXPORT TCPSlaveBase : public SlaveBase
00047 {
00048 public:
00056 TCPSlaveBase(const QByteArray &protocol,
00057 const QByteArray &poolSocket, const QByteArray &appSocket,
00058 bool autoSsl = false);
00059
00060 virtual ~TCPSlaveBase();
00061
00062 protected:
00063 enum SslResultDetail {
00064 ResultOk = 1,
00065 ResultOverridden = 2,
00066 ResultFailed = 4,
00067 ResultFailedEarly = 8
00068 };
00069 friend class QFlags<KIO::TCPSlaveBase::SslResultDetail>;
00070 public:
00071 Q_DECLARE_FLAGS(SslResult, SslResultDetail)
00072 protected:
00073
00082 using SlaveBase::write;
00083 ssize_t write(const char *data, ssize_t len);
00084
00093 using SlaveBase::read;
00094 ssize_t read(char *data, ssize_t len);
00095
00099 ssize_t readLine(char *data, ssize_t len);
00100
00113 bool connectToHost(const QString &protocol, const QString& host, quint16 port);
00114
00119 quint16 port() const;
00120
00127 bool isAutoSsl() const;
00128
00135 bool isUsingSsl() const;
00136
00145 bool startSsl();
00146
00150 void disconnectFromHost();
00151
00155 bool atEnd() const;
00156
00164 bool isConnected() const;
00165
00176 bool waitForResponse( int t );
00177
00187 void setBlocking( bool b );
00188
00192 QIODevice *socket() const;
00193
00194 protected:
00195 virtual void virtual_hook( int id, void* data );
00196
00197 private:
00198
00199 SslResult verifyServerCertificate();
00200
00201
00202 void selectClientCertificate();
00203
00204
00205 SslResult startTLSInternal(uint KTcpSocket_SslVersion);
00206
00207 class TcpSlaveBasePrivate;
00208 TcpSlaveBasePrivate* const d;
00209 };
00210
00211 }
00212
00213 #endif