KIO
KIO::TCPSlaveBase Class Reference
There are two classes that specifies the protocol between application (job) and kioslave. More...
#include <tcpslavebase.h>

Public Member Functions | |
TCPSlaveBase (const QByteArray &protocol, const QByteArray &poolSocket, const QByteArray &appSocket, bool autoSsl=false) | |
virtual | ~TCPSlaveBase () |
Protected Types | |
enum | SslResultDetail { ResultOk = 1, ResultOverridden = 2, ResultFailed = 4, ResultFailedEarly = 8 } |
Protected Member Functions | |
bool | atEnd () const |
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) |
ssize_t | readLine (char *data, ssize_t len) |
void | setBlocking (bool b) |
QIODevice * | socket () const |
bool | startSsl () |
virtual void | virtual_hook (int id, void *data) |
bool | waitForResponse (int t) |
ssize_t | write (const char *data, ssize_t len) |
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 46 of file tcpslavebase.h.
Member Enumeration Documentation
enum KIO::TCPSlaveBase::SslResultDetail [protected] |
Definition at line 63 of file tcpslavebase.h.
Constructor & Destructor Documentation
TCPSlaveBase::TCPSlaveBase | ( | const QByteArray & | protocol, | |
const QByteArray & | poolSocket, | |||
const QByteArray & | appSocket, | |||
bool | autoSsl = false | |||
) |
Constructor.
- Parameters:
-
autoSsl if 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 184 of file tcpslavebase.cpp.
TCPSlaveBase::~TCPSlaveBase | ( | ) | [virtual] |
Definition at line 201 of file tcpslavebase.cpp.
Member Function Documentation
bool TCPSlaveBase::atEnd | ( | ) | const [protected] |
Returns true when end of data is reached.
Definition at line 430 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:
-
protocol the protocol being used host hostname port port number
- Returns:
- on succes, true is returned. on failure, false is returned and an appropriate error message is sent to the application.
Definition at line 296 of file tcpslavebase.cpp.
void TCPSlaveBase::disconnectFromHost | ( | ) | [protected] |
Close the connection and forget non-permanent data like the peer host.
Definition at line 392 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 415 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 967 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 420 of file tcpslavebase.cpp.
quint16 TCPSlaveBase::port | ( | ) | const [protected] |
the current port for this service
Definition at line 425 of file tcpslavebase.cpp.
ssize_t TCPSlaveBase::read | ( | char * | data, | |
ssize_t | len | |||
) | [protected] |
Definition at line 239 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 264 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:
-
b true to make the connection a blocking one, false otherwise.
Definition at line 982 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 178 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 435 of file tcpslavebase.cpp.
void TCPSlaveBase::virtual_hook | ( | int | id, | |
void * | data | |||
) | [protected, virtual] |
Reimplemented from KIO::SlaveBase.
Definition at line 991 of file tcpslavebase.cpp.
bool TCPSlaveBase::waitForResponse | ( | int | t | ) | [protected] |
Wait for incoming data on the socket for the period specified by t
.
- Parameters:
-
t length 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 974 of file tcpslavebase.cpp.
ssize_t TCPSlaveBase::write | ( | const char * | data, | |
ssize_t | len | |||
) | [protected] |
Definition at line 207 of file tcpslavebase.cpp.
The documentation for this class was generated from the following files: