#include <slavebase.h>
Public Types | |
enum | MessageBoxType { QuestionYesNo = 1 , WarningYesNo = 2 , WarningContinueCancel = 3 , WarningYesNoCancel = 4 , Information = 5 , SSLMessageBox = 6 } |
Public Member Functions | |
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 | 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 | special (const TQByteArray &data) |
virtual void | multiGet (const TQByteArray &data) |
virtual void | slave_status () |
virtual void | reparseConfiguration () |
virtual void | localURL (const KURL &remoteURL) |
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 () |
Static Public Member Functions | |
static void | sigsegv_handler (int) |
static void | sigpipe_handler (int) |
Public Attributes | |
TQCString | mProtocol |
Connection * | m_pConnection |
MetaData | mOutgoingMetaData |
MetaData | mIncomingMetaData |
Protected Member Functions | |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
UDSEntryList | pendingListEntries |
uint | listEntryCurrentSize |
long | listEntry_sec |
long | listEntry_usec |
Connection * | appconn |
TQString | mPoolSocket |
TQString | mAppSocket |
bool | mConnectedToApp |
Static Protected Attributes | |
static long | s_seqNr |
Detailed Description
There are two classes that specifies the protocol between application (job) and tdeioslave.
SlaveInterface is the class to use on the application end, SlaveBase is the one to use on the slave end.
Slave implementations should simply inherit SlaveBase
A call to foo() results in a call to slotFoo() on the other end.
Definition at line 45 of file slavebase.h.
Member Function Documentation
◆ cacheAuthentication()
bool SlaveBase::cacheAuthentication | ( | const AuthInfo & | info | ) |
Explicitly store authentication information.
openPassDlg already stores password information automatically, you only need to call this function if you want to store authentication information that is different from the information returned by openPassDlg.
Definition at line 1250 of file slavebase.cpp.
◆ canResume()
bool SlaveBase::canResume | ( | TDEIO::filesize_t | offset | ) |
Call this at the beginning of put(), to give the size of the existing partial file, if there is one.
The offset
argument notifies the other job (the one that gets the data) about the offset to use. In this case, the boolean returns whether we can indeed resume or not (we can't if the protocol doing the get() doesn't support setting an offset)
Definition at line 937 of file slavebase.cpp.
◆ checkCachedAuthentication()
bool SlaveBase::checkCachedAuthentication | ( | AuthInfo & | info | ) |
Checks for cached authentication based on parameters given by info
.
Use this function to check if any cached password exists for the URL given by info
. If AuthInfo::realmValue
and/or AuthInfo::verifyPath
flag is specified, then they will also be factored in determining the presence of a cached password. Note that Auth::url
is a required parameter when attempting to check for cached authorization info. Here is a simple example:
- Parameters
-
info See AuthInfo.
- Returns
true
if cached Authorization is found, false otherwise.
Definition at line 1207 of file slavebase.cpp.
◆ chmod()
|
virtual |
Change permissions on path
The slave emits ERR_DOES_NOT_EXIST or ERR_CANNOT_CHMOD.
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 801 of file slavebase.cpp.
◆ closeConnection()
|
virtual |
Closes the connection (forced) Called when the application disconnects the slave to close any open network connections.
When the slave was operating in connection-oriented mode, it should reset itself to connectionless (default) mode.
Definition at line 777 of file slavebase.cpp.
◆ config()
TDEConfigBase * SlaveBase::config | ( | ) |
Returns a configuration object to query config/meta-data information from.
The application provides the slave with all configuration information relevant for the current protocol and host.
Definition at line 386 of file slavebase.cpp.
◆ connected()
void SlaveBase::connected | ( | ) |
Call in openConnection, if you reimplement it, when you're done.
Definition at line 442 of file slavebase.cpp.
◆ connectSlave()
void SlaveBase::connectSlave | ( | const TQString & | path | ) |
internal function to connect a slave to/ disconnect from either the slave pool or the application
Definition at line 336 of file slavebase.cpp.
◆ connectTimeout()
int SlaveBase::connectTimeout | ( | ) |
- Returns
- timeout value for connecting to remote host.
Definition at line 1265 of file slavebase.cpp.
◆ copy()
|
virtual |
Copy src
into dest
.
If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for get + put instead.
- Parameters
-
src where to copy the file from (decoded) dest where to copy the file to (decoded) permissions may be -1. In this case no special permission mode is set. overwrite if true, any existing file will be overwritten
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 795 of file slavebase.cpp.
◆ createAuthCacheKey()
TQString SlaveBase::createAuthCacheKey | ( | const KURL & | url | ) |
- Deprecated:
- as of 3.1.
Use openPassDlg instead. TODO: Remove before KDE 4.0 Creates a basic key to be used to cache the password.
- Parameters
-
url the url from which the key is supposed to be generated
Definition at line 1166 of file slavebase.cpp.
◆ data()
void SlaveBase::data | ( | const TQByteArray & | data | ) |
Sends data in the slave to the job (i.e.
in get).
To signal end of data, simply send an empty TQByteArray().
- Parameters
-
data the data read by the slave
Definition at line 409 of file slavebase.cpp.
◆ dataReq()
void SlaveBase::dataReq | ( | ) |
◆ dcopClient()
DCOPClient * SlaveBase::dcopClient | ( | ) |
◆ del()
|
virtual |
Delete a file or directory.
- Parameters
-
url file/directory to delete isfile if true, a file should be deleted. if false, a directory should be deleted.
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 797 of file slavebase.cpp.
◆ delCachedAuthentication()
void SlaveBase::delCachedAuthentication | ( | const TQString & | key | ) |
- Deprecated:
- as of 3.1.
Use openPassDlg instead. TODO: Remove before KDE 4.0
Cached authentication information is now session based and removed automatically when a given session ends, i.e. the application is closed.
Definition at line 718 of file slavebase.cpp.
◆ dropNetwork()
void SlaveBase::dropNetwork | ( | const TQString & | host = TQString::null | ) |
Used by the slave to withdraw a connection requested by requestNetwork.
This function cancels the last call to requestNetwork. If a client uses more than one internet connection, it must use dropNetwork(host) to stop each request.
If KNetMgr is not running, then this is a no-op.
- Parameters
-
host the host passed to requestNetwork
A slave should call this function every time it disconnect from a host.
Definition at line 641 of file slavebase.cpp.
◆ error()
void SlaveBase::error | ( | int | _errid, |
const TQString & | _text | ||
) |
Call to signal an error.
This also finishes the job, no need to call finished.
If the Error code is TDEIO::ERR_SLAVE_DEFINED then the _text should contain the complete translated text of of the error message. This message will be displayed in an KTextBrowser which allows rich text complete with hyper links. Email links will call the default mailer, "exec:/command arg1 arg2" will be forked and all other links will call the default browser.
- See also
- TDEIO::Error
- KTextBrowser
- Parameters
-
_errid the error code from TDEIO::Error _text the rich text error message
Definition at line 429 of file slavebase.cpp.
◆ errorPage()
void SlaveBase::errorPage | ( | ) |
Tell that we will only get an error page here.
This means: the data you'll get isn't the data you requested, but an error page (usually HTML) that describes an error.
Definition at line 554 of file slavebase.cpp.
◆ finished()
void SlaveBase::finished | ( | ) |
Call to signal successful completion of any command (besides openConnection and closeConnection)
Definition at line 449 of file slavebase.cpp.
◆ get()
|
virtual |
get, aka read.
- Parameters
-
url the 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 in TDEIO::ForwardingSlaveBase.
Definition at line 787 of file slavebase.cpp.
◆ hasMetaData() [1/2]
bool SlaveBase::hasMetaData | ( | const TQString & | key | ) |
- Deprecated:
- kept for binary compatibility Queries for the existence of a certain config/meta-data entry send by the application to the slave.
Definition at line 382 of file slavebase.cpp.
◆ hasMetaData() [2/2]
bool SlaveBase::hasMetaData | ( | const TQString & | key | ) | const |
Queries for the existence of a certain config/meta-data entry send by the application to the slave.
- Since
- 3.2
Definition at line 369 of file slavebase.cpp.
◆ infoMessage()
void SlaveBase::infoMessage | ( | const TQString & | msg | ) |
Call to signal a message, to be displayed if the application wants to, for instance in a status bar.
Usual examples are "connecting to host xyz", etc.
Definition at line 620 of file slavebase.cpp.
◆ listDir()
|
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 in TDEIO::ForwardingSlaveBase.
Definition at line 785 of file slavebase.cpp.
◆ listEntries()
void SlaveBase::listEntries | ( | const UDSEntryList & | _entry | ) |
Call this in listDir, each time you have a bunch of entries to report.
- Parameters
-
_entry The UDSEntry containing all of the object attributes.
Definition at line 697 of file slavebase.cpp.
◆ listEntry()
void SlaveBase::listEntry | ( | const UDSEntry & | _entry, |
bool | ready | ||
) |
internal function to be called by the slave.
It collects entries and emits them via listEntries when enough of them are there or a certain time frame exceeded (to make sure the app gets some items in time but not too many items one by one as this will cause a drastic performance penalty)
- Parameters
-
_entry The UDSEntry containing all of the object attributes. ready set to true after emitting all items. _entry
is not used in this case
Definition at line 655 of file slavebase.cpp.
◆ localURL()
|
virtual |
For use with for ForwardingSlaveBase Returns the local URL of the given remote URL if possible.
- Since
- R14.0.0
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 816 of file slavebase.cpp.
◆ messageBox() [1/2]
int SlaveBase::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 |
||
) |
Call this to show a message box from the slave.
- Parameters
-
text Message string. May contain newlines. type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel... caption Message box title. buttonYes The text for the first button. The default is i18n("&Yes"). buttonNo The text for the second button. The default is i18n("&No"). Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused. and for Information, none is used. dontAskAgainName A checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in tdeioslaverc.
- Returns
- a button code, as defined in KMessageBox, or 0 on communication error.
- Since
- 3.3
Definition at line 920 of file slavebase.cpp.
◆ messageBox() [2/2]
int SlaveBase::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.
- Parameters
-
type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel... text Message string. May contain newlines. caption Message box title. buttonYes The text for the first button. The default is i18n("&Yes"). buttonNo The text for the second button. The default is i18n("&No"). Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused. and for Information, none is used.
- Returns
- a button code, as defined in KMessageBox, or 0 on communication error.
Definition at line 914 of file slavebase.cpp.
◆ metaData() [1/2]
TQString SlaveBase::metaData | ( | const TQString & | key | ) |
- Deprecated:
- kept for binary compatibility Queries for config/meta-data sent by the application to the slave.
Definition at line 379 of file slavebase.cpp.
◆ metaData() [2/2]
TQString SlaveBase::metaData | ( | const TQString & | key | ) | const |
Queries for config/meta-data send by the application to the slave.
- Since
- 3.2
Definition at line 360 of file slavebase.cpp.
◆ mimetype()
|
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 in TDEIO::ForwardingSlaveBase.
Definition at line 789 of file slavebase.cpp.
◆ mimeType()
void SlaveBase::mimeType | ( | const TQString & | _type | ) |
Call this in mimetype() and in get(), when you know the mimetype.
See mimetype about other ways to implement it.
Definition at line 571 of file slavebase.cpp.
◆ mkdir()
|
virtual |
Create a directory.
- Parameters
-
url path to the directory to create permissions the permissions to set after creating the directory (-1 if no permissions to be set) The slave emits ERR_COULD_NOT_MKDIR if failure.
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 799 of file slavebase.cpp.
◆ multiGet()
|
virtual |
Used for multiple get.
Currently only used foir HTTP pielining support.
- Parameters
-
data packed data; Contains number of URLs to fetch, and for each URL the URL itself and its associated MetaData.
Definition at line 805 of file slavebase.cpp.
◆ multipleAuthCaching()
|
inline |
- Deprecated:
- as of 3.1.
Use openPassDlg instead. TODO: Remove before KDE 4.0
Definition at line 752 of file slavebase.h.
◆ needSubURLData()
void SlaveBase::needSubURLData | ( | ) |
Call to signal that data from the sub-URL is needed.
Definition at line 462 of file slavebase.cpp.
◆ openConnection()
|
virtual |
Opens the connection (forced) When this function gets called the slave is operating in connection-oriented mode.
When a connection gets lost while the slave operates in connection oriented mode, the slave should report ERR_CONNECTION_BROKEN instead of reconnecting. The user is expected to disconnect the slave in the error handler.
Definition at line 775 of file slavebase.cpp.
◆ openPassDlg() [1/2]
bool SlaveBase::openPassDlg | ( | TDEIO::AuthInfo & | info | ) |
Same as above function except it does not need error message.
BIC: Combine this function with the above for KDE4.
Definition at line 849 of file slavebase.cpp.
◆ openPassDlg() [2/2]
bool SlaveBase::openPassDlg | ( | TDEIO::AuthInfo & | info, |
const TQString & | errorMsg | ||
) |
Prompt the user for Authorization info (login & password).
Use this function to request authorization information from the end user. You can also pass an error message which explains why a previous authorization attempt failed. Here is a very simple example:
You can also preset some values like the username, caption or comment as follows:
- Note
- You should consider using checkCachedAuthentication() to see if the password is available in kpasswdserver before calling this function.
-
A call to this function can fail and return
false
, if the UIServer could not be started for whatever reason.
- See also
- checkCachedAuthentication
- Parameters
-
info See AuthInfo. errorMsg Error message to show
- Returns
true
if user clicks on "OK",false
otherwsie.
- Since
- 3.1
Definition at line 854 of file slavebase.cpp.
◆ pingCacheDaemon()
bool SlaveBase::pingCacheDaemon | ( | ) | const |
◆ processedPercent()
void SlaveBase::processedPercent | ( | float | percent | ) |
Only use this if you can't know in advance the size of the copied data.
For example, if you're doing variable bitrate compression of the source.
STUB ! Currently unimplemented. Here now for binary compatibility.
Call this during get and copy, once in a while, to give some info about the current state. Don't emit it in listDir, listEntries speaks for itself.
Definition at line 534 of file slavebase.cpp.
◆ processedSize()
void SlaveBase::processedSize | ( | TDEIO::filesize_t | _bytes | ) |
Call this during get and copy, once in a while, to give some info about the current state.
Don't emit it in listDir, listEntries speaks for itself.
Definition at line 498 of file slavebase.cpp.
◆ proxyConnectTimeout()
int SlaveBase::proxyConnectTimeout | ( | ) |
- Returns
- timeout value for connecting to proxy in secs.
Definition at line 1275 of file slavebase.cpp.
◆ put()
|
virtual |
put, i.e.
write data into a file.
- Parameters
-
url where to write the file permissions may be -1. In this case no special permission mode is set. overwrite if true, any existing file will be overwritten. If the file indeed already exists, the slave should NOT apply the permissions change to it. resume currently 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 in TDEIO::ForwardingSlaveBase.
Definition at line 781 of file slavebase.cpp.
◆ readData()
int SlaveBase::readData | ( | TQByteArray & | buffer | ) |
Read data send by the job, after a dataReq.
- Parameters
-
buffer buffer where data is stored
- Returns
- 0 on end of data, > 0 bytes read < 0 error
Definition at line 987 of file slavebase.cpp.
◆ readTimeout()
int SlaveBase::readTimeout | ( | ) |
- Returns
- timeout value for read from subsequent data from remote host in secs.
Definition at line 1297 of file slavebase.cpp.
◆ redirection()
void SlaveBase::redirection | ( | const KURL & | _url | ) |
Call this to signal a redirection The job will take care of going to that url.
Definition at line 548 of file slavebase.cpp.
◆ remoteEncoding()
KRemoteEncoding * SlaveBase::remoteEncoding | ( | ) |
Returns an object that can translate remote filenames into proper Unicode forms.
This encoding can be set by the user.
- Since
- 3.3
Definition at line 401 of file slavebase.cpp.
◆ rename()
|
virtual |
Rename oldname
into newname
.
If the slave returns an error ERR_UNSUPPORTED_ACTION, the job will ask for copy + del instead.
- Parameters
-
src where to move the file from dest where to move the file to overwrite if true, any existing file will be overwritten
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 791 of file slavebase.cpp.
◆ reparseConfiguration()
|
virtual |
Called by the scheduler to tell the slave that the configuration changed (i.e.
proxy settings) .
Definition at line 812 of file slavebase.cpp.
◆ requestNetwork()
bool SlaveBase::requestNetwork | ( | const TQString & | host = TQString::null | ) |
Used by the slave to check if it can connect to a given host.
This should be called where the slave is ready to do a ::connect() on a socket. For each call to requestNetwork must exist a matching call to dropNetwork, or the system will stay online until KNetMgr gets closed (or the SlaveBase gets destructed)!
If KNetMgr is not running, then this is a no-op and returns true
- Parameters
-
host tells the netmgr the host the slave wants to connect to. As this could also be a proxy, we can't just take the host currenctly connected to (but that's the default value)
- Returns
- true in theorie, the host is reachable false the system is offline and the host is in a remote network.
Definition at line 626 of file slavebase.cpp.
◆ responseTimeout()
int SlaveBase::responseTimeout | ( | ) |
- Returns
- timeout value for read from first data from remote host in seconds.
Definition at line 1286 of file slavebase.cpp.
◆ sendAuthenticationKey()
void SlaveBase::sendAuthenticationKey | ( | const TQCString & | gKey, |
const TQCString & | key, | ||
bool | keep | ||
) |
- Deprecated:
- as of 3.1.
Use openPassDlg instead. TODO: Remove before KDE 4.0
Cache authentication information is now stored automatically by openPassDlg.
Definition at line 710 of file slavebase.cpp.
◆ sendMetaData()
void SlaveBase::sendMetaData | ( | ) |
Internal function to transmit meta data to the application.
Definition at line 391 of file slavebase.cpp.
◆ setHost()
|
virtual |
Set the host.
- Parameters
-
host port user pass Called directly by createSlave, this is why there is no equivalent in SlaveInterface, unlike the other methods.
This method is called whenever a change in host, port or user occurs.
Definition at line 771 of file slavebase.cpp.
◆ setKillFlag()
void SlaveBase::setKillFlag | ( | ) |
Internally used.
Definition at line 1312 of file slavebase.cpp.
◆ setMetaData()
void SlaveBase::setMetaData | ( | const TQString & | key, |
const TQString & | value | ||
) |
Sets meta-data to be send to the application before the first data() or finished() signal.
Definition at line 355 of file slavebase.cpp.
◆ setMultipleAuthCaching()
|
inline |
- Deprecated:
- as of 3.1.
Use openPassDlg instead. TODO: Remove before KDE 4.0
Definition at line 746 of file slavebase.h.
◆ setSubURL()
|
virtual |
Prepare slave for streaming operation.
Definition at line 803 of file slavebase.cpp.
◆ setTimeoutSpecialCommand()
void SlaveBase::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 it was called by the application.
A timeout can only occur when the slave is waiting for a command from the application.
Specifying a negative timeout cancels a pending timeout.
Only one timeout at a time is supported, setting a timeout cancels any pending timeout.
- Since
- 3.1
Definition at line 994 of file slavebase.cpp.
◆ slave_status()
|
virtual |
Called to get the status of the slave.
Slave should respond by calling slaveStatus(...)
Definition at line 809 of file slavebase.cpp.
◆ slaveStatus()
void SlaveBase::slaveStatus | ( | const TQString & | host, |
bool | connected | ||
) |
Used to report the status of the slave.
- Parameters
-
host the slave is currently connected to. (Should be empty if not connected) connected Whether an actual network connection exists.
Definition at line 467 of file slavebase.cpp.
◆ special()
|
virtual |
Used for any command that is specific to this slave (protocol) Examples are : HTTP POST, mount and unmount (tdeio_file)
- Parameters
-
data packed data; the meaning is completely dependent on the slave, but usually starts with an int for the command number. Document your slave's commands, at least in its header file.
Definition at line 783 of file slavebase.cpp.
◆ speed()
void SlaveBase::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 of the size you passed to processedSize (in most cases you don't want to call it)
Definition at line 540 of file slavebase.cpp.
◆ stat()
|
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 in TDEIO::ForwardingSlaveBase.
Definition at line 779 of file slavebase.cpp.
◆ statEntry()
void SlaveBase::statEntry | ( | const UDSEntry & | _entry | ) |
Call this from stat() to express details about an object, the UDSEntry customarily contains the atoms describing file name, size, mimetype, etc.
- Parameters
-
_entry The UDSEntry containing all of the object attributes.
Definition at line 647 of file slavebase.cpp.
◆ symlink()
|
virtual |
Creates a symbolic link named dest
, pointing to target
, which may be a relative or an absolute path.
- Parameters
-
target The string that will become the "target" of the link (can be relative) dest The symlink to create. overwrite whether to automatically overwrite if the dest exists
Reimplemented in TDEIO::ForwardingSlaveBase.
Definition at line 793 of file slavebase.cpp.
◆ totalSize()
void SlaveBase::totalSize | ( | TDEIO::filesize_t | _bytes | ) |
Call this in get and copy, to give the total size of the file Call in listDir too, when you know the total number of items.
Definition at line 482 of file slavebase.cpp.
◆ waitForAnswer()
int SlaveBase::waitForAnswer | ( | int | expected1, |
int | expected2, | ||
TQByteArray & | data, | ||
int * | pCmd = 0 |
||
) |
Wait for an answer to our request, until we get expected1
or expected2
.
- Returns
- the result from readData, as well as the cmd in *pCmd if set, and the data in
data
Definition at line 959 of file slavebase.cpp.
◆ warning()
void SlaveBase::warning | ( | const TQString & | msg | ) |
Call to signal a warning, to be displayed in a dialog box.
Definition at line 614 of file slavebase.cpp.
◆ wasKilled()
bool SlaveBase::wasKilled | ( | ) | const |
If your ioslave was killed by a signal, wasKilled() returns true.
Check it regularly in lengthy functions (e.g. in get();) and return as fast as possible from this function if wasKilled() returns true. This will ensure that your slave destructor will be called correctly.
- Since
- 3.1
Definition at line 1307 of file slavebase.cpp.
Member Data Documentation
◆ mProtocol
TQCString TDEIO::SlaveBase::mProtocol |
Name of the protocol supported by this slave.
Definition at line 809 of file slavebase.h.
The documentation for this class was generated from the following files: