add stub for windows tls socket class

This commit is contained in:
Benjamin Sergeant 2018-10-09 15:55:44 -07:00
parent 93f16018f7
commit 1f659c34bd
3 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,55 @@
/*
* 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>
# include <io.h>
#else
namespace ix
{
SocketSChannel::SocketSChannel()
{
;
}
SocketSChanne::~SocketSChannel()
{
}
bool SocketSChannel::connect(const std::string& host,
int port,
std::string& errMsg)
{
return Socket::connect(host, port, errMsg);
}
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);
}
}

View File

@ -0,0 +1,31 @@
/*
* IXSocketSChannel.h
* Author: Benjamin Sergeant
* Copyright (c) 2017-2018 Machine Zone, Inc. All rights reserved.
*/
#pragma once
#include "IXSocket.h"
namespace ix
{
class SocketSChannel : public Socket
{
public:
SocketAppleSSL();
~SocketAppleSSL();
virtual bool connect(const std::string& host,
int port,
std::string& errMsg) final;
virtual void close() 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;
private:
};
}

View File

@ -16,6 +16,8 @@
# include "IXSocketAppleSSL.h"
# elif defined(__linux__)
# include "IXSocketOpenSSL.h"
# elif defined(_WIN32)
# include "IXSocketSChannel.h"
# endif
#endif
@ -146,6 +148,8 @@ namespace ix {
_socket = std::make_shared<SocketAppleSSL>();
# elif defined(__linux__)
_socket = std::make_shared<SocketOpenSSL>();
# elif defined(_WIN32)
_socket = std::make_shared<SocketSChannel>();
# endif
#else
return WebSocketInitResult(false, 0, "TLS is not supported.");