• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

KIO::TCPSlaveBase

KIO::TCPSlaveBase Class Reference

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

#include <tcpslavebase.h>

Inheritance diagram for KIO::TCPSlaveBase:

Inheritance graph
[legend]

List of all members.


Public Member Functions

 TCPSlaveBase (unsigned short int defaultPort, const QCString &protocol, const QCString &poolSocket, const QCString &appSocket, bool useSSL)
 TCPSlaveBase (unsigned short int defaultPort, const QCString &protocol, const QCString &poolSocket, const QCString &appSocket)
virtual ~TCPSlaveBase ()

Protected Member Functions

bool atEnd ()
KDE_DEPRECATED bool AtEOF ()
bool canUseTLS ()
void certificatePrompt ()
void cleanSSL ()
KDE_DEPRECATED void CleanSSL ()
void closeDescriptor ()
KDE_DEPRECATED void CloseDescriptor ()
int connectResult ()
bool connectToHost (const QString &host, unsigned int port, bool sendError=true)
KDE_DEPRECATED bool ConnectToHost (const QString &host, unsigned int port, bool sendError)
void doConstructorStuff ()
KDE_DEPRECATED unsigned short int GetPort (unsigned short int p)
bool initializeSSL ()
KDE_DEPRECATED bool InitializeSSL ()
bool isConnectionValid ()
bool isSSLTunnelEnabled ()
unsigned short int port (unsigned short int _port)
ssize_t read (void *data, ssize_t len)
KDE_DEPRECATED ssize_t Read (void *data, ssize_t len)
ssize_t readLine (char *data, ssize_t len)
KDE_DEPRECATED ssize_t ReadLine (char *data, ssize_t len)
void setBlockConnection (bool b)
void setBlockSize (int sz)
void setConnectTimeout (int t)
void setEnableSSLTunnel (bool enable)
void setRealHost (const QString &realHost)
void setSSLMetaData ()
int startTLS ()
void stopTLS ()
bool userAborted () const
bool usingSSL () const
bool usingTLS ()
bool usingTLS () const
int verifyCertificate ()
virtual void virtual_hook (int id, void *data)
bool waitForResponse (int t)
ssize_t write (const void *data, ssize_t len)
KDE_DEPRECATED ssize_t Write (const void *data, ssize_t len)

Protected Attributes

FILE * fp
bool m_bIsSSL
unsigned short int m_iDefaultPort
unsigned short int m_iPort
int m_iSock
QCString m_sServiceName

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


Constructor & Destructor Documentation

TCPSlaveBase::TCPSlaveBase ( unsigned short int  defaultPort,
const QCString &  protocol,
const QCString &  poolSocket,
const QCString &  appSocket 
)

Definition at line 94 of file tcpslavebase.cpp.

TCPSlaveBase::TCPSlaveBase ( unsigned short int  defaultPort,
const QCString &  protocol,
const QCString &  poolSocket,
const QCString &  appSocket,
bool  useSSL 
)

Definition at line 110 of file tcpslavebase.cpp.

TCPSlaveBase::~TCPSlaveBase (  )  [virtual]

Definition at line 143 of file tcpslavebase.cpp.


Member Function Documentation

bool TCPSlaveBase::atEnd (  )  [protected]

Returns true when end of data is reached.

Definition at line 446 of file tcpslavebase.cpp.

KDE_DEPRECATED bool KIO::TCPSlaveBase::AtEOF (  )  [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 94 of file tcpslavebase.h.

bool TCPSlaveBase::canUseTLS (  )  [protected]

Can we use TLS?

Returns:
if so, true is returned. if not, true isn't returned.

Definition at line 524 of file tcpslavebase.cpp.

void TCPSlaveBase::certificatePrompt (  )  [protected]

Definition at line 534 of file tcpslavebase.cpp.

void TCPSlaveBase::cleanSSL (  )  [protected]

Cleans up all SSL settings.

Definition at line 435 of file tcpslavebase.cpp.

KDE_DEPRECATED void KIO::TCPSlaveBase::CleanSSL (  )  [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 104 of file tcpslavebase.h.

void TCPSlaveBase::closeDescriptor (  )  [protected]

Closes the current file descriptor.

Call this function to properly close up the socket since it also takes care to prroperly close the stdio fstream stuff, as well as sets the socket back to -1

Definition at line 406 of file tcpslavebase.cpp.

KDE_DEPRECATED void KIO::TCPSlaveBase::CloseDescriptor (  )  [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 89 of file tcpslavebase.h.

int TCPSlaveBase::connectResult (  )  [protected]

Returns the status of the connection.

This function allows you to invoke ConnectToHost with the sendError flag set to false so that you can send the appropriate error message back to the calling io-slave.

Returns:
the status code as returned by KExtendedSocket.

Definition at line 1252 of file tcpslavebase.cpp.

bool TCPSlaveBase::connectToHost ( const QString &  host,
unsigned int  port,
bool  sendError = true 
) [protected]

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

Please note that unlike its deprecated counterpart, this function allows you to disable any error message from being sent back to the calling application! You can then use the connectResult() function to determine the result of the request for connection.

Parameters:
host hostname
port port number to connect to
sendError if true sends error message to calling app.
Returns:
on succes, true is returned. on failure, false is returned and an appropriate error message is send to the application.

Definition at line 302 of file tcpslavebase.cpp.

KDE_DEPRECATED bool KIO::TCPSlaveBase::ConnectToHost ( const QString &  host,
unsigned int  port,
bool  sendError 
) [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 83 of file tcpslavebase.h.

void TCPSlaveBase::doConstructorStuff (  )  [protected]

Definition at line 128 of file tcpslavebase.cpp.

KDE_DEPRECATED unsigned short int KIO::TCPSlaveBase::GetPort ( unsigned short int  p  )  [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 78 of file tcpslavebase.h.

bool TCPSlaveBase::initializeSSL (  )  [protected]

Initializs all SSL variables.

Definition at line 424 of file tcpslavebase.cpp.

KDE_DEPRECATED bool KIO::TCPSlaveBase::InitializeSSL (  )  [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 99 of file tcpslavebase.h.

bool TCPSlaveBase::isConnectionValid (  )  [protected]

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

This method may fail to detect a closed SSL connection.

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

Definition at line 1150 of file tcpslavebase.cpp.

bool TCPSlaveBase::isSSLTunnelEnabled (  )  [protected]

Returns true if SSL tunneling is enabled.

See also:
setEnableSSlTunnel

Definition at line 1267 of file tcpslavebase.cpp.

unsigned short int TCPSlaveBase::port ( unsigned short int  _port  )  [protected]

Determines the appropriate port to use.

This functions attempts to discover the appropriate port.

Parameters:
_port the port to try, if it works, it is returned
Returns:
the default port if the given port doesn't work

Definition at line 284 of file tcpslavebase.cpp.

ssize_t TCPSlaveBase::read ( void *  data,
ssize_t  len 
) [protected]

This function acts like standard read function call except it is also capable of deciphering SSL data as well as handling data over SOCKSified connections.

Parameters:
data storage for the info read from server
len lenght of the info to read from the server
Returns:
the actual size of data that was obtained

Definition at line 167 of file tcpslavebase.cpp.

KDE_DEPRECATED ssize_t KIO::TCPSlaveBase::Read ( void *  data,
ssize_t  len 
) [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 68 of file tcpslavebase.h.

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

Same as above except it reads data one line at a time.

Definition at line 192 of file tcpslavebase.cpp.

KDE_DEPRECATED ssize_t KIO::TCPSlaveBase::ReadLine ( char *  data,
ssize_t  len 
) [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 73 of file tcpslavebase.h.

void TCPSlaveBase::setBlockConnection ( 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 1257 of file tcpslavebase.cpp.

void TCPSlaveBase::setBlockSize ( int  sz  )  [protected]

Sets the maximum size of blocks read in during calls to readLine().

This allows a slave to optimize for the protocol which it implements. Ideally this should be (common_line_length+1) or so. Making this too large will have adverse effects on performance. Initial/default value is 256(bytes)

Definition at line 183 of file tcpslavebase.cpp.

void TCPSlaveBase::setConnectTimeout ( int  t  )  [protected]

Sets how long to wait for orignally connecting to the requested before timinig out.

Be sure to call this function before calling ConnectToHost, otherwise the setting will not take effect until the next call to ConnectToHost.

Parameters:
t timeout value

Definition at line 1262 of file tcpslavebase.cpp.

void TCPSlaveBase::setEnableSSLTunnel ( bool  enable  )  [protected]

Set up SSL tunneling mode.

Calling this function with a true argument will allow you to temprarly ignore the m_bIsSSL flag setting and make a non-SSL connection. It is mostly useful for making connections to SSL sites through a non-transparent proxy server (i.e. most proxy servers out there).

Note that once you have successfully "tunneled" through the proxy server you must call this function with its argument set to false to properly connect to the SSL site.

Parameters:
enable if true SSL Tunneling will be enabled

Definition at line 1272 of file tcpslavebase.cpp.

void TCPSlaveBase::setRealHost ( const QString &  realHost  )  [protected]

Sets up the the real hostname for an SSL connection that goes through a proxy server.

This function is essential in making sure that the real hostname is used for validating certificates from SSL sites!

Parameters:
realHost the actual host name we are connecting to

Definition at line 1277 of file tcpslavebase.cpp.

void TCPSlaveBase::setSSLMetaData (  )  [protected]

Call this if you use persistent connections and want all the metadata restored.

This is particularly important for SSL sessions since the app needs to know the state of connection, certificates, etc.

Definition at line 516 of file tcpslavebase.cpp.

int TCPSlaveBase::startTLS (  )  [protected]

Start using TLS on the connection.

Returns:
on success, 1 is returned. on failure, 0 is returned. on TLS init failure, -1 is returned. on connect failure, -2 is returned. on certificate failure, -3 is returned.

Definition at line 451 of file tcpslavebase.cpp.

void TCPSlaveBase::stopTLS (  )  [protected]

Stop using TLS on the connection.

Definition at line 506 of file tcpslavebase.cpp.

bool TCPSlaveBase::userAborted (  )  const [protected]

Definition at line 1336 of file tcpslavebase.cpp.

bool KIO::TCPSlaveBase::usingSSL (  )  const [inline, protected]

Are we using SSL?

Returns:
if so, true is returned. if not, true isn't returned.
Since:
3.2

Definition at line 183 of file tcpslavebase.h.

bool TCPSlaveBase::usingTLS (  )  [protected]

Deprecated:
kept for binary compatibility Are we using TLS?
Returns:
if so, true is returned. if not, true isn't returned.

Definition at line 729 of file tcpslavebase.cpp.

bool TCPSlaveBase::usingTLS (  )  const [protected]

Are we using TLS?

Returns:
if so, true is returned. if not, true isn't returned.
Since:
3.2

Definition at line 723 of file tcpslavebase.cpp.

int TCPSlaveBase::verifyCertificate (  )  [protected]

Definition at line 736 of file tcpslavebase.cpp.

void TCPSlaveBase::virtual_hook ( int  id,
void *  data 
) [protected, virtual]

Reimplemented from KIO::SlaveBase.

Definition at line 1341 of file tcpslavebase.cpp.

bool TCPSlaveBase::waitForResponse ( int  t  )  [protected]

Wait for some type of activity 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 activity was seen on the socket before the timeout value was reached, false otherwise.

Definition at line 1203 of file tcpslavebase.cpp.

ssize_t TCPSlaveBase::write ( const void *  data,
ssize_t  len 
) [protected]

This function acts like standard write function call except it is also capable of making SSL or SOCKS connections.

Parameters:
data info to be sent to remote machine
len the length of the data to be sent
Returns:
the actual size of the data that was sent

Definition at line 152 of file tcpslavebase.cpp.

KDE_DEPRECATED ssize_t KIO::TCPSlaveBase::Write ( const void *  data,
ssize_t  len 
) [inline, protected]

Deprecated:
Due to inconsistency with KDE naming convention.

Definition at line 63 of file tcpslavebase.h.


Member Data Documentation

FILE* KIO::TCPSlaveBase::fp [protected]

Definition at line 375 of file tcpslavebase.h.

bool KIO::TCPSlaveBase::m_bIsSSL [protected]

Definition at line 371 of file tcpslavebase.h.

unsigned short int KIO::TCPSlaveBase::m_iDefaultPort [protected]

Definition at line 373 of file tcpslavebase.h.

unsigned short int KIO::TCPSlaveBase::m_iPort [protected]

Definition at line 372 of file tcpslavebase.h.

int KIO::TCPSlaveBase::m_iSock [protected]

Definition at line 370 of file tcpslavebase.h.

QCString KIO::TCPSlaveBase::m_sServiceName [protected]

Definition at line 374 of file tcpslavebase.h.


The documentation for this class was generated from the following files:
  • tcpslavebase.h
  • tcpslavebase.cpp

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal