| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# slavebase.h

    00001 /*
    00002    Copyright (C) 2000 David Faure <faure@kde.org>
    00003
    00004    This library is free software; you can redistribute it and/or
    00005    modify it under the terms of the GNU Library General Public
    00006    License as published by the Free Software Foundation; either
    00007    version 2 of the License, or (at your option) any later version.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef __slavebase_h
    00021 #define __slavebase_h
    00022
    00023 #include <kurl.h>
    00024 #include <kconfigbase.h>
    00025 #include <kio/global.h>
    00026 #include <kio/authinfo.h>
    00027
    00028 class DCOPClient;
    00029
    00030 namespace KIO {
    00031
    00032 class Connection;
    00033 class SlaveBasePrivate;
    00034
    00044 class SlaveBase
    00045 {
    00046 public:
    00047     SlaveBase( const QCString &protocol, const QCString &pool_socket, const QCString &app_socket);
    00048     virtual ~SlaveBase();
    00049
    00054     void exit();
    00055
    00059     void dispatchLoop();
    00060
    00064     void setConnection( Connection* connection ) { m_pConnection = connection; }
    00068     Connection *connection() const { return m_pConnection; }
    00069
    00070
    00072     // Message Signals to send to the job
    00074
    00083     void data( const QByteArray &data );
    00084
    00089     void dataReq( );
    00090
    00108     void error( int _errid, const QString &_text );
    00109
    00113     void connected();
    00114
    00119     void finished();
    00120
    00124     void needSubURLData();
    00125
    00132     void slaveStatus(const QString &host, bool connected);
    00133
    00140     void statEntry( const UDSEntry& _entry );
    00141
    00146     void listEntries( const UDSEntryList& _entry );
    00147
    00155     bool canResume( KIO::filesize_t offset );
    00156
    00157     /*
    00158      * Call this at the beginning of get(), if the "resume" metadata was set
    00159      * and resuming is implemented by this protocol.
    00160      */
    00161     void canResume();
    00162
    00164     // Info Signals to send to the job
    00166
    00172     void totalSize( KIO::filesize_t _bytes );
    00178     void processedSize( KIO::filesize_t _bytes );
    00179
    00191     void processedPercent( float percent );
    00192
    00198     void speed( unsigned long _bytes_per_second );
    00199
    00204     void redirection( const KURL &_url );
    00205
    00211     void errorPage();
    00212
    00217     void mimeType( const QString &_type );
    00218
    00222     void warning( const QString &msg );
    00223
    00228     void infoMessage( const QString &msg );
    00229
    00230     enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
    00231
    00247     int messageBox( MessageBoxType type, const QString &text,
    00248                     const QString &caption = QString::null,
    00249                     const QString &buttonYes = QString::null,
    00250                     const QString &buttonNo = QString::null );
    00251
    00256     void setMetaData(const QString &key, const QString &value);
    00257
    00262     bool hasMetaData(const QString &key);
    00263
    00267     QString metaData(const QString &key);
    00268
    00276     KConfigBase* config();
    00277
    00279     // Commands sent by the job, the slave has to
    00280     // override what it wants to implement
    00282
    00294     virtual void setHost(const QString& host, int port, const QString& user, const QString& pass);
    00295
    00299     virtual void setSubURL(const KURL&url);
    00300
    00309     virtual void openConnection();
    00310
    00319     virtual void closeConnection();
    00320
    00327     virtual void get( const KURL& url );
    00328
    00338     virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
    00339
    00345     virtual void stat( const KURL& url );
    00346
    00359     virtual void mimetype( const KURL& url );
    00360
    00368     virtual void listDir( const KURL& url );
    00369
    00377     virtual void mkdir( const KURL&url, int permissions );
    00378
    00387     virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
    00388
    00396     virtual void symlink( const QString& target, const KURL& dest, bool overwrite );
    00397
    00402     virtual void chmod( const KURL& url, int permissions );
    00403
    00414     virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
    00415
    00422     virtual void del( const KURL &url, bool isfile);
    00423
    00432     virtual void special( const QByteArray & );
    00433
    00441     virtual void multiGet( const QByteArray & );
    00442
    00447     virtual void slave_status();
    00448
    00453     virtual void reparseConfiguration();
    00454
    00455
    00459     int connectTimeout();
    00460
    00464     int proxyConnectTimeout();
    00465
    00470     int responseTimeout();
    00471
    00476     int readTimeout();
    00477
    00492     void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
    00493
    00497     static void sigsegv_handler(int);
    00501     static void sigpipe_handler(int);
    00502
    00504     // Dispatching (internal)
    00506
    00510     virtual bool dispatch();
    00514     virtual void dispatch( int command, const QByteArray &data );
    00515
    00524     int readData( QByteArray &buffer );
    00525
    00536     void listEntry( const UDSEntry& _entry, bool ready);
    00537
    00542     void connectSlave(const QString& path);
    00543     void disconnectSlave();
    00544
    00551     bool pingCacheDaemon() const;
    00552
    00595     bool openPassDlg( KIO::AuthInfo& info, const QString &errorMsg );
    00596
    00597     bool openPassDlg( KIO::AuthInfo& info );
    00598
    00644     bool checkCachedAuthentication( AuthInfo& info );
    00645
    00652     bool cacheAuthentication( const AuthInfo& info );
    00653
    00659     QString createAuthCacheKey( const KURL& url );
    00660
    00667     void sendAuthenticationKey( const QCString& gKey, const QCString& key, bool keep );
    00668
    00675     void delCachedAuthentication( const QString& key );
    00676
    00695     void setMultipleAuthCaching( bool enable );
    00696
    00700     bool multipleAuthCaching() const;
    00701
    00720     bool requestNetwork(const QString& host = QString::null);
    00721
    00735     void dropNetwork(const QString& host = QString::null);
    00736
    00741     DCOPClient *dcopClient();
    00742
    00747     int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
    00748
    00752     void sendMetaData();
    00753
    00757     QCString mProtocol;
    00758
    00759     Connection * m_pConnection;
    00760
    00761     MetaData mOutgoingMetaData;
    00762     MetaData mIncomingMetaData;
    00763
    00770     bool wasKilled() const;
    00775     void setKillFlag();
    00776 private:
    00777     bool storeAuthInfo( const QCString&, const QCString&, const AuthInfo& );
    00778
    00779     UDSEntryList pendingListEntries;
    00780     uint listEntryCurrentSize;
    00781     long listEntry_sec, listEntry_usec;
    00782     Connection *appconn;
    00783     QString mPoolSocket;
    00784     QString mAppSocket;
    00785     bool mConnectedToApp;
    00786     static long s_seqNr;
    00787 protected:
    00788     virtual void virtual_hook( int id, void* data );
    00789 private:
    00790     SlaveBasePrivate *d;
    00791 };
    00792
    00793 }
    00794
    00795 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:39 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001