• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __slavebase_h
00021 #define __slavebase_h
00022 
00023 #include <kurl.h>
00024 #include <tdeconfigbase.h>
00025 #include <tdeio/global.h>
00026 #include <tdeio/authinfo.h>
00027 
00028 class DCOPClient;
00029 class KRemoteEncoding;
00030 
00031 namespace TDEIO {
00032 
00033 class Connection;
00034 class SlaveBasePrivate;
00035 
00045 class TDEIO_EXPORT SlaveBase
00046 {
00047 public:
00048     SlaveBase( const TQCString &protocol, const TQCString &pool_socket, const TQCString &app_socket);
00049     virtual ~SlaveBase();
00050 
00055     void exit();
00056 
00060     void dispatchLoop();
00061 
00065     void setConnection( Connection* connection ) { m_pConnection = connection; }
00069     Connection *connection() const { return m_pConnection; }
00070 
00071 
00073     // Message Signals to send to the job
00075 
00084     void data( const TQByteArray &data );
00085 
00090     void dataReq( );
00091 
00109     void error( int _errid, const TQString &_text );
00110 
00114     void connected();
00115 
00120     void finished();
00121 
00125     void needSubURLData();
00126 
00133     void slaveStatus(const TQString &host, bool connected);
00134 
00141     void statEntry( const UDSEntry& _entry );
00142 
00148     void listEntries( const UDSEntryList& _entry );
00149 
00157     bool canResume( TDEIO::filesize_t offset );
00158 
00159     /*
00160      * Call this at the beginning of get(), if the "resume" metadata was set
00161      * and resuming is implemented by this protocol.
00162      */
00163     void canResume();
00164 
00166     // Info Signals to send to the job
00168 
00174     void totalSize( TDEIO::filesize_t _bytes );
00180     void processedSize( TDEIO::filesize_t _bytes );
00181 
00193     void processedPercent( float percent );
00194 
00200     void speed( unsigned long _bytes_per_second );
00201 
00206     void redirection( const KURL &_url );
00207 
00213     void errorPage();
00214 
00219     void mimeType( const TQString &_type );
00220 
00224     void warning( const TQString &msg );
00225 
00230     void infoMessage( const TQString &msg );
00231 
00232     enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
00233 
00247     int messageBox( MessageBoxType type, const TQString &text,
00248                     const TQString &caption = TQString::null,
00249                     const TQString &buttonYes = TQString::null,
00250                     const TQString &buttonNo = TQString::null );
00251 
00268     int messageBox( const TQString &text, MessageBoxType type,
00269                     const TQString &caption = TQString::null,
00270                     const TQString &buttonYes = TQString::null,
00271                     const TQString &buttonNo = TQString::null,
00272                     const TQString &dontAskAgainName = TQString::null );
00273 
00278     void setMetaData(const TQString &key, const TQString &value);
00279 
00285     bool hasMetaData(const TQString &key) const;
00286 
00291     TQString metaData(const TQString &key) const;
00292 
00298     bool hasMetaData(const TQString &key);
00299 
00304     TQString metaData(const TQString &key);
00305 
00311     MetaData allMetaData() const { return mIncomingMetaData; }
00312 
00320     TDEConfigBase* config();
00321 
00328     KRemoteEncoding* remoteEncoding();
00329 
00330 
00332     // Commands sent by the job, the slave has to
00333     // override what it wants to implement
00335 
00347     virtual void setHost(const TQString& host, int port, const TQString& user, const TQString& pass);
00348 
00352     virtual void setSubURL(const KURL&url);
00353 
00363     virtual void openConnection();
00364 
00373     virtual void closeConnection();
00374 
00381     virtual void get( const KURL& url );
00382 
00398     virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
00399 
00405     virtual void stat( const KURL& url );
00406 
00419     virtual void mimetype( const KURL& url );
00420 
00428     virtual void listDir( const KURL& url );
00429 
00437     virtual void mkdir( const KURL&url, int permissions );
00438 
00447     virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
00448 
00456     virtual void symlink( const TQString& target, const KURL& dest, bool overwrite );
00457 
00462     virtual void chmod( const KURL& url, int permissions );
00463 
00474     virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
00475 
00482     virtual void del( const KURL &url, bool isfile);
00483 
00484     // TODO KDE4: add setLinkDest() or something, to modify symlink targets.
00485     // Will be used for tdeio_file but also tdeio_remote (#97129)
00486 
00495     virtual void special( const TQByteArray & data );
00496 
00504     virtual void multiGet( const TQByteArray & data );
00505 
00510     virtual void slave_status();
00511 
00516     virtual void reparseConfiguration();
00517 
00523     virtual void localURL( const KURL& remoteURL );
00524 
00528     int connectTimeout();
00529 
00533     int proxyConnectTimeout();
00534 
00539     int responseTimeout();
00540 
00545     int readTimeout();
00546 
00561     void setTimeoutSpecialCommand(int timeout, const TQByteArray &data=TQByteArray());
00562 
00566     static void sigsegv_handler(int);
00570     static void sigpipe_handler(int);
00571 
00573     // Dispatching (internal)
00575 
00579     virtual bool dispatch();
00583     virtual void dispatch( int command, const TQByteArray &data );
00584 
00593     int readData( TQByteArray &buffer );
00594 
00606     void listEntry( const UDSEntry& _entry, bool ready);
00607 
00612     void connectSlave(const TQString& path);
00613     void disconnectSlave();
00614 
00664     bool openPassDlg( TDEIO::AuthInfo& info, const TQString &errorMsg );
00665 
00670     bool openPassDlg( TDEIO::AuthInfo& info );
00671 
00699     bool checkCachedAuthentication( AuthInfo& info );
00700 
00707     bool cacheAuthentication( const AuthInfo& info );
00708 
00713     bool pingCacheDaemon() const;
00714 
00721     TQString createAuthCacheKey( const KURL& url );
00722 
00730     void sendAuthenticationKey( const TQCString& gKey, const TQCString& key, bool keep );
00731 
00740     void delCachedAuthentication( const TQString& key );
00741 
00746     void setMultipleAuthCaching( bool ) {};
00747 
00752     bool multipleAuthCaching() const { return false; }
00753 
00772     bool requestNetwork(const TQString& host = TQString::null);
00773 
00787     void dropNetwork(const TQString& host = TQString::null);
00788 
00793     DCOPClient *dcopClient();
00794 
00799     int waitForAnswer( int expected1, int expected2, TQByteArray & data, int * pCmd = 0 );
00800 
00804     void sendMetaData();
00805 
00809     TQCString mProtocol;
00810 
00811     Connection * m_pConnection;
00812 
00813     MetaData mOutgoingMetaData;
00814     MetaData mIncomingMetaData;
00815 
00822     bool wasKilled() const;
00823 
00828     void setKillFlag();
00829 
00830 protected:
00831     UDSEntryList pendingListEntries;
00832     uint listEntryCurrentSize;
00833     long listEntry_sec, listEntry_usec;
00834     Connection *appconn;
00835     TQString mPoolSocket;
00836     TQString mAppSocket;
00837     bool mConnectedToApp;
00838     static long s_seqNr;
00839     virtual void virtual_hook( int id, void* data );
00840 
00841 private:
00842     SlaveBasePrivate *d;
00843 };
00844 
00845 }
00846 
00847 #endif

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.6.3
This website is maintained by Timothy Pearson.