kio Library API Documentation

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:

KIO::SlaveBase List of all members.

Public Member Functions

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

Protected Member Functions

ssize_t Write (const void *data, ssize_t len)
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

ssize_t Read (void *data, ssize_t len)
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

ssize_t ReadLine (char *data, ssize_t len)
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

unsigned short int GetPort (unsigned short int p)
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

bool ConnectToHost (const QString &host, unsigned int port, bool sendError)
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

void CloseDescriptor ()
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

bool AtEOF ()
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

bool InitializeSSL ()
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

void CleanSSL ()
 This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

ssize_t write (const void *data, ssize_t len)
 This function acts like standard write function call except it is also capable of making SSL or SOCKS connections.

ssize_t read (void *data, ssize_t len)
 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.

ssize_t readLine (char *data, ssize_t len)
 Same as above except it reads data one line at a time.

void setBlockSize (int sz)
 Sets the maximum size of blocks read in during calls to readLine().

unsigned short int port (unsigned short int)
 Determines the appropiate port to use.

bool connectToHost (const QString &host, unsigned int port, bool sendError=true)
 Performs the initial TCP connection stuff and/or SSL handshaking as necessary.

bool usingTLS ()
 Are we using TLS?

bool canUseTLS ()
 Can we use TLS?

int startTLS ()
 Start using TLS on the connection.

void stopTLS ()
 Stop using TLS on the connection.

void closeDescriptor ()
 Closes the current file descriptor.

bool atEnd ()
 Returns true when end of data is reached.

void setSSLMetaData ()
 Call this if you use persistent connections and want all the metadata restored.

bool initializeSSL ()
 Initializs all SSL variables.

void cleanSSL ()
 Cleans up all SSL settings.

bool isConnectionValid ()
 Determines whether or not we are still connected to the remote machine.

int connectResult ()
 Returns the status of the connection.

bool waitForResponse (int t)
 Wait for some type of activity on the socket for the period specified by t.

void setBlockConnection (bool b)
 Sets the mode of the connection to blocking or non-blocking.

void setConnectTimeout (int t)
 Sets how long to wait for orignally connecting to the requested before timinig out.

bool isSSLTunnelEnabled ()
 Returns true if SSL tunneling is enabled.

void setEnableSSLTunnel (bool enable)
 Set up SSL tunneling mode.

void setRealHost (const QString &realHost)
 Sets up the the real hostname for an SSL connection that goes through a proxy server.

void doConstructorStuff ()
int verifyCertificate ()
void certificatePrompt ()
bool userAborted () const
virtual void virtual_hook (int id, void *data)

Protected Attributes

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

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


Member Function Documentation

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 66 of file tcpslavebase.h.

References write().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 71 of file tcpslavebase.h.

References read().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 76 of file tcpslavebase.h.

References readLine().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 81 of file tcpslavebase.h.

References port().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 86 of file tcpslavebase.h.

References connectToHost().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 92 of file tcpslavebase.h.

References closeDescriptor().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 97 of file tcpslavebase.h.

References atEnd().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 102 of file tcpslavebase.h.

References initializeSSL().

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

This class or method is obsolete, it is provided for compatibility only. Due to inconsistency with KDE naming convention.

Definition at line 107 of file tcpslavebase.h.

References cleanSSL().

ssize_t KIO::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

Referenced by Write().

ssize_t KIO::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

Referenced by Read().

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

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

Referenced by ReadLine().

void KIO::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)

unsigned short int KIO::TCPSlaveBase::port unsigned short  int  )  [protected]
 

Determines the appropiate port to use.

This functions attempts to discover the appropriate port.

Parameters:
port 

Referenced by GetPort().

bool KIO::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
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.

Referenced by ConnectToHost().

bool KIO::TCPSlaveBase::usingTLS  )  [protected]
 

Are we using TLS?

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

bool KIO::TCPSlaveBase::canUseTLS  )  [protected]
 

Can we use TLS?

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

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

void KIO::TCPSlaveBase::stopTLS  )  [protected]
 

Stop using TLS on the connection.

void KIO::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

Referenced by CloseDescriptor().

bool KIO::TCPSlaveBase::atEnd  )  [protected]
 

Returns true when end of data is reached.

Referenced by AtEOF().

void KIO::TCPSlaveBase::setSSLMetaData  )  [protected]
 

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

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

bool KIO::TCPSlaveBase::initializeSSL  )  [protected]
 

Initializs all SSL variables.

Referenced by InitializeSSL().

void KIO::TCPSlaveBase::cleanSSL  )  [protected]
 

Cleans up all SSL settings.

Referenced by CleanSSL().

bool KIO::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.

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

bool KIO::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.

void KIO::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.

void KIO::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

bool KIO::TCPSlaveBase::isSSLTunnelEnabled  )  [protected]
 

Returns true if SSL tunneling is enabled.

See also:
setEnableSSlTunnel

void KIO::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

void KIO::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


The documentation for this class was generated from the following file:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:39 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001