33bool XEngine_AuthorizeHTTP_CDKey (LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPCXSTR lpszMsgBuffer, int nMsgLen)
44{
55 int nSDLen = 0 ;
6- int nRVLen = 0 ;
76 LPCXSTR lpszAPICreate = _X (" create" );
87 LPCXSTR lpszAPIAuth = _X (" auth" );
98 LPCXSTR lpszAPIVer = _X (" ver" );
109
1110 CHttpMemory_PoolEx m_MemoryPoolSend (XENGINE_MEMORY_SIZE_MAX);
12- CHttpMemory_PoolEx m_MemoryPoolRecv (XENGINE_MEMORY_SIZE_MAX);
1311 if (!st_FunSwitch.bSwitchCDKey )
1412 {
1513 Protocol_Packet_HttpComm (m_MemoryPoolSend.get (), &nSDLen, ERROR_AUTHORIZE_PROTOCOL_CLOSED, " the function is closed" );
@@ -22,20 +20,20 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP
2220 VERIFICATION_XAUTHKEY st_Authorize = {};
2321
2422 Verification_XAuthKey_KeyInit (&st_Authorize);
25- if (!Verification_XAuthKey_WriteMemory (m_MemoryPoolRecv .get (), &nRVLen, &st_Authorize ))
23+ if (!Verification_XAuthKey_MemoryWrite (&st_Authorize, m_MemoryPoolSend .get (), &nSDLen ))
2624 {
2725 Protocol_Packet_HttpComm (m_MemoryPoolSend.get (), &nSDLen, ERROR_AUTHORIZE_PROTOCOL_SERVER, " Not Acceptable,write key failed" );
2826 XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend.get (), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
2927 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求创建CDKEY协议失败,读取CDKEY失败:%lX" ), lpszClientAddr, Verification_GetLastError ());
3028 return false ;
3129 }
32- XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolRecv .get (), nRVLen , XENGINE_AUTH_APP_NETTYPE_HTTP);
30+ XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend .get (), nSDLen , XENGINE_AUTH_APP_NETTYPE_HTTP);
3331 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X (" HTTP客户端:%s,请求创建CDKEY成功,APP名:%s,APP版本:%s" ), lpszClientAddr, st_Authorize.st_AuthAppInfo .tszAppName , st_Authorize.st_AuthAppInfo .tszAppVer );
3432 }
3533 else if (0 == _tcsxnicmp (lpszAPIAuth, lpszAPIName, _tcsxlen (lpszAPIAuth)))
3634 {
3735 VERIFICATION_XAUTHKEY st_Authorize = {};
38- if (!Verification_XAuthKey_ReadMemory (lpszMsgBuffer, nMsgLen, &st_Authorize ))
36+ if (!Verification_XAuthKey_MemoryRead (&st_Authorize, lpszMsgBuffer, nMsgLen ))
3937 {
4038 Protocol_Packet_HttpComm (m_MemoryPoolSend.get (), &nSDLen, ERROR_AUTHORIZE_PROTOCOL_CDKEY, " Not Acceptable,read key failed" );
4139 XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend.get (), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
@@ -50,13 +48,14 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP
5048 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求创建授权CDKEY协议失败,读取CDKEY失败:%lX" ), lpszClientAddr, Verification_GetLastError ());
5149 return false ;
5250 }
53- XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolRecv.get (), nRVLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
51+ Verification_XAuthKey_MemoryWrite (&st_Authorize, m_MemoryPoolSend.get (), &nSDLen);
52+ XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend.get (), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
5453 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X (" HTTP客户端:%s,请求授权CDKEY成功,APP名:%s,APP版本:%s,授权期限:%s" ), lpszClientAddr, st_Authorize.st_AuthAppInfo .tszAppName , st_Authorize.st_AuthAppInfo .tszAppVer , st_Authorize.st_AuthRegInfo .tszLeftTime );
5554 }
5655 else if (0 == _tcsxnicmp (lpszAPIVer, lpszAPIName, _tcsxlen (lpszAPIVer)))
5756 {
5857 VERIFICATION_XAUTHKEY st_Authorize = {};
59- if (!Verification_XAuthKey_ReadMemory (lpszMsgBuffer, nMsgLen, &st_Authorize ))
58+ if (!Verification_XAuthKey_MemoryRead (&st_Authorize, lpszMsgBuffer, nMsgLen ))
6059 {
6160 Protocol_Packet_HttpComm (m_MemoryPoolSend.get (), &nSDLen, ERROR_AUTHORIZE_PROTOCOL_CDKEY, " Not Acceptable,read key failed" );
6261 XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend.get (), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
@@ -77,8 +76,8 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP
7776 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X (" HTTP客户端:%s,请求验证CDKEY失败,cdkey未授权或者已超时,错误:%lX" ), lpszClientAddr, Verification_GetLastError ());
7877 return false ;
7978 }
80- Verification_XAuthKey_WriteMemory (m_MemoryPoolRecv .get (), &nRVLen, &st_Authorize );
81- XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolRecv .get (), nRVLen , XENGINE_AUTH_APP_NETTYPE_HTTP);
79+ Verification_XAuthKey_MemoryWrite (&st_Authorize, m_MemoryPoolSend .get (), &nSDLen );
80+ XEngine_Client_TaskSend (lpszClientAddr, m_MemoryPoolSend .get (), nSDLen , XENGINE_AUTH_APP_NETTYPE_HTTP);
8281 XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X (" HTTP客户端:%s,请求验证CDKEY成功,APP名:%s,APP版本:%s,授权期限:%s" ), lpszClientAddr, st_Authorize.st_AuthAppInfo .tszAppName , st_Authorize.st_AuthAppInfo .tszAppVer , st_Authorize.st_AuthRegInfo .tszLeftTime );
8382 }
8483 else
0 commit comments