diff --git a/.github/workflows/Alma_build.yml b/.github/workflows/Alma_build.yml index 11127b1..942b28c 100644 --- a/.github/workflows/Alma_build.yml +++ b/.github/workflows/Alma_build.yml @@ -44,16 +44,18 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 + with: + ref: 'develop' - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine - name: sub module checkout (opensource) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/XEngine_OPenSource path: XEngine_Source/XEngine_DependLibrary @@ -89,7 +91,7 @@ jobs: ./XEngine_AuthorizeService -t - name: Upload folder as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-AlmaLinux_${{ matrix.version }}_${{ matrix.artifact }} path: XEngine_Release/ \ No newline at end of file diff --git a/.github/workflows/Centos_build.yml b/.github/workflows/Centos_build.yml index e3c4ddb..24f0c2c 100644 --- a/.github/workflows/Centos_build.yml +++ b/.github/workflows/Centos_build.yml @@ -48,16 +48,16 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine - name: sub module checkout (opensource) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/XEngine_OPenSource path: XEngine_Source/XEngine_DependLibrary @@ -93,7 +93,7 @@ jobs: ./XEngine_AuthorizeService -t - name: Upload folder as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-CentOS_${{ matrix.version }}_${{ matrix.artifact }} path: XEngine_Release/ \ No newline at end of file diff --git a/.github/workflows/Rocky_build.yml b/.github/workflows/Rocky_build.yml index 90f8ae9..96a5b7d 100644 --- a/.github/workflows/Rocky_build.yml +++ b/.github/workflows/Rocky_build.yml @@ -44,18 +44,18 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine - name: sub module checkout (opensource) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/XEngine_OPenSource path: XEngine_Source/XEngine_DependLibrary @@ -95,7 +95,7 @@ jobs: ./XEngine_AuthorizeService -t - name: Upload folder as artifact with RockyLinux - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-RockyLinux_${{ matrix.version }}_${{ matrix.artifact }} path: XEngine_Release/ diff --git a/.github/workflows/Ubuntu_build.yml b/.github/workflows/Ubuntu_build.yml index 736d591..3eea97a 100644 --- a/.github/workflows/Ubuntu_build.yml +++ b/.github/workflows/Ubuntu_build.yml @@ -24,12 +24,12 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine @@ -102,28 +102,28 @@ jobs: - name: Upload folder as artifact with ubuntu22.04 if: matrix.os == 'ubuntu-22.04' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Ubuntu_22.04_x86-64 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with ubuntu24.04 if: matrix.os == 'ubuntu-24.04' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Ubuntu_24.04_x86-64 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with ubuntu24.04 arm64 if: matrix.os == 'ubuntu-24.04-arm' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Ubuntu_24.04_Arm64 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with ubuntu22.04 arm64 if: matrix.os == 'ubuntu-22.04-arm' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Ubuntu_22.04_Arm64 path: XEngine_Release/ diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 75bb2a8..603dd33 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,12 +25,12 @@ jobs: - language: c-cpp steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine @@ -50,7 +50,7 @@ jobs: sudo ./XEngine_LINEnv.sh -i 3 - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} @@ -60,6 +60,6 @@ jobs: make - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 279b03f..0a6eb20 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' @@ -29,7 +29,7 @@ jobs: continue-on-error: true - name: Upload Cppcheck Results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: cppcheck_results path: static_analysis/log.xml \ No newline at end of file diff --git a/.github/workflows/debian_build.yml b/.github/workflows/debian_build.yml index 7fc58f5..b7bd871 100644 --- a/.github/workflows/debian_build.yml +++ b/.github/workflows/debian_build.yml @@ -36,16 +36,16 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine - name: sub module checkout (opensource) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/XEngine_OPenSource path: XEngine_Source/XEngine_DependLibrary @@ -81,7 +81,7 @@ jobs: ./XEngine_AuthorizeService -t - name: Upload folder as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Debian_${{ matrix.version }}_x86-64 path: XEngine_Release/ diff --git a/.github/workflows/fedora_build.yml b/.github/workflows/fedora_build.yml index 608d9f8..22966aa 100644 --- a/.github/workflows/fedora_build.yml +++ b/.github/workflows/fedora_build.yml @@ -34,16 +34,16 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine - name: sub module checkout (opensource) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/XEngine_OPenSource path: XEngine_Source/XEngine_DependLibrary @@ -82,7 +82,7 @@ jobs: ./XEngine_AuthorizeService -t - name: Upload folder as artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Fedora_${{ matrix.fedora-version }}_${{ matrix.artifact }} path: XEngine_Release/ diff --git a/.github/workflows/macbuild.yml b/.github/workflows/macbuild.yml index 3b5fdc9..911b941 100644 --- a/.github/workflows/macbuild.yml +++ b/.github/workflows/macbuild.yml @@ -20,13 +20,13 @@ jobs: steps: - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' # 检出依赖的xengine仓库到指定的xengine目录 - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine @@ -85,14 +85,14 @@ jobs: - name: Upload folder as artifact with mac x64 if: matrix.os == 'macos-15-intel' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Mac_x86-64 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with mac arm if: matrix.os == 'macos-15' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Mac_Arm64 path: XEngine_Release/ diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index d22204e..55ff8d2 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -21,13 +21,13 @@ jobs: steps: # 检出您的主仓库代码 - name: Checkout main repository code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: 'develop' # 检出依赖的xengine仓库到指定的xengine目录 - name: Checkout dependency repository (xengine) - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: libxengine/libxengine path: libxengine @@ -110,21 +110,21 @@ jobs: - name: Upload folder as artifact with x86 if: matrix.configuration == 'Release' && matrix.platform == 'x86' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Windows_x86-32 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with x64 if: matrix.configuration == 'Release' && matrix.platform == 'x64' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Windows_x86-64 path: XEngine_Release/ retention-days: 1 - name: Upload folder as artifact with Arm64 if: matrix.configuration == 'Release' && matrix.platform == 'Arm64' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: XEngine_AuthorizeService-Windows_Arm64 path: XEngine_Release/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cac7be..8761750 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,12 +12,12 @@ jobs: steps: # 检出代码并包含标签 - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Download Ubuntu build - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: Ubuntu_build.yml workflow_conclusion: success @@ -26,7 +26,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download debian build - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: debian_build.yml workflow_conclusion: success @@ -35,7 +35,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download fedora build - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: fedora_build.yml workflow_conclusion: success @@ -44,7 +44,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download RockyLinux build - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: Rocky_build.yml workflow_conclusion: success @@ -53,7 +53,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download macbuild - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: macbuild.yml workflow_conclusion: success @@ -62,7 +62,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download msbuild - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: msbuild.yml workflow_conclusion: success @@ -71,7 +71,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download Alma Linux - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: Alma_build.yml workflow_conclusion: success @@ -80,7 +80,7 @@ jobs: if_no_artifact_found: fail path: ./XRelease/ - name: Download CentOS - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v16 with: workflow: Centos_build.yml workflow_conclusion: success diff --git a/CHANGELOG b/CHANGELOG index 78a392b..b9b3678 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,22 @@ +XEngine_Authorize V3.22.0.1001 + +ci:更新库依赖环境 +增加:mqtt协议和心跳支持 +优化:发送消息处理流程 +修改:http api函数不区分大小写 +修改:启动参数不区分大小写 +修改:加密通信类型 +修改:序列号生成服务器生成了 + +ci:update version depend +added:mqtt protocol support and heart support +update:depend library +improved:send message process +modify:does not case-sensitive for http api name +modify:start parameter does not case-sensitive +modify:crypt type modify xcrypt to api and improved app manamgent crypt code +modify:Serial number generation is only available after the server has generated it +================================================================ XEngine_Authorize V3.21.0.1001 增加:http 用户可以获取用户时间信息 diff --git a/README.en.md b/README.en.md index 118ae91..2b7e94e 100644 --- a/README.en.md +++ b/README.en.md @@ -30,7 +30,7 @@ Our product is completely free and offers both free and paid technical support. Our feature list not only includes the following but also has many features in development. You can refer to this webpage to learn about the features we plan to support in the future: https://github.com/libxengine/XEngine_Authorize/issues feature list: -1. support http.websocket protocols +1. support http.websocket,MQTT protocols 2. Support Encrypto communication 3. Support User Management 4. Support Serial Management diff --git a/README.md b/README.md index e8ea9b0..3183dbc 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ c c++network Authorize service 我们的功能列表不仅包括下面的,还有很多待开发的功能正在计划中。 你可以参考这个网页了解我们未来支持的功能列表:https://github.com/libxengine/XEngine_Authorize/issues 软件特性: -1. 支持TCP,WEBSOCKET协议 +1. 支持TCP,WEBSOCKET,MQTT协议 2. 支持加密通信 3. 支持用户管理 4. 支持序列卡管理 diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 5d645e9..dc9ebac 100644 Binary files a/XEngine_Docment/Docment_en.docx and b/XEngine_Docment/Docment_en.docx differ diff --git a/XEngine_Docment/Docment_zh.docx b/XEngine_Docment/Docment_zh.docx index 14e88a2..b7884fd 100644 Binary files a/XEngine_Docment/Docment_zh.docx and b/XEngine_Docment/Docment_zh.docx differ diff --git a/XEngine_Release/XEngine_Config/XEngine_Config.json b/XEngine_Release/XEngine_Config/XEngine_Config.json index 4e7db56..955e13e 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -2,6 +2,7 @@ "nTCPPort": 5300, "nWSPort": 5301, "nHTTPPort": 5302, + "nMQTTPort": 5303, "bDeamon": false, "bTimeNotify": false, "XMax": { @@ -10,13 +11,15 @@ "nIOThread": 2, "nTCPThread": 2, "nWSThread": 2, - "nHTTPThread": 2 + "nHTTPThread": 2, + "nMQTTThread": 2 }, "XTime": { "nHeartCheck": 3, "nTCPTime": 5, "nWSTime": 5, - "nHTTPTime": 5 + "nHTTPTime": 5, + "nMQTTTime": 5 }, "XVerification": { "nTokenTimeout": 3600, @@ -51,7 +54,8 @@ } }, "XCrypto": { - "bEnable": false, + "bEnable": true, + "nCryptionType": 1, "tszPassKey": "123123aa" }, "XApiVer": { diff --git a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json index 25dc830..cd70124 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json @@ -1,5 +1,6 @@ { "XVer":[ + "V3.22.0.1001 Build20260316", "V3.21.0.1001 Build20251223", "V3.20.0.1001 Build20251104", "V3.19.0.1001 Build20250826", diff --git a/XEngine_Source/AuthorizeModule_Configure/Config_Define.h b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h index 48de753..0801503 100644 --- a/XEngine_Source/AuthorizeModule_Configure/Config_Define.h +++ b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h @@ -20,6 +20,7 @@ typedef struct int nTCPPort; //TCP端口 int nWSPort; //WEBSOCKET端口 int nHTTPPort; //HTTP管理端口 + int nMQTTPort; //MQTT端口 bool bDeamon; //守护进程,LINUX bool bTimeNotify; //超时通知设置,真为一直通知,假为通知一次关闭客户端 struct @@ -30,12 +31,14 @@ typedef struct int nTCPThread; //TCP业务线程个数 int nWSThread; //WEBSOCKET业务线程个数 int nHTTPThread; //HTTP业务线程个数 + int nMQTTThread; //MQTT业务线程个数 }st_XMax; struct { int nHeartCheck; //检测次数 int nTCPTime; //TCP检测时间 int nWSTime; //WEBSOCKET检测时间 + int nMQTime; //MQTT检测时间 int nHTTPTime; //HTTP检测时间 }st_XTime; struct @@ -82,6 +85,7 @@ typedef struct struct { XCHAR tszCryptoKey[32]; //加密传输密钥 + int nCryptionType; //加密传输类型,参考:ENUM_XENGINE_CRYPTION_SYMMETRIC bool bEnable; //是否启用加密传输 }st_XCrypto; struct diff --git a/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp b/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp index 2cb54bf..904cea7 100644 --- a/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp +++ b/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp @@ -75,10 +75,11 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->nTCPPort = st_JsonRoot["nTCPPort"].asInt(); pSt_ServerConfig->nWSPort = st_JsonRoot["nWSPort"].asInt(); pSt_ServerConfig->nHTTPPort = st_JsonRoot["nHTTPPort"].asInt(); + pSt_ServerConfig->nMQTTPort = st_JsonRoot["nMQTTPort"].asInt(); pSt_ServerConfig->bDeamon = st_JsonRoot["bDeamon"].asBool(); pSt_ServerConfig->bTimeNotify = st_JsonRoot["bTimeNotify"].asBool(); //最大配置 - if (st_JsonRoot["XMax"].empty() || (6 != st_JsonRoot["XMax"].size())) + if (st_JsonRoot["XMax"].empty() || (7 != st_JsonRoot["XMax"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XMAX; @@ -91,8 +92,9 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XMax.nTCPThread = st_JsonXMax["nTCPThread"].asInt(); pSt_ServerConfig->st_XMax.nWSThread = st_JsonXMax["nWSThread"].asInt(); pSt_ServerConfig->st_XMax.nHTTPThread = st_JsonXMax["nHTTPThread"].asInt(); + pSt_ServerConfig->st_XMax.nMQTTThread = st_JsonXMax["nMQTTThread"].asInt(); //时间配置 - if (st_JsonRoot["XTime"].empty() || (4 != st_JsonRoot["XTime"].size())) + if (st_JsonRoot["XTime"].empty() || (5 != st_JsonRoot["XTime"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XTIME; @@ -103,6 +105,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XTime.nTCPTime = st_JsonXTime["nTCPTime"].asInt(); pSt_ServerConfig->st_XTime.nWSTime = st_JsonXTime["nWSTime"].asInt(); pSt_ServerConfig->st_XTime.nHTTPTime = st_JsonXTime["nHTTPTime"].asInt(); + pSt_ServerConfig->st_XTime.nMQTime = st_JsonXTime["nMQTTTime"].asInt(); //验证配置 if (st_JsonRoot["XVerification"].empty() || (8 != st_JsonRoot["XVerification"].size())) { @@ -146,7 +149,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XLogin.st_MulitLogin.bSecond = st_JsonMulitLogin["bSecond"].asBool(); pSt_ServerConfig->st_XLogin.st_MulitLogin.bTime = st_JsonMulitLogin["bTime"].asBool(); //加密配置 - if (st_JsonRoot["XCrypto"].empty() || (2 != st_JsonRoot["XCrypto"].size())) + if (st_JsonRoot["XCrypto"].empty() || (3 != st_JsonRoot["XCrypto"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XCRYPTO; @@ -154,6 +157,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE } Json::Value st_JsonXCrypto = st_JsonRoot["XCrypto"]; pSt_ServerConfig->st_XCrypto.bEnable = st_JsonXCrypto["bEnable"].asBool(); + pSt_ServerConfig->st_XCrypto.nCryptionType = st_JsonXCrypto["nCryptionType"].asInt(); _tcsxcpy(pSt_ServerConfig->st_XCrypto.tszCryptoKey, st_JsonXCrypto["tszPassKey"].asCString()); //接口验证 if (st_JsonRoot["XApiVer"].empty() || (5 != st_JsonRoot["XApiVer"].size())) diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def index cde4e4c..3cfecc6 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def +++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def @@ -25,6 +25,7 @@ EXPORTS Protocol_Parse_HttpParseTry Protocol_Parse_HttpParseTable Protocol_Parse_HttpParseSerial + Protocol_Parse_HttpParseSerial2 Protocol_Parse_HttpParseOnline Protocol_Parse_HttpParseTime Protocol_Parse_HttpParseSwitch diff --git a/XEngine_Source/AuthorizeModule_Protocol/Makefile b/XEngine_Source/AuthorizeModule_Protocol/Makefile index f06fc59..b780f8f 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Makefile +++ b/XEngine_Source/AuthorizeModule_Protocol/Makefile @@ -4,7 +4,7 @@ FILEEXT = LIBFLAG = LOADHDR = -I ./ -I ../XEngine_DependLibrary/XEngine_Module/jsoncpp LOADSO = -L ../XEngine_DependLibrary/XEngine_Module/jsoncpp -LIB = -ljsoncpp -lXEngine_BaseLib +LIB = -ljsoncpp -lXEngine_BaseLib -lRfcComponents_MQTTProtocol LIBEX = OBJECTS = Protocol_Packet.o Protocol_Parse.o pch.o diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h index 366ad8c..9120942 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h @@ -600,6 +600,50 @@ extern "C" bool Protocol_Parse_HttpParseTable(LPCXSTR lpszMsgBuffer, int nMsgLen *********************************************************************/ extern "C" bool Protocol_Parse_HttpParseSerial(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_SERIALTABLE*** pppSt_SerialTable, int* pInt_ListCount); /******************************************************************** +函数名称:Protocol_Parse_HttpParseSerial +函数功能:解析HTTP序列号信息 + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入要解析的大小 + 参数.三:ptszOUTTime + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出过期时间 + 参数.四:ptszHASTime + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出拥有时间 + 参数.五:pInt_SerialCount + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出序列号个数 + 参数.六:pInt_FieldCount + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出字段个数 + 参数.七:penSerialType + In/Out:Out + 类型:枚举型指针 + 可空:N + 意思:输出生成类型 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool Protocol_Parse_HttpParseSerial2(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszExpiredTime, XCHAR* ptszMaxTime, int* pInt_SerialCount, int* pInt_FieldCount, ENUM_VERIFICATION_MODULE_SERIAL_TYPE* penSerialType); +/******************************************************************** 函数名称:Protocol_Parse_HttpParseOnline 函数功能:解析在线列表 参数.一:lpszMsgBuffer diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp index 157fc90..310dfb8 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp @@ -60,11 +60,77 @@ bool CProtocol_Packet::Protocol_Packet_HDRComm(XCHAR* ptszMsgBuffer, int* pInt_M Protocol_dwErrorCode = ERROR_AUTHORIZE_MODULE_PROTOCOL_PARAMENT; return false; } - if (0 == enDeviceType) + + if (XENGINE_AUTH_APP_NETTYPE_TCP == enDeviceType) { *pInt_MsgLen = sizeof(XENGINE_PROTOCOLHDR); memcpy(ptszMsgBuffer, pSt_ProtocolHdr, *pInt_MsgLen); } + else if (XENGINE_AUTH_APP_NETTYPE_MQTT == enDeviceType) + { + int nRVLen = 0; + XCHAR tszRVBuffer[1024] = {}; + + if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REPLOGIN == pSt_ProtocolHdr->unOperatorCode) + { + if (0 == pSt_ProtocolHdr->wReserve) + { + int nRVLen = 0; + int nListCount = 6; + XCHAR tszRVBuffer[1024]; + MQTTPROTOCOL_HDRPROPERTY** ppSt_HDRProperty; + + BaseLib_Memory_Malloc((XPPPMEM)&ppSt_HDRProperty, nListCount, sizeof(MQTTPROTOCOL_HDRPROPERTY)); + + ppSt_HDRProperty[0]->nProLen = 4; + ppSt_HDRProperty[0]->st_unValue.nValue = 1024000; + ppSt_HDRProperty[0]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_PACKMAX; + + ppSt_HDRProperty[1]->nProLen = 1; + ppSt_HDRProperty[1]->st_unValue.byValue = 1; + ppSt_HDRProperty[1]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_REVERAVAI; + + ppSt_HDRProperty[2]->nProLen = 1; + ppSt_HDRProperty[2]->st_unValue.byValue = 1; + ppSt_HDRProperty[2]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_SHAREDSUBAVAI; + + ppSt_HDRProperty[3]->nProLen = 1; + ppSt_HDRProperty[3]->st_unValue.byValue = 1; + ppSt_HDRProperty[3]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_SUBIDAVAI; + + ppSt_HDRProperty[4]->nProLen = 2; + ppSt_HDRProperty[4]->st_unValue.wValue = 65535; + ppSt_HDRProperty[4]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_ALIASMAX; + + ppSt_HDRProperty[5]->nProLen = 1; + ppSt_HDRProperty[5]->st_unValue.byValue = 1; + ppSt_HDRProperty[5]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_WILDCARDSUBAVAI; + + MQTTProtocol_Packet_REPConnect(tszRVBuffer, &nRVLen, 0, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_REASON_SUCCESS, &ppSt_HDRProperty, nListCount); + MQTTProtocol_Packet_Header(ptszMsgBuffer, pInt_MsgLen, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_CONNACK, tszRVBuffer, nRVLen); + BaseLib_Memory_Free((XPPPMEM)&ppSt_HDRProperty, nListCount); + } + else + { + MQTTProtocol_Packet_REPConnect(tszRVBuffer, &nRVLen, 0, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_REASON_USERPASS); + MQTTProtocol_Packet_Header(ptszMsgBuffer, pInt_MsgLen, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_CONNACK, tszRVBuffer, nRVLen); + } + } + else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_EXPIRED == pSt_ProtocolHdr->unOperatorCode) + { + Json::Value st_JsonRoot; + st_JsonRoot["wHeader"] = pSt_ProtocolHdr->wHeader; + st_JsonRoot["wTail"] = pSt_ProtocolHdr->wTail; + st_JsonRoot["xhToken"] = (Json::Value::UInt64)pSt_ProtocolHdr->xhToken; + st_JsonRoot["unOperatorType"] = pSt_ProtocolHdr->unOperatorType; + st_JsonRoot["unOperatorCode"] = pSt_ProtocolHdr->unOperatorCode; + st_JsonRoot["wCrypto"] = pSt_ProtocolHdr->wCrypto; + st_JsonRoot["wReserve"] = pSt_ProtocolHdr->wReserve; + + MQTTProtocol_Packet_REQPublish(tszRVBuffer, &nRVLen, _X("authorize"), st_JsonRoot.toStyledString().c_str(), st_JsonRoot.toStyledString().length()); + MQTTProtocol_Packet_Header(ptszMsgBuffer, pInt_MsgLen, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_PUBLISH, tszRVBuffer, nRVLen); + } + } else { Json::Value st_JsonRoot; diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp index b61170a..8211cec 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp @@ -519,6 +519,94 @@ bool CProtocol_Parse::Protocol_Parse_HttpParseTable(LPCXSTR lpszMsgBuffer, int n } /******************************************************************** 函数名称:Protocol_Parse_HttpParseSerial +函数功能:解析HTTP序列号信息 + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入要解析的大小 + 参数.三:ptszOUTTime + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出过期时间 + 参数.四:ptszHASTime + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出拥有时间 + 参数.五:pInt_SerialCount + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出序列号个数 + 参数.六:pInt_FieldCount + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出字段个数 + 参数.七:penSerialType + In/Out:Out + 类型:枚举型指针 + 可空:N + 意思:输出生成类型 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CProtocol_Parse::Protocol_Parse_HttpParseSerial2(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszExpiredTime, XCHAR* ptszMaxTime, int* pInt_SerialCount, int* pInt_FieldCount, ENUM_VERIFICATION_MODULE_SERIAL_TYPE* penSerialType) +{ + Protocol_IsErrorOccur = false; + + if ((NULL == lpszMsgBuffer) || (NULL == ptszMaxTime)) + { + Protocol_IsErrorOccur = true; + Protocol_dwErrorCode = ERROR_AUTHORIZE_MODULE_PROTOCOL_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + JSONCPP_STRING st_JsonError; + Json::CharReaderBuilder st_ReaderBuilder; + + std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); + if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) + { + Protocol_IsErrorOccur = true; + Protocol_dwErrorCode = ERROR_AUTHORIZE_MODULE_PROTOCOL_PARSE; + return false; + } + Json::Value st_JsonObject = st_JsonRoot["st_SerialInfo"]; + + if (!st_JsonObject["tszExpiredTime"].isNull()) + { + _tcsxcpy(ptszExpiredTime, st_JsonObject["tszExpiredTime"].asCString()); + } + if (!st_JsonObject["tszMaxTime"].isNull()) + { + _tcsxcpy(ptszMaxTime, st_JsonObject["tszMaxTime"].asCString()); + } + if (!st_JsonObject["nSerialCount"].isNull()) + { + *pInt_SerialCount = st_JsonObject["nSerialCount"].asInt(); + } + if (!st_JsonObject["nFieldCount"].isNull()) + { + *pInt_FieldCount = st_JsonObject["nFieldCount"].asInt(); + } + if (!st_JsonObject["enSerialType"].isNull()) + { + *penSerialType = (ENUM_VERIFICATION_MODULE_SERIAL_TYPE)st_JsonObject["enSerialType"].asInt(); + } + return true; +} +/******************************************************************** +函数名称:Protocol_Parse_HttpParseSerial 函数功能:解析HTTP序列号信息 参数.一:lpszMsgBuffer In/Out:In diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h index d1d16f5..2260153 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h @@ -26,6 +26,7 @@ class CProtocol_Parse bool Protocol_Parse_HttpParseTry(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_TEMPVER* pSt_NETTry); bool Protocol_Parse_HttpParseTable(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_USERTABLE* pSt_UserTable); bool Protocol_Parse_HttpParseSerial(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_SERIALTABLE*** pppSt_SerialTable, int* pInt_ListCount); + bool Protocol_Parse_HttpParseSerial2(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszExpiredTime, XCHAR* ptszMaxTime, int* pInt_SerialCount, int* pInt_FieldCount, ENUM_VERIFICATION_MODULE_SERIAL_TYPE* penSerialType); bool Protocol_Parse_HttpParseOnline(LPCXSTR lpszMsgBuffer, int nMsgLen, bool* pbOnline); bool Protocol_Parse_HttpParseTime(LPCXSTR lpszMsgBuffer, int nMsgLen, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime); bool Protocol_Parse_HttpParseSwitch(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_FUNCTIONSWITCH* pSt_FunSwitch); diff --git a/XEngine_Source/AuthorizeModule_Protocol/pch.cpp b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp index 05fe44a..af329aa 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/pch.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp @@ -118,6 +118,10 @@ extern "C" bool Protocol_Parse_HttpParseSerial(LPCXSTR lpszMsgBuffer, int nMsgLe { return m_ProtocolParse.Protocol_Parse_HttpParseSerial(lpszMsgBuffer, nMsgLen, pppSt_SerialTable, pInt_ListCount); } +extern "C" bool Protocol_Parse_HttpParseSerial2(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszExpiredTime, XCHAR* ptszMaxTime, int* pInt_SerialCount, int* pInt_FieldCount, ENUM_VERIFICATION_MODULE_SERIAL_TYPE* penSerialType) +{ + return m_ProtocolParse.Protocol_Parse_HttpParseSerial2(lpszMsgBuffer, nMsgLen, ptszExpiredTime, ptszMaxTime, pInt_SerialCount, pInt_FieldCount, penSerialType); +} extern "C" bool Protocol_Parse_HttpParseOnline(LPCXSTR lpszMsgBuffer, int nMsgLen, bool * pbOnline) { return m_ProtocolParse.Protocol_Parse_HttpParseOnline(lpszMsgBuffer, nMsgLen, pbOnline); diff --git a/XEngine_Source/AuthorizeModule_Protocol/pch.h b/XEngine_Source/AuthorizeModule_Protocol/pch.h index ac92c00..d695634 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/pch.h +++ b/XEngine_Source/AuthorizeModule_Protocol/pch.h @@ -24,6 +24,9 @@ using namespace std; #include #include #include +#include +#include +#include #include "../XEngine_DependLibrary/XEngine_Module/XEngine_Verification/Verification_Define.h" #include "../XAuth_Protocol.h" #include "../AuthorizeModule_Configure/Config_Define.h" @@ -47,6 +50,7 @@ extern XLONG Protocol_dwErrorCode; #ifdef _MSC_BUILD #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") +#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_MQTTProtocol.lib") #ifdef _DEBUG #ifdef _M_X64 #pragma comment(lib,"../x64/Debug/jsoncpp") diff --git a/XEngine_Source/VSCopy_Arm64.bat b/XEngine_Source/VSCopy_Arm64.bat index 9171e7e..67a63d1 100644 --- a/XEngine_Source/VSCopy_Arm64.bat +++ b/XEngine_Source/VSCopy_Arm64.bat @@ -18,6 +18,7 @@ copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_HttpProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_MQTTProtocol.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_Debug.bat b/XEngine_Source/VSCopy_Debug.bat index b200edb..734950f 100644 --- a/XEngine_Source/VSCopy_Debug.bat +++ b/XEngine_Source/VSCopy_Debug.bat @@ -18,6 +18,7 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_XLog.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\RfcComponents_WSProtocol.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\RfcComponents_HttpProtocol.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\RfcComponents_MQTTProtocol.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemApi.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemConfig.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_x64.bat b/XEngine_Source/VSCopy_x64.bat index f7b08fb..d8ed88f 100644 --- a/XEngine_Source/VSCopy_x64.bat +++ b/XEngine_Source/VSCopy_x64.bat @@ -18,6 +18,7 @@ copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" copy /y "%XEngine_Lib64%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" copy /y "%XEngine_Lib64%\XEngine_RfcComponents\RfcComponents_HttpProtocol.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_RfcComponents\RfcComponents_MQTTProtocol.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_x86.bat b/XEngine_Source/VSCopy_x86.bat index 4f31596..7066fbf 100644 --- a/XEngine_Source/VSCopy_x86.bat +++ b/XEngine_Source/VSCopy_x86.bat @@ -18,6 +18,7 @@ copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_HttpProtocol.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_MQTTProtocol.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/XAuth_Protocol.h b/XEngine_Source/XAuth_Protocol.h index c7ac531..22c1d4d 100644 --- a/XEngine_Source/XAuth_Protocol.h +++ b/XEngine_Source/XAuth_Protocol.h @@ -10,6 +10,11 @@ // Purpose: 验证协议头 // History: *********************************************************************/ +#define XENGINE_AUTH_APP_NETTYPE_TCP 0 +#define XENGINE_AUTH_APP_NETTYPE_WS 1 +#define XENGINE_AUTH_APP_NETTYPE_HTTP 2 +#define XENGINE_AUTH_APP_NETTYPE_MQTT 3 + #define XENGINE_AUTHREG_SERVICE_SQL_MAX_USERNAME 32 ////////////////////////////////////////////////////////////////////////// // 导出的协议定义 diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Announcement.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Announcement.cpp index 6e8fc89..a5a122a 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Announcement.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Announcement.cpp @@ -95,44 +95,28 @@ void CDialog_Announcement::OnBnClickedButton1() memset(tszCodecBuffer, '\0', sizeof(tszCodecBuffer)); memset(tszPassBuffer, '\0', sizeof(tszPassBuffer)); ::GetDlgItemText(hConfigWnd, IDC_EDIT6, tszPassBuffer, sizeof(tszPassBuffer)); + ::GetDlgItemText(hConfigWnd, IDC_EDIT6, tszPassBuffer, sizeof(tszPassBuffer)); nMsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); BaseLib_Charset_AnsiToUTF(Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), tszCodecBuffer, &nMsgLen); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Encoder(tszCodecBuffer, &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); - APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); - } - else - { - APIClient_Http_Request(_X("POST"), tszUrlAddr, tszCodecBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + Cryption_Api_CryptEncodec(NULL, (XBYTE *)tszCodecBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } + APIClient_Http_Request(_X("POST"), tszUrlAddr, tszCodecBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + JSONCPP_STRING st_JsonError; Json::CharReaderBuilder st_ReaderBuilder; st_JsonRoot.clear(); std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -191,7 +175,7 @@ void CDialog_Announcement::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -204,23 +188,12 @@ void CDialog_Announcement::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE *)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -269,7 +242,7 @@ void CDialog_Announcement::OnBnClickedButton3() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -282,23 +255,12 @@ void CDialog_Announcement::OnBnClickedButton3() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } for (unsigned int i = 0; i < st_JsonRoot["Array"].size(); i++) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp index 9c1b379..b676834 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp @@ -158,7 +158,7 @@ void CDialog_Banned::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -171,23 +171,12 @@ void CDialog_Banned::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -248,7 +237,7 @@ void CDialog_Banned::OnBnClickedButton4() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -261,23 +250,12 @@ void CDialog_Banned::OnBnClickedButton4() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } for (unsigned int i = 0; i < st_JsonRoot["ArrayAddr"].size(); i++) @@ -376,7 +354,7 @@ void CDialog_Banned::OnBnClickedButton3() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -389,23 +367,12 @@ void CDialog_Banned::OnBnClickedButton3() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析删除黑名单接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析删除黑名单接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析删除黑名单接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -494,7 +461,7 @@ void CDialog_Banned::OnBnClickedButton5() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -507,23 +474,12 @@ void CDialog_Banned::OnBnClickedButton5() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp index 4a86416..1306f2e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp @@ -84,11 +84,13 @@ BOOL CDialog_Config::OnInitDialog() m_ComboPassCodec.InsertString(3, _T("SHA256")); m_ComboPassCodec.SetCurSel(1); - m_ListEncrypto.AddString(_T("XCrypto(X加密)")); - m_ListEncrypto.SetCurSel(0); + m_ListEncrypto.InsertString(0, _T("不启用")); + m_ListEncrypto.InsertString(1, _T("AES128")); + m_ListEncrypto.InsertString(2, _T("AES256")); + m_ListEncrypto.SetCurSel(1); m_ListEncrypto.EnableWindow(false); - m_EditPassword.SetWindowText(_T("123123")); + m_EditPassword.SetWindowText(_T("123123aa")); m_EditPassword.EnableWindow(false); hConfigWnd = m_hWnd; @@ -149,27 +151,16 @@ void CDialog_Config::OnBnClickedButton1() if (BST_CHECKED == m_CheckCodecEnable.GetCheck()) { CString m_StrCodecPass; - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - m_EditPassword.GetWindowText(m_StrCodecPass); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(m_StrCodecPass.GetBuffer())); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("登录失败,无法继续")); - AuthHelp_Windows_Dithering(hMainWnd); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(m_StrCodecPass.GetBuffer()), (ENUM_XENGINE_CRYPTION_SYMMETRIC)m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("登录失败,无法继续")); - AuthHelp_Windows_Dithering(hMainWnd); - return; - } + Authorize_Help_LogPrint(_T("登录失败,无法继续")); + AuthHelp_Windows_Dithering(hMainWnd); + return; } + if (0 != st_JsonRoot["code"].asInt()) { Authorize_Help_LogPrint(_T("登录失败,无法继续")); @@ -216,25 +207,15 @@ void CDialog_Config::OnBnClickedButton2() if (BST_CHECKED == m_CheckCodecEnable.GetCheck()) { CString m_StrCodecPass; - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - m_EditPassword.GetWindowText(m_StrCodecPass); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(m_StrCodecPass.GetBuffer())); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("关闭失败,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(m_StrCodecPass.GetBuffer()), (ENUM_XENGINE_CRYPTION_SYMMETRIC)m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("关闭失败,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("关闭失败,无法继续")); + return; } + if (0 != st_JsonRoot["code"].asInt()) { Authorize_Help_LogPrint(_T("关闭失败,无法继续")); @@ -277,25 +258,15 @@ void CDialog_Config::OnBnClickedButton5() if (BST_CHECKED == m_CheckCodecEnable.GetCheck()) { CString m_StrCodecPass; - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - m_EditPassword.GetWindowText(m_StrCodecPass); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(m_StrCodecPass.GetBuffer())); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("续期失败,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(m_StrCodecPass.GetBuffer()), (ENUM_XENGINE_CRYPTION_SYMMETRIC)m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("续期失败,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("续期失败,无法继续")); + return; } + if (0 != st_JsonRoot["code"].asInt()) { Authorize_Help_LogPrint(_T("续期失败,无法继续")); @@ -349,25 +320,15 @@ void CDialog_Config::OnBnClickedButton8() if (BST_CHECKED == m_CheckCodecEnable.GetCheck()) { CString m_StrCodecPass; - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - m_EditPassword.GetWindowText(m_StrCodecPass); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(m_StrCodecPass.GetBuffer())); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("获取验证码失败,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(m_StrCodecPass.GetBuffer()), (ENUM_XENGINE_CRYPTION_SYMMETRIC)m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("获取验证码失败,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("获取验证码失败,无法继续")); + return; } + if (0 != st_JsonRoot["code"].asInt()) { Authorize_Help_LogPrint(_T("获取验证码失败,无法继续")); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp index 092dc50..d59ee7f 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp @@ -111,7 +111,7 @@ BOOL CDialog_Modify::OnInitDialog() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pConfigWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -125,23 +125,12 @@ BOOL CDialog_Modify::OnInitDialog() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return false; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pConfigWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return false; - } + Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); + return false; } st_JsonObject = st_JsonRoot["st_UserTable"]; @@ -268,7 +257,7 @@ void CDialog_Modify::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pConfigWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -281,23 +270,12 @@ void CDialog_Modify::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pConfigWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp index 8008a9b..db6a832 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp @@ -123,7 +123,7 @@ void CDialog_Serial::OnBnClickedButton1() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -136,23 +136,12 @@ void CDialog_Serial::OnBnClickedButton1() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } for (unsigned int i = 0; i < st_JsonRoot["Array"].size(); i++) @@ -215,32 +204,18 @@ void CDialog_Serial::OnBnClickedButton2() AfxMessageBox(_T("必须配置卡拥有的时间和生成数量")); return; } - Json::Value st_JsonRoot; - Json::Value st_JsonArray; Json::Value st_JsonObject; - m_ComboNumber.GetLBText(m_ComboNumber.GetCurSel(), m_StrNumberCount); USES_CONVERSION; - XCHAR tszTimeStr[XPATH_MIN] = {}; - BaseLib_Time_TimeToStr(tszTimeStr); - for (int i = 0; i < _ttoi(m_StrSerialCount.GetBuffer()); i++) - { - Json::Value st_JsonObject; - XCHAR tszSerialStr[XPATH_MIN] = {}; - Verification_XAuthKey_KeySerial(tszSerialStr, _ttoi(m_StrNumberCount.GetBuffer()), 0); - - st_JsonObject["bIsUsed"] = false; - st_JsonObject["enSerialType"] = m_ComboSerialType.GetCurSel(); - st_JsonObject["tszCreateTime"] = tszTimeStr; - st_JsonObject["tszExpiredTime"] = W2A(m_StrExpiredTime.GetBuffer()); - st_JsonObject["tszMaxTime"] = W2A(m_StrHasTime.GetBuffer()); - st_JsonObject["tszSerialNumber"] = tszSerialStr; - st_JsonObject["tszUserName"] = "NOT"; - st_JsonArray.append(st_JsonObject); - } - st_JsonRoot["Array"] = st_JsonArray; + st_JsonObject["enSerialType"] = m_ComboSerialType.GetCurSel(); + st_JsonObject["tszExpiredTime"] = W2A(m_StrExpiredTime.GetBuffer()); + st_JsonObject["tszMaxTime"] = W2A(m_StrHasTime.GetBuffer()); + st_JsonObject["nSerialCount"] = _ttoi(m_StrSerialCount.GetBuffer()); + st_JsonObject["nFieldCount"] = _ttoi(m_StrNumberCount.GetBuffer()); + + st_JsonRoot["st_SerialInfo"] = st_JsonObject; st_JsonRoot["xhToken"] = _ttoll(m_StrToken.GetBuffer()); int nMsgLen = 0; @@ -257,7 +232,7 @@ void CDialog_Serial::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -270,23 +245,12 @@ void CDialog_Serial::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -356,7 +320,7 @@ void CDialog_Serial::OnBnClickedButton4() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -369,23 +333,12 @@ void CDialog_Serial::OnBnClickedButton4() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -512,7 +465,7 @@ void CDialog_Serial::OnBnClickedButton6() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -525,23 +478,12 @@ void CDialog_Serial::OnBnClickedButton6() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析序列号推送接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析序列号推送接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析序列号推送接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp index 92b4234..0620513 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp @@ -98,7 +98,7 @@ void CDialog_Switch::OnBnClickedButton1() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -111,23 +111,12 @@ void CDialog_Switch::OnBnClickedButton1() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -449,7 +438,7 @@ void CDialog_Switch::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -462,23 +451,12 @@ void CDialog_Switch::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Try.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Try.cpp index d745884..61a3928 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Try.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Try.cpp @@ -80,6 +80,7 @@ void CDialog_Try::OnBnClickedButton1() XCHAR tszUrlAddr[XPATH_MAX]; CString m_StrPosStart; CString m_StrPosEnd; + CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd); memset(tszIPAddr, '\0', XPATH_MAX); memset(tszIPPort, '\0', XPATH_MAX); @@ -112,7 +113,7 @@ void CDialog_Try::OnBnClickedButton1() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -125,23 +126,12 @@ void CDialog_Try::OnBnClickedButton1() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } for (unsigned int i = 0, j = 0; i < st_JsonRoot["Array"].size(); i++) @@ -207,7 +197,7 @@ void CDialog_Try::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -221,23 +211,12 @@ void CDialog_Try::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -347,7 +326,7 @@ void CDialog_Try::OnBnClickedButton3() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -364,7 +343,7 @@ void CDialog_Try::OnBnClickedButton3() XCHAR tszMsgBuffer[2048]; memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp index 50c9c29..faa5e5b 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp @@ -83,6 +83,7 @@ void CDialog_User::OnBnClickedButton1() XCHAR tszUrlAddr[XPATH_MAX]; CString m_StrPosStart; CString m_StrPosEnd; + CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd); memset(tszIPAddr, '\0', XPATH_MAX); memset(tszIPPort, '\0', XPATH_MAX); @@ -121,7 +122,7 @@ void CDialog_User::OnBnClickedButton1() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -134,23 +135,12 @@ void CDialog_User::OnBnClickedButton1() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; } for (unsigned int i = 0, j = 0; i < st_JsonRoot["Array"].size(); i++) @@ -235,7 +225,7 @@ void CDialog_User::OnBnClickedButton2() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -249,23 +239,12 @@ void CDialog_User::OnBnClickedButton2() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) @@ -324,7 +303,7 @@ void CDialog_User::OnBnClickedButton3() memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); nMsgLen = st_JsonRoot.toStyledString().length(); - Cryption_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, W2A(tszPassBuffer)); + Cryption_Api_CryptEncodec((LPCXBTR)st_JsonRoot.toStyledString().c_str(), (XBYTE*)tszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); APIClient_Http_Request(_X("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else @@ -338,23 +317,12 @@ void CDialog_User::OnBnClickedButton3() std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); if (bCrypto) { - XCHAR tszMsgBuffer[2048]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, W2A(tszPassBuffer)); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, W2A(tszPassBuffer), (ENUM_XENGINE_CRYPTION_SYMMETRIC)pWnd->m_ListEncrypto.GetCurSel()); } - else + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { - if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) - { - Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); - return; - } + Authorize_Help_LogPrint(_T("解析客户接口数据错误,无法继续")); + return; } if (0 == st_JsonRoot["code"].asInt()) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_GetTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_GetTask.cpp index 663358e..f0080dd 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_GetTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_GetTask.cpp @@ -13,7 +13,7 @@ bool XEngine_AuthorizeHTTP_GetTask(LPCXSTR lpszClientAddr, XCHAR** pptszList, in memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); BaseLib_String_GetKeyValue(pptszList[0], "=", tszURLKey, tszURLValue); - if (0 == _tcsxnicmp(lpszAPITime, tszURLValue, _tcsxlen(lpszAPITime))) + if (0 == _tcsxncmp(lpszAPITime, tszURLValue, _tcsxlen(lpszAPITime))) { XCHAR tszUserToken[128]; memset(tszUserToken, '\0', sizeof(tszUserToken)); @@ -41,7 +41,7 @@ bool XEngine_AuthorizeHTTP_GetTask(LPCXSTR lpszClientAddr, XCHAR** pptszList, in XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,获取时间成功,用户同时在线数:%d"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIDCode, tszURLValue, _tcsxlen(lpszAPIDCode))) + else if (0 == _tcsxncmp(lpszAPIDCode, tszURLValue, _tcsxlen(lpszAPIDCode))) { if (!st_FunSwitch.bSwitchDCode) { @@ -58,7 +58,7 @@ bool XEngine_AuthorizeHTTP_GetTask(LPCXSTR lpszClientAddr, XCHAR** pptszList, in XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求获得动态验证码成功,TOKEN:%lld,验证码:%d"), lpszClientAddr, xhToken, nDCode); } - else if (0 == _tcsxnicmp(lpszAPINotice, tszURLValue, _tcsxlen(lpszAPINotice))) + else if (0 == _tcsxncmp(lpszAPINotice, tszURLValue, _tcsxlen(lpszAPINotice))) { XCHAR tszUserToken[128]; memset(tszUserToken, '\0', sizeof(tszUserToken)); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp index 0ee1f68..a5fdb8e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp @@ -15,7 +15,7 @@ bool XEngine_AuthorizeHTTP_Token(LPCXSTR lpszClientAddr, XCHAR** pptszList, int memset(tszURLValue, '\0', sizeof(tszURLValue)); BaseLib_String_GetKeyValue(pptszList[0], "=", tszURLKey, tszURLValue); - if (0 == _tcsxnicmp(lpszAPILogin, tszURLValue, _tcsxlen(lpszAPILogin))) + if (0 == _tcsxncmp(lpszAPILogin, tszURLValue, _tcsxlen(lpszAPILogin))) { //http://app.xyry.org:5302/api?function=login&user=123123aa&pass=123123&device=1 XCHAR tszUserName[128]; @@ -116,7 +116,7 @@ bool XEngine_AuthorizeHTTP_Token(LPCXSTR lpszClientAddr, XCHAR** pptszList, int XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求登录获得TOKEN:%lld 成功,用户级别:%d"), lpszClientAddr, xhToken, st_UserTable.st_UserInfo.nUserLevel); } - else if (0 == _tcsxnicmp(lpszAPIUPDate, tszURLValue, _tcsxlen(lpszAPIUPDate))) + else if (0 == _tcsxncmp(lpszAPIUPDate, tszURLValue, _tcsxlen(lpszAPIUPDate))) { //http://app.xyry.org:5302/api?function=update&token=1000112345 XCHAR tszUserToken[128]; @@ -135,7 +135,7 @@ bool XEngine_AuthorizeHTTP_Token(LPCXSTR lpszClientAddr, XCHAR** pptszList, int XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求更新TOKEN:%s 成功"), lpszClientAddr, tszUserToken); } - else if (0 == _tcsxnicmp(lpszAPIClose, tszURLValue, _tcsxlen(lpszAPIClose))) + else if (0 == _tcsxncmp(lpszAPIClose, tszURLValue, _tcsxlen(lpszAPIClose))) { //http://app.xyry.org:5302/api?function=close&token=1000112345 XCHAR tszUserToken[128]; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Announcement.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Announcement.cpp index a192494..9d017fd 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Announcement.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Announcement.cpp @@ -16,7 +16,7 @@ bool XEngine_AuthorizeHTTP_Announcement(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIN return false; } - if (0 == _tcsxnicmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) + if (0 == _tcsxncmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) { int nListCount = 0; AUTHREG_ANNOUNCEMENT st_Announcement; @@ -57,7 +57,7 @@ bool XEngine_AuthorizeHTTP_Announcement(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIN XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,插入公告成功,公告信息:%s"), lpszClientAddr, st_Announcement.tszContext); } - else if (0 == _tcsxnicmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) + else if (0 == _tcsxncmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) { AUTHREG_ANNOUNCEMENT st_Announcement; memset(&st_Announcement, '\0', sizeof(AUTHREG_ANNOUNCEMENT)); @@ -75,7 +75,7 @@ bool XEngine_AuthorizeHTTP_Announcement(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIN XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,删除公告成功.删除公告ID:%lld"), lpszClientAddr, st_Announcement.nID); } - else if (0 == _tcsxnicmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) + else if (0 == _tcsxncmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) { int nListCount = 0; AUTHREG_ANNOUNCEMENT** ppSt_Announcement; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp index 4a743aa..4292500 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp @@ -17,7 +17,7 @@ bool XEngine_AuthorizeHTTP_Banned(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L return false; } - if (0 == _tcsxnicmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) + if (0 == _tcsxncmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) { AUTHREG_BANNED st_Banned; memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); @@ -35,7 +35,7 @@ bool XEngine_AuthorizeHTTP_Banned(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,插入禁用列表成功,禁用的用户:%s,禁用的IP地址:%s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPAddr); } - else if (0 == _tcsxnicmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) + else if (0 == _tcsxncmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) { AUTHREG_BANNED st_Banned; memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); @@ -53,7 +53,7 @@ bool XEngine_AuthorizeHTTP_Banned(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,删除禁用列表成功,删除禁用的用户:%s,删除禁用的IP地址:%s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPAddr); } - else if (0 == _tcsxnicmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) + else if (0 == _tcsxncmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) { int nCountAddr = 0; int nCountUser = 0; @@ -78,7 +78,7 @@ bool XEngine_AuthorizeHTTP_Banned(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L BaseLib_Memory_Free((XPPPMEM)&ppSt_BannedUser, nCountUser); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,查询禁用列表成功,禁用的用户个数:%d,禁用的IP地址个数:%d"), lpszClientAddr, nCountUser, nCountAddr); } - else if (0 == _tcsxnicmp(lpszAPIModify, lpszAPIName, _tcsxlen(lpszAPIModify))) + else if (0 == _tcsxncmp(lpszAPIModify, lpszAPIName, _tcsxlen(lpszAPIModify))) { AUTHREG_BANNED st_Banned; memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp index c48bf28..b99e495 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp @@ -15,7 +15,7 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,CDKey验证授权失败,功能已经被服务器关闭!"), lpszClientAddr); return false; } - if (0 == _tcsxnicmp(lpszAPICreate, lpszAPIName, _tcsxlen(lpszAPICreate))) + if (0 == _tcsxncmp(lpszAPICreate, lpszAPIName, _tcsxlen(lpszAPICreate))) { VERIFICATION_XAUTHKEY st_Authorize = {}; @@ -30,7 +30,7 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPoolSend.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); 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); } - else if (0 == _tcsxnicmp(lpszAPIAuth, lpszAPIName, _tcsxlen(lpszAPIAuth))) + else if (0 == _tcsxncmp(lpszAPIAuth, lpszAPIName, _tcsxlen(lpszAPIAuth))) { VERIFICATION_XAUTHKEY st_Authorize = {}; if (!Verification_XAuthKey_MemoryRead(&st_Authorize, lpszMsgBuffer, nMsgLen)) @@ -52,7 +52,7 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPoolSend.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); 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); } - else if (0 == _tcsxnicmp(lpszAPIVer, lpszAPIName, _tcsxlen(lpszAPIVer))) + else if (0 == _tcsxncmp(lpszAPIVer, lpszAPIName, _tcsxlen(lpszAPIVer))) { VERIFICATION_XAUTHKEY st_Authorize = {}; if (!Verification_XAuthKey_MemoryRead(&st_Authorize, lpszMsgBuffer, nMsgLen)) diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp index 0611ec9..3a85a64 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp @@ -10,7 +10,7 @@ bool XEngine_AuthorizeHTTP_Client(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L LPCXSTR lpszAPIDelete = _X("delete"); CHttpMemory_PoolEx m_MemoryPool(XENGINE_MEMORY_SIZE_MAX); - if (0 == _tcsxnicmp(lpszAPIGet, lpszAPIName, _tcsxlen(lpszAPIGet))) + if (0 == _tcsxncmp(lpszAPIGet, lpszAPIName, _tcsxlen(lpszAPIGet))) { AUTHREG_USERTABLE st_UserTable; memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE)); @@ -36,7 +36,7 @@ bool XEngine_AuthorizeHTTP_Client(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求客户端:%s 信息成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) + else if (0 == _tcsxncmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) { int nOnCount = 0; int nOffCount = 0; @@ -77,7 +77,7 @@ bool XEngine_AuthorizeHTTP_Client(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求客户端列表成功,在线用户:%d,离线用户:%d,显示标志:%d"), lpszClientAddr, nOnCount, nOffCount - nOnCount, bOnline); } - else if (0 == _tcsxnicmp(lpszAPIClose, lpszAPIName, _tcsxlen(lpszAPIClose))) + else if (0 == _tcsxncmp(lpszAPIClose, lpszAPIName, _tcsxlen(lpszAPIClose))) { int nListCount = 0; AUTHSESSION_NETCLIENT** ppSt_ListClient; @@ -101,7 +101,7 @@ bool XEngine_AuthorizeHTTP_Client(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求剔除用户:%s 成功,在线用户数:%d"), lpszClientAddr, st_UserInfo.tszUserName, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIModify, lpszAPIName, _tcsxlen(lpszAPIModify))) + else if (0 == _tcsxncmp(lpszAPIModify, lpszAPIName, _tcsxlen(lpszAPIModify))) { AUTHREG_USERTABLE st_UserTable; memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE)); @@ -128,7 +128,7 @@ bool XEngine_AuthorizeHTTP_Client(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求修改用户信息:%s 成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) + else if (0 == _tcsxncmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) { XENGINE_PROTOCOL_USERINFO st_UserInfo = {}; Protocol_Parse_HttpParseUser(lpszMsgBuffer, nMsgLen, &st_UserInfo); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Pass.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Pass.cpp index 69646fa..3611611 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Pass.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Pass.cpp @@ -10,7 +10,7 @@ bool XEngine_AuthorizeHTTP_Pass(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPC memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - if (0 == _tcsxnicmp(lpszAPIName, lpszAPILogin, _tcsxlen(lpszAPIName))) + if (0 == _tcsxncmp(lpszAPIName, lpszAPILogin, _tcsxlen(lpszAPIName))) { XENGINE_PROTOCOL_USERAUTHEX st_UserAuth; AUTHREG_USERTABLE st_UserTable; @@ -46,7 +46,7 @@ bool XEngine_AuthorizeHTTP_Pass(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPC XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("PASS客户端:%s,请求登录用户:%s 成功"), lpszClientAddr, st_UserAuth.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPILogout, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPILogout, _tcsxlen(lpszAPIName))) { AUTHREG_PROTOCOL_TIME st_ProtocolTime; memset(&st_ProtocolTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME)); @@ -65,7 +65,7 @@ bool XEngine_AuthorizeHTTP_Pass(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPC XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("PASS客户端:%s,用户名:%s,请求离开服务成功"), lpszClientAddr, st_ProtocolTime.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPITimeout, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPITimeout, _tcsxlen(lpszAPIName))) { AUTHREG_PROTOCOL_TIME st_ProtocolTime; memset(&st_ProtocolTime, '\0', sizeof(AUTHREG_PROTOCOL_TIME)); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Serial.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Serial.cpp index 2c82136..308baf1 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Serial.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Serial.cpp @@ -8,7 +8,7 @@ bool XEngine_AuthorizeHTTP_Serial(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L LPCXSTR lpszAPIDelete = _X("delete"); CHttpMemory_PoolEx m_MemoryPool(XENGINE_MEMORY_SIZE_MAX); - if (0 == _tcsxnicmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) + if (0 == _tcsxncmp(lpszAPIList, lpszAPIName, _tcsxlen(lpszAPIList))) { int nPosStart = 0; int nPosEnd = 0; @@ -44,7 +44,7 @@ bool XEngine_AuthorizeHTTP_Serial(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L ptszMsgBuffer = NULL; XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求序列号列表成功,个数:%d"), lpszClientAddr, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) + else if (0 == _tcsxncmp(lpszAPIDelete, lpszAPIName, _tcsxlen(lpszAPIDelete))) { int nListCount = 0; AUTHREG_SERIALTABLE** ppSt_SerialTable; @@ -69,30 +69,41 @@ bool XEngine_AuthorizeHTTP_Serial(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求删除序列号成功,删除个数:%d"), lpszClientAddr, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) + else if (0 == _tcsxncmp(lpszAPIInsert, lpszAPIName, _tcsxlen(lpszAPIInsert))) { - int nListCount = 0; - AUTHREG_SERIALTABLE** ppSt_SerialTable; + int nSerialCount = 0; + int nFieldCount = 0; + ENUM_VERIFICATION_MODULE_SERIAL_TYPE enSerialType; + XCHAR tszExpiredTime[64] = {}; + XCHAR tszMaxTime[64] = {}; + XCHAR tszCreateTime[64] = {}; - Protocol_Parse_HttpParseSerial(lpszMsgBuffer, nMsgLen, &ppSt_SerialTable, &nListCount); - if (0 == st_AuthConfig.st_XSql.nDBType) + Protocol_Parse_HttpParseSerial2(lpszMsgBuffer, nMsgLen, tszExpiredTime, tszMaxTime, &nSerialCount, &nFieldCount, &enSerialType); + BaseLib_Time_TimeToStr(tszCreateTime); + + for (int i = 0; i < nSerialCount; i++) { - for (int i = 0; i < nListCount; i++) + AUTHREG_SERIALTABLE st_SerialTable = {}; + st_SerialTable.bIsUsed = false; + st_SerialTable.enSerialType = enSerialType; + _xstprintf(st_SerialTable.tszUserName, _X("NOT")); + _tcsxcpy(st_SerialTable.tszCreateTime, tszCreateTime); + _tcsxcpy(st_SerialTable.tszExpiredTime, tszExpiredTime); + _tcsxcpy(st_SerialTable.tszMaxTime, tszMaxTime); + Verification_XAuthKey_KeySerial(st_SerialTable.tszSerialNumber, nFieldCount, 0); + + if (0 == st_AuthConfig.st_XSql.nDBType) { - DBModule_SQLite_SerialInsert(ppSt_SerialTable[i]); + DBModule_SQLite_SerialInsert(&st_SerialTable); } - } - else - { - for (int i = 0; i < nListCount; i++) + else { - DBModule_SQLite_SerialInsert(ppSt_SerialTable[i]); + DBModule_SQLite_SerialInsert(&st_SerialTable); } } - BaseLib_Memory_Free((XPPPMEM)&ppSt_SerialTable, nListCount); Protocol_Packet_HttpComm(m_MemoryPool.get(), &nSDLen); XEngine_Client_TaskSend(lpszClientAddr, m_MemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求插入自定义序列号成功,个数:%d"), lpszClientAddr, nListCount); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求插入自定义序列号成功,个数:%d"), lpszClientAddr, nSerialCount); } return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp index 8303c7c..cd559e6 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp @@ -9,13 +9,13 @@ bool XEngine_AuthorizeHTTP_Switch(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, L memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - if (0 == _tcsxnicmp(lpszAPIGet, lpszAPIName, _tcsxlen(lpszAPIGet))) + if (0 == _tcsxncmp(lpszAPIGet, lpszAPIName, _tcsxlen(lpszAPIGet))) { Protocol_Packet_HttpSwitch(tszSDBuffer, &nSDLen, &st_FunSwitch); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求获取功能开关成功,删除功能:%d,登录功能:%d,找回密码:%d,充值功能:%d,注册功能:%d,CDKey功能:%d,公告系统:%d,多端登录:%d,临时试用:%d,普通Token:%d,硬件码登录:%d,硬件码绑定:%d"), lpszClientAddr, st_FunSwitch.bSwitchDelete, st_FunSwitch.bSwitchLogin, st_FunSwitch.bSwitchPass, st_FunSwitch.bSwitchPay, st_FunSwitch.bSwitchRegister, st_FunSwitch.bSwitchCDKey, st_FunSwitch.bSwitchNotice, st_FunSwitch.bSwitchMulti, st_FunSwitch.bSwitchTry, st_FunSwitch.bSwitchTokenLogin, st_FunSwitch.bSwitchHCLogin, st_FunSwitch.bSwitchHWBind); } - else if (0 == _tcsxnicmp(lpszAPISet, lpszAPIName, _tcsxlen(lpszAPISet))) + else if (0 == _tcsxncmp(lpszAPISet, lpszAPIName, _tcsxlen(lpszAPISet))) { Protocol_Parse_HttpParseSwitch(lpszMsgBuffer, nMsgLen, &st_FunSwitch); Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Try.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Try.cpp index e8feb6c..de1d24e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Try.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Try.cpp @@ -11,7 +11,7 @@ bool XEngine_AuthorizeHTTP_Try(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPCX memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - if (0 == _tcsxnicmp(lpszAPIName, lpszAPIList, _tcsxlen(lpszAPIName))) + if (0 == _tcsxncmp(lpszAPIName, lpszAPIList, _tcsxlen(lpszAPIName))) { int nPosStart = 0; int nPosEnd = 0; @@ -34,7 +34,7 @@ bool XEngine_AuthorizeHTTP_Try(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPCX XEngine_Client_TaskSend(lpszClientAddr, m_HTTPMemoryPool.get(), nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,临时验证获取列表成功,列表个数:%d"), lpszClientAddr, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPIDelete, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPIDelete, _tcsxlen(lpszAPIName))) { AUTHREG_TEMPVER st_VERTemp; memset(&st_VERTemp, '\0', sizeof(AUTHREG_TEMPVER)); @@ -52,7 +52,7 @@ bool XEngine_AuthorizeHTTP_Try(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,序列号:%s,临时验证删除成功"), lpszClientAddr, st_VERTemp.tszVSerial); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPIModify, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPIModify, _tcsxlen(lpszAPIName))) { AUTHREG_TEMPVER st_VERTemp; memset(&st_VERTemp, '\0', sizeof(AUTHREG_TEMPVER)); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp index eb242d3..2d14883 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp @@ -13,7 +13,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - if (0 == _tcsxnicmp(lpszAPIName, lpszAPIDelete, _tcsxlen(lpszAPIName))) + if (0 == _tcsxncmp(lpszAPIName, lpszAPIDelete, _tcsxlen(lpszAPIName))) { if (!st_FunSwitch.bSwitchDelete) { @@ -37,7 +37,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX bRet = DBModule_MySQL_UserQuery(st_UserInfo.tszUserName, &st_UserTable); } //安全验证判断 - if ((0 != _tcsxnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcsxlen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber)) + if ((0 != _tcsxncmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcsxlen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber)) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_NOTMATCH, "user information is incorrent"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); @@ -74,7 +74,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求删除用户:%s 成功,在线用户数:%d"), lpszClientAddr, st_UserInfo.tszUserName, nListCount); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPIRegister, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPIRegister, _tcsxlen(lpszAPIName))) { //用户注册 AUTHREG_USERTABLE st_UserTable; @@ -154,7 +154,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,注册成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPIPay, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPIPay, _tcsxlen(lpszAPIName))) { AUTHREG_PROTOCOL_USERPAY st_UserPay; AUTHREG_USERTABLE st_UserInfo; @@ -223,7 +223,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE, _X("HTTP客户端:%s,用户名:%s,充值成功,序列号:%s"), lpszClientAddr, st_UserPay.tszUserName, st_UserPay.tszSerialNumber); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPIPass, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPIPass, _tcsxlen(lpszAPIName))) { AUTHREG_USERTABLE st_UserTable; XENGINE_PROTOCOL_USERINFO st_UserInfo; @@ -263,7 +263,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX return false; } //安全验证判断 - if ((0 != _tcsxnicmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcsxlen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber) || (st_UserTable.st_UserInfo.nPhoneNumber != st_UserInfo.nPhoneNumber)) + if ((0 != _tcsxncmp(st_UserInfo.tszEMailAddr, st_UserTable.st_UserInfo.tszEMailAddr, _tcsxlen(st_UserInfo.tszEMailAddr))) || (st_UserTable.st_UserInfo.nIDNumber != st_UserInfo.nIDNumber) || (st_UserTable.st_UserInfo.nPhoneNumber != st_UserInfo.nPhoneNumber)) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_NOTMATCH, "user information is incorrent"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); @@ -298,7 +298,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,找回重置密码成功"), lpszClientAddr, st_UserInfo.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPITime, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPITime, _tcsxlen(lpszAPIName))) { if (!st_FunSwitch.bSwitchTime) { @@ -359,7 +359,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,获取时间成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName); } - else if (0 == _tcsxnicmp(lpszAPIName, lpszAPITry, _tcsxlen(lpszAPIName))) + else if (0 == _tcsxncmp(lpszAPIName, lpszAPITry, _tcsxlen(lpszAPIName))) { AUTHREG_TEMPVER st_VERTemp; memset(&st_VERTemp, '\0', sizeof(AUTHREG_TEMPVER)); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp index 1369937..c798a21 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Config.cpp @@ -24,47 +24,47 @@ bool Authorize_Service_Parament(int argc, char** argv) for (int i = 0;i < argc;i++) { - if (0 == _tcsxicmp("-h", argv[i])) + if (0 == _tcsxcmp("-h", argv[i])) { Authorize_Service_ParamentHelp(); return false; } - else if (0 == _tcsxicmp("-d", argv[i])) + else if (0 == _tcsxcmp("-d", argv[i])) { st_AuthConfig.bDeamon = _ttxoi(argv[++i]); } - else if (0 == _tcsxicmp("-tp", argv[i])) + else if (0 == _tcsxcmp("-tp", argv[i])) { st_AuthConfig.nTCPPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxicmp("-wp", argv[i])) + else if (0 == _tcsxcmp("-wp", argv[i])) { st_AuthConfig.nWSPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxicmp("-hp", argv[i])) + else if (0 == _tcsxcmp("-hp", argv[i])) { st_AuthConfig.nHTTPPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxicmp("-t", argv[i])) + else if (0 == _tcsxcmp("-t", argv[i])) { bIsTest = true; } - else if (0 == _tcsxicmp("-lt", argv[i])) + else if (0 == _tcsxcmp("-lt", argv[i])) { st_AuthConfig.st_XLog.nLogType = _ttxoi(argv[++i]); } - else if (0 == _tcsxicmp("-l", argv[i])) + else if (0 == _tcsxcmp("-l", argv[i])) { LPCXSTR lpszLogLevel = argv[++i]; - if (0 == _tcsxicmp("debug", lpszLogLevel)) + if (0 == _tcsxcmp("debug", lpszLogLevel)) { st_AuthConfig.st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG; } - else if (0 == _tcsxicmp("detail", lpszLogLevel)) + else if (0 == _tcsxcmp("detail", lpszLogLevel)) { st_AuthConfig.st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DETAIL; } - else if (0 == _tcsxicmp("info", lpszLogLevel)) + else if (0 == _tcsxcmp("info", lpszLogLevel)) { st_AuthConfig.st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO; } diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h index 44ced79..150c60d 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h @@ -46,6 +46,8 @@ using namespace std; #include #include #include +#include +#include #include "../../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h" #include "../../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport/InfoReport_Error.h" #include "../../XEngine_DependLibrary/XEngine_Module/XEngine_Verification/Verification_Define.h" @@ -68,6 +70,7 @@ extern XHANDLE xhLog; extern XHANDLE xhTCPSocket; extern XHANDLE xhWSSocket; extern XHANDLE xhHttpSocket; +extern XHANDLE xhMQTTSocket; extern XHANDLE xhTCPPacket; extern XHANDLE xhWSPacket; @@ -76,19 +79,17 @@ extern XHANDLE xhHttpPacket; extern XHANDLE xhTCPHeart; extern XHANDLE xhWSHeart; extern XHANDLE xhHTTPHeart; +extern XHANDLE xhMQTTHeart; extern XHANDLE xhMemPool; extern XHANDLE xhTCPPool; extern XHANDLE xhWSPool; extern XHANDLE xhHttpPool; +extern XHANDLE xhMQTTPool; extern XENGINE_SERVICECONFIG st_AuthConfig; extern XENGINE_FUNCTIONSWITCH st_FunSwitch; -#define XENGINE_AUTH_APP_NETTYPE_TCP 0 -#define XENGINE_AUTH_APP_NETTYPE_WS 1 -#define XENGINE_AUTH_APP_NETTYPE_HTTP 2 - #include "Authorize_HttpMemory.h" #include "Authorize_Config.h" #include "Authorize_Net.h" @@ -96,6 +97,7 @@ extern XENGINE_FUNCTIONSWITCH st_FunSwitch; #include "Authorize_TCPTask.h" #include "Authorize_WSTask.h" #include "Authorize_HttpTask.h" +#include "Authorize_MQTTTask.h" #include "AuthorizeHTTP_Post/AuthorizeHTTP_User.h" #include "AuthorizeHTTP_Post/AuthorizeHTTP_Client.h" #include "AuthorizeHTTP_Post/AuthorizeHTTP_Serial.h" @@ -121,6 +123,7 @@ extern XENGINE_FUNCTIONSWITCH st_FunSwitch; #pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Packets.lib") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_WSProtocol.lib") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_HttpProtocol.lib") +#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_MQTTProtocol.lib") #ifdef _DEBUG #ifdef _M_X64 #pragma comment(lib,"../../x64/Debug/AuthorizeModule_Configure.lib") diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp index d6fb0ce..411c9b3 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp @@ -26,14 +26,9 @@ XHTHREAD XCALLBACK XEngine_AuthService_HttpThread(XPVOID lParam) { if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszDeBuffer[2048] = {}; - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); - XEngine_Client_HttpTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_HTTPParament, ppszListHdr, nHdrCount); - } - else - { - XEngine_Client_HttpTask(ppSt_ListClient[i]->tszClientAddr, ptszMsgBuffer, nMsgLen, &st_HTTPParament, ppszListHdr, nHdrCount); + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMsgBuffer, &nMsgLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); } + XEngine_Client_HttpTask(ppSt_ListClient[i]->tszClientAddr, ptszMsgBuffer, nMsgLen, &st_HTTPParament, ppszListHdr, nHdrCount); } BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); BaseLib_Memory_Free((XPPPMEM)&ppszListHdr, nHdrCount); @@ -180,7 +175,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,HTTP验证类型:%d 通过"), lpszClientAddr, nVType); } - if (0 == _tcsxnicmp(lpszMethodPost, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodPost))) + if (0 == _tcsxncmp(lpszMethodPost, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodPost))) { XCHAR tszAPIType[64]; XCHAR tszAPIVer[64]; @@ -202,7 +197,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int memset(tszAPIName, '\0', sizeof(tszAPIName)); HttpProtocol_ServerHelp_GetUrlApi(pSt_HTTPParament->tszHttpUri, tszAPIType, tszAPIVer, tszAPIName); - if (0 != _tcsxnicmp(lpszAPIType, tszAPIType, _tcsxlen(lpszAPIType))) + if (0 != _tcsxncmp(lpszAPIType, tszAPIType, _tcsxlen(lpszAPIType))) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_REQUEST, "request url is incorrent"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); @@ -221,7 +216,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int return false; } - if (0 == _tcsxnicmp(lpszAPIVerClient, tszAPIVer, _tcsxlen(lpszAPIVerClient))) + if (0 == _tcsxncmp(lpszAPIVerClient, tszAPIVer, _tcsxlen(lpszAPIVerClient))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -233,7 +228,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Client(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerSerial, tszAPIVer, _tcsxlen(lpszAPIVerSerial))) + else if (0 == _tcsxncmp(lpszAPIVerSerial, tszAPIVer, _tcsxlen(lpszAPIVerSerial))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -245,7 +240,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Serial(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerSwitch, tszAPIVer, _tcsxlen(lpszAPIVerSwitch))) + else if (0 == _tcsxncmp(lpszAPIVerSwitch, tszAPIVer, _tcsxlen(lpszAPIVerSwitch))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -257,7 +252,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Switch(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerBanned, tszAPIVer, _tcsxlen(lpszAPIVerBanned))) + else if (0 == _tcsxncmp(lpszAPIVerBanned, tszAPIVer, _tcsxlen(lpszAPIVerBanned))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -269,7 +264,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Banned(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerNotice, tszAPIVer, _tcsxlen(lpszAPIVerNotice))) + else if (0 == _tcsxncmp(lpszAPIVerNotice, tszAPIVer, _tcsxlen(lpszAPIVerNotice))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -281,7 +276,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Announcement(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerTry, tszAPIVer, _tcsxlen(lpszAPIVerTry))) + else if (0 == _tcsxncmp(lpszAPIVerTry, tszAPIVer, _tcsxlen(lpszAPIVerTry))) { //验证权限 if (0 != st_UserTable.st_UserInfo.nUserLevel) @@ -303,15 +298,15 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } else { - if (0 == _tcsxnicmp(lpszAPIVerPass, tszAPIVer, _tcsxlen(lpszAPIVerPass))) + if (0 == _tcsxncmp(lpszAPIVerPass, tszAPIVer, _tcsxlen(lpszAPIVerPass))) { XEngine_AuthorizeHTTP_Pass(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerCDKey, tszAPIVer, _tcsxlen(lpszAPIVerCDKey))) + else if (0 == _tcsxncmp(lpszAPIVerCDKey, tszAPIVer, _tcsxlen(lpszAPIVerCDKey))) { XEngine_AuthorizeHTTP_CDKey(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } - else if (0 == _tcsxnicmp(lpszAPIVerUser, tszAPIVer, _tcsxlen(lpszAPIVerUser))) + else if (0 == _tcsxncmp(lpszAPIVerUser, tszAPIVer, _tcsxlen(lpszAPIVerUser))) { XEngine_AuthorizeHTTP_User(xhToken, lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } @@ -324,7 +319,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } } } - else if (0 == _tcsxnicmp(lpszMethodGet, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodGet))) + else if (0 == _tcsxncmp(lpszMethodGet, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodGet))) { int nListCount = 0; XCHAR** pptszList; @@ -336,7 +331,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int memset(tszUrlName, '\0', sizeof(tszUrlName)); HttpProtocol_ServerHelp_GetParament(pSt_HTTPParament->tszHttpUri, &pptszList, &nListCount, tszUrlName); - if ((nListCount < 1) || (0 != _tcsxnicmp(lpszFuncName, tszUrlName, _tcsxlen(lpszFuncName)))) + if ((nListCount < 1) || (0 != _tcsxncmp(lpszFuncName, tszUrlName, _tcsxlen(lpszFuncName)))) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_REQUEST, "request is failed"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); @@ -351,8 +346,8 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int memset(tszURLValue, '\0', sizeof(tszURLValue)); BaseLib_String_GetKeyValue(pptszList[0], "=", tszURLKey, tszURLValue); - if (0 == _tcsxnicmp(lpszAPIVerDCode, tszURLValue, _tcsxlen(lpszAPIVerDCode)) || 0 == _tcsxnicmp(lpszAPIVerTime, tszURLValue, _tcsxlen(lpszAPIVerTime)) || - 0 == _tcsxnicmp(lpszAPIVerNotice, tszURLValue, _tcsxlen(lpszAPIVerNotice))) + if (0 == _tcsxncmp(lpszAPIVerDCode, tszURLValue, _tcsxlen(lpszAPIVerDCode)) || 0 == _tcsxncmp(lpszAPIVerTime, tszURLValue, _tcsxlen(lpszAPIVerTime)) || + 0 == _tcsxncmp(lpszAPIVerNotice, tszURLValue, _tcsxlen(lpszAPIVerNotice))) { XEngine_AuthorizeHTTP_GetTask(lpszClientAddr, pptszList, nListCount); } @@ -362,7 +357,7 @@ bool XEngine_Client_HttpTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } BaseLib_Memory_Free((XPPPMEM)&pptszList, nListCount); } - else if (0 == _tcsxnicmp(lpszMethodOPtion, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodOPtion))) + else if (0 == _tcsxncmp(lpszMethodOPtion, pSt_HTTPParament->tszHttpMethod, _tcsxlen(lpszMethodOPtion))) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.cpp new file mode 100644 index 0000000..377557d --- /dev/null +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.cpp @@ -0,0 +1,120 @@ +#include "Authorize_Hdr.h" + +XHTHREAD XCALLBACK Authorize_MQTTTask_Thread(XPVOID lParam) +{ + int nThreadPos = *(int*)lParam; + nThreadPos++; + while (bIsRun) + { + if (!MQTTProtocol_Parse_WaitEvent(nThreadPos)) + { + continue; + } + int nListCount = 0; + XENGINE_MANAGEPOOL_TASKEVENT** ppSst_ListAddr; + + MQTTProtocol_Parse_GetPool(nThreadPos, &ppSst_ListAddr, &nListCount); + for (int i = 0; i < nListCount; i++) + { + for (int j = 0; j < ppSst_ListAddr[i]->nPktCount; j++) + { + int nMSGLen = 0; + XCHAR *ptszMSGBuffer = NULL; + MQTTPROTOCOL_FIXEDHEADER st_MQTTHdr = {}; + + if (MQTTProtocol_Parse_Recv(ppSst_ListAddr[i]->tszClientAddr, &st_MQTTHdr, &ptszMSGBuffer, &nMSGLen)) + { + if (st_AuthConfig.st_XCrypto.bEnable) + { + Cryption_Api_CryptDecodec(NULL, (XBYTE*)ptszMSGBuffer, &nMSGLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); + } + Authorize_MQTTTask_Handle(ppSst_ListAddr[i]->tszClientAddr, &st_MQTTHdr, ptszMSGBuffer, nMSGLen); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMSGBuffer); + } + } + } + BaseLib_Memory_Free((XPPPMEM)&ppSst_ListAddr, nListCount); + } + return 0; +} +void Packet_Property(MQTTPROTOCOL_HDRPROPERTY*** pppSt_HDRProperty, int nListCount) +{ + BaseLib_Memory_Malloc((XPPPMEM)pppSt_HDRProperty, nListCount, sizeof(MQTTPROTOCOL_HDRPROPERTY)); + + (*pppSt_HDRProperty)[0]->nProLen = 4; + (*pppSt_HDRProperty)[0]->st_unValue.nValue = 1024000; + (*pppSt_HDRProperty)[0]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_PACKMAX; + + (*pppSt_HDRProperty)[1]->nProLen = 1; + (*pppSt_HDRProperty)[1]->st_unValue.byValue = 1; + (*pppSt_HDRProperty)[1]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_REVERAVAI; + + (*pppSt_HDRProperty)[2]->nProLen = 1; + (*pppSt_HDRProperty)[2]->st_unValue.byValue = 1; + (*pppSt_HDRProperty)[2]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_SHAREDSUBAVAI; + + (*pppSt_HDRProperty)[3]->nProLen = 1; + (*pppSt_HDRProperty)[3]->st_unValue.byValue = 1; + (*pppSt_HDRProperty)[3]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_SUBIDAVAI; + + (*pppSt_HDRProperty)[4]->nProLen = 2; + (*pppSt_HDRProperty)[4]->st_unValue.wValue = 65535; + (*pppSt_HDRProperty)[4]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_ALIASMAX; + + (*pppSt_HDRProperty)[5]->nProLen = 1; + (*pppSt_HDRProperty)[5]->st_unValue.byValue = 1; + (*pppSt_HDRProperty)[5]->byProFlag = XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_PROPERTY_WILDCARDSUBAVAI; +} +bool Authorize_MQTTTask_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt_MQTTHdr, LPCXSTR lpszMSGBuffer, int nMSGLen) +{ + int nSDLen = 0; + int nRVLen = 0; + XCHAR tszSDBuffer[1024]; + XCHAR tszRVBuffer[1024]; + + memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); + memset(tszRVBuffer, '\0', sizeof(tszRVBuffer)); + //是不是连接 + if (XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_CONNECT == pSt_MQTTHdr->byMsgType) + { + int nListCount = 0; + MQTTPROTOCOL_HDRPROPERTY** ppSt_HDRProperty; + MQTTPROTOCOL_HDRCONNNECT st_HDRConnect = {}; + MQTTPROTOCOL_USERINFO st_USerInfo = {}; + + if (!MQTTProtocol_Parse_Connect(lpszMSGBuffer, nMSGLen, &st_HDRConnect, &st_USerInfo, &ppSt_HDRProperty, &nListCount)) + { + //错误断开连接 + MQTTProtocol_Packet_DisConnect(tszRVBuffer, &nRVLen); + MQTTProtocol_Packet_Header(tszSDBuffer, &nSDLen, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_DISCONN, tszRVBuffer, nRVLen); + //XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_MQAPP_NETTYPE_MQTT); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("MQTT客户端:%s,请求链接失败,错误码:%lX"), lpszClientAddr, MQTTProtocol_GetLastError()); + return false; + } + BaseLib_Memory_Free((XPPPMEM)&ppSt_HDRProperty, nListCount); + + XENGINE_PROTOCOLHDR st_ProtocolHdr = {}; + XENGINE_PROTOCOL_USERAUTH st_ProtocolAuth = {}; + st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER; + st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_AUTH; + st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_REQLOGIN; + st_ProtocolHdr.unPacketSize = sizeof(XENGINE_PROTOCOL_USERAUTH); + st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL; + + st_ProtocolAuth.enClientType = ENUM_PROTOCOL_FOR_SERVICE_TYPE_USER; + st_ProtocolAuth.enDeviceType = ENUM_PROTOCOL_FOR_DEVICE_TYPE_MOBILE_EMBEDDED; + _tcsxcpy(st_ProtocolAuth.tszUserName, st_USerInfo.tszClientUser); + _tcsxcpy(st_ProtocolAuth.tszUserPass, st_USerInfo.tszClientPass); + + XEngine_Client_TCPTask(lpszClientAddr, (LPCXSTR)&st_ProtocolAuth, sizeof(XENGINE_PROTOCOL_USERAUTH), &st_ProtocolHdr, XENGINE_AUTH_APP_NETTYPE_MQTT); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("MQTT客户端:%s,请求链接成功,客户端ID:%s,用户名:%s"), lpszClientAddr, st_USerInfo.tszClientID, st_USerInfo.tszClientUser); + return true; + } + else if (XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_PINGREQ == pSt_MQTTHdr->byMsgType) + { + MQTTProtocol_Packet_Header(tszSDBuffer, &nSDLen, XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_PINGREP); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_MQTT); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("MQTT客户端:%s,请求了心跳PING协议成功"), lpszClientAddr); + } + return true; +} \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.h new file mode 100644 index 0000000..a325c52 --- /dev/null +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_MQTTTask.h @@ -0,0 +1,4 @@ +#pragma once + +XHTHREAD XCALLBACK Authorize_MQTTTask_Thread(XPVOID lParam); +bool Authorize_MQTTTask_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt_MQTTHdr, LPCXSTR lpszMSGBuffer, int nMSGLen); \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp index 163e819..204ecb9 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp @@ -88,6 +88,31 @@ void XCALLBACK XEngine_Client_HttpHeart(LPCXSTR lpszClientAddr, XSOCKET hSocket, XEngine_CloseClient(lpszClientAddr, 2); } ////////////////////////////////////////////////////////////////////////// +bool XCALLBACK XEngine_Client_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +{ + MQTTProtocol_Parse_Insert(lpszClientAddr); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("MQTT客户端:%s,链接到服务器"), lpszClientAddr); + return true; +} +void XCALLBACK XEngine_Client_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) +{ + if (!MQTTProtocol_Parse_Send(lpszClientAddr, lpszRecvMsg, nMsgLen)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("MQTT客户端:%s,投递MQTT数据包到消息队列失败,错误:%lX"), lpszClientAddr, MQTTProtocol_GetLastError()); + return; + } + SocketOpt_HeartBeat_ActiveAddrEx(xhMQTTSocket, lpszClientAddr); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("MQTT客户端:%s,投递MQTT数据包到消息队列成功,%d"), lpszClientAddr, nMsgLen); +} +void XCALLBACK XEngine_Client_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +{ + XEngine_CloseClient(lpszClientAddr, 0); +} +void XCALLBACK XEngine_Client_MQTTHeart(LPCXSTR lpszClientAddr, XSOCKET hSocket, int nStatus, XPVOID lParam) +{ + XEngine_CloseClient(lpszClientAddr, 2); +} +////////////////////////////////////////////////////////////////////////// bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType) { xstring m_StrLeave; @@ -96,6 +121,7 @@ bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType) NetCore_TCPXCore_CloseForClientEx(xhTCPSocket, lpszClientAddr); NetCore_TCPXCore_CloseForClientEx(xhWSSocket, lpszClientAddr); NetCore_TCPXCore_CloseForClientEx(xhHttpSocket, lpszClientAddr); + NetCore_TCPXCore_CloseForClientEx(xhMQTTSocket, lpszClientAddr); SocketOpt_HeartBeat_DeleteAddrEx(xhTCPHeart, lpszClientAddr); SocketOpt_HeartBeat_DeleteAddrEx(xhWSHeart, lpszClientAddr); @@ -114,15 +140,15 @@ bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType) NetCore_TCPXCore_CloseForClientEx(xhTCPSocket, lpszClientAddr); NetCore_TCPXCore_CloseForClientEx(xhWSSocket, lpszClientAddr); NetCore_TCPXCore_CloseForClientEx(xhHttpSocket, lpszClientAddr); + NetCore_TCPXCore_CloseForClientEx(xhMQTTSocket, lpszClientAddr); m_StrLeave = _X("心跳断开"); } HelpComponents_Datas_DeleteEx(xhTCPPacket, lpszClientAddr); RfcComponents_WSPacket_DeleteEx(xhWSPacket, lpszClientAddr); HttpProtocol_Server_CloseClinetEx(xhHttpPacket, lpszClientAddr); - - AUTHSESSION_NETCLIENT st_NETClient; - memset(&st_NETClient, '\0', sizeof(AUTHSESSION_NETCLIENT)); + MQTTProtocol_Parse_Delete(lpszClientAddr); + AUTHSESSION_NETCLIENT st_NETClient = {}; if (Session_Authorize_GetUserForAddr(lpszClientAddr, &st_NETClient)) { AUTHREG_PROTOCOL_TIME st_AuthTime; @@ -156,31 +182,20 @@ bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType) } ////////////////////////////////////////////////////////////////////////// bool XEngine_Client_TaskSend(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType) -{ - if (st_AuthConfig.st_XCrypto.bEnable) - { - XEngine_SendMsg(lpszClientAddr, lpszMsgBuffer, nMsgLen, nNetType, st_AuthConfig.st_XCrypto.tszCryptoKey); - } - else - { - XEngine_SendMsg(lpszClientAddr, lpszMsgBuffer, nMsgLen, nNetType); - } - return true; -} -bool XEngine_SendMsg(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType, LPCXSTR lpszPass) { CHttpMemory_PoolEx m_HTTPMemory(XENGINE_MEMORY_SIZE_MAX); + if (XENGINE_AUTH_APP_NETTYPE_WS == nNetType) { - if (NULL == lpszPass) + if (st_AuthConfig.st_XCrypto.bEnable) { - RfcComponents_WSCodec_EncodeMsg(lpszMsgBuffer, m_HTTPMemory.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); + CHttpMemory_PoolEx m_CodecMemory(XENGINE_MEMORY_SIZE_MAX); + Cryption_Api_CryptEncodec((LPCXBTR)lpszMsgBuffer, (XBYTE*)m_CodecMemory.get(), &nMsgLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); + RfcComponents_WSCodec_EncodeMsg(m_CodecMemory.get(), m_HTTPMemory.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); } else { - CHttpMemory_PoolEx m_CodecMemory(XENGINE_MEMORY_SIZE_MAX); - Cryption_XCrypto_Encoder(lpszMsgBuffer, &nMsgLen, (XBYTE*)m_CodecMemory.get(), lpszPass); - RfcComponents_WSCodec_EncodeMsg(m_CodecMemory.get(), m_HTTPMemory.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); + RfcComponents_WSCodec_EncodeMsg(lpszMsgBuffer, m_HTTPMemory.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); } NetCore_TCPXCore_SendEx(xhWSSocket, lpszClientAddr, m_HTTPMemory.get(), nMsgLen); SocketOpt_HeartBeat_ActiveAddrEx(xhWSHeart, lpszClientAddr); @@ -190,23 +205,31 @@ bool XEngine_SendMsg(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, NetCore_TCPXCore_SendEx(xhTCPSocket, lpszClientAddr, lpszMsgBuffer, nMsgLen); SocketOpt_HeartBeat_ActiveAddrEx(xhTCPHeart, lpszClientAddr); } + else if (XENGINE_AUTH_APP_NETTYPE_MQTT == nNetType) + { + if (!NetCore_TCPXCore_SendEx(xhMQTTSocket, lpszClientAddr, lpszMsgBuffer, nMsgLen)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给MQTT客户端:%s,失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError()); + return false; + } + SocketOpt_HeartBeat_ActiveAddrEx(xhMQTTSocket, lpszClientAddr); + } else { int nSDSize = XENGINE_MEMORY_SIZE_MAX; - RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam; - memset(&st_HDRParam, '\0', sizeof(RFCCOMPONENTS_HTTP_HDRPARAM)); + RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam = {}; st_HDRParam.nHttpCode = 200; st_HDRParam.bIsClose = true; - if (NULL == lpszPass) + if (st_AuthConfig.st_XCrypto.bEnable) { - HttpProtocol_Server_SendMsgEx(xhHttpPacket, m_HTTPMemory.get(), &nSDSize, &st_HDRParam, lpszMsgBuffer, nMsgLen); + CHttpMemory_PoolEx m_CodecMemory(XENGINE_MEMORY_SIZE_MAX); + Cryption_Api_CryptEncodec((LPCXBTR)lpszMsgBuffer, (XBYTE*)m_CodecMemory.get(), &nMsgLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); + HttpProtocol_Server_SendMsgEx(xhHttpPacket, m_HTTPMemory.get(), &nSDSize, &st_HDRParam, m_CodecMemory.get(), nMsgLen); } else { - CHttpMemory_PoolEx m_CodecMemory(XENGINE_MEMORY_SIZE_MAX); - Cryption_XCrypto_Encoder(lpszMsgBuffer, &nMsgLen, (XBYTE*)m_CodecMemory.get(), lpszPass); - HttpProtocol_Server_SendMsgEx(xhHttpPacket, m_HTTPMemory.get(), &nSDSize, &st_HDRParam, m_CodecMemory.get(), nMsgLen); + HttpProtocol_Server_SendMsgEx(xhHttpPacket, m_HTTPMemory.get(), &nSDSize, &st_HDRParam, lpszMsgBuffer, nMsgLen); } NetCore_TCPXCore_SendEx(xhHttpSocket, lpszClientAddr, m_HTTPMemory.get(), nSDSize); SocketOpt_HeartBeat_ActiveAddrEx(xhHTTPHeart, lpszClientAddr); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h index 3e7e53d..f36f609 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.h @@ -15,6 +15,10 @@ void XCALLBACK XEngine_Client_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, void XCALLBACK XEngine_Client_HttpClose(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); void XCALLBACK XEngine_Client_HttpHeart(LPCXSTR lpszClientAddr, XSOCKET hSocket, int nStatus, XPVOID lParam); +bool XCALLBACK XEngine_Client_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +void XCALLBACK XEngine_Client_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); +void XCALLBACK XEngine_Client_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +void XCALLBACK XEngine_Client_MQTTHeart(LPCXSTR lpszClientAddr, XSOCKET hSocket, int nStatus, XPVOID lParam); + bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType = 0); -bool XEngine_Client_TaskSend(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType); -bool XEngine_SendMsg(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType, LPCXSTR lpszPass = NULL); \ No newline at end of file +bool XEngine_Client_TaskSend(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType); \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp index d0329c2..e5b8d27 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp @@ -27,16 +27,11 @@ XHTHREAD XCALLBACK XEngine_AuthService_TCPThread(XPVOID lParam) { continue; } - if (st_AuthConfig.st_XCrypto.bEnable && (ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT == st_ProtocolHdr.wCrypto)) + if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszDeBuffer[2048] = {}; - Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); - XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_ProtocolHdr, XENGINE_AUTH_APP_NETTYPE_TCP); - } - else - { - XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, &st_ProtocolHdr, XENGINE_AUTH_APP_NETTYPE_TCP); + Cryption_Api_CryptDecodec(NULL, (XBYTE*)tszMsgBuffer, &nMsgLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); } + XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, &st_ProtocolHdr, XENGINE_AUTH_APP_NETTYPE_TCP); } BaseLib_Memory_Free((XPPPMEM)&ppSt_ListClient, nListCount); } diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp index b7dfd5d..cd804b4 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp @@ -27,14 +27,9 @@ XHTHREAD XCALLBACK XEngine_AuthService_WSThread(XPVOID lParam) } if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszDeBuffer[2048] = {}; - Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); - XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, enOPCode); - } - else - { - XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, enOPCode); + Cryption_Api_CryptDecodec(NULL, (XBYTE*)tszMsgBuffer, &nMsgLen, st_AuthConfig.st_XCrypto.tszCryptoKey, (ENUM_XENGINE_CRYPTION_SYMMETRIC)st_AuthConfig.st_XCrypto.nCryptionType); } + XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszMsgBuffer, nMsgLen, enOPCode); } BaseLib_Memory_Free((XPPPMEM)&ppSt_ListClient, nListCount); } diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile index e953eb1..386b47b 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile @@ -6,10 +6,10 @@ LOADHDR = -I ./ LOADSO = -L ../../XEngine_DependLibrary/XEngine_Module/jsoncpp -L ../../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport -L ../../XEngine_DependLibrary/XEngine_Module/XEngine_Verification \ -L ../../AuthorizeModule_Session -L ../../AuthorizeModule_Database -L ../../AuthorizeModule_Protocol -L ../../AuthorizeModule_Configure -L ../../AuthorizeModule_Help -L ../../AuthorizeModule_CDKey LIB = -lXEngine_InfoReport -ljsoncpp -lXEngine_Verification \ - -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_Cryption -lXClient_APIHelp -lNetHelp_APIAddr -lHelpComponents_Packets -lHelpComponents_DataBase -lHelpComponents_XLog -lRfcComponents_WSProtocol -lRfcComponents_HttpProtocol -lXEngine_SystemApi \ + -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_Cryption -lXClient_APIHelp -lNetHelp_APIAddr -lHelpComponents_Packets -lHelpComponents_DataBase -lHelpComponents_XLog -lRfcComponents_WSProtocol -lRfcComponents_HttpProtocol -lRfcComponents_MQTTProtocol -lXEngine_SystemApi \ -lAuthorizeModule_Session -lAuthorizeModule_Database -lAuthorizeModule_Protocol -lAuthorizeModule_Configure -lAuthorizeModule_Help LIBEX = -OBJECTS = Authorize_Config.o Authorize_Net.o Authorize_Task.o Authorize_TCPTask.o Authorize_WSTask.o Authorize_HttpTask.o XEngine_AuthorizeService.o \ +OBJECTS = Authorize_Config.o Authorize_Net.o Authorize_Task.o Authorize_TCPTask.o Authorize_WSTask.o Authorize_HttpTask.o Authorize_MQTTTask.o XEngine_AuthorizeService.o \ AuthorizeHTTP_Client.o AuthorizeHTTP_Serial.o AuthorizeHTTP_User.o AuthorizeHTTP_Pass.o AuthorizeHTTP_Switch.o AuthorizeHTTP_Banned.o AuthorizeHTTP_CDKey.o AuthorizeHTTP_Announcement.o AuthorizeHTTP_Try.o\ AuthorizeHTTP_Token.o AuthorizeHTTP_GetTask.o @@ -66,6 +66,8 @@ Authorize_WSTask.o:./Authorize_WSTask.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./Authorize_WSTask.cpp Authorize_HttpTask.o:./Authorize_HttpTask.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./Authorize_HttpTask.cpp +Authorize_MQTTTask.o:./Authorize_MQTTTask.cpp + $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./Authorize_MQTTTask.cpp AuthorizeHTTP_Client.o:./AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./AuthorizeHTTP_Post/AuthorizeHTTP_Client.cpp diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp index c20c264..1cde9f1 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp @@ -7,6 +7,7 @@ XHANDLE xhLog = NULL; XHANDLE xhTCPSocket = NULL; XHANDLE xhWSSocket = NULL; XHANDLE xhHttpSocket = NULL; +XHANDLE xhMQTTSocket = NULL; XHANDLE xhTCPPacket = NULL; XHANDLE xhWSPacket = NULL; @@ -15,11 +16,13 @@ XHANDLE xhHttpPacket = NULL; XHANDLE xhTCPHeart = NULL; XHANDLE xhWSHeart = NULL; XHANDLE xhHTTPHeart = NULL; +XHANDLE xhMQTTHeart = NULL; XHANDLE xhMemPool = NULL; XHANDLE xhTCPPool = NULL; XHANDLE xhWSPool = NULL; XHANDLE xhHttpPool = NULL; +XHANDLE xhMQTTPool = NULL; XENGINE_SERVICECONFIG st_AuthConfig; XENGINE_FUNCTIONSWITCH st_FunSwitch; @@ -34,18 +37,22 @@ void ServiceApp_Stop(int signo) HelpComponents_Datas_Destory(xhTCPPacket); RfcComponents_WSPacket_DestoryEx(xhWSPacket); HttpProtocol_Server_DestroyEx(xhHttpPacket); + MQTTProtocol_Parse_Destory(); NetCore_TCPXCore_DestroyEx(xhTCPSocket); NetCore_TCPXCore_DestroyEx(xhWSSocket); NetCore_TCPXCore_DestroyEx(xhHttpSocket); + NetCore_TCPXCore_DestroyEx(xhMQTTSocket); SocketOpt_HeartBeat_DestoryEx(xhTCPHeart); SocketOpt_HeartBeat_DestoryEx(xhWSHeart); SocketOpt_HeartBeat_DestoryEx(xhHTTPHeart); + SocketOpt_HeartBeat_DestoryEx(xhMQTTHeart); ManagePool_Thread_NQDestroy(xhTCPPool); ManagePool_Thread_NQDestroy(xhWSPool); ManagePool_Thread_NQDestroy(xhHttpPool); + ManagePool_Thread_NQDestroy(xhMQTTPool); ManagePool_Memory_Destory(xhMemPool); HelpComponents_XLog_StrongClose(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE); @@ -140,6 +147,8 @@ int main(int argc, char** argv) THREADPOOL_PARAMENT** ppSt_ListTCPThread; THREADPOOL_PARAMENT** ppSt_ListWSThread; THREADPOOL_PARAMENT** ppSt_ListHttpThread; + THREADPOOL_PARAMENT** ppSt_ListMQTTParam; + LPCXSTR lpszHTTPMime = _X("./XEngine_Config/HttpMime.types"); LPCXSTR lpszHTTPCode = _X("./XEngine_Config/HttpCode.types"); @@ -286,7 +295,7 @@ int main(int argc, char** argv) XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化WebSocket组包器失败,错误:%lX"), WSFrame_GetLastError()); goto XENGINE_EXITAPP; } - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化WebSocket组包器成功,任务池个数:%d"), st_AuthConfig.st_XMax.nWSThread); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化WEBSOCKET组包器成功,任务池个数:%d"), st_AuthConfig.st_XMax.nWSThread); xhWSSocket = NetCore_TCPXCore_StartEx(st_AuthConfig.nWSPort, st_AuthConfig.st_XMax.nMaxQueue, st_AuthConfig.st_XMax.nIOThread); if (NULL == xhWSSocket) @@ -371,6 +380,62 @@ int main(int argc, char** argv) xhHttpPool = ManagePool_Thread_NQCreate(&ppSt_ListHttpThread, st_AuthConfig.st_XMax.nHTTPThread); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化HTTP任务线程池成功,线程个数:%d"), st_AuthConfig.st_XMax.nHTTPThread); } + //MQTT服务 + if (st_AuthConfig.nMQTTPort > 0) + { + if (!MQTTProtocol_Parse_Init(st_AuthConfig.st_XMax.nMQTTThread)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务器中,初始化MQTT组包失败,错误:%lX"), MQTTProtocol_GetLastError()); + goto XENGINE_EXITAPP; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化MQTT组包成功,IO线程个数:%d"), st_AuthConfig.st_XMax.nMQTTThread); + + xhMQTTSocket = NetCore_TCPXCore_StartEx(st_AuthConfig.nMQTTPort, st_AuthConfig.st_XMax.nMaxClient, st_AuthConfig.st_XMax.nMQTTThread); + if (NULL == xhMQTTSocket) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动MQTT网络服务器失败,错误:%lX"), NetCore_GetLastError()); + goto XENGINE_EXITAPP; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动MQTT网络服务器成功,MQTT端口:%d,IO:%d"), st_AuthConfig.nMQTTPort, st_AuthConfig.st_XMax.nMQTTThread); + NetCore_TCPXCore_RegisterCallBackEx(xhMQTTSocket, XEngine_Client_MQTTLogin, XEngine_Client_MQTTRecv, XEngine_Client_MQTTLeave); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,注册MQTT网络事件成功")); + + if (st_AuthConfig.st_XTime.nMQTime > 0) + { + xhMQTTHeart = SocketOpt_HeartBeat_InitEx(st_AuthConfig.st_XTime.nHeartCheck, st_AuthConfig.st_XTime.nMQTime, XEngine_Client_MQTTHeart); + if (NULL == xhMQTTHeart) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化MQTT心跳服务失败,错误:%lX"), NetCore_GetLastError()); + goto XENGINE_EXITAPP; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化MQTT心跳服务成功,检测次数:%d,检测时间:%d"), st_AuthConfig.st_XTime.nHeartCheck, st_AuthConfig.st_XTime.nMQTime); + } + else + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,检测到MQTT心跳服务没有启用")); + } + + BaseLib_Memory_Malloc((XPPPMEM)&ppSt_ListMQTTParam, st_AuthConfig.st_XMax.nMQTTThread, sizeof(THREADPOOL_PARAMENT)); + for (int i = 0; i < st_AuthConfig.st_XMax.nMQTTThread; i++) + { + int* pInt_Pos = new int; + + *pInt_Pos = i; + ppSt_ListMQTTParam[i]->lParam = pInt_Pos; + ppSt_ListMQTTParam[i]->fpCall_ThreadsTask = Authorize_MQTTTask_Thread; + } + xhWSPool = ManagePool_Thread_NQCreate(&ppSt_ListMQTTParam, st_AuthConfig.st_XMax.nMQTTThread); + if (NULL == xhWSPool) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动MQTT线程池服务失败,错误:%lX"), ManagePool_GetLastError()); + goto XENGINE_EXITAPP; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动MQTT线程池服务成功,启动个数:%d"), st_AuthConfig.st_XMax.nMQTTThread); + } + else + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,MQTT消息服务没有被启用")); + } if (st_AuthConfig.st_XCrypto.bEnable) { @@ -448,18 +513,22 @@ int main(int argc, char** argv) HelpComponents_Datas_Destory(xhTCPPacket); RfcComponents_WSPacket_DestoryEx(xhWSPacket); HttpProtocol_Server_DestroyEx(xhHttpPacket); + MQTTProtocol_Parse_Destory(); NetCore_TCPXCore_DestroyEx(xhTCPSocket); NetCore_TCPXCore_DestroyEx(xhWSSocket); NetCore_TCPXCore_DestroyEx(xhHttpSocket); + NetCore_TCPXCore_DestroyEx(xhMQTTSocket); SocketOpt_HeartBeat_DestoryEx(xhTCPHeart); SocketOpt_HeartBeat_DestoryEx(xhWSHeart); SocketOpt_HeartBeat_DestoryEx(xhHTTPHeart); + SocketOpt_HeartBeat_DestoryEx(xhMQTTHeart); ManagePool_Thread_NQDestroy(xhTCPPool); ManagePool_Thread_NQDestroy(xhWSPool); ManagePool_Thread_NQDestroy(xhHttpPool); + ManagePool_Thread_NQDestroy(xhMQTTPool); ManagePool_Memory_Destory(xhMemPool); HelpComponents_XLog_StrongClose(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_NOTICE); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj index 264a063..bdd8488 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj @@ -244,6 +244,7 @@ + @@ -266,6 +267,7 @@ + diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters index 54e46c7..ff32cae 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters @@ -81,6 +81,9 @@ 源文件\AuthorizeHTTP_Get + + 源文件 + @@ -140,5 +143,8 @@ 头文件 + + 头文件 + \ No newline at end of file diff --git a/XEngine_Source/XEngine_DependLibrary b/XEngine_Source/XEngine_DependLibrary index 1db2b64..207abe8 160000 --- a/XEngine_Source/XEngine_DependLibrary +++ b/XEngine_Source/XEngine_DependLibrary @@ -1 +1 @@ -Subproject commit 1db2b6460dd13016df0052808bf2f8ae82ba901f +Subproject commit 207abe8b617744e35bf1438a03536d898ddc93fd