00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef RGMA_SSLSOCKET_H
00015 #define RGMA_SSLSOCKET_H
00016 #define OPENSSL_NO_KRB5
00017 #include "rgma/RGMAException.h"
00018 #include "rgma/RemoteException.h"
00019 #include "rgma/TCPSocket.h"
00020 #include "rgma/SSLContext.h"
00021 #include "log4cxx/logger.h"
00022 #include "log4cxx/level.h"
00023 #include "log4cxx/helpers/loglog.h"
00024 #include "log4cxx/propertyconfigurator.h"
00025 #include "log4cxx/helpers/exception.h"
00026 #include <openssl/ssl.h>
00027 #include <sys/socket.h>
00028 #include <string>
00029 namespace glite
00030 {
00031 namespace rgma
00032 {
00037 class SSLSocket :public TCPSocket
00038 {
00039 private:
00040 SSL* m_ssl;
00041 SSL_SESSION* m_sslSession;
00042 std::string m_host;
00043 int connectionCounter;
00044 const static int MAX_NO_OF_CONNECTIONS;
00045 int m_port;
00046 static SSLContext m_sslContext;
00047 log4cxx::LoggerPtr m_ssllogger;
00048 void establishSSL()throw(RGMAException, RemoteException);
00054 int sslPing(SSL *ssl, int socket);
00060 void reMakeSSLConnection() throw(RGMAException, RemoteException);
00061
00062
00063 void testRead(int returnCode) throw(RGMAException, RemoteException);
00064
00065 public:
00066 virtual ~SSLSocket();
00067 SSLSocket();
00068 void connect(std::string host, int port) throw(RGMAException, RemoteException);
00069 void write(std::string request, std::string& resonse) throw(RGMAException, RemoteException);
00070 virtual void close()throw(RGMAException, RemoteException);
00071 };
00072 }
00073 }
00074 #endif