KIO::TCPSlaveBase

#include <KIO/TCPSlaveBase>

Inheritance diagram for KIO::TCPSlaveBase:

Public Types

typedef QFlags< SslResultDetail > SslResult
 
- Public Types inherited from KIO::SlaveBase
enum  ButtonCode {
  Ok = 1, Cancel = 2, Yes = 3, No = 4,
  Continue = 5
}
 
enum  MessageBoxType {
  QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4,
  Information = 5, SSLMessageBox = 6, WarningContinueCancelDetailed = 10
}
 

Public Member Functions

 TCPSlaveBase (const QByteArray &protocol, const QByteArray &poolSocket, const QByteArray &appSocket, bool autoSsl=false)
 
- Public Member Functions inherited from KIO::SlaveBase
 SlaveBase (const QByteArray &protocol, const QByteArray &pool_socket, const QByteArray &app_socket)
 
void addTemporaryAuthorization (const QString &action)
 
MetaData allMetaData () const
 
bool cacheAuthentication (const AuthInfo &info)
 
bool canResume (KIO::filesize_t offset)
 
void canResume ()
 
bool checkCachedAuthentication (AuthInfo &info)
 
virtual void chmod (const QUrl &url, int permissions)
 
virtual void chown (const QUrl &url, const QString &owner, const QString &group)
 
virtual void close ()
 
virtual void closeConnection ()
 
KConfigGroupconfig ()
 
bool configValue (const QString &key, bool defaultValue) const
 
int configValue (const QString &key, int defaultValue) const
 
QString configValue (const QString &key, const QString &defaultValue=QString()) const
 
void connected ()
 
void connectSlave (const QString &path)
 
int connectTimeout ()
 
virtual void copy (const QUrl &src, const QUrl &dest, int permissions, JobFlags flags)
 
void data (const QByteArray &data)
 
void dataReq ()
 
virtual void del (const QUrl &url, bool isfile)
 
void disconnectSlave ()
 
virtual void dispatch (int command, const QByteArray &data)
 
void dispatchLoop ()
 
virtual void dispatchOpenCommand (int command, const QByteArray &data)
 
void dropNetwork (const QString &host=QString())
 
void error (int _errid, const QString &_text)
 
void errorPage ()
 
Q_NORETURN void exit ()
 
void finished ()
 
virtual void get (const QUrl &url)
 
bool hasMetaData (const QString &key) const
 
void infoMessage (const QString &msg)
 
virtual void listDir (const QUrl &url)
 
void listEntries (const UDSEntryList &_entry)
 
void listEntry (const UDSEntry &_entry, bool ready)
 
void listEntry (const UDSEntry &entry)
 
void lookupHost (const QString &host)
 
QMap< QString, QVariantmapConfig () const
 
int messageBox (MessageBoxType type, const QString &text, const QString &caption=QString(), const QString &buttonYes=QString(), const QString &buttonNo=QString())
 
int messageBox (const QString &text, MessageBoxType type, const QString &caption=QString(), const QString &buttonYes=QString(), const QString &buttonNo=QString(), const QString &dontAskAgainName=QString())
 
QString metaData (const QString &key) const
 
void mimeType (const QString &_type)
 
virtual void mimetype (const QUrl &url)
 
virtual void mkdir (const QUrl &url, int permissions)
 
virtual void multiGet (const QByteArray &data)
 
void needSubUrlData ()
 
virtual void open (const QUrl &url, QIODevice::OpenMode mode)
 
virtual void openConnection ()
 
void opened ()
 
bool openPasswordDialog (KIO::AuthInfo &info, const QString &errorMsg=QString())
 
int openPasswordDialogV2 (KIO::AuthInfo &info, const QString &errorMsg=QString())
 
void position (KIO::filesize_t _pos)
 
void processedPercent (float percent)
 
void processedSize (KIO::filesize_t _bytes)
 
int proxyConnectTimeout ()
 
virtual void put (const QUrl &url, int permissions, JobFlags flags)
 
virtual void read (KIO::filesize_t size)
 
int readData (QByteArray &buffer)
 
int readTimeout ()
 
void redirection (const QUrl &_url)
 
KRemoteEncodingremoteEncoding ()
 
virtual void rename (const QUrl &src, const QUrl &dest, JobFlags flags)
 
virtual void reparseConfiguration ()
 
bool requestNetwork (const QString &host=QString())
 
PrivilegeOperationStatus requestPrivilegeOperation (const QString &operationDetails)
 
PrivilegeOperationStatus requestPrivilegeOperation ()
 
int responseTimeout ()
 
virtual void seek (KIO::filesize_t offset)
 
void sendAndKeepMetaData ()
 
void sendMetaData ()
 
virtual void setHost (const QString &host, quint16 port, const QString &user, const QString &pass)
 
void setKillFlag ()
 
virtual void setLinkDest (const QUrl &url, const QString &target)
 
void setMetaData (const QString &key, const QString &value)
 
virtual void setModificationTime (const QUrl &url, const QDateTime &mtime)
 
virtual void setSubUrl (const QUrl &url)
 
void setTimeoutSpecialCommand (int timeout, const QByteArray &data=QByteArray())
 
virtual void slave_status ()
 
void slaveStatus (const QString &host, bool connected)
 
virtual void special (const QByteArray &data)
 
void speed (unsigned long _bytes_per_second)
 
virtual void stat (const QUrl &url)
 
void statEntry (const UDSEntry &_entry)
 
virtual void symlink (const QString &target, const QUrl &dest, JobFlags flags)
 
void totalSize (KIO::filesize_t _bytes)
 
void truncated (KIO::filesize_t _length)
 
int waitForAnswer (int expected1, int expected2, QByteArray &data, int *pCmd=nullptr)
 
int waitForHostInfo (QHostInfo &info)
 
void warning (const QString &msg)
 
bool wasKilled () const
 
virtual void write (const QByteArray &data)
 
void written (KIO::filesize_t _bytes)
 

Protected Types

enum  SslResultDetail { ResultOk = 1, ResultOverridden = 2, ResultFailed = 4, ResultFailedEarly = 8 }
 
- Protected Types inherited from KIO::SlaveBase
enum  VirtualFunctionId { AppConnectionMade = 0, GetFileSystemFreeSpace = 1, Truncate = 2 }
 

Protected Member Functions

bool atEnd () const
 
bool connectToHost (const QString &protocol, const QString &host, quint16 port)
 
int connectToHost (const QString &host, quint16 port, QString *errorString=nullptr)
 
void disconnectFromHost ()
 
bool isAutoSsl () const
 
bool isConnected () const
 
bool isUsingSsl () const
 
quint16 port () const
 
ssize_t read (char *data, ssize_t len)
 
ssize_t readLine (char *data, ssize_t len)
 
void setBlocking (bool b)
 
QIODevicesocket () const
 
bool startSsl ()
 
void virtual_hook (int id, void *data) override
 
bool waitForResponse (int t)
 
ssize_t write (const char *data, ssize_t len)
 

Additional Inherited Members

- Protected Attributes inherited from KIO::SlaveBase
MetaData mIncomingMetaData
 
MetaData mOutgoingMetaData
 
QByteArray mProtocol
 

Detailed Description

There are two classes that specifies the protocol between application (job) and kioslave.

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 50 of file tcpslavebase.h.

Constructor & Destructor Documentation

TCPSlaveBase::TCPSlaveBase ( const QByteArray protocol,
const QByteArray poolSocket,
const QByteArray appSocket,
bool  autoSsl = false 
)

Constructor.

Parameters
autoSslif true, will automatically invoke startSsl() right after connecting. In the absence of errors the use of SSL will therefore be transparent to higher layers.

Definition at line 176 of file tcpslavebase.cpp.

Member Function Documentation

bool TCPSlaveBase::atEnd ( ) const
protected

Returns true when end of data is reached.

Definition at line 418 of file tcpslavebase.cpp.

bool TCPSlaveBase::connectToHost ( const QString protocol,
const QString host,
quint16  port 
)
protected

Performs the initial TCP connection stuff and/or SSL handshaking as necessary.

Parameters
protocolthe protocol being used
hosthostname
portport number
Returns
on success, true is returned. on failure, false is returned and an appropriate error message is sent to the application.

Definition at line 280 of file tcpslavebase.cpp.

int TCPSlaveBase::connectToHost ( const QString host,
quint16  port,
QString errorString = nullptr 
)
protected

Connects to the specified host and port.

Parameters
hosthost name
portport number
errorStringif not nullptr, this string will contain error information on why the connection request failed.
Returns
on success, 0 is returned. on failure, a KIO::Error code is returned. errorString, if not nullptr, will contain the appropriate error message that can be sent back to the client.
Since
4.7.2

Definition at line 294 of file tcpslavebase.cpp.

void TCPSlaveBase::disconnectFromHost ( )
protected

Close the connection and forget non-permanent data like the peer host.

Definition at line 379 of file tcpslavebase.cpp.

bool TCPSlaveBase::isAutoSsl ( ) const
protected

Will start SSL after connecting?

Returns
if so, true is returned. if not, false is returned.

Definition at line 403 of file tcpslavebase.cpp.

bool TCPSlaveBase::isConnected ( ) const
protected

Determines whether or not we are still connected to the remote machine.

return true if the socket is still active or false otherwise.

Definition at line 906 of file tcpslavebase.cpp.

bool TCPSlaveBase::isUsingSsl ( ) const
protected

Is the current connection using SSL?

Returns
if so, true is returned. if not, false is returned.

Definition at line 408 of file tcpslavebase.cpp.

quint16 TCPSlaveBase::port ( ) const
protected

the current port for this service

Definition at line 413 of file tcpslavebase.cpp.

ssize_t TCPSlaveBase::readLine ( char *  data,
ssize_t  len 
)
protected

Same as read() except it reads data one line at a time.

Definition at line 256 of file tcpslavebase.cpp.

void TCPSlaveBase::setBlocking ( bool  b)
protected

Sets the mode of the connection to blocking or non-blocking.

Be sure to call this function before calling connectToHost. Otherwise, this setting will not have any effect until the next connectToHost.

Parameters
btrue to make the connection a blocking one, false otherwise.

Definition at line 920 of file tcpslavebase.cpp.

QIODevice * TCPSlaveBase::socket ( ) const
protected

Return the socket object, if the class ever needs to do anything to it.

Definition at line 171 of file tcpslavebase.cpp.

bool TCPSlaveBase::startSsl ( )
protected

Start using SSL on the connection.

You can use it right after connecting for classic, transparent to the protocol SSL. Calling it later can be used to implement e.g. SMTP's STARTTLS feature.

Returns
on success, true is returned. on failure, false is returned.

Definition at line 423 of file tcpslavebase.cpp.

bool TCPSlaveBase::waitForResponse ( int  t)
protected

Wait for incoming data on the socket for the period specified by t.

Parameters
tlength of time in seconds that we should monitor the socket before timing out.
Returns
true if any data arrived on the socket before the timeout value was reached, false otherwise.

Definition at line 912 of file tcpslavebase.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 3 2020 23:00:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.