Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

epp_TransportSSL.h

Go to the documentation of this file.
00001 /************************************************************************
00002 * EPP RTK C++
00003 * Copyright (C) 2001 Global Name Registry 
00004 * 
00005 * This library is free software; you can redistribute it and/or modify it
00006 * under the terms of the GNU Lesser General Public License as published
00007 * by the Free Software Foundation; either version 2.1 of the License, or
00008 * (at your option) any later version.
00009 *
00010 * This library is distributed in the hope that it will be useful, but
00011 * WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 * Lesser General Public License for more details.
00014 *
00015 * You should have received a copy of the GNU Lesser General Public
00016 * License along with this library; if not, write to the Free Software
00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 *
00019 * Contact information:  epprtk@gnr.com
00020 *
00021 *                       EPP RTK
00022 *                       GNR Ltd.
00023 *                       125 High Holborn
00024 *                       London WC1V 6QA
00025 *                       United Kingdom
00026 ************************************************************************/
00027 
00028 #ifndef __EPP_TRANSPORTSSL_H
00029 #define __EPP_TRANSPORTSSL_H
00030 
00031 #include "../ssl/npssl.h"
00032 #include <string>
00033 #include "epp_TransportConn.h"
00034 
00035 // Socket:
00036 #include <sys/types.h>
00037 #include <sys/socket.h>
00038 #include <netinet/in.h>
00039 #include <arpa/inet.h>
00040 #include <stdio.h>
00041 #include <unistd.h>
00042 #include <netdb.h>
00044 
00045 
00046 // <FIXME>Some cleanup needed...</fixme>
00047 
00048 namespace epptransport {
00049 
00050    class epp_TransportSSL : public epp_TransportConn {
00051       
00052     private:
00053       
00054       string m_certFile;
00055       string m_cacertFile;
00056       string m_cacertDir;
00057       
00058       npbase::npssl *sslserver;
00059       int sockfd;
00060       struct sockaddr_in address;
00061       
00062     public:
00063       
00064       epp_TransportSSL() : epp_TransportConn()
00065    {
00066       sslserver = NULL;
00067       m_certFile = "/usr/share/ssl/certs/client.pem";
00068    };
00069       
00070       virtual ~epp_TransportSSL()
00071    {
00072       delete sslserver;
00073    };
00074 
00075       void writeToServer(const string & xml_string);
00076       string readFromServer();
00077       
00078       void connect(const string & serverName, const unsigned long & serverPort);
00079       void connect(const string & serverName,
00080          const unsigned long & serverPort,
00081          const string & certFile,
00082          const string & cacertFile = "",
00083          const string & cacertDir = "");
00084       
00085       void connect();
00086       void disconnect();
00087       
00088       string getCertFile()
00089    {
00090       return m_certFile;
00091    };
00092       
00093       void setCertFile(const string & certFile)
00094    {
00095       m_certFile = certFile;
00096    }
00097       
00098       string getCACertFile()
00099    {
00100       return m_cacertFile;
00101    }
00102       
00103       void setCACertFile(const string & cacertFile)
00104    {
00105       m_cacertFile = cacertFile;
00106    }
00107       
00108       string getCACertDir()
00109    {
00110       return m_cacertDir;
00111    }
00112       
00113       void setCACertDir(const string & cacertDir)
00114    {
00115       m_cacertDir = cacertDir;
00116    }
00117       
00118       bool connected()
00119    {
00120       return (sslserver ? true : false);
00121    }
00122    };
00123 };
00124 
00125 #endif

Generated on Fri Mar 22 15:45:39 2002 for epprtk c++ by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001