00001 #ifndef __SSL_H__ 00002 #define __SSL_H__ 00003 00004 #include <time.h> 00005 #include <pthread.h> 00006 00007 #include "os_spec.h" 00008 #include "SslCtx.h" 00009 #include "Mutex.h" 00010 00011 class Ssl 00012 { 00013 public: 00014 Ssl(); 00015 ~Ssl(); 00016 00017 void setTimeOut(bool infinite, int tv_sec, int tv_usec); 00018 00019 bool open(bool server_mode, SslCtx &ssl_ctx, OS_SPEC_SOCKET_TYPE sock); 00020 00021 void shutdown(void); 00022 00023 int read(void* buff, int count); 00024 00025 int write(void* buff, int count); 00026 00027 SSL* getSsl(void); 00028 00029 OS_SPEC_SOCKET_TYPE getStream(void); 00030 00031 private: 00032 SSL* m_ssl; 00033 Mutex m_lock; 00034 OS_SPEC_SOCKET_TYPE m_sock; 00035 bool m_timeout_infinite; 00036 struct timeval m_timeout; 00037 }; 00038 00039 #endif