Search for usage in LXR

#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, 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

 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)
void canResume ()
bool canResume (KIO::filesize_t offset)
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
QString configValue (const QString &key, const QString &defaultValue=QString()) const
int configValue (const QString &key, int defaultValue) 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 ()
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 (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 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 ()
PrivilegeOperationStatus requestPrivilegeOperation (const QString &operationDetails)
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
int connectToHost (const QString &host, quint16 port, QString *errorString=nullptr)
bool 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 void read (KIO::filesize_t size)
ssize_t readLine (char *data, ssize_t len)
void setBlocking (bool b)
QIODevicesocket () const
bool startSsl ()
QAbstractSockettcpSocket () const
void virtual_hook (int id, void *data) override
bool waitForResponse (int t)
ssize_t write (const char *data, ssize_t len)
virtual void write (const QByteArray &data)

Additional Inherited Members

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

Detailed Description

A SlaveBase with convenience methods for TCP-connected storages.

Since 5.99, use TCPWorkerBase.

Definition at line 37 of file tcpslavebase.h.

Constructor & Destructor Documentation

◆ TCPSlaveBase()

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


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 170 of file tcpslavebase.cpp.

Member Function Documentation

◆ atEnd()

bool TCPSlaveBase::atEnd ( ) const

Returns true when end of data is reached.

Definition at line 394 of file tcpslavebase.cpp.

◆ connectToHost() [1/2]

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

Connects to the specified host and port.

hosthost name
portport number
errorStringif not nullptr, this string will contain error information on why the connection request failed.
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 270 of file tcpslavebase.cpp.

◆ connectToHost() [2/2]

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

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

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

Definition at line 258 of file tcpslavebase.cpp.

◆ disconnectFromHost()

void TCPSlaveBase::disconnectFromHost ( )

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

Definition at line 355 of file tcpslavebase.cpp.

◆ isAutoSsl()

bool TCPSlaveBase::isAutoSsl ( ) const

Will start SSL after connecting?

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

Definition at line 379 of file tcpslavebase.cpp.

◆ isConnected()

bool TCPSlaveBase::isConnected ( ) const

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 581 of file tcpslavebase.cpp.

◆ isUsingSsl()

bool TCPSlaveBase::isUsingSsl ( ) const

Is the current connection using SSL?

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

Definition at line 384 of file tcpslavebase.cpp.

◆ port()

quint16 TCPSlaveBase::port ( ) const

the current port for this service

Definition at line 389 of file tcpslavebase.cpp.

◆ read()

void SlaveBase::read

Read incoming data from the remote host.

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

Definition at line 949 of file slavebase.cpp.

◆ readLine()

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

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

Definition at line 234 of file tcpslavebase.cpp.

◆ setBlocking()

void TCPSlaveBase::setBlocking ( bool  b)

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.

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

Definition at line 595 of file tcpslavebase.cpp.

◆ socket()

QIODevice * TCPSlaveBase::socket ( ) const

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

since 5.83, use tcpSocket() instead.

Definition at line 159 of file tcpslavebase.cpp.

◆ startSsl()

bool TCPSlaveBase::startSsl ( )

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.

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

Definition at line 399 of file tcpslavebase.cpp.

◆ tcpSocket()

QAbstractSocket * TCPSlaveBase::tcpSocket ( ) const

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 165 of file tcpslavebase.cpp.

◆ waitForResponse()

bool TCPSlaveBase::waitForResponse ( int  t)

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

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

Definition at line 587 of file tcpslavebase.cpp.

◆ write()

void SlaveBase::write

Send data to the remote host.

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

Definition at line 953 of file slavebase.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.