26 #ifndef SECURE_SOCKET_H 27 #define SECURE_SOCKET_H 29 #ifdef COMPILE_WITH_SSL 31 #include <openssl/ssl.h> 32 #include <openssl/rand.h> 39 #include "dynamicssllocking.h" 40 #include "staticssllocking.h" 48 #define CIPHER_LIST "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH" 53 class SecureSocket :
public Socket 56 SecureSocket(
const SecureSocket &);
58 SecureSocket & operator=(
const SecureSocket &);
62 virtual void Init(
int port);
69 SecureSocket(
const std::string & certfile =
"",
73 virtual ~SecureSocket();
79 virtual bool IsSecure()
const {
return true; }
81 virtual int Read(
void *buf,
int bufsize);
83 virtual int Send(
const void *buf,
size_t buflen,
int flags = 0);
101 static int PassphraseCallback(
char * buf,
int bufsize,
int rwflag,
void * userdata);
109 SecureSocket(SSL *ssl, ehs_socket_t fd, sockaddr_in *peer);
112 SSL_CTX *InitializeCertificates();
120 std::string m_sCertFile;
128 static DynamicSslLocking * s_pDynamicSslLocking;
131 static StaticSslLocking * s_pStaticSslLocking;
134 static SslError * s_pSslError;
137 static SSL_CTX * s_pSslCtx;
140 static int s_refcount;
143 static pthread_mutex_t s_mutex;
146 #endif // COMPILE_WITH_SSL 148 #endif // SECURE_SOCKET_H plain socket implementation of NetworkAbstraction
virtual void Close()
Closes the underlying socket.
This interface describes a handler for retrieving passphrases.
virtual bool IsSecure() const
Determines, whether the underlying socket is secure.
virtual int Send(const void *buf, size_t buflen, int flags=0)
Performs a send on the underlying socket.
virtual NetworkAbstraction * Accept()
Waits for an incoming connection.
virtual void Init(int port)
Initializes a listening socket.
virtual void ThreadCleanup()
Handles thread specific clean up (used by OpenSSL).
virtual int Read(void *buf, int bufsize)
Performs a read from the underlying socket.
Abstracts different socket types.