Skip to content

Commit 49e1617

Browse files
committed
added:hardware code bind with login and register
1 parent b1724ce commit 49e1617

File tree

14 files changed

+62
-24
lines changed

14 files changed

+62
-24
lines changed

XEngine_Source/AuthorizeModule_Client/AuthClient_Connector/AuthClient_Connector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ bool CAuthClient_Connector::AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR
163163
#if (1 == _XAUTH_BUILD_SWITCH_CLIENT_TCP)
164164
XCHAR tszMsgBuffer[2048] = {};
165165
XENGINE_PROTOCOLHDR st_ProtocolHdr = {};
166-
XENGINE_PROTOCOL_USERAUTH st_AuthUser = {};
166+
AUTHORIZE_PROTOCOL_USERAUTHEX st_AuthUser = {};
167167
//协议头
168168
st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
169169
st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH;
170170
st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN;
171-
st_ProtocolHdr.unPacketSize = sizeof(XENGINE_PROTOCOL_USERAUTH);
171+
st_ProtocolHdr.unPacketSize = sizeof(AUTHORIZE_PROTOCOL_USERAUTHEX);
172172
st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
173173

174174
#ifdef _MSC_BUILD
@@ -216,7 +216,7 @@ bool CAuthClient_Connector::AuthClient_Connector_Login(LPCXSTR lpszUser, LPCXSTR
216216
memcpy(tszMsgBuffer, &st_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR));
217217
memcpy(tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), &st_AuthUser, st_ProtocolHdr.unPacketSize);
218218

219-
nMsgLen = sizeof(XENGINE_PROTOCOLHDR) + sizeof(XENGINE_PROTOCOL_USERAUTH);
219+
nMsgLen = sizeof(XENGINE_PROTOCOLHDR) + sizeof(AUTHORIZE_PROTOCOL_USERAUTHEX);
220220
}
221221
//发送数据
222222
if (!XClient_TCPSelect_SendMsg(m_hSocket, tszMsgBuffer, nMsgLen))

XEngine_Source/AuthorizeModule_Configure/Config_Define.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ typedef struct
138138
bool bSwitchBanned; //黑名单
139139
bool bSwitchTokenLogin; //TOKEN开关
140140
bool bSwitchHCLogin; //硬件码登录
141+
bool bSwitchHWBind; //硬件码绑定
141142
}XENGINE_FUNCTIONSWITCH;
142143
//////////////////////////////////////////////////////////////////////////
143144
// 导出的函数

XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,5 +353,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_Switch(LPCXSTR lpszConfigFile,
353353
pSt_ServerConfig->bSwitchBanned = st_JsonRoot["bSwitchBanned"].asBool();
354354
pSt_ServerConfig->bSwitchTokenLogin = st_JsonRoot["bSwitchTokenLogin"].asBool();
355355
pSt_ServerConfig->bSwitchHCLogin = st_JsonRoot["bSwitchHCLogin"].asBool();
356+
pSt_ServerConfig->bSwitchHWBind = st_JsonRoot["bSwitchHWBind"].asBool();
356357
return true;
357358
}

XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ extern "C" bool Protocol_Packet_HttpComm(XCHAR* ptszMsgBuffer, int* pInt_MsgLen,
9898
意思:是否成功
9999
备注:
100100
*********************************************************************/
101-
extern "C" bool Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
101+
extern "C" bool Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth);
102102
/********************************************************************
103103
函数名称:Protocol_Packet_UserTime
104104
函数功能:用户时间打包函数
@@ -473,7 +473,7 @@ extern "C" bool Protocol_Parse_HttpParseToken(LPCXSTR lpszMsgBuffer, int nMsgLen
473473
意思:是否成功
474474
备注:
475475
*********************************************************************/
476-
extern "C" bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth);
476+
extern "C" bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth);
477477
/********************************************************************
478478
函数名称:Protocol_Parse_HttpParseUser
479479
函数功能:解析用户信息

XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ bool CProtocol_Packet::Protocol_Packet_HttpComm(XCHAR* ptszMsgBuffer, int* pInt_
159159
意思:是否成功
160160
备注:
161161
*********************************************************************/
162-
bool CProtocol_Packet::Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth)
162+
bool CProtocol_Packet::Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth)
163163
{
164164
Protocol_IsErrorOccur = false;
165165

@@ -174,6 +174,7 @@ bool CProtocol_Packet::Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* p
174174

175175
st_JsonUser["tszUserName"] = pSt_UserAuth->tszUserName;
176176
st_JsonUser["tszUserPass"] = pSt_UserAuth->tszUserPass;
177+
st_JsonUser["tszHWCode"] = pSt_UserAuth->tszHWCode;
177178
st_JsonUser["enDeviceType"] = pSt_UserAuth->enDeviceType;
178179
st_JsonUser["enClientType"] = pSt_UserAuth->enClientType;
179180

XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CProtocol_Packet
2020
bool Protocol_Packet_HDRComm(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, int enDeviceType);
2121
public:
2222
bool Protocol_Packet_HttpComm(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCXSTR lpszMsgBuffer = NULL);
23-
bool Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
23+
bool Protocol_Packet_HttpUserPass(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth);
2424
bool Protocol_Packet_UserTime(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHSESSION_NETCLIENT*** pppSt_ListClient, int nListCount);
2525
bool Protocol_Packet_HttpUserTime(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime);
2626
bool Protocol_Packet_HttpClientInfo(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE* pSt_UserTable);

XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ bool CProtocol_Parse::Protocol_Parse_HttpParseToken(LPCXSTR lpszMsgBuffer, int n
154154
意思:是否成功
155155
备注:
156156
*********************************************************************/
157-
bool CProtocol_Parse::Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth)
157+
bool CProtocol_Parse::Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth)
158158
{
159159
Protocol_IsErrorOccur = false;
160160

@@ -197,6 +197,10 @@ bool CProtocol_Parse::Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nM
197197
{
198198
pSt_UserAuth->enDeviceType = (ENUM_PROTOCOLDEVICE_TYPE)st_JsonProtocol["enDeviceType"].asInt();
199199
}
200+
if (!st_JsonProtocol["tszHWCode"].isNull())
201+
{
202+
_tcsxcpy(pSt_UserAuth->tszHWCode, st_JsonProtocol["tszHWCode"].asCString());
203+
}
200204
return true;
201205
}
202206
/********************************************************************

XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CProtocol_Parse
2020
bool Protocol_Parse_WSHdr(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
2121
public:
2222
bool Protocol_Parse_HttpParseToken(LPCXSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE* pxhToken);
23-
bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
23+
bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth);
2424
bool Protocol_Parse_HttpParseUser(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
2525
bool Protocol_Parse_HttpParsePay(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_PROTOCOL_USERPAY* pSt_UserPay);
2626
bool Protocol_Parse_HttpParseTry(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_TEMPVER* pSt_NETTry);

XEngine_Source/AuthorizeModule_Protocol/pch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extern "C" bool Protocol_Packet_HttpComm(XCHAR * ptszMsgBuffer, int* pInt_MsgLen
3939
{
4040
return m_ProtocolPacket.Protocol_Packet_HttpComm(ptszMsgBuffer, pInt_MsgLen, nCode, lpszMsgBuffer);
4141
}
42-
extern "C" bool Protocol_Packet_HttpUserPass(XCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
42+
extern "C" bool Protocol_Packet_HttpUserPass(XCHAR * ptszMsgBuffer, int* pInt_MsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth)
4343
{
4444
return m_ProtocolPacket.Protocol_Packet_HttpUserPass(ptszMsgBuffer, pInt_MsgLen, pSt_UserAuth);
4545
}
@@ -94,7 +94,7 @@ extern "C" bool Protocol_Parse_HttpParseToken(LPCXSTR lpszMsgBuffer, int nMsgLen
9494
{
9595
return m_ProtocolParse.Protocol_Parse_HttpParseToken(lpszMsgBuffer, nMsgLen, pxhToken);
9696
}
97-
extern "C" bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
97+
extern "C" bool Protocol_Parse_HttpParseAuth(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHORIZE_PROTOCOL_USERAUTHEX* pSt_UserAuth)
9898
{
9999
return m_ProtocolParse.Protocol_Parse_HttpParseAuth(lpszMsgBuffer, nMsgLen, pSt_UserAuth);
100100
}

XEngine_Source/XAuth_Protocol.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,8 @@ typedef struct
224224
XCHAR tszContext[4096]; //信息
225225
XCHAR tszCreateTime[64]; //创建时间
226226
__int64x nID; //ID
227-
}AUTHREG_ANNOUNCEMENT, * LPAUTHREG_ANNOUNCEMENT;
227+
}AUTHREG_ANNOUNCEMENT, * LPAUTHREG_ANNOUNCEMENT;
228+
//扩展登录协议
229+
struct AUTHORIZE_PROTOCOL_USERAUTHEX : public XENGINE_PROTOCOL_USERAUTH {
230+
XCHAR tszHWCode[64];
231+
};

0 commit comments

Comments
 (0)