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.33.2.1 2003/07/15 00:40:51 mueller Exp $"
00028
00029 #include <sys/types.h>
00030
00031 #include <stdio.h>
00032
00033 #include <kextsock.h>
00034 #include <kio/slavebase.h>
00035
00036
00037 namespace KIO {
00038
00048 class TCPSlaveBase : public SlaveBase
00049 {
00050 public:
00051 TCPSlaveBase(unsigned short int defaultPort, const QCString &protocol,
00052 const QCString &poolSocket, const QCString &appSocket);
00053
00054 TCPSlaveBase(unsigned short int defaultPort, const QCString &protocol,
00055 const QCString &poolSocket, const QCString &appSocket,
00056 bool useSSL);
00057
00058 virtual ~TCPSlaveBase();
00059
00060 protected:
00061
00062 #ifndef KDE_NO_COMPAT
00063
00066 ssize_t Write(const void *data, ssize_t len) { return write( data, len ); }
00067
00071 ssize_t Read(void *data, ssize_t len) { return read( data, len ); }
00072
00076 ssize_t ReadLine(char *data, ssize_t len) { return readLine( data, len ); }
00077
00081 unsigned short int GetPort(unsigned short int p) { return port(p); }
00082
00086 bool ConnectToHost( const QString &host, unsigned int port,
00087 bool sendError ) { return connectToHost( host, port, sendError ); }
00088
00092 void CloseDescriptor() { closeDescriptor(); }
00093
00097 bool AtEOF() { return atEnd(); }
00098
00102 bool InitializeSSL() { return initializeSSL(); }
00103
00107 void CleanSSL() { cleanSSL(); }
00108 #endif
00109
00120 ssize_t write(const void *data, ssize_t len);
00121
00132 ssize_t read(void *data, ssize_t len);
00133
00137 ssize_t readLine(char *data, ssize_t len);
00138
00146 void setBlockSize(int sz);
00147
00155 unsigned short int port(unsigned short int);
00156
00175 bool connectToHost( const QString &host, unsigned int port,
00176 bool sendError = true );
00177
00184 bool usingTLS();
00185
00192 bool canUseTLS();
00193
00203 int startTLS();
00204
00208 void stopTLS();
00209
00217 void closeDescriptor();
00218
00219
00223 bool atEnd();
00224
00225
00232 void setSSLMetaData();
00233
00234
00238 bool initializeSSL();
00239
00240
00244 void cleanSSL();
00245
00255 bool isConnectionValid();
00256
00267 int connectResult();
00268
00279 bool waitForResponse( int t );
00280
00290 void setBlockConnection( bool b );
00291
00302 void setConnectTimeout( int t );
00303
00309 bool isSSLTunnelEnabled();
00310
00326 void setEnableSSLTunnel( bool enable );
00327
00338 void setRealHost( const QString& realHost );
00339
00340
00341 void doConstructorStuff();
00342
00343
00344 int verifyCertificate();
00345
00346
00347 void certificatePrompt();
00348
00349
00350 bool userAborted() const;
00351
00352 protected:
00353 int m_iSock;
00354 bool m_bIsSSL;
00355 unsigned short int m_iPort;
00356 unsigned short int m_iDefaultPort;
00357 QCString m_sServiceName;
00358 FILE *fp;
00359
00360 private:
00361 bool doSSLHandShake( bool sendError );
00362
00363 protected:
00364 virtual void virtual_hook( int id, void* data );
00365 private:
00366 class TcpSlaveBasePrivate;
00367 TcpSlaveBasePrivate *d;
00368 };
00369
00370 }
00371
00372 #endif
This file is part of the documentation for kdelibs Version 3.1.4.