add stub for windows tls socket class
This commit is contained in:
parent
93f16018f7
commit
1f659c34bd
55
ixwebsocket/IXSocketSChannel.cpp
Normal file
55
ixwebsocket/IXSocketSChannel.cpp
Normal 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);
|
||||
}
|
||||
|
||||
}
|
31
ixwebsocket/IXSocketSChannel.h
Normal file
31
ixwebsocket/IXSocketSChannel.h
Normal 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:
|
||||
};
|
||||
|
||||
}
|
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user