16 #ifndef HAZELCAST_CLIENT_INTERNAL_SOCKET_SSLSOCKET_H_
17 #define HAZELCAST_CLIENT_INTERNAL_SOCKET_SSLSOCKET_H_
19 #ifdef HZ_BUILD_WITH_SSL
21 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
23 #pragma warning(disable: 4251) //for dll export
27 #include <asio/ssl.hpp>
29 #include "hazelcast/client/Socket.h"
30 #include "hazelcast/client/Address.h"
31 #include "hazelcast/util/AtomicBoolean.h"
33 #if !defined(MSG_NOSIGNAL)
34 # define MSG_NOSIGNAL 0
44 class HAZELCAST_API SSLSocket :
public Socket {
50 std::string description;
56 SSLSocket(
const client::Address &address, asio::io_service &ioService,
57 asio::ssl::context &sslContext);
69 int connect(
int timeoutInMillis);
77 int send(
const void *buffer,
int len)
const;
86 int receive(
void *buffer,
int len,
int flag = 0)
const;
91 int getSocketId()
const;
96 void setRemoteEndpoint(
const client::Address &address);
101 const client::Address &getRemoteEndpoint()
const;
109 client::Address getAddress()
const;
111 void setBlocking(
bool blocking);
116 std::vector<SSLSocket::CipherInfo> getCiphers()
const;
118 SSLSocket(
const Socket &rhs);
120 SSLSocket &operator=(
const Socket &rhs);
126 int handleError(
const std::string &source,
size_t numBytes,
const asio::error_code &error)
const;
130 client::Address remoteEndpoint;
132 util::AtomicBoolean isOpen;
134 asio::io_service &ioService;
135 asio::ssl::context &sslContext;
136 std::auto_ptr<asio::ssl::stream<asio::ip::tcp::socket> > socket;
137 asio::deadline_timer deadline;
140 std::ostream &operator<<(std::ostream &out,
const SSLSocket::CipherInfo &info);
146 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)