16 #ifndef HAZELCAST_CLIENT_INTERNAL_SOCKET_SSLSOCKET_H_
17 #define HAZELCAST_CLIENT_INTERNAL_SOCKET_SSLSOCKET_H_
19 #ifdef HZ_BUILD_WITH_SSL
22 #include <asio/ssl.hpp>
24 #include "hazelcast/client/Socket.h"
25 #include "hazelcast/client/Address.h"
26 #include "hazelcast/util/AtomicBoolean.h"
28 #if !defined(MSG_NOSIGNAL)
29 # define MSG_NOSIGNAL 0
32 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
34 #pragma warning(disable: 4251) //for dll export
35 #pragma warning(disable: 4003) //for not enough actual parameters for macro 'min' in asio wait_traits
45 class HAZELCAST_API SSLSocket :
public Socket {
51 std::string description;
57 SSLSocket(
const client::Address &address, asio::io_service &ioService,
58 asio::ssl::context &sslContext);
70 int connect(
int timeoutInMillis);
78 int send(
const void *buffer,
int len)
const;
87 int receive(
void *buffer,
int len,
int flag = 0)
const;
92 int getSocketId()
const;
97 void setRemoteEndpoint(
const client::Address &address);
102 const client::Address &getRemoteEndpoint()
const;
110 client::Address getAddress()
const;
112 void setBlocking(
bool blocking);
117 std::vector<SSLSocket::CipherInfo> getCiphers()
const;
119 SSLSocket(
const Socket &rhs);
121 SSLSocket &operator=(
const Socket &rhs);
127 int handleError(
const std::string &source,
size_t numBytes,
const asio::error_code &error)
const;
131 client::Address remoteEndpoint;
133 util::AtomicBoolean isOpen;
135 asio::io_service &ioService;
136 asio::ssl::context &sslContext;
137 std::auto_ptr<asio::ssl::stream<asio::ip::tcp::socket> > socket;
138 asio::deadline_timer deadline;
141 std::ostream &operator<<(std::ostream &out,
const SSLSocket::CipherInfo &info);
147 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)