KIO
tcpslavebase.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2000 Alex Zepeda <zipzippy@sonic.net> 00003 * Copyright (C) 2001 George Staikos <staikos@kde.org> 00004 * Copyright (C) 2001 Dawit Alemayehu <adawit@kde.org> 00005 * Copyright (C) 2007,2008 Andreas Hartmetz <ahartmetz@gmail.com> 00006 * 00007 * This file is part of the KDE project 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Library General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Library General Public License 00020 * along with this library; see the file COPYING.LIB. If not, write to 00021 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00022 * Boston, MA 02110-1301, USA. 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; //Silence incompatible virtual override warning 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 // For the certificate verification code 00199 SslResult verifyServerCertificate(); 00200 00201 // For prompting for the client certificate to use 00202 void selectClientCertificate(); 00203 00204 //we can't include ktcpsocket.h here as it is not exported 00205 SslResult startTLSInternal(uint KTcpSocket_SslVersion); 00206 00207 class TcpSlaveBasePrivate; 00208 TcpSlaveBasePrivate* const d; 00209 }; 00210 00211 } 00212 00213 #endif
KDE 4.6 API Reference