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

tdeio/tdeio

  • tdeio
  • tdeio
slavebase.h
1/*
2 Copyright (C) 2000 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __slavebase_h
21#define __slavebase_h
22
23#include <kurl.h>
24#include <tdeconfigbase.h>
25#include <tdeio/global.h>
26#include <tdeio/authinfo.h>
27
28class DCOPClient;
29class KRemoteEncoding;
30
31namespace TDEIO {
32
33class Connection;
34class SlaveBasePrivate;
35
45class TDEIO_EXPORT SlaveBase
46{
47public:
48 SlaveBase( const TQCString &protocol, const TQCString &pool_socket, const TQCString &app_socket);
49 virtual ~SlaveBase();
50
55 void exit();
56
60 void dispatchLoop();
61
65 void setConnection( Connection* connection ) { m_pConnection = connection; }
69 Connection *connection() const { return m_pConnection; }
70
71
73 // Message Signals to send to the job
75
84 void data( const TQByteArray &data );
85
90 void dataReq( );
91
109 void error( int _errid, const TQString &_text );
110
114 void connected();
115
120 void finished();
121
125 void needSubURLData();
126
133 void slaveStatus(const TQString &host, bool connected);
134
141 void statEntry( const UDSEntry& _entry );
142
148 void listEntries( const UDSEntryList& _entry );
149
157 bool canResume( TDEIO::filesize_t offset );
158
159 /*
160 * Call this at the beginning of get(), if the "resume" metadata was set
161 * and resuming is implemented by this protocol.
162 */
163 void canResume();
164
166 // Info Signals to send to the job
168
174 void totalSize( TDEIO::filesize_t _bytes );
180 void processedSize( TDEIO::filesize_t _bytes );
181
193 void processedPercent( float percent );
194
200 void speed( unsigned long _bytes_per_second );
201
206 void redirection( const KURL &_url );
207
213 void errorPage();
214
219 void mimeType( const TQString &_type );
220
224 void warning( const TQString &msg );
225
230 void infoMessage( const TQString &msg );
231
232 enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
233
247 int messageBox( MessageBoxType type, const TQString &text,
248 const TQString &caption = TQString::null,
249 const TQString &buttonYes = TQString::null,
250 const TQString &buttonNo = TQString::null );
251
268 int messageBox( const TQString &text, MessageBoxType type,
269 const TQString &caption = TQString::null,
270 const TQString &buttonYes = TQString::null,
271 const TQString &buttonNo = TQString::null,
272 const TQString &dontAskAgainName = TQString::null );
273
278 void setMetaData(const TQString &key, const TQString &value);
279
285 bool hasMetaData(const TQString &key) const;
286
291 TQString metaData(const TQString &key) const;
292
298 bool hasMetaData(const TQString &key);
299
304 TQString metaData(const TQString &key);
305
311 MetaData allMetaData() const { return mIncomingMetaData; }
312
320 TDEConfigBase* config();
321
328 KRemoteEncoding* remoteEncoding();
329
330
332 // Commands sent by the job, the slave has to
333 // override what it wants to implement
335
347 virtual void setHost(const TQString& host, int port, const TQString& user, const TQString& pass);
348
352 virtual void setSubURL(const KURL&url);
353
363 virtual void openConnection();
364
373 virtual void closeConnection();
374
381 virtual void get( const KURL& url );
382
398 virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
399
405 virtual void stat( const KURL& url );
406
419 virtual void mimetype( const KURL& url );
420
428 virtual void listDir( const KURL& url );
429
437 virtual void mkdir( const KURL&url, int permissions );
438
447 virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
448
456 virtual void symlink( const TQString& target, const KURL& dest, bool overwrite );
457
462 virtual void chmod( const KURL& url, int permissions );
463
474 virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
475
482 virtual void del( const KURL &url, bool isfile);
483
484 // TODO KDE4: add setLinkDest() or something, to modify symlink targets.
485 // Will be used for tdeio_file but also tdeio_remote (#97129)
486
495 virtual void special( const TQByteArray & data );
496
504 virtual void multiGet( const TQByteArray & data );
505
510 virtual void slave_status();
511
516 virtual void reparseConfiguration();
517
523 virtual void localURL( const KURL& remoteURL );
524
528 int connectTimeout();
529
533 int proxyConnectTimeout();
534
539 int responseTimeout();
540
545 int readTimeout();
546
561 void setTimeoutSpecialCommand(int timeout, const TQByteArray &data=TQByteArray());
562
566 static void sigsegv_handler(int);
570 static void sigpipe_handler(int);
571
573 // Dispatching (internal)
575
579 virtual bool dispatch();
583 virtual void dispatch( int command, const TQByteArray &data );
584
593 int readData( TQByteArray &buffer );
594
606 void listEntry( const UDSEntry& _entry, bool ready);
607
612 void connectSlave(const TQString& path);
613 void disconnectSlave();
614
664 bool openPassDlg( TDEIO::AuthInfo& info, const TQString &errorMsg );
665
670 bool openPassDlg( TDEIO::AuthInfo& info );
671
699 bool checkCachedAuthentication( AuthInfo& info );
700
707 bool cacheAuthentication( const AuthInfo& info );
708
713 bool pingCacheDaemon() const;
714
721 TQString createAuthCacheKey( const KURL& url );
722
730 void sendAuthenticationKey( const TQCString& gKey, const TQCString& key, bool keep );
731
740 void delCachedAuthentication( const TQString& key );
741
746 void setMultipleAuthCaching( bool ) {};
747
752 bool multipleAuthCaching() const { return false; }
753
772 bool requestNetwork(const TQString& host = TQString::null);
773
787 void dropNetwork(const TQString& host = TQString::null);
788
793 DCOPClient *dcopClient();
794
799 int waitForAnswer( int expected1, int expected2, TQByteArray & data, int * pCmd = 0 );
800
804 void sendMetaData();
805
809 TQCString mProtocol;
810
811 Connection * m_pConnection;
812
813 MetaData mOutgoingMetaData;
814 MetaData mIncomingMetaData;
815
822 bool wasKilled() const;
823
828 void setKillFlag();
829
830protected:
831 UDSEntryList pendingListEntries;
832 uint listEntryCurrentSize;
833 long listEntry_sec, listEntry_usec;
834 Connection *appconn;
835 TQString mPoolSocket;
836 TQString mAppSocket;
837 bool mConnectedToApp;
838 static long s_seqNr;
839 virtual void virtual_hook( int id, void* data );
840
841private:
842 SlaveBasePrivate *d;
843};
844
845}
846
847#endif
KRemoteEncoding
Allows encoding and decoding properly remote filenames into Unicode.
Definition kremoteencoding.h:45
TDEIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information.
Definition authinfo.h:52
TDEIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition connection.h:49
TDEIO::MetaData
MetaData is a simple map of key/value strings.
Definition global.h:516
TDEIO::SlaveBase::proxyConnectTimeout
int proxyConnectTimeout()
Definition slavebase.cpp:1275
TDEIO::SlaveBase::setSubURL
virtual void setSubURL(const KURL &url)
Prepare slave for streaming operation.
Definition slavebase.cpp:803
TDEIO::SlaveBase::wasKilled
bool wasKilled() const
If your ioslave was killed by a signal, wasKilled() returns true.
Definition slavebase.cpp:1307
TDEIO::SlaveBase::symlink
virtual void symlink(const TQString &target, const KURL &dest, bool overwrite)
Creates a symbolic link named dest, pointing to target, which may be a relative or an absolute path.
Definition slavebase.cpp:793
TDEIO::SlaveBase::openPassDlg
bool openPassDlg(TDEIO::AuthInfo &info, const TQString &errorMsg)
Prompt the user for Authorization info (login & password).
Definition slavebase.cpp:854
TDEIO::SlaveBase::delCachedAuthentication
void delCachedAuthentication(const TQString &key)
Definition slavebase.cpp:718
TDEIO::SlaveBase::stat
virtual void stat(const KURL &url)
Finds all details for one file or directory.
Definition slavebase.cpp:779
TDEIO::SlaveBase::config
TDEConfigBase * config()
Returns a configuration object to query config/meta-data information from.
Definition slavebase.cpp:386
TDEIO::SlaveBase::speed
void speed(unsigned long _bytes_per_second)
Call this in get and copy, to give the current transfer speed, but only if it can't be calculated out...
Definition slavebase.cpp:540
TDEIO::SlaveBase::sendAuthenticationKey
void sendAuthenticationKey(const TQCString &gKey, const TQCString &key, bool keep)
Definition slavebase.cpp:710
TDEIO::SlaveBase::data
void data(const TQByteArray &data)
Sends data in the slave to the job (i.e.
Definition slavebase.cpp:409
TDEIO::SlaveBase::createAuthCacheKey
TQString createAuthCacheKey(const KURL &url)
Definition slavebase.cpp:1166
TDEIO::SlaveBase::canResume
bool canResume(TDEIO::filesize_t offset)
Call this at the beginning of put(), to give the size of the existing partial file,...
Definition slavebase.cpp:937
TDEIO::SlaveBase::mkdir
virtual void mkdir(const KURL &url, int permissions)
Create a directory.
Definition slavebase.cpp:799
TDEIO::SlaveBase::reparseConfiguration
virtual void reparseConfiguration()
Called by the scheduler to tell the slave that the configuration changed (i.e.
Definition slavebase.cpp:812
TDEIO::SlaveBase::multipleAuthCaching
bool multipleAuthCaching() const
Definition slavebase.h:752
TDEIO::SlaveBase::infoMessage
void infoMessage(const TQString &msg)
Call to signal a message, to be displayed if the application wants to, for instance in a status bar.
Definition slavebase.cpp:620
TDEIO::SlaveBase::errorPage
void errorPage()
Tell that we will only get an error page here.
Definition slavebase.cpp:554
TDEIO::SlaveBase::setTimeoutSpecialCommand
void setTimeoutSpecialCommand(int timeout, const TQByteArray &data=TQByteArray())
This function sets a timeout of timeout seconds and calls special(data) when the timeout occurs as if...
Definition slavebase.cpp:994
TDEIO::SlaveBase::mimetype
virtual void mimetype(const KURL &url)
Finds mimetype for one file or directory.
Definition slavebase.cpp:789
TDEIO::SlaveBase::finished
void finished()
Call to signal successful completion of any command (besides openConnection and closeConnection).
Definition slavebase.cpp:449
TDEIO::SlaveBase::connectTimeout
int connectTimeout()
Definition slavebase.cpp:1265
TDEIO::SlaveBase::openConnection
virtual void openConnection()
Opens the connection (forced) When this function gets called the slave is operating in connection-ori...
Definition slavebase.cpp:775
TDEIO::SlaveBase::special
virtual void special(const TQByteArray &data)
Used for any command that is specific to this slave (protocol) Examples are : HTTP POST,...
Definition slavebase.cpp:783
TDEIO::SlaveBase::cacheAuthentication
bool cacheAuthentication(const AuthInfo &info)
Explicitly store authentication information.
Definition slavebase.cpp:1250
TDEIO::SlaveBase::dataReq
void dataReq()
Asks for data from the job.
Definition slavebase.cpp:418
TDEIO::SlaveBase::responseTimeout
int responseTimeout()
Definition slavebase.cpp:1286
TDEIO::SlaveBase::mimeType
void mimeType(const TQString &_type)
Call this in mimetype() and in get(), when you know the mimetype.
Definition slavebase.cpp:571
TDEIO::SlaveBase::warning
void warning(const TQString &msg)
Call to signal a warning, to be displayed in a dialog box.
Definition slavebase.cpp:614
TDEIO::SlaveBase::pingCacheDaemon
bool pingCacheDaemon() const
Definition slavebase.cpp:1185
TDEIO::SlaveBase::statEntry
void statEntry(const UDSEntry &_entry)
Call this from stat() to express details about an object, the UDSEntry customarily contains the atoms...
Definition slavebase.cpp:647
TDEIO::SlaveBase::get
virtual void get(const KURL &url)
get, aka read.
Definition slavebase.cpp:787
TDEIO::SlaveBase::readData
int readData(TQByteArray &buffer)
Read data send by the job, after a dataReq.
Definition slavebase.cpp:987
TDEIO::SlaveBase::connected
void connected()
Call in openConnection, if you reimplement it, when you're done.
Definition slavebase.cpp:442
TDEIO::SlaveBase::messageBox
int messageBox(MessageBoxType type, const TQString &text, const TQString &caption=TQString::null, const TQString &buttonYes=TQString::null, const TQString &buttonNo=TQString::null)
Call this to show a message box from the slave.
Definition slavebase.cpp:914
TDEIO::SlaveBase::remoteEncoding
KRemoteEncoding * remoteEncoding()
Returns an object that can translate remote filenames into proper Unicode forms.
Definition slavebase.cpp:401
TDEIO::SlaveBase::chmod
virtual void chmod(const KURL &url, int permissions)
Change permissions on path The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD.
Definition slavebase.cpp:801
TDEIO::SlaveBase::redirection
void redirection(const KURL &_url)
Call this to signal a redirection The job will take care of going to that url.
Definition slavebase.cpp:548
TDEIO::SlaveBase::setMetaData
void setMetaData(const TQString &key, const TQString &value)
Sets meta-data to be send to the application before the first data() or finished() signal.
Definition slavebase.cpp:355
TDEIO::SlaveBase::mProtocol
TQCString mProtocol
Name of the protocol supported by this slave.
Definition slavebase.h:809
TDEIO::SlaveBase::copy
virtual void copy(const KURL &src, const KURL &dest, int permissions, bool overwrite)
Copy src into dest.
Definition slavebase.cpp:795
TDEIO::SlaveBase::needSubURLData
void needSubURLData()
Call to signal that data from the sub-URL is needed.
Definition slavebase.cpp:462
TDEIO::SlaveBase::hasMetaData
bool hasMetaData(const TQString &key) const
Queries for the existence of a certain config/meta-data entry send by the application to the slave.
Definition slavebase.cpp:369
TDEIO::SlaveBase::processedPercent
void processedPercent(float percent)
Only use this if you can't know in advance the size of the copied data.
Definition slavebase.cpp:534
TDEIO::SlaveBase::rename
virtual void rename(const KURL &src, const KURL &dest, bool overwrite)
Rename oldname into newname.
Definition slavebase.cpp:791
TDEIO::SlaveBase::put
virtual void put(const KURL &url, int permissions, bool overwrite, bool resume)
put, i.e.
Definition slavebase.cpp:781
TDEIO::SlaveBase::multiGet
virtual void multiGet(const TQByteArray &data)
Used for multiple get.
Definition slavebase.cpp:805
TDEIO::SlaveBase::listEntries
void listEntries(const UDSEntryList &_entry)
Call this in listDir, each time you have a bunch of entries to report.
Definition slavebase.cpp:697
TDEIO::SlaveBase::readTimeout
int readTimeout()
Definition slavebase.cpp:1297
TDEIO::SlaveBase::setMultipleAuthCaching
void setMultipleAuthCaching(bool)
Definition slavebase.h:746
TDEIO::SlaveBase::listEntry
void listEntry(const UDSEntry &_entry, bool ready)
internal function to be called by the slave.
Definition slavebase.cpp:655
TDEIO::SlaveBase::processedSize
void processedSize(TDEIO::filesize_t _bytes)
Call this during get and copy, once in a while, to give some info about the current state.
Definition slavebase.cpp:498
TDEIO::SlaveBase::slave_status
virtual void slave_status()
Called to get the status of the slave.
Definition slavebase.cpp:809
TDEIO::SlaveBase::closeConnection
virtual void closeConnection()
Closes the connection (forced) Called when the application disconnects the slave to close any open ne...
Definition slavebase.cpp:777
TDEIO::SlaveBase::listDir
virtual void listDir(const KURL &url)
Lists the contents of url.
Definition slavebase.cpp:785
TDEIO::SlaveBase::setHost
virtual void setHost(const TQString &host, int port, const TQString &user, const TQString &pass)
Set the host.
Definition slavebase.cpp:771
TDEIO::SlaveBase::metaData
TQString metaData(const TQString &key) const
Queries for config/meta-data send by the application to the slave.
Definition slavebase.cpp:360
TDEIO::SlaveBase::connectSlave
void connectSlave(const TQString &path)
internal function to connect a slave to/ disconnect from either the slave pool or the application
Definition slavebase.cpp:336
TDEIO::SlaveBase::setKillFlag
void setKillFlag()
Internally used.
Definition slavebase.cpp:1312
TDEIO::SlaveBase::del
virtual void del(const KURL &url, bool isfile)
Delete a file or directory.
Definition slavebase.cpp:797
TDEIO::SlaveBase::error
void error(int _errid, const TQString &_text)
Call to signal an error.
Definition slavebase.cpp:429
TDEIO::SlaveBase::slaveStatus
void slaveStatus(const TQString &host, bool connected)
Used to report the status of the slave.
Definition slavebase.cpp:467
TDEIO::SlaveBase::checkCachedAuthentication
bool checkCachedAuthentication(AuthInfo &info)
Checks for cached authentication based on parameters given by info.
Definition slavebase.cpp:1207
TDEIO::SlaveBase::totalSize
void totalSize(TDEIO::filesize_t _bytes)
Call this in get and copy, to give the total size of the file Call in listDir too,...
Definition slavebase.cpp:482
TDEIO::SlaveBase::localURL
virtual void localURL(const KURL &remoteURL)
For use with for ForwardingSlaveBase Returns the local URL of the given remote URL if possible.
Definition slavebase.cpp:816
TDEIO
A namespace for TDEIO globals.
Definition authinfo.h:29
TDEIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition global.h:507
TDEIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition global.h:39

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • 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.15.0
This website is maintained by Timothy Pearson.