mirror of https://github.com/tp4a/teleport
解决win下域名访问时助手无法连接websocket的问题。
parent
f817b79289
commit
e28b2c3ba7
|
@ -1,362 +0,0 @@
|
||||||
#include "stdafx.h"
|
|
||||||
#include "msocketx.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#pragma warning(disable:4244)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
msocketx::msocketx()
|
|
||||||
{
|
|
||||||
m_sock = INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
msocketx::~msocketx()
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
int msocketx::getsockname(unsigned int& uiip, unsigned short& usport)
|
|
||||||
{
|
|
||||||
sockaddr_in addr;
|
|
||||||
socklen_t ilen = sizeof(addr);
|
|
||||||
|
|
||||||
int nret = ::getsockname(m_sock, (sockaddr*)&addr, &ilen);
|
|
||||||
if (nret != SOCKET_ERROR)
|
|
||||||
{
|
|
||||||
uiip = addr.sin_addr.s_addr;
|
|
||||||
usport = ntohs(addr.sin_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::shutdown(int ihow)
|
|
||||||
{
|
|
||||||
return ::shutdown(m_sock, ihow);
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::closesocket()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return ::closesocket(m_sock);
|
|
||||||
#else
|
|
||||||
return ::close(m_sock);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void msocketx::close()
|
|
||||||
{
|
|
||||||
if (isvalid())
|
|
||||||
{
|
|
||||||
shutdown(0);
|
|
||||||
closesocket();
|
|
||||||
m_sock = INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::startup()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSADATA wsaData;
|
|
||||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::clearup()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return WSACleanup() == 0;
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::getlasterror()
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return WSAGetLastError();
|
|
||||||
#else
|
|
||||||
return errno;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void msocketx::attach(SOCKET sock)
|
|
||||||
{
|
|
||||||
if (sock == INVALID_SOCKET)
|
|
||||||
return;
|
|
||||||
m_sock = sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::isvalid()
|
|
||||||
{
|
|
||||||
return m_sock != INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::setsockbuff(unsigned int uirecvlen /* = 4 * 1024 * 1024 */,
|
|
||||||
unsigned int uisendlen /* = 4 * 1024 * 1024 */)
|
|
||||||
{
|
|
||||||
return (setsockopt(m_sock, SOL_SOCKET, SO_SNDBUF, (char*)&uisendlen, sizeof(uisendlen)) == 0) &&
|
|
||||||
(setsockopt(m_sock, SOL_SOCKET, SO_RCVBUF, (char*)&uirecvlen, sizeof(uirecvlen)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::setsocknagle(bool benable /* = true */)
|
|
||||||
{
|
|
||||||
socklen_t iflag = (benable ? 0 : 1);
|
|
||||||
return setsockopt(m_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&iflag, sizeof(iflag)) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::setsocktime(unsigned int uimillisecond /* = 500 */)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
return (setsockopt(m_sock, SOL_SOCKET, SO_SNDTIMEO, (char*)&uimillisecond, sizeof(uimillisecond)) == 0) &&
|
|
||||||
(setsockopt(m_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&uimillisecond, sizeof(uimillisecond)) == 0);
|
|
||||||
#else
|
|
||||||
struct timeval timeout;
|
|
||||||
timeout.tv_sec = uimillisecond / 1000;
|
|
||||||
timeout.tv_usec = (uimillisecond % 1000) * 1000;
|
|
||||||
return (setsockopt(m_sock, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof(timeout)) == 0) &&
|
|
||||||
(setsockopt(m_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)) == 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::setsock()
|
|
||||||
{
|
|
||||||
return setsockbuff() && setsocktime();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::setblock(bool bblock /* = false */)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
|
||||||
u_long b = bblock ? 0 : 1;
|
|
||||||
return ioctlsocket(m_sock, FIONBIO, &b) == 0;
|
|
||||||
#else
|
|
||||||
int flags = fcntl(m_sock, F_GETFL, 0);
|
|
||||||
if (bblock)
|
|
||||||
flags |= O_NONBLOCK;
|
|
||||||
else
|
|
||||||
flags &= (~O_NONBLOCK);
|
|
||||||
return fcntl(m_sock, F_SETFL, flags) != -1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::create(int itype, int iprotocol)
|
|
||||||
{
|
|
||||||
if (isvalid())
|
|
||||||
return true;
|
|
||||||
m_sock = socket(AF_INET, itype, iprotocol);
|
|
||||||
|
|
||||||
return isvalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::bind(unsigned short usport, const char* pstrip /* = NULL */)
|
|
||||||
{
|
|
||||||
sockaddr_in addr = { 0 };
|
|
||||||
unsigned long nResult = 0;
|
|
||||||
|
|
||||||
addr.sin_family = AF_INET;
|
|
||||||
|
|
||||||
if (pstrip == NULL)
|
|
||||||
addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nResult = inet_addr(pstrip);
|
|
||||||
if (nResult == INADDR_NONE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
addr.sin_addr.s_addr = nResult;
|
|
||||||
}
|
|
||||||
addr.sin_port = htons(usport);
|
|
||||||
|
|
||||||
return ::bind(m_sock, (sockaddr*)&addr, sizeof(addr)) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::sendto(const void* pbuf, unsigned int ilen, unsigned int uiip, unsigned short usport, int iflags)
|
|
||||||
{
|
|
||||||
if (pbuf == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
sockaddr_in addr = { 0 };
|
|
||||||
|
|
||||||
addr.sin_family = AF_INET;
|
|
||||||
addr.sin_addr.s_addr = uiip;
|
|
||||||
addr.sin_port = htons(usport);
|
|
||||||
|
|
||||||
return ::sendto(m_sock, (char*)pbuf, ilen, iflags, (sockaddr*)&addr, sizeof(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::sendto(const void* pbuf, unsigned int ilen, const char* pszip, unsigned short usport, int iflags)
|
|
||||||
{
|
|
||||||
if (pbuf == NULL)
|
|
||||||
return -1;
|
|
||||||
return sendto(pbuf, ilen, inet_addr(pszip), usport, iflags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::recvfrom(void* pbuf, unsigned int ilen, unsigned int& uiip, unsigned short& usport, int iflags)
|
|
||||||
{
|
|
||||||
if (pbuf == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
sockaddr_in srcaddr = { 0 };
|
|
||||||
socklen_t iaddrlen = sizeof(srcaddr);
|
|
||||||
|
|
||||||
int nret = ::recvfrom(m_sock, (char*)pbuf, ilen, iflags, (sockaddr*)&srcaddr, &iaddrlen);
|
|
||||||
if (nret != SOCKET_ERROR)
|
|
||||||
{
|
|
||||||
usport = htons(srcaddr.sin_port);
|
|
||||||
uiip = srcaddr.sin_addr.s_addr;
|
|
||||||
}
|
|
||||||
return nret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::send(const void* pbuf, unsigned int ilen, int iflags)
|
|
||||||
{
|
|
||||||
if (pbuf == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return ::send(m_sock, (char*)pbuf, ilen, iflags);
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::recv(void* pbuf, unsigned int ilen, int iflags)
|
|
||||||
{
|
|
||||||
if (pbuf == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return ::recv(m_sock, (char*)pbuf, ilen, iflags);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::listen(int ibacklog)
|
|
||||||
{
|
|
||||||
return ::listen(m_sock, ibacklog) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::accept(SOCKET& sock, sockaddr* peeraddr, socklen_t* addrlen)
|
|
||||||
{
|
|
||||||
sock = ::accept(m_sock, peeraddr, addrlen);
|
|
||||||
return sock != INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool msocketx::accept(msocketx& sock, sockaddr* peeraddr, socklen_t* addrlen)
|
|
||||||
{
|
|
||||||
SOCKET socktmp = ::accept(m_sock, peeraddr, addrlen);
|
|
||||||
sock.m_sock = socktmp;
|
|
||||||
return socktmp != INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::connect(const char* pszip, unsigned short usport, bool bblock)
|
|
||||||
{
|
|
||||||
if (pszip == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!isvalid())
|
|
||||||
{
|
|
||||||
if (!create(SOCK_STREAM, 0))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
setblock(bblock);
|
|
||||||
|
|
||||||
sockaddr_in addr = { 0 };
|
|
||||||
|
|
||||||
addr.sin_port = htons(usport);
|
|
||||||
addr.sin_addr.s_addr = inet_addr(pszip);
|
|
||||||
addr.sin_family = AF_INET;
|
|
||||||
|
|
||||||
return ::connect(m_sock, (sockaddr*)&addr, sizeof(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
int msocketx::wait(unsigned int uimilli, int iflagx)
|
|
||||||
{
|
|
||||||
timeval timeout;
|
|
||||||
timeout.tv_sec = uimilli / 1000;
|
|
||||||
timeout.tv_usec = (uimilli % 1000) * 1000;
|
|
||||||
|
|
||||||
fd_set *prfds = NULL, *pwfds = NULL, *pefds = NULL;
|
|
||||||
int iret = 0;
|
|
||||||
|
|
||||||
if ((iflagx & CAN_CONNECTX) == CAN_CONNECTX)
|
|
||||||
{
|
|
||||||
pwfds = new(std::nothrow) fd_set;
|
|
||||||
if (pwfds == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
pefds = new(std::nothrow) fd_set;
|
|
||||||
if (pefds == NULL)
|
|
||||||
{
|
|
||||||
if (pwfds)
|
|
||||||
delete pwfds;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_ZERO(pwfds);
|
|
||||||
FD_ZERO(pefds);
|
|
||||||
|
|
||||||
FD_SET(m_sock, pwfds);
|
|
||||||
FD_SET(m_sock, pefds);
|
|
||||||
|
|
||||||
iret = ::select(m_sock + 1, NULL, pwfds, pefds, &timeout);
|
|
||||||
if (iret > 0)
|
|
||||||
{
|
|
||||||
if (FD_ISSET(m_sock, pwfds) || FD_ISSET(m_sock, pefds))
|
|
||||||
{
|
|
||||||
int iopt = 0;
|
|
||||||
socklen_t ioptlen = sizeof(iopt);
|
|
||||||
if (getsockopt(m_sock, SOL_SOCKET, SO_ERROR, (char*)&iopt, &ioptlen) == 0)
|
|
||||||
{
|
|
||||||
if (iopt == 0)
|
|
||||||
iret = CAN_CONNECTX;
|
|
||||||
else
|
|
||||||
iret = SOCKET_ERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
iret = SOCKET_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pwfds)
|
|
||||||
delete pwfds;
|
|
||||||
if (pefds)
|
|
||||||
delete pefds;
|
|
||||||
return iret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((iflagx & CAN_READX) == CAN_READX || (iflagx & CAN_ACCEPTX) == CAN_ACCEPTX)
|
|
||||||
{
|
|
||||||
prfds = new(std::nothrow) fd_set;
|
|
||||||
if (prfds == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
FD_ZERO(prfds);
|
|
||||||
FD_SET(m_sock, prfds);
|
|
||||||
}
|
|
||||||
if ((iflagx & CAN_WRITEX) == CAN_WRITEX)
|
|
||||||
{
|
|
||||||
pwfds = new(std::nothrow) fd_set;
|
|
||||||
if (pwfds == NULL)
|
|
||||||
{
|
|
||||||
if (prfds)
|
|
||||||
delete prfds;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_ZERO(pwfds);
|
|
||||||
FD_SET(m_sock, pwfds);
|
|
||||||
}
|
|
||||||
|
|
||||||
iret = ::select(m_sock + 1, prfds, pwfds, NULL, &timeout);
|
|
||||||
if (iret > 0)
|
|
||||||
{
|
|
||||||
int itmp = 0;
|
|
||||||
if (prfds)
|
|
||||||
if (FD_ISSET(m_sock, prfds))
|
|
||||||
itmp |= CAN_READX;
|
|
||||||
if (pwfds)
|
|
||||||
if (FD_ISSET(m_sock, pwfds))
|
|
||||||
itmp |= CAN_WRITEX;
|
|
||||||
iret = itmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pwfds)
|
|
||||||
delete pwfds;
|
|
||||||
if (prfds)
|
|
||||||
delete prfds;
|
|
||||||
|
|
||||||
return iret;
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
#ifndef MSOCKETX_H_
|
|
||||||
#define MSOCKETX_H_
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#pragma comment(lib,"ws2_32.lib")
|
|
||||||
#include "winsock2.h"
|
|
||||||
typedef int socklen_t;
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h> //for ntohs
|
|
||||||
#include <sys/time.h> //for timeval
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <netinet/tcp.h>
|
|
||||||
typedef int SOCKET;
|
|
||||||
#define SOCKET_ERROR (-1)
|
|
||||||
#define INVALID_SOCKET (-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CAN_READX 1
|
|
||||||
#define CAN_WRITEX 2
|
|
||||||
#define CAN_CONNECTX 4
|
|
||||||
#define CAN_ACCEPTX 8
|
|
||||||
|
|
||||||
class msocketx
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
msocketx();
|
|
||||||
virtual ~msocketx();
|
|
||||||
public:
|
|
||||||
// startup 最先调用,linux可以不用调用
|
|
||||||
static bool startup();
|
|
||||||
|
|
||||||
// clearup 程序结束时调用,linux可以不用调用
|
|
||||||
static bool clearup();
|
|
||||||
|
|
||||||
// getlasterror 获取上一次错误代码
|
|
||||||
static int getlasterror();
|
|
||||||
|
|
||||||
public:
|
|
||||||
// attch 挂载一个socket
|
|
||||||
void attach(SOCKET sock);
|
|
||||||
|
|
||||||
// isvalid 是否有效
|
|
||||||
inline bool isvalid();
|
|
||||||
|
|
||||||
// close 会先判断isvalid,然后shutdown,然后closesocket,最后赋值INVALIDSOCKET
|
|
||||||
void close();
|
|
||||||
|
|
||||||
// setsock 会调用setsockbuff,setsocktime.
|
|
||||||
bool setsock();
|
|
||||||
|
|
||||||
// create 建立socket
|
|
||||||
bool create(int itype,int iprotocol);
|
|
||||||
|
|
||||||
// bind 绑定指定ip和端口,如果pstrip为空则绑定所有ip
|
|
||||||
bool bind(unsigned short usport,const char* pstrip = NULL);
|
|
||||||
|
|
||||||
// sendto 发送收据
|
|
||||||
int sendto(const void* pbuf, unsigned int ilen, unsigned int uiip, unsigned short usport, int iflags);
|
|
||||||
|
|
||||||
// sendto 发送收据
|
|
||||||
int sendto(const void* pbuf, unsigned int ilen, const char* pszip, unsigned short usport, int iflags);
|
|
||||||
|
|
||||||
// recvfrom 接收数据
|
|
||||||
int recvfrom(void* pbuf, unsigned int ilen, unsigned int& uiip, unsigned short& usport, int iflags);
|
|
||||||
|
|
||||||
// send 发送数据
|
|
||||||
int send(const void* pbuf, unsigned int ilen,int iflags);
|
|
||||||
|
|
||||||
// recv 接收数据
|
|
||||||
int recv(void* pbuf,unsigned int ilen,int iflags);
|
|
||||||
|
|
||||||
// listen 监听
|
|
||||||
bool listen(int ibacklog);
|
|
||||||
|
|
||||||
// accept 接收
|
|
||||||
bool accept(SOCKET& sock,sockaddr* peeraddr,socklen_t* addrlen);
|
|
||||||
|
|
||||||
bool accept(msocketx& sock,sockaddr* peeraddr,socklen_t* addrlen);
|
|
||||||
|
|
||||||
// connect 连接,usport为主机字节序.
|
|
||||||
int connect(const char* pszip,unsigned short usport,bool bblock);
|
|
||||||
|
|
||||||
// wait 等待iflagx事件,事件如上面的CAN_READX...出错返回-1,0表示超时,
|
|
||||||
// 正常返回可操作类型,用&取出判断
|
|
||||||
int wait(unsigned int uimilli,int iflagx);
|
|
||||||
public:
|
|
||||||
// setblock 设置是否阻塞
|
|
||||||
bool setblock(bool bblock = false);
|
|
||||||
|
|
||||||
// setsockbuff 设置socket系统缓冲区大小
|
|
||||||
bool setsockbuff(unsigned int uirecvlen = 4 * 1024 * 1024,
|
|
||||||
unsigned int uisendlen = 4 * 1024 * 1024);
|
|
||||||
|
|
||||||
// setsocktime 设置send\recv操作超时时间.
|
|
||||||
bool setsocktime(unsigned int uimillisecond = 500);
|
|
||||||
|
|
||||||
// setsocknagle 是否启用nagle算法.
|
|
||||||
bool setsocknagle(bool benable = true);
|
|
||||||
|
|
||||||
// shutdown 0 read,1 write,2 both
|
|
||||||
int shutdown(int ihow);
|
|
||||||
|
|
||||||
// closesocket 最基本的关掉socket
|
|
||||||
int closesocket();
|
|
||||||
|
|
||||||
// getsockname 获取该socket当前绑定地址,ulip 为网络序,usport为主机序
|
|
||||||
int getsockname(unsigned int& uiip,unsigned short& usport);
|
|
||||||
|
|
||||||
private:
|
|
||||||
SOCKET m_sock;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //MSOCKETX_H_
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.2.32505.173
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tp_assist", "tp_assist.vs2020.vcxproj", "{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {397ABE48-C68C-4ECB-BABF-978C775AC9CB}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,192 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{63B7A8F2-9722-487C-A92A-3DB5D8CA1473}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>tp_assist</RootNamespace>
|
||||||
|
<ProjectName>tp_assist</ProjectName>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>false</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
|
||||||
|
<IncludePath>C:\apps\vld\include;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>C:\apps\vld\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_DEBUG;MG_ENABLE_SSL;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;MG_ENABLE_SYNC_RESOLVER;MG_ENABLE_GETADDRINFO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\external\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;MG_ENABLE_SSL;NDEBUG;_WINDOWS;_WINSOCK_DEPRECATED_NO_WARNINGS;MG_ENABLE_THREADS;MG_DISABLE_HTTP_DIGEST_AUTH;MG_DISABLE_MQTT;MG_DISABLE_SSI;MG_DISABLE_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<AdditionalIncludeDirectories>..\..\common\teleport;..\..\common\libex\include;..\..\external\jsoncpp\include;..\..\external\openssl\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\external\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_const.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_ini.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_log.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_path.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_platform.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_str.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_thread.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_types.h" />
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_util.h" />
|
||||||
|
<ClInclude Include="..\..\common\teleport\teleport_const.h" />
|
||||||
|
<ClInclude Include="..\..\external\mongoose\mongoose.h" />
|
||||||
|
<ClInclude Include="dlg_main.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
<ClInclude Include="tp_assist.h" />
|
||||||
|
<ClInclude Include="ts_cfg.h" />
|
||||||
|
<ClInclude Include="ts_const.h" />
|
||||||
|
<ClInclude Include="ts_env.h" />
|
||||||
|
<ClInclude Include="ts_utils.h" />
|
||||||
|
<ClInclude Include="ts_ver.h" />
|
||||||
|
<ClInclude Include="ts_ws_client.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_ini.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_log.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_path.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_str.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_thread.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_util.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_reader.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_value.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_writer.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\mongoose\mongoose.c">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="dlg_main.cpp" />
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="tp_assist.cpp" />
|
||||||
|
<ClCompile Include="ts_cfg.cpp" />
|
||||||
|
<ClCompile Include="ts_env.cpp" />
|
||||||
|
<ClCompile Include="ts_utils.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ts_ws_client.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="tp_assist.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\tp.ico" />
|
||||||
|
<Image Include="res\tp_small.ico" />
|
||||||
|
<Image Include="res\tray_normal.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\external\jsoncpp\src\lib_json\json_valueiterator.inl" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,174 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="dlg_main.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="tp_assist.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ts_env.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ts_cfg.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_reader.cpp">
|
||||||
|
<Filter>jsoncpp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_value.cpp">
|
||||||
|
<Filter>jsoncpp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\jsoncpp\src\lib_json\json_writer.cpp">
|
||||||
|
<Filter>jsoncpp</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\external\mongoose\mongoose.c">
|
||||||
|
<Filter>mongoose</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_str.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_util.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_path.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_ini.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_log.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\libex\src\ex_thread.cpp">
|
||||||
|
<Filter>libex\src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ts_ws_client.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ts_utils.cpp">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>resource</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="dlg_main.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="stdafx.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="tp_assist.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_env.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_cfg.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\external\mongoose\mongoose.h">
|
||||||
|
<Filter>mongoose</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_const.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_path.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_platform.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_str.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_types.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_util.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_const.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_ver.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_ini.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_log.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\libex\include\ex\ex_thread.h">
|
||||||
|
<Filter>libex\header</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\teleport\teleport_const.h">
|
||||||
|
<Filter>teleport</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_ws_client.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ts_utils.h">
|
||||||
|
<Filter>main app</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\tp.ico">
|
||||||
|
<Filter>resource</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="res\tp_small.ico">
|
||||||
|
<Filter>resource</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="res\tray_normal.ico">
|
||||||
|
<Filter>resource</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="resource">
|
||||||
|
<UniqueIdentifier>{52b425b1-8aa9-4e08-acbd-c88387350530}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="jsoncpp">
|
||||||
|
<UniqueIdentifier>{adabe93d-3938-4b11-9352-5b67a1efd7e3}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="mongoose">
|
||||||
|
<UniqueIdentifier>{35a345a0-6147-4c87-97c9-3b0b2a57e348}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="main app">
|
||||||
|
<UniqueIdentifier>{0942cec3-67df-4d19-bbc1-e962145e496f}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="libex">
|
||||||
|
<UniqueIdentifier>{a88e05d3-51f4-463f-84cc-c3bc86f07aac}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="libex\header">
|
||||||
|
<UniqueIdentifier>{e3e7a811-5905-4ad5-86a7-9721af5d015a}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="libex\src">
|
||||||
|
<UniqueIdentifier>{d7d49fa4-5192-42c5-bc70-5584d9d646c6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="teleport">
|
||||||
|
<UniqueIdentifier>{1291a5cf-cb08-4ad6-8a86-8a0486297c63}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="tp_assist.rc">
|
||||||
|
<Filter>resource</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\external\jsoncpp\src\lib_json\json_valueiterator.inl">
|
||||||
|
<Filter>jsoncpp</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -156,21 +156,21 @@ void TsWsClient::url_scheme_handler(const std::string& url)
|
||||||
std::string::size_type pos_protocol = url.find("://");
|
std::string::size_type pos_protocol = url.find("://");
|
||||||
if (pos_protocol == std::string::npos)
|
if (pos_protocol == std::string::npos)
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid url: %s\n", url.c_str());
|
EXLOGE("[url-schema] invalid url: %s\n", url.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string::size_type pos_method = url.find('?');
|
std::string::size_type pos_method = url.find('?');
|
||||||
if (pos_method == std::string::npos)
|
if (pos_method == std::string::npos)
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid url: %s\n", url.c_str());
|
EXLOGE("[url-schema] invalid url: %s\n", url.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol.assign(url, 0, pos_protocol);
|
protocol.assign(url, 0, pos_protocol);
|
||||||
if (protocol != "teleport")
|
if (protocol != "teleport")
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid protocol: %s\n", protocol.c_str());
|
EXLOGE("[url-schema] invalid protocol: %s\n", protocol.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,14 +180,14 @@ void TsWsClient::url_scheme_handler(const std::string& url)
|
||||||
method.erase(method.length() - 1, 1);
|
method.erase(method.length() - 1, 1);
|
||||||
if (method != "register")
|
if (method != "register")
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] unknown method: %s\n", method.c_str());
|
EXLOGE("[url-schema] unknown method: %s\n", method.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.assign(url, pos_method + 7); // ?param=
|
param.assign(url, pos_method + 7); // ?param=
|
||||||
if (param.empty())
|
if (param.empty())
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid protocol: %s\n", protocol.c_str());
|
EXLOGE("[url-schema] invalid protocol: %s\n", protocol.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,12 +199,12 @@ void TsWsClient::url_scheme_handler(const std::string& url)
|
||||||
memset(&sztmp[0], 0, len);
|
memset(&sztmp[0], 0, len);
|
||||||
if (-1 == ts_url_decode(param.c_str(), (int)param.length(), &sztmp[0], (int)len, 0))
|
if (-1 == ts_url_decode(param.c_str(), (int)param.length(), &sztmp[0], (int)len, 0))
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] url-decode param failed: %s\n", param.c_str());
|
EXLOGE("[url-schema] url-decode param failed: %s\n", param.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
param = &sztmp[0];
|
param = &sztmp[0];
|
||||||
|
|
||||||
EXLOGV("[rpc] method=%s, json_param=%s\n", method.c_str(), param.c_str());
|
EXLOGV("[url-schema] method=%s, json_param=%s\n", method.c_str(), param.c_str());
|
||||||
|
|
||||||
Json::CharReaderBuilder jcrb;
|
Json::CharReaderBuilder jcrb;
|
||||||
std::unique_ptr<Json::CharReader> const jreader(jcrb.newCharReader());
|
std::unique_ptr<Json::CharReader> const jreader(jcrb.newCharReader());
|
||||||
|
@ -214,12 +214,12 @@ void TsWsClient::url_scheme_handler(const std::string& url)
|
||||||
ex_astr err;
|
ex_astr err;
|
||||||
if (!jreader->parse(str_json_begin, str_json_begin + param.length(), &js_root, &err))
|
if (!jreader->parse(str_json_begin, str_json_begin + param.length(), &js_root, &err))
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] param not in json format: %s\n", param.c_str());
|
EXLOGE("[url-schema] param not in json format: %s\n", param.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!js_root.isObject())
|
if (!js_root.isObject())
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid param, need json object: %s\n", param.c_str());
|
EXLOGE("[url-schema] invalid param, need json object: %s\n", param.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void TsWsClient::_process_register(const std::string& param, Json::Value& js_roo
|
||||||
// check param
|
// check param
|
||||||
if (!js_root["ws_url"].isString() || !js_root["assist_id"].isNumeric() || !js_root["session_id"].isString())
|
if (!js_root["ws_url"].isString() || !js_root["assist_id"].isNumeric() || !js_root["session_id"].isString())
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid param: %s\n", param.c_str());
|
EXLOGE("[url-schema] invalid param: %s\n", param.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,15 +247,15 @@ void TsWsClient::_process_register(const std::string& param, Json::Value& js_roo
|
||||||
protocol.assign(ws_url, 0, 3);
|
protocol.assign(ws_url, 0, 3);
|
||||||
if (protocol == "ws:")
|
if (protocol == "ws:")
|
||||||
{
|
{
|
||||||
g_ws_client._register(ws_url, assist_id, session_id);
|
g_ws_client._register(false, ws_url, assist_id, session_id);
|
||||||
}
|
}
|
||||||
else if (protocol == "wss")
|
else if (protocol == "wss")
|
||||||
{
|
{
|
||||||
g_wss_client._register(ws_url, assist_id, session_id);
|
g_wss_client._register(true, ws_url, assist_id, session_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] invalid ws_url: %s\n", ws_url.c_str());
|
EXLOGE("[url-schema] invalid ws_url: %s\n", ws_url.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ void TsWsClient::_thread_loop(void)
|
||||||
EXLOGV("[ws] main loop end.\n");
|
EXLOGV("[ws] main loop end.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TsWsClient::_register(const std::string& ws_url, uint32_t assist_id, const std::string& session_id)
|
void TsWsClient::_register(bool is_ssl, const std::string& ws_url, uint32_t assist_id, const std::string& session_id)
|
||||||
{
|
{
|
||||||
if (m_assist_id == 0)
|
if (m_assist_id == 0)
|
||||||
m_assist_id = assist_id;
|
m_assist_id = assist_id;
|
||||||
|
@ -307,7 +307,22 @@ void TsWsClient::_register(const std::string& ws_url, uint32_t assist_id, const
|
||||||
std::string url = ws_url;
|
std::string url = ws_url;
|
||||||
url += msg;
|
url += msg;
|
||||||
|
|
||||||
|
EXLOGD("mg_connect_ws: %s\n", url.c_str());
|
||||||
|
|
||||||
|
if (is_ssl)
|
||||||
|
{
|
||||||
|
struct mg_connect_opts opts;
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.ssl_ca_cert = "*";
|
||||||
|
opts.ssl_server_name = "*";
|
||||||
|
m_nc = mg_connect_ws_opt(&m_mg_mgr, _mg_event_handler, opts, url.c_str(), "wss", NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_nc = mg_connect_ws(&m_mg_mgr, _mg_event_handler, url.c_str(), NULL, NULL);
|
m_nc = mg_connect_ws(&m_mg_mgr, _mg_event_handler, url.c_str(), NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_nc = mg_connect_ws(&m_mg_mgr, _mg_event_handler, url.c_str(), NULL, NULL);
|
||||||
if (!m_nc)
|
if (!m_nc)
|
||||||
{
|
{
|
||||||
EXLOGE("[ws] TsWsClient::init failed: %s\n", url.c_str());
|
EXLOGE("[ws] TsWsClient::init failed: %s\n", url.c_str());
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
// bool _on_init();
|
// bool _on_init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _register(const std::string& ws_url, uint32_t assist_id, const std::string& session_id);
|
void _register(bool is_ssl, const std::string& ws_url, uint32_t assist_id, const std::string& session_id);
|
||||||
|
|
||||||
void _on_message(const std::string& message, std::string& buf);
|
void _on_message(const std::string& message, std::string& buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue