|
|
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.
TCPSlaveBase (unsigned short int default_port, const QCString &protocol,
const QCString &pool_socket, const QCString &app_socket)
| TCPSlaveBase |
TCPSlaveBase (unsigned short int default_port, const QCString &protocol,
const QCString &pool_socket, const QCString &app_socket,
bool useSSL)
| TCPSlaveBase |
~TCPSlaveBase ()
| ~TCPSlaveBase |
[virtual]
ssize_t Write (const void *data, ssize_t len)
| Write |
[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
ssize_t Read (void *data, ssize_t len)
| Read |
[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
ssize_t ReadLine (char *data, ssize_t len)
| ReadLine |
[protected]
Same as above except it reads data one line at a time.
unsigned short int GetPort (unsigned short int port)
| GetPort |
[protected]
Determines the appropiate port to use.
This functions attempts to discover the appropriate port.
Parameters:
port |
bool ConnectToHost ( const QString &host, unsigned int port,
bool sendError )
| ConnectToHost |
[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.
bool ConnectToHost (const QCString &host, unsigned short int port)
| ConnectToHost |
[protected]
FIXME: Remove in KDE 3.0
bool usingTLS ()
| usingTLS |
[protected]
Are we using TLS?
Returns: if so, true is returned. if not, true isn't returned.
bool canUseTLS ()
| canUseTLS |
[protected]
Can we use TLS?
Returns: if so, true is returned. if not, true isn't returned.
int startTLS ()
| 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 stopTLS ()
| stopTLS |
[protected]
Stop using TLS on the connection.
void CloseDescriptor ()
| 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
bool AtEOF ()
| AtEOF |
[protected]
Returns true when end of data is reached
bool InitializeSSL ()
| InitializeSSL |
[protected]
Initializs all SSL variables
void CleanSSL ()
| CleanSSL |
[protected]
Cleans up all SSL settings.
bool isConnectionValid ()
| isConnectionValid |
[protected]
Determines whether or not we are still connected to the remote machine.
return true
if the socket is still active, false otherwise.
int connectResult ()
| connectResult |
[protected]
Returns the status of the connection.
This function allows to retrieve the result of a call
to ConnectToHost with the sendError
flag set to
false. That way your io-slave instead of this class will
send the appropriate error message back to the calling to
the application that requested the service.
Returns: the status code as returned by KExtendedSocket.
bool waitForResponse ( int t )
| waitForResponse |
[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 setBlockConnection ( bool b )
| setBlockConnection |
[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 setConnectTimeout ( int t )
| setConnectTimeout |
[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 isSSLTunnelEnabled ()
| isSSLTunnelEnabled |
[protected]
Returns true if SSL tunneling is enabled.
See also: setEnableSSlTunnel
void setEnableSSLTunnel ( bool enable )
| setEnableSSLTunnel |
[protected]
Sets up SSL tunneling through a proxy server.
Call this function with a enable
paramter set to true to
temprarly ignore the ssl 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 | true enables SSL Tunneling. |
void setRealHost ( const QString& realHost )
| setRealHost |
[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 |
void doConstructorStuff ()
| doConstructorStuff |
[protected]
int verifyCertificate ()
| verifyCertificate |
[protected]
void certificatePrompt ()
| certificatePrompt |
[protected]
int m_iSock | m_iSock |
[protected]
bool m_bIsSSL | m_bIsSSL |
[protected]
unsigned short int m_iPort | m_iPort |
[protected]
unsigned short int m_iDefaultPort | m_iDefaultPort |
[protected]
QCString m_sServiceName | m_sServiceName |
[protected]
FILE * fp | fp |
[protected]
TcpSlaveBasePrivate * d | d |
[protected]
Generated by: dfaure on kde.faure.org on Thu Jan 17 22:16:53 2002, using kdoc 2.0a53. |