00001 #ifndef __SSLCONNECTION_H 00002 #define __SSLCONNECTION_H 00003 00004 #ifdef LINUX 00005 #include <netinet/in.h> 00006 #include <sys/time.h> 00007 #endif 00008 00009 #ifdef WIN32 00010 #include <winsock2.h> 00011 #include <ws2tcpip.h> 00012 #endif 00013 00014 #include "os_spec.h" 00015 #include "BasicObject.h" 00016 #include "TcpConnection.h" 00017 #include "IpAddress.h" 00018 #include "ConnectionInterface.h" 00019 #include "Ssl.h" 00020 #include "SslCtx.h" 00021 00022 00023 class SslConnection : public BasicObject, public ConnectionInterface 00024 { 00025 public: 00026 SslConnection(); 00027 00028 // these functions fulfill the ConnectionInterface contract 00029 virtual ~SslConnection(); 00030 virtual SocketAddress* getSocketAddress(); 00031 virtual void setSocketAddress(SocketAddress*); 00032 virtual int connect(); 00033 virtual void close(); 00034 virtual int listen(); 00035 virtual ConnectionInterface* accept(); 00036 virtual bool isConnected(); 00037 virtual bool isConnectedTo(IpAddress ipAddr); 00038 virtual int getStream(); 00039 virtual void setStream(int stream); 00040 virtual int read(unsigned char* buffer, int bufferSize, int amountToRead = 0); 00041 virtual int write(unsigned char* buffer, int amountToWrite); 00042 virtual ConnectionInterface::ObjectType getConnectionType(); 00043 00044 // fulfills the BasicObject contract 00045 virtual void toStream(std::ostream& out); 00046 00047 private: 00048 ConnectionInterface* m_connection; 00049 00051 Ssl* m_sslStream; 00052 00054 //SslCtx* m_serverCtx; 00055 00057 //SslCtx* m_clientCtx; 00058 }; 00059 00060 #endif 00061