gloox 1.0

tlsopensslclient.cpp

00001 /*
00002   Copyright (c) 2005-2009 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 
00014 
00015 #include "tlsopensslclient.h"
00016 
00017 #ifdef HAVE_OPENSSL
00018 
00019 namespace gloox
00020 {
00021 
00022   OpenSSLClient::OpenSSLClient( TLSHandler* th, const std::string& server )
00023     : OpenSSLBase( th, server )
00024   {
00025   }
00026 
00027   OpenSSLClient::~OpenSSLClient()
00028   {
00029   }
00030 
00031   bool OpenSSLClient::setType()
00032   {
00033     m_ctx = SSL_CTX_new( SSLv23_client_method() ); // FIXME: use TLSv1_client_method() as soon as OpenSSL/gtalk combo is fixed!
00034     if( !m_ctx )
00035       return false;
00036 
00037     return true;
00038   }
00039 
00040   int OpenSSLClient::handshakeFunction()
00041   {
00042     return SSL_connect( m_ssl );
00043   }
00044 
00045 }
00046 
00047 #endif // HAVE_OPENSSL