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
00120 bool connectToHost(const QString &protocol, const QString& host, quint16 port);
00121
00126 quint16 port() const;
00127
00134 bool isAutoSsl() const;
00135
00142 bool isUsingSsl() const;
00143
00152 bool startSsl();
00153
00157 void disconnectFromHost();
00158
00162 bool atEnd() const;
00163
00171 bool isConnected() const;
00172
00183 bool waitForResponse( int t );
00184
00194 void setBlocking( bool b );
00195
00199 QIODevice *socket() const;
00200
00201 protected:
00202 virtual void virtual_hook( int id, void* data );
00203
00204 private:
00205
00206 SslResult verifyServerCertificate();
00207
00208
00209 void selectClientCertificate();
00210
00211
00212 SslResult startTLSInternal(uint KTcpSocket_SslVersion);
00213
00214 class TcpSlaveBasePrivate;
00215 TcpSlaveBasePrivate* const d;
00216 };
00217
00218 }
00219
00220 #endif