ulxr_ssl_connection.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                    ulxr_ssl_connection.h  -  ssl connection
00003                              -------------------
00004     begin                : Mon May 3 2004
00005     copyright            : (C) 2002-2007 by Ewald Arnold
00006     email                : ulxmlrpcpp@ewald-arnold.de
00007 
00008     $Id: ulxr_ssl_connection.h 940 2006-12-30 18:22:05Z ewald-arnold $
00009 
00010  ***************************************************************************/
00011 
00012 /**************************************************************************
00013  *
00014  * This program is free software; you can redistribute it and/or modify
00015  * it under the terms of the GNU Lesser General Public License as
00016  * published by the Free Software Foundation; either version 2 of the License,
00017  * or (at your option) any later version.
00018  *
00019  * This program is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public License
00025  * along with this program; if not, write to the Free Software
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00027  *
00028  ***************************************************************************/
00029 
00030 #ifndef ULXR_SSL_CONNECTION_H
00031 #define ULXR_SSL_CONNECTION_H
00032 
00033 
00034 #include <ulxmlrpcpp/ulxmlrpcpp.h>  // always first header
00035 
00036 #ifdef ULXR_INCLUDE_SSL_STUFF
00037 
00038 #include <openssl/ssl.h>
00039 
00040 #include <ulxmlrpcpp/ulxr_tcpip_connection.h>
00041 
00042 
00043 namespace ulxr {
00044 
00045 
00049 class ULXR_API_DECL0 SSLConnection : public TcpIpConnection
00050 {
00051  public:
00052 
00059    SSLConnection(bool server, const CppString &domain, unsigned port = 80);
00060 
00067    SSLConnection(bool server, long adr = INADDR_ANY, unsigned port = 0);
00068 
00072    virtual ~SSLConnection();
00073 
00076    virtual void close();
00077 
00080    virtual void open();
00081 
00087    virtual bool accept(int timeout = 0);
00088 
00092    virtual CppString getInterfaceName();
00093 
00097    virtual void cut();
00098 
00102    std::string getPassword() const;
00103 
00109    void setCryptographyData (const std::string &password,
00110                              const std::string &certfile,
00111                              const std::string &keyfile);
00112 
00113  protected:
00114 
00118    SSL *getSslObject() const;
00119 
00123    SSL_CTX *getSslContextObject() const;
00124 
00128    SSL_SESSION *getSslSessionObject() const;
00129 
00133    virtual bool hasPendingInput() const;
00134 
00135  private:
00136 
00137    SSL          *ssl;
00138    SSL_CTX      *ssl_ctx;
00139    SSL_SESSION  *session;
00140 
00141    std::string   password;
00142    std::string   keyfile;
00143    std::string   certfile;
00144 
00145    static bool ssl_initialized;
00146 
00149    void createSSL();
00150 
00153    void initializeCTX();
00154 
00160    ssize_t virtual low_level_write(char const *buff, long len);
00161 
00167    ssize_t virtual low_level_read(char *buff, long len);
00168 
00171    void init();
00172 
00176     virtual TcpIpConnection *makeClone();
00177 };
00178 
00179 
00180 }  // namespace ulxr
00181 
00182 
00183 #endif // ULXR_INCLUDE_SSL_STUFF
00184 
00185 
00186 #endif // ULXR_SSL_CONNECTION_H
00187 

Generated on Sun Aug 19 20:08:57 2007 for ulxmlrpcpp by  doxygen 1.5.1