kio Library API Documentation

tcpslavebase.h

00001 /*
00002  * $Id: tcpslavebase.h,v 1.33 2002/08/10 01:26:13 waba Exp $
00003  *
00004  * Copyright (C) 2000 Alex Zepeda <zipzippy@sonic.net>
00005  * Copyright (C) 2001 George Staikos <staikos@kde.org>
00006  * Copyright (C) 2001 Dawit Alemayehu <adawit@kde.org>
00007  *
00008  * This file is part of the KDE project
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Library General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Library General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Library General Public License
00021  * along with this library; see the file COPYING.LIB.  If not, write to
00022  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023  * Boston, MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef _TCP_SLAVEBASE_H
00027 #define _TCP_SLAVEBASE_H "$Id: tcpslavebase.h,v 1.33 2002/08/10 01:26:13 waba 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     // don't use me!
00341     void doConstructorStuff();
00342 
00343     // For the certificate verification code
00344     int verifyCertificate();
00345 
00346     // For prompting for the certificate to use
00347     void certificatePrompt();
00348 
00349     // Did the user abort (as the reason for connectToHost returning false)
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
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:33 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001