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

tdeio/tdeio

  • TDEIO
  • ForwardingSlaveBase
Public Member Functions | Protected Member Functions | List of all members
TDEIO::ForwardingSlaveBase Class Referenceabstract

#include <forwardingslavebase.h>

Inheritance diagram for TDEIO::ForwardingSlaveBase:
TDEIO::SlaveBase

Public Member Functions

 ForwardingSlaveBase (const TQCString &protocol, const TQCString &poolSocket, const TQCString &appSocket)
 
virtual void get (const KURL &url)
 
virtual void put (const KURL &url, int permissions, bool overwrite, bool resume)
 
virtual void stat (const KURL &url)
 
virtual void mimetype (const KURL &url)
 
virtual void listDir (const KURL &url)
 
virtual void mkdir (const KURL &url, int permissions)
 
virtual void rename (const KURL &src, const KURL &dest, bool overwrite)
 
virtual void symlink (const TQString &target, const KURL &dest, bool overwrite)
 
virtual void chmod (const KURL &url, int permissions)
 
virtual void copy (const KURL &src, const KURL &dest, int permissions, bool overwrite)
 
virtual void del (const KURL &url, bool isfile)
 
virtual void localURL (const KURL &remoteURL)
 
- Public Member Functions inherited from TDEIO::SlaveBase
 SlaveBase (const TQCString &protocol, const TQCString &pool_socket, const TQCString &app_socket)
 
void exit ()
 
void dispatchLoop ()
 
void setConnection (Connection *connection)
 
Connection * connection () const
 
void data (const TQByteArray &data)
 
void dataReq ()
 
void error (int _errid, const TQString &_text)
 
void connected ()
 
void finished ()
 
void needSubURLData ()
 
void slaveStatus (const TQString &host, bool connected)
 
void statEntry (const UDSEntry &_entry)
 
void listEntries (const UDSEntryList &_entry)
 
bool canResume (TDEIO::filesize_t offset)
 
void canResume ()
 
void totalSize (TDEIO::filesize_t _bytes)
 
void processedSize (TDEIO::filesize_t _bytes)
 
void processedPercent (float percent)
 
void speed (unsigned long _bytes_per_second)
 
void redirection (const KURL &_url)
 
void errorPage ()
 
void mimeType (const TQString &_type)
 
void warning (const TQString &msg)
 
void infoMessage (const TQString &msg)
 
int messageBox (MessageBoxType type, const TQString &text, const TQString &caption=TQString::null, const TQString &buttonYes=TQString::null, const TQString &buttonNo=TQString::null)
 
int messageBox (const TQString &text, MessageBoxType type, const TQString &caption=TQString::null, const TQString &buttonYes=TQString::null, const TQString &buttonNo=TQString::null, const TQString &dontAskAgainName=TQString::null)
 
void setMetaData (const TQString &key, const TQString &value)
 
bool hasMetaData (const TQString &key) const
 
TQString metaData (const TQString &key) const
 
bool hasMetaData (const TQString &key)
 
TQString metaData (const TQString &key)
 
MetaData allMetaData () const
 
TDEConfigBase * config ()
 
KRemoteEncoding * remoteEncoding ()
 
virtual void setHost (const TQString &host, int port, const TQString &user, const TQString &pass)
 
virtual void setSubURL (const KURL &url)
 
virtual void openConnection ()
 
virtual void closeConnection ()
 
virtual void special (const TQByteArray &data)
 
virtual void multiGet (const TQByteArray &data)
 
virtual void slave_status ()
 
virtual void reparseConfiguration ()
 
int connectTimeout ()
 
int proxyConnectTimeout ()
 
int responseTimeout ()
 
int readTimeout ()
 
void setTimeoutSpecialCommand (int timeout, const TQByteArray &data=TQByteArray())
 
virtual bool dispatch ()
 
virtual void dispatch (int command, const TQByteArray &data)
 
int readData (TQByteArray &buffer)
 
void listEntry (const UDSEntry &_entry, bool ready)
 
void connectSlave (const TQString &path)
 
void disconnectSlave ()
 
bool openPassDlg (TDEIO::AuthInfo &info, const TQString &errorMsg)
 
bool openPassDlg (TDEIO::AuthInfo &info)
 
bool checkCachedAuthentication (AuthInfo &info)
 
bool cacheAuthentication (const AuthInfo &info)
 
bool pingCacheDaemon () const
 
TQString createAuthCacheKey (const KURL &url)
 
void sendAuthenticationKey (const TQCString &gKey, const TQCString &key, bool keep)
 
void delCachedAuthentication (const TQString &key)
 
void setMultipleAuthCaching (bool)
 
bool multipleAuthCaching () const
 
bool requestNetwork (const TQString &host=TQString::null)
 
void dropNetwork (const TQString &host=TQString::null)
 
DCOPClient * dcopClient ()
 
int waitForAnswer (int expected1, int expected2, TQByteArray &data, int *pCmd=0)
 
void sendMetaData ()
 
bool wasKilled () const
 
void setKillFlag ()
 

Protected Member Functions

virtual bool rewriteURL (const KURL &url, KURL &newURL)=0
 
virtual void prepareUDSEntry (TDEIO::UDSEntry &entry, bool listing=false) const
 
KURL processedURL () const
 
KURL requestedURL () const
 
- Protected Member Functions inherited from TDEIO::SlaveBase
virtual void virtual_hook (int id, void *data)
 

Additional Inherited Members

- Public Types inherited from TDEIO::SlaveBase
enum  MessageBoxType {
  QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4,
  Information = 5, SSLMessageBox = 6
}
 
- Static Public Member Functions inherited from TDEIO::SlaveBase
static void sigsegv_handler (int)
 
static void sigpipe_handler (int)
 
- Public Attributes inherited from TDEIO::SlaveBase
TQCString mProtocol
 
Connection * m_pConnection
 
MetaData mOutgoingMetaData
 
MetaData mIncomingMetaData
 
- Protected Attributes inherited from TDEIO::SlaveBase
UDSEntryList pendingListEntries
 
uint listEntryCurrentSize
 
long listEntry_sec
 
long listEntry_usec
 
Connection * appconn
 
TQString mPoolSocket
 
TQString mAppSocket
 
bool mConnectedToApp
 
- Static Protected Attributes inherited from TDEIO::SlaveBase
static long s_seqNr
 

Detailed Description

This class should be used as a base for ioslaves acting as a forwarder to other ioslaves.

It has been designed to support only local filesystem like ioslaves.

If the resulting ioslave should be a simple proxy, you only need to implement the ForwardingSlaveBase::rewriteURL() method.

For more advanced behavior, the classic ioslave methods should be reimplemented, because their default behavior in this class is to forward using the ForwardingSlaveBase::rewriteURL() method.

A possible code snippet for an advanced stat() behavior would look like this in the child class:

void ChildProtocol::stat(const KURL &url)
{
bool is_special = false;
// Process the URL to see if it should have
// a special treatment
if ( is_special )
{
// Handle the URL ourselves
TDEIO::UDSEntry entry;
// Fill entry with UDSAtom instances
statEntry(entry);
finished();
}
else
{
// Setup the ioslave internal state if
// required by ChildProtocol::rewriteURL()
ForwardingSlaveBase::stat(url);
}
}

Of course in this case, you surely need to reimplement listDir() and get() accordingly.

If you want view on directories to be correctly refreshed when something changes on a forwarded URL, you'll need a companion kded module to emit the KDirNotify Files*() DCOP signals.

This class was initially used for media:/ ioslave. This ioslave code and the MediaDirNotify class of its companion kded module can be a good source of inspiration.

See also
ForwardingSlaveBase::rewriteURL()
Since
3.4
Author
Kevin Ottens ervin.nosp@m.@ips.nosp@m.quad..nosp@m.net

Definition at line 88 of file forwardingslavebase.h.

Member Function Documentation

void TDEIO::ForwardingSlaveBase::chmod ( const KURL &  url,
int  permissions 
)
virtual

Change permissions on path The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD.

Reimplemented from TDEIO::SlaveBase.

Definition at line 233 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::copy ( const KURL &  src,
const KURL &  dest,
int  permissions,
bool  overwrite 
)
virtual

Copy src into dest.

If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for get + put instead.

Parameters
srcwhere to copy the file from (decoded)
destwhere to copy the file to (decoded)
permissionsmay be -1. In this case no special permission mode is set.
overwriteif true, any existing file will be overwritten

Reimplemented from TDEIO::SlaveBase.

Definition at line 247 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::del ( const KURL &  url,
bool  isfile 
)
virtual

Delete a file or directory.

Parameters
urlfile/directory to delete
isfileif true, a file should be deleted. if false, a directory should be deleted.

Reimplemented from TDEIO::SlaveBase.

Definition at line 263 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::get ( const KURL &  url)
virtual

get, aka read.

Parameters
urlthe full url for this request. Host, port and user of the URL can be assumed to be the same as in the last setHost() call. The slave emits the data through data

Reimplemented from TDEIO::SlaveBase.

Definition at line 117 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::listDir ( const KURL &  url)
virtual

Lists the contents of url.

The slave should emit ERR_CANNOT_ENTER_DIRECTORY if it doesn't exist, if we don't have enough permissions, or if it is a file It should also emit totalFiles as soon as it knows how many files it will list.

Reimplemented from TDEIO::SlaveBase.

Definition at line 175 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::localURL ( const KURL &  remoteURL)
virtual

For use with for ForwardingSlaveBase Returns the local URL of the given remote URL if possible.

Since
R14.0.0

Reimplemented from TDEIO::SlaveBase.

Definition at line 285 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::mimetype ( const KURL &  url)
virtual

Finds mimetype for one file or directory.

This method should either emit 'mimeType' or it should send a block of data big enough to be able to determine the mimetype.

If the slave doesn't reimplement it, a get will be issued, i.e. the whole file will be downloaded before determining the mimetype on it - this is obviously not a good thing in most cases.

Reimplemented from TDEIO::SlaveBase.

Definition at line 161 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::mkdir ( const KURL &  url,
int  permissions 
)
virtual

Create a directory.

Parameters
urlpath to the directory to create
permissionsthe permissions to set after creating the directory (-1 if no permissions to be set) The slave emits ERR_COULD_NOT_MKDIR if failure.

Reimplemented from TDEIO::SlaveBase.

Definition at line 189 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::prepareUDSEntry ( TDEIO::UDSEntry &  entry,
bool  listing = false 
) const
protectedvirtual

Allow to modify a UDSEntry before it's sent to the ioslave enpoint.

This is the default implementation working in most case, but sometimes you could make use of more forwarding black magic (for example dynamically transform any desktop file into a fake directory...)

Parameters
entrythe UDSEntry to post-process
listingindicate if this entry it created during a listDir operation

Definition at line 66 of file forwardingslavebase.cpp.

KURL TDEIO::ForwardingSlaveBase::processedURL ( ) const
inlineprotected

Return the URL being processed by the ioslave Only access it inside prepareUDSEntry()

Definition at line 156 of file forwardingslavebase.h.

void TDEIO::ForwardingSlaveBase::put ( const KURL &  url,
int  permissions,
bool  overwrite,
bool  resume 
)
virtual

put, i.e.

write data into a file.

Parameters
urlwhere to write the file
permissionsmay be -1. In this case no special permission mode is set.
overwriteif true, any existing file will be overwritten. If the file indeed already exists, the slave should NOT apply the permissions change to it.
resumecurrently unused, please ignore. The support for resuming using .part files is done by calling canResume().

IMPORTANT: Use the "modified" metadata in order to set the modification time of the file.

See also
canResume()

Reimplemented from TDEIO::SlaveBase.

Definition at line 131 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::rename ( const KURL &  src,
const KURL &  dest,
bool  overwrite 
)
virtual

Rename oldname into newname.

If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for copy + del instead.

Parameters
srcwhere to move the file from
destwhere to move the file to
overwriteif true, any existing file will be overwritten

Reimplemented from TDEIO::SlaveBase.

Definition at line 203 of file forwardingslavebase.cpp.

KURL TDEIO::ForwardingSlaveBase::requestedURL ( ) const
inlineprotected

Return the URL asked to the ioslave Only access it inside prepareUDSEntry()

Definition at line 162 of file forwardingslavebase.h.

virtual bool TDEIO::ForwardingSlaveBase::rewriteURL ( const KURL &  url,
KURL &  newURL 
)
protectedpure virtual

Rewrite an url to it's forwarded counterpart.

It should return true if everything was ok, and false otherwise.

If a problem is detected it's up to this method to trigger error() before returning. Returning false silently cancel the current slave operation.

Parameters
urlThe URL as given during the slave call
newURLThe new URL to forward the slave call to
Returns
true if the given url could be correctly rewritten
void TDEIO::ForwardingSlaveBase::stat ( const KURL &  url)
virtual

Finds all details for one file or directory.

The information returned is the same as what listDir returns, but only for one file or directory.

Reimplemented from TDEIO::SlaveBase.

Definition at line 147 of file forwardingslavebase.cpp.

void TDEIO::ForwardingSlaveBase::symlink ( const TQString &  target,
const KURL &  dest,
bool  overwrite 
)
virtual

Creates a symbolic link named dest, pointing to target, which may be a relative or an absolute path.

Parameters
targetThe string that will become the "target" of the link (can be relative)
destThe symlink to create.
overwritewhether to automatically overwrite if the dest exists

Reimplemented from TDEIO::SlaveBase.

Definition at line 218 of file forwardingslavebase.cpp.


The documentation for this class was generated from the following files:
  • forwardingslavebase.h
  • forwardingslavebase.cpp

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.8.8
This website is maintained by Timothy Pearson.