tcpslavebase.h
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
00026 #ifndef _TCP_SLAVEBASE_H
00027 #define _TCP_SLAVEBASE_H "$Id: tcpslavebase.h,v 1.41 2003/08/30 08:56:21 raabe Exp $"
00028
00029 #include <sys/types.h>
00030
00031 #include <stdio.h>
00032
00033 #include <kextsock.h>
00034 #include <kio/slavebase.h>
00035 #include <kdemacros.h>
00036
00037
00038 namespace KIO {
00039
00049 class TCPSlaveBase : public SlaveBase
00050 {
00051 public:
00052 TCPSlaveBase(unsigned short int defaultPort, const QCString &protocol,
00053 const QCString &poolSocket, const QCString &appSocket);
00054
00055 TCPSlaveBase(unsigned short int defaultPort, const QCString &protocol,
00056 const QCString &poolSocket, const QCString &appSocket,
00057 bool useSSL);
00058
00059 virtual ~TCPSlaveBase();
00060
00061 protected:
00062
00063 #ifndef KDE_NO_COMPAT
00064
00067 KDE_DEPRECATED ssize_t Write(const void *data, ssize_t len) { return write( data, len ); }
00068
00072 KDE_DEPRECATED ssize_t Read(void *data, ssize_t len) { return read( data, len ); }
00073
00077 KDE_DEPRECATED ssize_t ReadLine(char *data, ssize_t len) { return readLine( data, len ); }
00078
00082 KDE_DEPRECATED unsigned short int GetPort(unsigned short int p) { return port(p); }
00083
00087 KDE_DEPRECATED bool ConnectToHost( const QString &host, unsigned int port,
00088 bool sendError ) { return connectToHost( host, port, sendError ); }
00089
00093 KDE_DEPRECATED void CloseDescriptor() { closeDescriptor(); }
00094
00098 KDE_DEPRECATED bool AtEOF() { return atEnd(); }
00099
00103 KDE_DEPRECATED bool InitializeSSL() { return initializeSSL(); }
00104
00108 KDE_DEPRECATED void CleanSSL() { cleanSSL(); }
00109 #endif
00110
00121 ssize_t write(const void *data, ssize_t len);
00122
00133 ssize_t read(void *data, ssize_t len);
00134
00138 ssize_t readLine(char *data, ssize_t len);
00139
00147 void setBlockSize(int sz);
00148
00157 unsigned short int port(unsigned short int _port);
00158
00177 bool connectToHost( const QString &host, unsigned int port,
00178 bool sendError = true );
00179
00187 bool usingSSL() const { return m_bIsSSL; }
00188
00196 bool usingTLS() const;
00197
00205 bool usingTLS();
00206
00213 bool canUseTLS();
00214
00224 int startTLS();
00225
00229 void stopTLS();
00230
00238 void closeDescriptor();
00239
00240
00244 bool atEnd();
00245
00246
00253 void setSSLMetaData();
00254
00255
00259 bool initializeSSL();
00260
00261
00265 void cleanSSL();
00266
00276 bool isConnectionValid();
00277
00288 int connectResult();
00289
00300 bool waitForResponse( int t );
00301
00311 void setBlockConnection( bool b );
00312
00323 void setConnectTimeout( int t );
00324
00330 bool isSSLTunnelEnabled();
00331
00347 void setEnableSSLTunnel( bool enable );
00348
00359 void setRealHost( const QString& realHost );
00360
00361
00362 void doConstructorStuff();
00363
00364
00365 int verifyCertificate();
00366
00367
00368 void certificatePrompt();
00369
00370
00371 bool userAborted() const;
00372
00373 protected:
00374 int m_iSock;
00375 bool m_bIsSSL;
00376 unsigned short int m_iPort;
00377 unsigned short int m_iDefaultPort;
00378 QCString m_sServiceName;
00379 FILE *fp;
00380
00381 private:
00382 bool doSSLHandShake( bool sendError );
00383
00384 protected:
00385 virtual void virtual_hook( int id, void* data );
00386 private:
00387 class TcpSlaveBasePrivate;
00388 TcpSlaveBasePrivate *d;
00389 };
00390
00391 }
00392
00393 #endif
This file is part of the documentation for kio Library Version 3.3.0.