KIO::TCPWorkerBase

Search for usage in LXR

#include <KIO/TCPWorkerBase>

Inheritance diagram for KIO::TCPWorkerBase:

Public Types

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

Public Member Functions

 TCPWorkerBase (const QByteArray &protocol, const QByteArray &poolSocket, const QByteArray &appSocket, bool autoSsl=false)
 
- Public Member Functions inherited from KIO::WorkerBase
 WorkerBase (const QByteArray &protocol, const QByteArray &poolSocket, const QByteArray &appSocket)
 
void addTemporaryAuthorization (const QString &action)
 
MetaData allMetaData () const
 
bool cacheAuthentication (const AuthInfo &info)
 
void canResume ()
 
bool canResume (KIO::filesize_t offset)
 
bool checkCachedAuthentication (AuthInfo &info)
 
virtual WorkerResult chmod (const QUrl &url, int permissions)
 
virtual WorkerResult chown (const QUrl &url, const QString &owner, const QString &group)
 
virtual WorkerResult close ()
 
virtual void closeConnection ()
 
KConfigGroupconfig ()
 
bool configValue (const QString &key, bool defaultValue) const
 
QString configValue (const QString &key, const QString &defaultValue=QString()) const
 
int configValue (const QString &key, int defaultValue) const
 
int connectTimeout ()
 
void connectWorker (const QString &path)
 
virtual WorkerResult copy (const QUrl &src, const QUrl &dest, int permissions, JobFlags flags)
 
void data (const QByteArray &data)
 
void dataReq ()
 
virtual WorkerResult del (const QUrl &url, bool isfile)
 
void disconnectWorker ()
 
void dispatchLoop ()
 
void errorPage ()
 
void exit ()
 
virtual WorkerResult fileSystemFreeSpace (const QUrl &url)
 
virtual WorkerResult get (const QUrl &url)
 
bool hasMetaData (const QString &key) const
 
void infoMessage (const QString &msg)
 
virtual WorkerResult listDir (const QUrl &url)
 
void listEntries (const UDSEntryList &_entry)
 
void listEntry (const UDSEntry &entry)
 
void lookupHost (const QString &host)
 
QMap< QString, QVariantmapConfig () const
 
int messageBox (const QString &text, MessageBoxType type, const QString &title=QString(), const QString &primaryActionText=QString(), const QString &secondaryActionText=QString(), const QString &dontAskAgainName=QString())
 
int messageBox (MessageBoxType type, const QString &text, const QString &title=QString(), const QString &primaryActionText=QString(), const QString &secondaryActionText=QString())
 
QString metaData (const QString &key) const
 
void mimeType (const QString &_type)
 
virtual WorkerResult mimetype (const QUrl &url)
 
virtual WorkerResult mkdir (const QUrl &url, int permissions)
 
virtual WorkerResult multiGet (const QByteArray &data)
 
void needSubUrlData ()
 
virtual WorkerResult open (const QUrl &url, QIODevice::OpenMode mode)
 
virtual WorkerResult openConnection ()
 
int openPasswordDialog (KIO::AuthInfo &info, const QString &errorMsg=QString())
 
void position (KIO::filesize_t _pos)
 
void processedSize (KIO::filesize_t _bytes)
 
int proxyConnectTimeout ()
 
virtual WorkerResult put (const QUrl &url, int permissions, JobFlags flags)
 
virtual WorkerResult read (KIO::filesize_t size)
 
int readData (QByteArray &buffer)
 
int readTimeout ()
 
void redirection (const QUrl &_url)
 
KRemoteEncodingremoteEncoding ()
 
virtual WorkerResult rename (const QUrl &src, const QUrl &dest, JobFlags flags)
 
virtual void reparseConfiguration ()
 
PrivilegeOperationStatus requestPrivilegeOperation (const QString &operationDetails)
 
int responseTimeout ()
 
virtual WorkerResult seek (KIO::filesize_t offset)
 
void sendAndKeepMetaData ()
 
void sendMetaData ()
 
virtual void setHost (const QString &host, quint16 port, const QString &user, const QString &pass)
 
void setIncomingMetaData (const KIO::MetaData &metaData)
 
void setMetaData (const QString &key, const QString &value)
 
virtual WorkerResult setModificationTime (const QUrl &url, const QDateTime &mtime)
 
void setTimeoutSpecialCommand (int timeout, const QByteArray &data=QByteArray())
 
virtual WorkerResult special (const QByteArray &data)
 
void speed (unsigned long _bytes_per_second)
 
virtual WorkerResult stat (const QUrl &url)
 
void statEntry (const UDSEntry &_entry)
 
virtual WorkerResult symlink (const QString &target, const QUrl &dest, JobFlags flags)
 
void totalSize (KIO::filesize_t _bytes)
 
virtual WorkerResult truncate (KIO::filesize_t size)
 
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 worker_status ()
 
void workerStatus (const QString &host, bool connected)
 
virtual WorkerResult write (const QByteArray &data)
 
void written (KIO::filesize_t _bytes)
 

Protected Types

enum  SslResultDetail { ResultOk = 1, ResultOverridden = 2, ResultFailed = 4, ResultFailedEarly = 8 }
 

Protected Member Functions

void appConnectionMade () override
 
bool atEnd () const
 
int connectToHost (const QString &host, quint16 port, QString *errorString=nullptr)
 
KIO::WorkerResult connectToHost (const QString &protocol, const QString &host, quint16 port)
 
void disconnectFromHost ()
 
bool isAutoSsl () const
 
bool isConnected () const
 
bool isUsingSsl () const
 
quint16 port () const
 
ssize_t read (char *data, ssize_t len)
 
virtual WorkerResult read (KIO::filesize_t size)
 
ssize_t readLine (char *data, ssize_t len)
 
void setBlocking (bool b)
 
bool startSsl ()
 
QAbstractSockettcpSocket () const
 
bool waitForResponse (int t)
 
ssize_t write (const char *data, ssize_t len)
 
virtual WorkerResult write (const QByteArray &data)
 

Detailed Description

A WorkerBase with convenience methods for TCP-connected storages.

Since
5.99

Definition at line 35 of file tcpworkerbase.h.

Constructor & Destructor Documentation

◆ TCPWorkerBase()

TCPWorkerBase::TCPWorkerBase ( 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 162 of file tcpworkerbase.cpp.

Member Function Documentation

◆ appConnectionMade()

void TCPWorkerBase::appConnectionMade ( )
overrideprotectedvirtual

Application connected to the worker.

Called when an application has connected to the worker. Mostly only useful when you want to e.g. send metadata to the application once it connects.

Reimplemented from KIO::WorkerBase.

Definition at line 597 of file tcpworkerbase.cpp.

◆ atEnd()

bool TCPWorkerBase::atEnd ( ) const
protected

Returns true when end of data is reached.

Definition at line 385 of file tcpworkerbase.cpp.

◆ connectToHost() [1/2]

int TCPWorkerBase::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.

Definition at line 261 of file tcpworkerbase.cpp.

◆ connectToHost() [2/2]

KIO::WorkerResult TCPWorkerBase::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 250 of file tcpworkerbase.cpp.

◆ disconnectFromHost()

void TCPWorkerBase::disconnectFromHost ( )
protected

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

Definition at line 346 of file tcpworkerbase.cpp.

◆ isAutoSsl()

bool TCPWorkerBase::isAutoSsl ( ) const
protected

Will start SSL after connecting?

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

Definition at line 370 of file tcpworkerbase.cpp.

◆ isConnected()

bool TCPWorkerBase::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 574 of file tcpworkerbase.cpp.

◆ isUsingSsl()

bool TCPWorkerBase::isUsingSsl ( ) const
protected

Is the current connection using SSL?

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

Definition at line 375 of file tcpworkerbase.cpp.

◆ port()

quint16 TCPWorkerBase::port ( ) const
protected

the current port for this service

Definition at line 380 of file tcpworkerbase.cpp.

◆ read()

WorkerResult KIO::WorkerBase::read
protected

Read incoming data from the remote host.

Parameters
datastorage for the data read from server
lenlength of the data (in bytes) to read from the server
Returns
the actual size of data that was obtained

Definition at line 247 of file workerbase.cpp.

◆ readLine()

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

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

Definition at line 226 of file tcpworkerbase.cpp.

◆ setBlocking()

void TCPWorkerBase::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 588 of file tcpworkerbase.cpp.

◆ startSsl()

bool TCPWorkerBase::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 390 of file tcpworkerbase.cpp.

◆ tcpSocket()

QAbstractSocket * TCPWorkerBase::tcpSocket ( ) const
protected

Returns the socket object, useful if sub-classes need to do anything with it (e.g.

connect to any of the signals emitted by QAbstractSocket).

Definition at line 157 of file tcpworkerbase.cpp.

◆ waitForResponse()

bool TCPWorkerBase::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 580 of file tcpworkerbase.cpp.

◆ write()

WorkerResult KIO::WorkerBase::write
protected

Send data to the remote host.

Parameters
datadata to be sent to remote machine
lenthe length (in bytes) of the data to be sent
Returns
the actual size of the data that was sent

Definition at line 252 of file workerbase.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.