IXWebSocket/ixwebsocket/IXSocketSChannel.cpp

73 lines
1.4 KiB
C++
Raw Normal View History

2018-10-10 00:55:44 +02:00
/*
* IXSocketSChannel.cpp
* Author: Benjamin Sergeant
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
*/
#include "IXSocketSChannel.h"
#ifdef _WIN32
# include <basetsd.h>
# include <WinSock2.h>
# include <ws2def.h>
# include <WS2tcpip.h>
2018-10-10 01:11:12 +02:00
# include <schannel.h>
2018-10-10 01:20:08 +02:00
# include <sslsock.h>
2018-10-10 00:55:44 +02:00
# include <io.h>
#else
2018-10-10 01:07:50 +02:00
# error("This file should only be built on Windows")
#endif
2018-10-10 00:55:44 +02:00
namespace ix
{
SocketSChannel::SocketSChannel()
{
;
}
2018-10-10 00:59:40 +02:00
SocketSChannel::~SocketSChannel()
2018-10-10 00:55:44 +02:00
{
}
bool SocketSChannel::connect(const std::string& host,
int port,
std::string& errMsg)
{
return Socket::connect(host, port, errMsg);
}
2018-10-10 00:59:40 +02:00
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
}
2018-10-10 00:55:44 +02:00
void SocketSChannel::close()
{
Socket::close();
}
int SocketSChannel::send(char* buf, size_t nbyte)
{
return Socket::send(buf, nbyte);
}
int SocketSChannel::send(const std::string& buffer)
{
return Socket::send(buffer);
}
int SocketSChannel::recv(void* buf, size_t nbyte)
{
return Socket::recv(buf, nbyte);
}
}