Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

connectiontls.h

00001 /*
00002  * Copyright (c) 2007-2008 by Jakob Schroeter <js@camaya.net>
00003  * This file is part of the gloox library. http://camaya.net/gloox
00004  *
00005  * This software is distributed under a license. The full license
00006  * agreement can be found in the file LICENSE in this distribution.
00007  * This software may not be copied, modified, sold or distributed
00008  * other than expressed in the named license agreement.
00009  *
00010  * This software is distributed without any warranty.
00011  */
00012 
00013 #ifndef CONNECTIONTLS_H__
00014 #define CONNECTIONTLS_H__
00015 
00016 #include <string>
00017 #include "gloox.h"
00018 #include "logsink.h"
00019 #include "connectionbase.h"
00020 #include "tlsdefault.h"
00021 #include "connectiondatahandler.h"
00022 
00023 namespace gloox
00024 {
00025 
00046   class GLOOX_API ConnectionTLS : public TLSHandler, public ConnectionBase, ConnectionDataHandler
00047   {
00048     public:
00057       ConnectionTLS( ConnectionBase * conn, ConnectionDataHandler * cdh, const LogSink & log );
00058 
00062       virtual ~ConnectionTLS();
00063 
00064       // reimplemented from ConnectionBase
00065       virtual ConnectionError connect();
00066 
00067       // reimplemented from ConnectionBase
00068       virtual ConnectionError recv( int timeout = -1 );
00069 
00070       // reimplemented from ConnectionBase
00071       virtual bool send( const std::string& data );
00072 
00073       // reimplemented from ConnectionBase
00074       virtual ConnectionError receive();
00075 
00076       // reimplemented from ConnectionBase
00077       virtual void disconnect();
00078 
00079       // reimplemented from ConnectionBase
00080       virtual void cleanup();
00081 
00082       // reimplemented from ConnectionBase
00083       virtual void getStatistics( int& totalIn, int& totalOut );
00084 
00085       // reimplemented from ConnectionDataHandler
00086       virtual void handleReceivedData( const ConnectionBase* connection, const std::string& data );
00087 
00088       // reimplemented from ConnectionDataHandler
00089       virtual void handleConnect( const ConnectionBase* connection );
00090 
00091       // reimplemented from ConnectionDataHandler
00092       virtual void handleDisconnect( const ConnectionBase* connection, ConnectionError reason );
00093 
00094       // reimplemented from ConnectionDataHandler
00095       virtual ConnectionBase* newInstance() const;
00096 
00097       // TLSHandler callbacks
00098       virtual void handleEncryptedData( const TLSBase*, const std::string& data );
00099       virtual void handleDecryptedData( const TLSBase*, const std::string& data );
00100       virtual void handleHandshakeResult( const TLSBase* base, bool success, CertInfo& certinfo );
00101 
00102     private:
00103       // Properties
00104       ConnectionBase* m_connection;
00105       TLSDefault* m_tls;
00106       const LogSink & m_log;
00107       bool m_handshaked;
00108 
00109   };
00110 
00111 }
00112 
00113 #endif

Generated on Mon Jun 23 10:50:18 2008 for gloox by  doxygen 1.4.1