implement secureSocket

This commit is contained in:
Benjamin Sergeant 2018-10-09 15:59:40 -07:00
parent 1f659c34bd
commit e26cd1faba
2 changed files with 19 additions and 3 deletions

View File

@ -20,7 +20,7 @@ namespace ix
;
}
SocketSChanne::~SocketSChannel()
SocketSChannel::~SocketSChannel()
{
}
@ -32,6 +32,19 @@ namespace ix
return Socket::connect(host, port, errMsg);
}
void SocketSChannel::secureSocket()
{
DWORD dwOptVal = SO_SEC_SSL;
DWORD dwBytes = 0;
SSLVALIDATECERTHOOK sslValidateFunc;
sockerror = setsockopt(_sockfd, SOL_SOCKET,
SO_SECURE, (LPSTR)&dwOptVal, sizeof(dwOptVal));
// FIXME do something with sockerror
}
void SocketSChannel::close()
{
Socket::close();

View File

@ -13,14 +13,17 @@ namespace ix
class SocketSChannel : public Socket
{
public:
SocketAppleSSL();
~SocketAppleSSL();
SocketSChannel();
~SocketSChannel();
virtual bool connect(const std::string& host,
int port,
std::string& errMsg) final;
virtual void close() final;
// The important override
virtual void secureSocket() final;
virtual int send(char* buffer, size_t length) final;
virtual int send(const std::string& buffer) final;
virtual int recv(void* buffer, size_t length) final;