diff --git a/.github/workflows/RockyArm64_build.yml b/.github/workflows/RockyArm64_build.yml new file mode 100644 index 0000000..afeca0e --- /dev/null +++ b/.github/workflows/RockyArm64_build.yml @@ -0,0 +1,78 @@ +name: rocky Arm64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + env: + IMAGE_NAME: rockylinux/rockylinux:9.5 + + strategy: + fail-fast: false + matrix: + arch: [linux/arm64] + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build ${{ matrix.arch }} + run: | + docker run --platform ${{ matrix.arch }} --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace ${{ env.IMAGE_NAME }} /bin/sh -c ' + set -e + dnf update -y + dnf install --allowerasing git make g++ wget curl jq unzip -y + + git config --global --add safe.directory /workspace + git submodule init + git submodule update + + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_RockyLinux_9_Arm64.zip + unzip ./XEngine_RockyLinux_9_Arm64.zip -d ./XEngine_RockyLinux_9_Arm64 + cd XEngine_RockyLinux_9_Arm64 + + chmod 777 ./XEngine_LINEnv.sh + ./XEngine_LINEnv.sh -i 0 + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/lib64 \; + ldconfig + cd .. + + cd XEngine_Source + make ARCH=Arm64 RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + cd .. + + cd XEngine_Release + ./XEngine_MQServiceApp -t + chown -R $(id -u):$(id -g) . + chmod -R a+r . ' + + - name: Upload folder as artifact with RockyLinux + uses: actions/upload-artifact@v4 + with: + name: XEngine_MQServiceApp-RockyLinux_9_Arm64 + path: XEngine_Release/ + retention-days: 1 diff --git a/.github/workflows/RockyX86_64_build.yml b/.github/workflows/RockyX86_64_build.yml new file mode 100644 index 0000000..c8ef9ee --- /dev/null +++ b/.github/workflows/RockyX86_64_build.yml @@ -0,0 +1,83 @@ +name: rocky x86_64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + container: + image: rockylinux/rockylinux:9.5 + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: sub module checkout (opensource) + uses: actions/checkout@v4 + with: + repository: libxengine/XEngine_OPenSource + path: XEngine_Source/XEngine_Depend + + - name: install system package + run: | + dnf update -y + dnf install gcc g++ make git jq unzip -y + # 设置依赖库的环境变量 + - name: Set up Dependency rocky linux Environment + run: | + cd libxengine + chmod 777 * + ./XEngine_LINEnv.sh -i 0 + - name: install xengine library + run: | + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_RockyLinux_9_x86-64.zip + unzip ./XEngine_RockyLinux_9_x86-64.zip -d ./XEngine_RockyLinux_9_x86-64 + cd XEngine_RockyLinux_9_x86-64 + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/lib64 \; + ldconfig + + - name: make + run: | + cd XEngine_Source + make + make FLAGS=InstallAll + make FLAGS=CleanAll + + make RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + + - name: test + run: | + cd XEngine_Release + ./XEngine_MQServiceApp -t + + - name: Upload folder as artifact with RockyLinux + uses: actions/upload-artifact@v4 + with: + name: XEngine_MQServiceApp-RockyLinux_9_x86_64 + path: XEngine_Release/ + retention-days: 1 diff --git a/.github/workflows/UbuntuArm64_build.yml b/.github/workflows/UbuntuArm64_build.yml new file mode 100644 index 0000000..bc4cb38 --- /dev/null +++ b/.github/workflows/UbuntuArm64_build.yml @@ -0,0 +1,74 @@ +name: ubuntu Arm64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + build: + runs-on: ubuntu-24.04 + env: + IMAGE_NAME: ubuntu:24.04 + + strategy: + fail-fast: false + matrix: + arch: [linux/arm64] + + steps: + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build ${{ matrix.arch }} + run: | + docker run --platform ${{ matrix.arch }} --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace ${{ env.IMAGE_NAME }} /bin/sh -c ' + set -e + apt update -y + apt install git make g++ wget curl jq unzip -y + + git config --global --add safe.directory /workspace + git submodule init + git submodule update + + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_UBuntu_24.04_Arm64.zip + unzip ./XEngine_UBuntu_24.04_Arm64.zip -d ./XEngine_UBuntu_24.04_Arm64 + cd XEngine_UBuntu_24.04_Arm64 + + chmod 777 ./XEngine_LINEnv.sh + ./XEngine_LINEnv.sh -i 0 + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/local/lib \; + ldconfig + cd .. + + cd XEngine_Source + make ARCH=Arm64 RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + cd .. + + cd XEngine_Release + ./XEngine_MQServiceApp -t + chown -R $(id -u):$(id -g) . + chmod -R a+r . ' + + - name: Upload folder as artifact with ubuntu Arm64 + uses: actions/upload-artifact@v4 + with: + name: XEngine_MQServiceApp-Ubuntu_24.04_Arm64 + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/ubuntubuild.yml b/.github/workflows/UbuntuX86_64_build.yml similarity index 91% rename from .github/workflows/ubuntubuild.yml rename to .github/workflows/UbuntuX86_64_build.yml index 26c558c..9bbe8e1 100644 --- a/.github/workflows/ubuntubuild.yml +++ b/.github/workflows/UbuntuX86_64_build.yml @@ -1,4 +1,4 @@ -name: ubuntu build workflows +name: ubuntu x86_64 build workflows on: push: @@ -78,11 +78,13 @@ jobs: if: matrix.os == 'ubuntu-22.04' uses: actions/upload-artifact@v4 with: - name: XEngine_MQServiceApp-x86_64-Ubuntu-22.04 + name: XEngine_MQServiceApp-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 with: - name: XEngine_MQServiceApp-x86_64-Ubuntu-24.04 - path: XEngine_Release/ \ No newline at end of file + name: XEngine_MQServiceApp-Ubuntu_24.04_x86_64 + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/macbuild.yml b/.github/workflows/macbuild.yml index dbe2ffc..e3edb2d 100644 --- a/.github/workflows/macbuild.yml +++ b/.github/workflows/macbuild.yml @@ -83,11 +83,13 @@ jobs: if: matrix.os == 'macos-13' uses: actions/upload-artifact@v4 with: - name: XEngine_MQServiceApp-x86_64-Mac + name: XEngine_MQServiceApp-Mac_x86_64 path: XEngine_Release/ + retention-days: 1 - name: Upload folder as artifact with mac arm if: matrix.os == 'macos-14' uses: actions/upload-artifact@v4 with: - name: XEngine_MQServiceApp-Arm64-Mac - path: XEngine_Release/ \ No newline at end of file + name: XEngine_MQServiceApp-Mac_Arm64 + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index d2bd79b..bdf78ef 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: configuration: [Debug ,Release] - platform: [x86 ,x64] + platform: [x86 ,x64 ,ARM64] runs-on: windows-latest @@ -57,6 +57,20 @@ jobs: echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append shell: pwsh + - name: Set up Dependency ARM64 Environment + if: matrix.platform == 'ARM64' + run: | + $response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"} + $latest_tag = $response.tag_name + Write-Host "Latest Tag: $latest_tag" + + $url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_Arm64.zip" + Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_Arm64.zip" + Expand-Archive -Path ./XEngine_Windows_Arm64.zip -DestinationPath ./XEngine_Windows -Force + + echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LibArm64=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + shell: pwsh - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 @@ -83,17 +97,34 @@ jobs: cd XEngine_Release ./VSCopy_x64.bat shell: pwsh + - name: Conditional Step for Arm64 Release + if: matrix.configuration == 'Release' && matrix.platform == 'Arm64' + run: | + cp -r XEngine_Source/ARM64/Release/*.dll XEngine_Release/ + cp -r XEngine_Source/ARM64/Release/*.exe XEngine_Release/ + cp -r XEngine_Source/VSCopy_Arm64.bat XEngine_Release/ + cd XEngine_Release + ./VSCopy_Arm64.bat + shell: pwsh - name: Upload folder as artifact with x86 if: matrix.configuration == 'Release' && matrix.platform == 'x86' uses: actions/upload-artifact@v4 with: - name: XEngine_MQServiceApp-x86_32-Windows + name: XEngine_MQServiceApp-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 with: - name: XEngine_MQServiceApp-x86_64-Windows - path: XEngine_Release/ \ No newline at end of file + name: XEngine_MQServiceApp-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 + with: + name: XEngine_MQServiceApp-Windows_Arm64 + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4edb5e5..1b3fb91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,10 +16,37 @@ jobs: with: fetch-depth: 0 - - name: Download ubuntubuild + - name: Download ubuntubuild x86_64 uses: dawidd6/action-download-artifact@v6 with: - workflow: ubuntubuild.yml + workflow: UbuntuX86_64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download ubuntubuild Arm64 + uses: dawidd6/action-download-artifact@v6 + with: + workflow: UbuntuArm64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download Rockylinux Arm64 + uses: dawidd6/action-download-artifact@v6 + with: + workflow: RockyArm64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download Rockylinux x86_64 + uses: dawidd6/action-download-artifact@v6 + with: + workflow: RockyX86_64_build.yml workflow_conclusion: success check_artifacts: false skip_unpack: true diff --git a/CHANGELOG b/CHANGELOG index 328a57e..fd32663 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,35 @@ +XEngine_MQService V3.15.0.1001 + +增加:HTTP验证授权支持 +增加:删除主题和用户的HTTP接口支持 +增加:帮助模块 +增加:arm64的发布流和编译支持 +增加:设置日志类型支持 +更新:依赖库 +优化:参数解析 +修改:http错误码使用了公用头的错误 +修改:主题存在不允许创建主题 +修改:为队列使用单独的序列号统计 +修改:不允许注册空的密码 +修改:http封包可以设置空的消息 +修正:定时发布不工作的问题 +修正:设置日志级别不工作的问题 + +added:authorize verification support with http authorize +added:delete topic and user for http management +added:help module +added:arm64 build support and ci release +added:set log type support +update:depend library +improved:parameter parse and more parameter supported +modify:http error code use protocol common hdr file +modify:does not allow to create topic when the topic is existed +modify:Use of separate statistical notation for queue +modify:does not allow empty for register and login +modify:http packet can be set null message +fixed:time publish task not work +fixed:set log level not work +====================================================================================== XEngine_MQService V3.14.0.1001 增加:删除消息协议支持 diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 51793ca..042cbc8 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 1e15a98..3600586 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 67b2e98..169ef61 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -19,10 +19,11 @@ "tszLOGFile":"./XEngine_Log/XEngine_MQServiceApp.Log", "MaxSize":1024000, "MaxCount":10, - "LogLeave":17 + "LogLeave":32, + "LogType":17 }, "XSql":{ - "SQLAddr":"10.0.2.6", + "SQLAddr":"10.0.4.150", "SQLPort":3306, "SQLUser":"root", "SQLPass":"123123aa" @@ -41,6 +42,11 @@ "nTimeLast":3600, "nTimeCount":0 }, + "XAuthorize":{ + "bHTTPAuth":true, + "tszHTTPPass":"", + "tszToken":"MQPasskey" + }, "XReport":{ "bEnable":true, "tszServiceName":"XEngine_MQService", diff --git a/XEngine_Release/XEngine_Config/XEngine_VerConfig.json b/XEngine_Release/XEngine_Config/XEngine_VerConfig.json index 83d4fcb..19dc911 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VerConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VerConfig.json @@ -1,5 +1,6 @@ { "XVer":[ + "3.15.0.1001 Build20250313", "3.14.0.1001 Build20250120", "3.13.0.1001 Build20241129", "3.12.0.1001 Build20240919", diff --git a/XEngine_Source/MQCore_ConfigModule/Config_Define.h b/XEngine_Source/MQCore_ConfigModule/Config_Define.h index 29ee591..b90cca0 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Define.h +++ b/XEngine_Source/MQCore_ConfigModule/Config_Define.h @@ -38,6 +38,7 @@ typedef struct int nMaxSize; int nMaxCount; int nLogLeave; + int nLogType; }st_XLog; struct { @@ -63,6 +64,12 @@ typedef struct int nTimeLast; int nTimeCount; }st_XMemory; + struct + { + bool bHTTPAuth; + XCHAR tszHTTPPass[MAX_PATH]; + XCHAR tszToken[MAX_PATH]; + }st_XAuthorize; struct { bool bEnable; diff --git a/XEngine_Source/MQCore_ConfigModule/Config_Error.h b/XEngine_Source/MQCore_ConfigModule/Config_Error.h index c0aa55d..e3dda9a 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Error.h +++ b/XEngine_Source/MQCore_ConfigModule/Config_Error.h @@ -22,4 +22,5 @@ #define ERROR_MQ_MODULE_CONFIG_JSON_XPASS 0x0020007 #define ERROR_MQ_MODULE_CONFIG_JSON_XVER 0x0020008 #define ERROR_MQ_MODULE_CONFIG_JSON_XREPORT 0x0020009 -#define ERROR_MQ_MODULE_CONFIG_JSON_XMEMORY 0x0020010 \ No newline at end of file +#define ERROR_MQ_MODULE_CONFIG_JSON_XMEMORY 0x0020010 +#define ERROR_MQ_MODULE_CONFIG_JSON_XAUTHORIZE 0x0020011 \ No newline at end of file diff --git a/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp b/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp index e6f4744..27677c1 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp +++ b/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp @@ -86,7 +86,7 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile,XENGINE_SERVERCONFIG pSt_ServerConfig->st_XMax.nWSThread = st_JsonXMax["nWSThread"].asInt(); pSt_ServerConfig->st_XMax.nMQTTThread = st_JsonXMax["nMQTTThread"].asInt(); - if (st_JsonRoot["XLog"].empty() || (4 != st_JsonRoot["XLog"].size())) + if (st_JsonRoot["XLog"].empty() || (5 != st_JsonRoot["XLog"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_XLOG; @@ -96,6 +96,7 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile,XENGINE_SERVERCONFIG pSt_ServerConfig->st_XLog.nMaxSize = st_JsonXLog["MaxSize"].asInt(); pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt(); pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt(); + pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["LogType"].asInt(); _tcsxcpy(pSt_ServerConfig->st_XLog.tszLOGFile, st_JsonXLog["tszLOGFile"].asCString()); if (st_JsonRoot["XSql"].empty() || (4 != st_JsonRoot["XSql"].size())) @@ -136,6 +137,17 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile,XENGINE_SERVERCONFIG pSt_ServerConfig->st_XMemory.nTimeLast = st_JsonXMemory["nTimeLast"].asInt(); pSt_ServerConfig->st_XMemory.nTimeCount = st_JsonXMemory["nTimeCount"].asInt(); + if (st_JsonRoot["XAuthorize"].empty() || (3 != st_JsonRoot["XAuthorize"].size())) + { + Config_IsErrorOccur = true; + Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_XAUTHORIZE; + return false; + } + Json::Value st_JsonXAuthorize = st_JsonRoot["XAuthorize"]; + pSt_ServerConfig->st_XAuthorize.bHTTPAuth = st_JsonXAuthorize["bHTTPAuth"].asBool(); + _tcsxcpy(pSt_ServerConfig->st_XAuthorize.tszHTTPPass, st_JsonXAuthorize["tszHTTPPass"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XAuthorize.tszToken, st_JsonXAuthorize["tszToken"].asCString()); + if (st_JsonRoot["XReport"].empty() || (3 != st_JsonRoot["XReport"].size())) { Config_IsErrorOccur = true; diff --git a/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj b/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj index c64a8b5..40c57e1 100644 --- a/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj +++ b/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -84,10 +111,18 @@ true $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + + true + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + false $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + + false + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + Level3 @@ -150,6 +185,24 @@ MQCore_ConfigModule.def + + + Level3 + true + _DEBUG;MQCORECONFIGMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + MQCore_ConfigModule.def + + Level3 @@ -175,6 +228,31 @@ MQCore_ConfigModule.def + + + Level3 + true + true + true + NDEBUG;MQCORECONFIGMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + MultiThreaded + 4819 + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Windows + true + true + true + false + MQCore_ConfigModule.def + + @@ -188,8 +266,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/MQCore_ConfigModule/pch.h b/XEngine_Source/MQCore_ConfigModule/pch.h index bcb0ee5..1d9d9de 100644 --- a/XEngine_Source/MQCore_ConfigModule/pch.h +++ b/XEngine_Source/MQCore_ConfigModule/pch.h @@ -42,15 +42,19 @@ extern XLONG Config_dwErrorCode; #ifdef _MSC_BUILD #ifdef _DEBUG -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Debug/jsoncpp") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/jsoncpp") +#elif _M_IX86 #pragma comment(lib,"../Debug/jsoncpp") #endif #else -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Release/jsoncpp") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/jsoncpp") +#elif _M_IX86 #pragma comment(lib,"../Release/jsoncpp") #endif #endif diff --git a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp index 1ee3bce..be3ef70 100644 --- a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp +++ b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp @@ -176,7 +176,14 @@ bool CDBModule_MQUser::DBModule_MQUser_UserQuery(XENGINE_PROTOCOL_USERINFO* pSt_ XCHAR tszSQLStatement[1024]; memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); - _xstprintf(tszSQLStatement, _X("SELECT * FROM `UserInfo` WHERE tszUserName = '%s' AND tszUserPass = '%s'"), pSt_UserInfo->tszUserName, pSt_UserInfo->tszUserPass); + if (_tcsxlen(pSt_UserInfo->tszUserPass) > 0) + { + _xstprintf(tszSQLStatement, _X("SELECT * FROM `UserInfo` WHERE tszUserName = '%s' AND tszUserPass = '%s'"), pSt_UserInfo->tszUserName, pSt_UserInfo->tszUserPass); + } + else + { + _xstprintf(tszSQLStatement, _X("SELECT * FROM `UserInfo` WHERE tszUserName = '%s'"), pSt_UserInfo->tszUserName); + } if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow)) { DBModule_IsErrorOccur = true; @@ -1063,7 +1070,7 @@ bool CDBModule_MQUser::DBModule_MQUser_OwnerDelete(XENGINE_DBTOPICOWNER* pSt_DBO return false; } } - else + else if ((_tcsxlen(pSt_DBOwner->tszUserName) > 0) && (_tcsxlen(pSt_DBOwner->tszQueueName) <= 0)) { _xstprintf(tszSQLStatement, _X("DELETE FROM `KeyOwner` WHERE tszUserName = '%s'"), pSt_DBOwner->tszUserName); if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement)) @@ -1073,6 +1080,16 @@ bool CDBModule_MQUser::DBModule_MQUser_OwnerDelete(XENGINE_DBTOPICOWNER* pSt_DBO return false; } } + else + { + _xstprintf(tszSQLStatement, _X("DELETE FROM `KeyOwner` WHERE tszKeyName = '%s'"), pSt_DBOwner->tszQueueName); + if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement)) + { + DBModule_IsErrorOccur = true; + DBModule_dwErrorCode = DataBase_GetLastError(); + return false; + } + } return true; } @@ -1163,7 +1180,7 @@ XHTHREAD CALLBACK CDBModule_MQUser::DBModule_MQUser_TimeThread(XPVOID lParam) while (pClass_This->bIsRun) { int nListCount = 0; - XENGINE_DBTIMERELEASE** ppSt_DBInfo; + XENGINE_DBTIMERELEASE** ppSt_DBInfo = NULL; pClass_This->DBModule_MQUser_TimeQuery(&ppSt_DBInfo, &nListCount); for (int i = 0; i < nListCount; i++) { diff --git a/XEngine_Source/MQCore_DBModule/MQCore_DBModule.vcxproj b/XEngine_Source/MQCore_DBModule/MQCore_DBModule.vcxproj index 10cd8ac..48bf97f 100644 --- a/XEngine_Source/MQCore_DBModule/MQCore_DBModule.vcxproj +++ b/XEngine_Source/MQCore_DBModule/MQCore_DBModule.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -149,6 +186,24 @@ MQCore_DBModule.def + + + Level3 + true + _DEBUG;MQCOREDBMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + MQCore_DBModule.def + + Level3 @@ -172,6 +227,29 @@ MQCore_DBModule.def + + + Level3 + true + true + true + NDEBUG;MQCOREDBMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Windows + true + true + true + false + MQCore_DBModule.def + + @@ -187,8 +265,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/MQCore_DBModule/pch.h b/XEngine_Source/MQCore_DBModule/pch.h index 3fbb3a7..8572435 100644 --- a/XEngine_Source/MQCore_DBModule/pch.h +++ b/XEngine_Source/MQCore_DBModule/pch.h @@ -50,15 +50,19 @@ extern XLONG DBModule_dwErrorCode; #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib") #pragma comment(lib,"XEngine_HelpComponents/HelpComponents_DataBase.lib") #ifdef _DEBUG -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Debug/MQCore_MemoryCache.lib") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/MQCore_MemoryCache.lib") +#elif _M_IX86 #pragma comment(lib,"../Debug/MQCore_MemoryCache.lib") #endif #else -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Release/MQCore_MemoryCache.lib") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/MQCore_MemoryCache.lib") +#elif _M_IX86 #pragma comment(lib,"../Release/MQCore_MemoryCache.lib") #endif #endif diff --git a/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.cpp b/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.cpp new file mode 100644 index 0000000..efaa5f8 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.cpp @@ -0,0 +1,124 @@ +#include "pch.h" +#include "APIHelp_Counter.h" +/******************************************************************** +// Created: 2025/03/11 14:49:15 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Counter\APIHelp_Counter.cpp +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Counter +// File Base: APIHelp_Counter +// File Ext: cpp +// Project: XEngine +// Author: qyt +// Purpose: 帮助模块计数器 +// History: +*********************************************************************/ +CAPIHelp_Counter::CAPIHelp_Counter() +{ +} +CAPIHelp_Counter::~CAPIHelp_Counter() +{ + +} +////////////////////////////////////////////////////////////////////////// +// 公有函数 +////////////////////////////////////////////////////////////////////////// +/******************************************************************** +函数名称:MemoryCache_DBData_DataSerialSet +函数功能:设置当前序列号 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要插入的队列名称 + 参数.二:nSerial + In/Out:In + 类型:整数型 + 可空:N + 意思:输入设置的队列序列号 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CAPIHelp_Counter::APIHelp_Counter_SerialSet(LPCXSTR lpszQueueName, __int64x nSerial) +{ + APIHelp_IsErrorOccur = false; + + if (NULL == lpszQueueName) + { + APIHelp_IsErrorOccur = true; + APIHelp_dwErrorCode = ERROR_XENGINE_MQCORE_APIHELP_COUNTER_PARAMENT; + return false; + } + st_Locker.lock(); + stl_MapSerial[lpszQueueName] = nSerial; + st_Locker.unlock(); + return true; +} +/******************************************************************** +函数名称:APIHelp_Counter_SerialGet +函数功能:获取当前序列号 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的队列名称 + 参数.二:pInt_Serial + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出当前队列序列号 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CAPIHelp_Counter::APIHelp_Counter_SerialGet(LPCXSTR lpszQueueName, __int64x *pInt_Serial) +{ + APIHelp_IsErrorOccur = false; + + if (NULL == pInt_Serial) + { + APIHelp_IsErrorOccur = true; + APIHelp_dwErrorCode = ERROR_XENGINE_MQCORE_APIHELP_COUNTER_PARAMENT; + return false; + } + st_Locker.lock_shared(); + auto stl_MapIterator = stl_MapSerial.find(lpszQueueName); + if (stl_MapIterator == stl_MapSerial.end()) + { + APIHelp_IsErrorOccur = true; + APIHelp_dwErrorCode = ERROR_XENGINE_MQCORE_APIHELP_COUNTER_NOTFOUND; + st_Locker.unlock_shared(); + return false; + } + stl_MapIterator->second++; + *pInt_Serial = stl_MapIterator->second; + st_Locker.unlock_shared(); + return true; +} +/******************************************************************** +函数名称:APIHelp_Counter_SerialDel +函数功能:删除当前队列 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的队列名称 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CAPIHelp_Counter::APIHelp_Counter_SerialDel(LPCXSTR lpszQueueName) +{ + APIHelp_IsErrorOccur = false; + + st_Locker.lock(); + auto stl_MapIterator = stl_MapSerial.find(lpszQueueName); + if (stl_MapIterator != stl_MapSerial.end()) + { + stl_MapSerial.erase(stl_MapIterator); + } + st_Locker.unlock(); + return true; +} \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.h b/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.h new file mode 100644 index 0000000..55134b9 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/APIHelp_Counter/APIHelp_Counter.h @@ -0,0 +1,29 @@ +#pragma once +/******************************************************************** +// Created: 2025/03/11 14:45:06 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Counter\APIHelp_Counter.h +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Counter +// File Base: APIHelp_Counter +// File Ext: h +// Project: XEngine +// Author: qyt +// Purpose: 帮助模块计数器 +// History: +*********************************************************************/ + + +class CAPIHelp_Counter +{ +public: + CAPIHelp_Counter(); + ~CAPIHelp_Counter(); +public: + bool APIHelp_Counter_SerialSet(LPCXSTR lpszQueueName, __int64x nSerial); + bool APIHelp_Counter_SerialGet(LPCXSTR lpszQueueName, __int64x* pInt_Serial); + bool APIHelp_Counter_SerialDel(LPCXSTR lpszQueueName); +protected: +private: + std::shared_mutex st_Locker; +private: + std::unordered_map> stl_MapSerial; +}; \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/APIHelp_Define.h b/XEngine_Source/MQCore_HelpModule/APIHelp_Define.h new file mode 100644 index 0000000..a152dbe --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/APIHelp_Define.h @@ -0,0 +1,71 @@ +#pragma once +/******************************************************************** +// Created: 2025/03/11 14:47:16 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Define.h +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule +// File Base: APIHelp_Define +// File Ext: h +// Project: XEngine +// Author: qyt +// Purpose: 导出的函数 +// History: +*********************************************************************/ +////////////////////////////////////////////////////////////////////////// +// 导出的函数 +////////////////////////////////////////////////////////////////////////// +extern "C" XLONG APIHelp_GetLastError(int *pInt_SysError = NULL); +/************************************************************************* + 统计计数器导出 +**************************************************************************/ +/******************************************************************** +函数名称:MemoryCache_DBData_DataSerialSet +函数功能:设置当前序列号 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要插入的队列名称 + 参数.二:nSerial + In/Out:In + 类型:整数型 + 可空:N + 意思:输入设置的队列序列号 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool APIHelp_Counter_SerialSet(LPCXSTR lpszQueueName, __int64x nSerial); +/******************************************************************** +函数名称:APIHelp_Counter_SerialGet +函数功能:获取当前序列号 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的队列名称 + 参数.二:pInt_Serial + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出当前队列序列号 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool APIHelp_Counter_SerialGet(LPCXSTR lpszQueueName, __int64x* pInt_Serial); +/******************************************************************** +函数名称:APIHelp_Counter_SerialDel +函数功能:删除当前队列 + 参数.一:lpszQueueName + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的队列名称 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool APIHelp_Counter_SerialDel(LPCXSTR lpszQueueName); \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/APIHelp_Error.h b/XEngine_Source/MQCore_HelpModule/APIHelp_Error.h new file mode 100644 index 0000000..e4c73ca --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/APIHelp_Error.h @@ -0,0 +1,17 @@ +#pragma once +/******************************************************************** +// Created: 2025/03/11 14:47:36 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\APIHelp_Error.h +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule +// File Base: APIHelp_Error +// File Ext: h +// Project: XEngine +// Author: qyt +// Purpose: 导出的错误 +// History: +*********************************************************************/ +////////////////////////////////////////////////////////////////////////// +// 导出的错误 +////////////////////////////////////////////////////////////////////////// +#define ERROR_XENGINE_MQCORE_APIHELP_COUNTER_PARAMENT 0x1B0001 //创建线程失败 +#define ERROR_XENGINE_MQCORE_APIHELP_COUNTER_NOTFOUND 0x1B0002 //没有找到 \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.def b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.def new file mode 100644 index 0000000..bcadb6a --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.def @@ -0,0 +1,8 @@ +LIBRARY + +EXPORTS + APIHelp_GetLastError + + APIHelp_Counter_SerialSet + APIHelp_Counter_SerialGet + APIHelp_Counter_SerialDel \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj new file mode 100644 index 0000000..bc15647 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj @@ -0,0 +1,257 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {4b061f8b-a783-45ea-a8d1-78f9668c49d2} + MQCoreHelpModule + 10.0 + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + $(XEngine_Include);..\MQCore_HelpModule;$(IncludePath) + $(XEngine_Lib32);$(LibraryPath) + + + $(XEngine_Include);$(IncludePath) + $(XEngine_Lib32);$(LibraryPath) + + + $(XEngine_Include);$(IncludePath) + $(XEngine_Lib64);$(LibraryPath) + + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + + + $(XEngine_Include);$(IncludePath) + $(XEngine_Lib64);$(LibraryPath) + + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + MQCore_HelpModule.def + + + + + Level3 + true + true + true + WIN32;NDEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + MQCore_HelpModule.def + + + + + Level3 + true + _DEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + MQCore_HelpModule.def + + + + + Level3 + true + _DEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + MQCore_HelpModule.def + + + + + Level3 + true + true + true + NDEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + MQCore_HelpModule.def + + + + + Level3 + true + true + true + NDEBUG;MQCOREHELPMODULE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + MQCore_HelpModule.def + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.filters b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.filters new file mode 100644 index 0000000..cf7c225 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {bc1c5ac9-a633-493a-900e-49ad8bc6d55c} + + + {75ffe4ca-a70b-4320-98d0-219b06839ac3} + + + + + 头文件 + + + 头文件 + + + 头文件\APIHelp_Counter + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + 源文件\APIHelp_Counter + + + + + 源文件 + + + \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.user b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/MQCore_HelpModule.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/Makefile b/XEngine_Source/MQCore_HelpModule/Makefile new file mode 100644 index 0000000..a2935b6 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/Makefile @@ -0,0 +1,69 @@ +CC = g++ -Wall -std=c++20 -fPIC +PLATFORM = linux +PLATVER = +PLATDIR = +FILEEXT = +LIBFLAG = +RELEASE = 0 +LOADHDR = -I ./ +LOADSO = +LIB = +LIBEX = +OBJECTS = APIHelp_Counter.o pch.o + +ifeq ($(RELEASE),1) +FLAGS = -c +DEBUG = +else + ifeq ($(PLATFORM),mac) + FLAGS = -c + DEBUG = -g + else + FLAGS = -c -lc_p + DEBUG = -g -pg + endif +endif + +ifeq ($(PLATFORM),linux) + ifeq (/etc/redhat-release,$(wildcard /etc/redhat-release)) + PLATVER = -D __CENTOS__ + PLATDIR = XEngine_Linux/Centos + else + PLATVER = -D __UBUNTU__ + PLATDIR = XEngine_Linux/Ubuntu + endif + FILEEXT = so + LIBFLAG = -shared + LIBEX = -lpthread -lrt -ldl + LOADBIN = -Wl,-rpath=./,--disable-new-dtags +else ifeq ($(PLATFORM),mac) + CC += -Wno-deprecated-declarations + PLATVER = -D __MACOS__ + PLATDIR = XEngine_Mac + FILEEXT = dylib + LIBFLAG = -dynamiclib + LIBEX = -lpthread -ldl + LOADBIN = -Wl,-rpath,@loader_path/./ +endif + + +all:$(OBJECTS) + $(CC) $(DEBUG) $(OBJECTS) -o libMQCore_HelpModule.$(FILEEXT) $(LIBFLAG) $(LIB) $(LIBEX) $(LOADSO) $(LOADBIN) + +APIHelp_Counter.o:./APIHelp_Counter/APIHelp_Counter.cpp + $(CC) $(DEBUG) $(FLAGS) $(PLATVER) $(LOADHDR) ./APIHelp_Counter/APIHelp_Counter.cpp + +pch.o:./pch.cpp + $(CC) $(DEBUG) $(FLAGS) $(PLATVER) $(LOADHDR) ./pch.cpp + + +InstallAll:InstallSo +InstallSo:./libMQCore_HelpModule.$(FILEEXT) + cp ./libMQCore_HelpModule.$(FILEEXT) ../../XEngine_Release/libMQCore_HelpModule.$(FILEEXT) + + +CleanAll:CleanObj CleanMk +CleanObj: + rm *.o +CleanMk: + rm *.$(FILEEXT) \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/dllmain.cpp b/XEngine_Source/MQCore_HelpModule/dllmain.cpp new file mode 100644 index 0000000..daed8c8 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : 定义 DLL 应用程序的入口点。 +#include "pch.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/XEngine_Source/MQCore_HelpModule/framework.h b/XEngine_Source/MQCore_HelpModule/framework.h new file mode 100644 index 0000000..80cbbc9 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/framework.h @@ -0,0 +1,5 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 +// Windows 头文件 +#include diff --git a/XEngine_Source/MQCore_HelpModule/pch.cpp b/XEngine_Source/MQCore_HelpModule/pch.cpp new file mode 100644 index 0000000..bb3d233 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/pch.cpp @@ -0,0 +1,43 @@ +#include "pch.h" +#include "APIHelp_Counter/APIHelp_Counter.h" +/******************************************************************** +// Created: 2025/03/11 14:51:51 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\pch.cpp +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule +// File Base: pch +// File Ext: cpp +// Project: XEngine +// Author: qyt +// Purpose: 导出实现 +// History: +*********************************************************************/ +bool APIHelp_IsErrorOccur = false; +XLONG APIHelp_dwErrorCode = 0; +////////////////////////////////////////////////////////////////////////// +CAPIHelp_Counter m_HelpCounter; +////////////////////////////////////////////////////////////////////////// +// 导出的函数 +////////////////////////////////////////////////////////////////////////// +extern "C" XLONG APIHelp_GetLastError(int* pInt_SysError) +{ + if (NULL != pInt_SysError) + { + *pInt_SysError = errno; + } + return APIHelp_dwErrorCode; +} +/************************************************************************* + 统计计数器导出 +**************************************************************************/ +extern "C" bool APIHelp_Counter_SerialSet(LPCXSTR lpszQueueName, __int64x nSerial) +{ + return m_HelpCounter.APIHelp_Counter_SerialSet(lpszQueueName, nSerial); +} +extern "C" bool APIHelp_Counter_SerialGet(LPCXSTR lpszQueueName, __int64x* pInt_Serial) +{ + return m_HelpCounter.APIHelp_Counter_SerialGet(lpszQueueName, pInt_Serial); +} +extern "C" bool APIHelp_Counter_SerialDel(LPCXSTR lpszQueueName) +{ + return m_HelpCounter.APIHelp_Counter_SerialDel(lpszQueueName); +} \ No newline at end of file diff --git a/XEngine_Source/MQCore_HelpModule/pch.h b/XEngine_Source/MQCore_HelpModule/pch.h new file mode 100644 index 0000000..5efbc19 --- /dev/null +++ b/XEngine_Source/MQCore_HelpModule/pch.h @@ -0,0 +1,38 @@ +// pch.h: 这是预编译标头文件。 +// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 +// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 +// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 +// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 + +#ifndef PCH_H +#define PCH_H + +// 添加要在此处预编译的标头 +#ifdef _MSC_BUILD +#include "framework.h" +#endif +#endif //PCH_H +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "APIHelp_Define.h" +#include "APIHelp_Error.h" +/******************************************************************** +// Created: 2025/03/11 14:46:04 +// File Name: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule\pch.h +// File Path: D:\XEngine_MQService\XEngine_Source\MQCore_HelpModule +// File Base: pch +// File Ext: h +// Project: XEngine +// Author: qyt +// Purpose: 公用头文件 +// History: +*********************************************************************/ +extern bool APIHelp_IsErrorOccur; +extern XLONG APIHelp_dwErrorCode; \ No newline at end of file diff --git a/XEngine_Source/MQCore_MemoryCache/MQCore_MemoryCache.vcxproj b/XEngine_Source/MQCore_MemoryCache/MQCore_MemoryCache.vcxproj index 534202a..cb25f8b 100644 --- a/XEngine_Source/MQCore_MemoryCache/MQCore_MemoryCache.vcxproj +++ b/XEngine_Source/MQCore_MemoryCache/MQCore_MemoryCache.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + $(XEngine_Include);..\MQCore_MemoryCache;$(IncludePath) @@ -83,10 +110,18 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -146,6 +181,24 @@ MQCore_MemoryCache.def + + + Level3 + true + _DEBUG;MQCOREMEMORYCACHE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + MQCore_MemoryCache.def + + Level3 @@ -169,6 +222,29 @@ MQCore_MemoryCache.def + + + Level3 + true + true + true + NDEBUG;MQCOREMEMORYCACHE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Windows + true + true + true + false + MQCore_MemoryCache.def + + @@ -184,8 +260,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp index 3a59ddd..6921db8 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp @@ -301,7 +301,7 @@ XHTHREAD CALLBACK CMemoryCache_DBData::DBModule_MQUser_TimeThread(XPVOID lParam) { stl_ListDelete.push_back(stl_MapIterator->second.st_DBMessageInfo); } - else if (pClass_This->m_nTimeCount > 0 && ((nTimeEnd - stl_MapIterator->second.nTimeLast) > pClass_This->m_nTimeCount)) + else if (pClass_This->m_nTimeCount > 0 && ((nTimeEnd - stl_MapIterator->second.nTimeStart) > pClass_This->m_nTimeCount)) { stl_ListDelete.push_back(stl_MapIterator->second.st_DBMessageInfo); } diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h index 6cb9638..6870c48 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h @@ -69,5 +69,6 @@ class CMemoryCache_DBData std::unique_ptr pSTDThread_Insert; private: std::list stl_ListInsert; + std::unordered_map> stl_MapSerial; std::unordered_map, MEMORYCACHE_DBINFO, TupleHash> stl_MapQuery; }; \ No newline at end of file diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp index 52aae56..fc0e9a8 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp @@ -229,7 +229,7 @@ XHTHREAD CALLBACK CMemoryCache_DBUser::DBModule_MQUser_TimeThread(XPVOID lParam) { stl_ListDelete.push_back(stl_MapIterator->second.st_DBUserInfo); } - else if (pClass_This->m_nTimeCount > 0 && ((nTimeEnd - stl_MapIterator->second.nTimeLast) > pClass_This->m_nTimeCount)) + else if (pClass_This->m_nTimeCount > 0 && ((nTimeEnd - stl_MapIterator->second.nTimeStart) > pClass_This->m_nTimeCount)) { stl_ListDelete.push_back(stl_MapIterator->second.st_DBUserInfo); } diff --git a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.def b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.def index 348a754..075760d 100644 --- a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.def +++ b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.def @@ -7,6 +7,7 @@ EXPORTS ProtocolModule_Packet_MQNumber ProtocolModule_Packet_PassAuth ProtocolModule_Packet_PassUser + ProtocolModule_Packet_PassHttp ProtocolModule_Packet_Http ProtocolModule_Packet_UserList ProtocolModule_Packet_TopicList diff --git a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj index 1729975..da45755 100644 --- a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj +++ b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -152,6 +189,24 @@ MQCore_ProtocolModule.def + + + Level3 + true + _DEBUG;MQCOREPROTOCOLMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + MQCore_ProtocolModule.def + + Level3 @@ -177,6 +232,31 @@ MQCore_ProtocolModule.def + + + Level3 + true + true + true + NDEBUG;MQCOREPROTOCOLMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + MultiThreaded + 4819 + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Windows + true + true + true + false + MQCore_ProtocolModule.def + + @@ -190,8 +270,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp index fed50f4..e3a11a6 100644 --- a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp +++ b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp @@ -280,6 +280,68 @@ bool CProtocolModule_Packet::ProtocolModule_Packet_PassUser(XENGINE_PROTOCOL_USE return true; } /******************************************************************** +函数名称:ProtocolModule_Packet_PassHttp +函数功能:HTTP请求验证打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打好包的缓冲区 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出缓冲区大小 + 参数.三:lpszToken + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的TOKEN + 参数.四:lpszAPIUser + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的API接口 + 参数.五:lpszURIApi + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的完整URL地址 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CProtocolModule_Packet::ProtocolModule_Packet_PassHttp(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszToken, LPCXSTR lpszAPIUser, LPCXSTR lpszURIApi) +{ + Protocol_IsErrorOccur = false; + + if ((NULL == ptszMsgBuffer) || (NULL == pInt_MsgLen)) + { + Protocol_IsErrorOccur = true; + Protocol_dwErrorCode = ERROR_MQ_MODULE_PROTOCOL_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + Json::Value st_JsonAuth; + Json::StreamWriterBuilder st_JsonBuilder; + + st_JsonAuth["lpszToken"] = lpszToken; + st_JsonAuth["lpszAPIUser"] = lpszAPIUser; + st_JsonAuth["lpszURIApi"] = lpszURIApi; + + st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ; + st_JsonRoot["wReserve"] = 0; + st_JsonRoot["byVersion"] = 2; + st_JsonRoot["st_Auth"] = st_JsonAuth; + + st_JsonBuilder["emitUTF8"] = true; + + *pInt_MsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); + memcpy(ptszMsgBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MsgLen); + return true; +} +/******************************************************************** 函数名称:ProtocolModule_Packet_Http 函数功能:HTTP封包类 参数.一:pSt_ProtocolHdr @@ -312,7 +374,14 @@ bool CProtocolModule_Packet::ProtocolModule_Packet_Http(XCHAR* ptszMsgBuffer, in Json::Value st_JsonRoot; Json::StreamWriterBuilder st_JsonBuilder; - st_JsonRoot["msg"] = lpszMsgBuffer; + if (NULL == lpszMsgBuffer) + { + st_JsonRoot["msg"] = "success"; + } + else + { + st_JsonRoot["msg"] = lpszMsgBuffer; + } st_JsonRoot["code"] = nCode; st_JsonBuilder["emitUTF8"] = true; diff --git a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.h b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.h index 0df6813..3721aae 100644 --- a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.h +++ b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.h @@ -29,6 +29,7 @@ class CProtocolModule_Packet bool ProtocolModule_Packet_MQNumber(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_MQNUMBER* pSt_MQNumber, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nNetType); bool ProtocolModule_Packet_PassAuth(XENGINE_PROTOCOL_USERAUTH* pSt_ProtocolAuth, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode); bool ProtocolModule_Packet_PassUser(XENGINE_PROTOCOL_USERINFO* pSt_ProtocolUser, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode); + bool ProtocolModule_Packet_PassHttp(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszToken, LPCXSTR lpszAPIUser, LPCXSTR lpszURIApi); bool ProtocolModule_Packet_Http(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCXSTR lpszMsgBuffer = NULL); bool ProtocolModule_Packet_UserList(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERINFO*** pppSt_UserInfo, int nListCount); bool ProtocolModule_Packet_TopicList(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XCHAR*** pppszTableName, int nListCount); diff --git a/XEngine_Source/MQCore_ProtocolModule/Protocol_Define.h b/XEngine_Source/MQCore_ProtocolModule/Protocol_Define.h index 23c84d1..db79519 100644 --- a/XEngine_Source/MQCore_ProtocolModule/Protocol_Define.h +++ b/XEngine_Source/MQCore_ProtocolModule/Protocol_Define.h @@ -154,6 +154,40 @@ extern "C" bool ProtocolModule_Packet_PassAuth(XENGINE_PROTOCOL_USERAUTH* pSt_Pr *********************************************************************/ extern "C" bool ProtocolModule_Packet_PassUser(XENGINE_PROTOCOL_USERINFO* pSt_ProtocolUser, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode); /******************************************************************** +函数名称:ProtocolModule_Packet_PassHttp +函数功能:HTTP请求验证打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打好包的缓冲区 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出缓冲区大小 + 参数.三:lpszToken + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的TOKEN + 参数.四:lpszAPIUser + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的API接口 + 参数.五:lpszURIApi + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入用户请求的完整URL地址 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ProtocolModule_Packet_PassHttp(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszToken, LPCXSTR lpszAPIUser, LPCXSTR lpszURIApi); +/******************************************************************** 函数名称:ProtocolModule_Packet_Http 函数功能:HTTP封包类 参数.一:pSt_ProtocolHdr diff --git a/XEngine_Source/MQCore_ProtocolModule/pch.cpp b/XEngine_Source/MQCore_ProtocolModule/pch.cpp index a52c751..07f7080 100644 --- a/XEngine_Source/MQCore_ProtocolModule/pch.cpp +++ b/XEngine_Source/MQCore_ProtocolModule/pch.cpp @@ -47,6 +47,10 @@ extern "C" bool ProtocolModule_Packet_PassUser(XENGINE_PROTOCOL_USERINFO * pSt_P { return m_ProtocolPacket.ProtocolModule_Packet_PassUser(pSt_ProtocolUser, ptszMsgBuffer, pInt_MsgLen, nCode); } +extern "C" bool ProtocolModule_Packet_PassHttp(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszToken, LPCXSTR lpszAPIUser, LPCXSTR lpszURIApi) +{ + return m_ProtocolPacket.ProtocolModule_Packet_PassHttp(ptszMsgBuffer, pInt_MsgLen, lpszToken, lpszAPIUser, lpszURIApi); +} extern "C" bool ProtocolModule_Packet_Http(XCHAR * ptszMsgBuffer, int* pInt_MsgLen, int nCode, LPCXSTR lpszMsgBuffer) { return m_ProtocolPacket.ProtocolModule_Packet_Http(ptszMsgBuffer, pInt_MsgLen, nCode, lpszMsgBuffer); diff --git a/XEngine_Source/MQCore_ProtocolModule/pch.h b/XEngine_Source/MQCore_ProtocolModule/pch.h index 65e187b..c53bdd8 100644 --- a/XEngine_Source/MQCore_ProtocolModule/pch.h +++ b/XEngine_Source/MQCore_ProtocolModule/pch.h @@ -45,21 +45,24 @@ extern bool Protocol_IsErrorOccur; extern XLONG Protocol_dwErrorCode; - #ifdef _MSC_BUILD #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") #pragma comment(lib,"XEngine_Core/XEngine_Cryption") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_MQTTProtocol.lib") #ifdef _DEBUG -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Debug/jsoncpp") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/jsoncpp") +#elif _M_IX86 #pragma comment(lib,"../Debug/jsoncpp") #endif #else -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Release/jsoncpp") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/jsoncpp") +#elif _M_IX86 #pragma comment(lib,"../Release/jsoncpp") #endif #endif diff --git a/XEngine_Source/MQCore_SessionModule/MQCore_SessionModule.vcxproj b/XEngine_Source/MQCore_SessionModule/MQCore_SessionModule.vcxproj index 6cd75df..7bd7aa5 100644 --- a/XEngine_Source/MQCore_SessionModule/MQCore_SessionModule.vcxproj +++ b/XEngine_Source/MQCore_SessionModule/MQCore_SessionModule.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -152,6 +189,24 @@ MQCore_SessionModule.def + + + Level3 + true + _DEBUG;MQCORESESSIONMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + MQCore_SessionModule.def + + Level3 @@ -177,6 +232,31 @@ MQCore_SessionModule.def + + + Level3 + true + true + true + NDEBUG;MQCORESESSIONMODULE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + MultiThreaded + 4819 + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Windows + true + true + true + false + MQCore_SessionModule.def + + @@ -189,8 +269,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/Makefile b/XEngine_Source/Makefile index 36bf6fc..41a88ae 100644 --- a/XEngine_Source/Makefile +++ b/XEngine_Source/Makefile @@ -11,6 +11,7 @@ BASE_PROTOCOL_PATH = ./MQCore_ProtocolModule BASE_MEMORYCACHE_PATH = ./MQCore_MemoryCache BASE_DATABASE_PATH = ./MQCore_DBModule BASE_SESSION_PATH = ./MQCore_SessionModule +BASE_HELP_PATH = ./MQCore_HelpModule APP_SERVICE_PATH = ./XEngine_MQServiceApp @@ -21,7 +22,7 @@ else ifeq ($(PLATFORM),mac) endif XENGINE_MODULES = libjsoncpp.so libXEngine_InfoReport.so \ - libMQCore_ConfigModule.so libMQCore_ProtocolModule.so libMQCore_SessionModule.so libMQCore_MemoryCache.so libMQCore_DBModule.so \ + libMQCore_ConfigModule.so libMQCore_ProtocolModule.so libMQCore_SessionModule.so libMQCore_MemoryCache.so libMQCore_DBModule.so libMQCore_HelpModule.so \ XEngine_MQServiceApp.exe .PHONY:MakeAll @@ -51,6 +52,8 @@ libMQCore_MemoryCache.so: make -C $(BASE_MEMORYCACHE_PATH) PLATFORM=$(PLATFORM) $(FLAGS) libMQCore_DBModule.so: make -C $(BASE_DATABASE_PATH) PLATFORM=$(PLATFORM) $(FLAGS) +libMQCore_HelpModule.so: + make -C $(BASE_HELP_PATH) PLATFORM=$(PLATFORM) $(FLAGS) XEngine_MQServiceApp.exe: make -C $(APP_SERVICE_PATH) PLATFORM=$(PLATFORM) $(FLAGS) \ No newline at end of file diff --git a/XEngine_Source/VSCopy_Arm64.bat b/XEngine_Source/VSCopy_Arm64.bat new file mode 100644 index 0000000..2d90d25 --- /dev/null +++ b/XEngine_Source/VSCopy_Arm64.bat @@ -0,0 +1,20 @@ +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_BaseLib.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_BaseSafe.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_Algorithm.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_Core.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_ManagePool.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_Cryption.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Client\XClient_APIHelp.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_DataBase.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_HttpProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_MQTTProtocol.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_Debug.bat b/XEngine_Source/VSCopy_Debug.bat index 396027d..04cfcec 100644 --- a/XEngine_Source/VSCopy_Debug.bat +++ b/XEngine_Source/VSCopy_Debug.bat @@ -6,6 +6,7 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_ManagePool.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Cryption.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemApi.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemConfig.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XClient_APIHelp.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_APIHelp.dll" "./" diff --git a/XEngine_Source/VSCopy_x64.bat b/XEngine_Source/VSCopy_x64.bat index 52af2f8..6091a6f 100644 --- a/XEngine_Source/VSCopy_x64.bat +++ b/XEngine_Source/VSCopy_x64.bat @@ -6,6 +6,7 @@ copy /y "%XEngine_Lib64%\XEngine_Core\XEngine_ManagePool.dll" "./" copy /y "%XEngine_Lib64%\XEngine_Core\XEngine_Cryption.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" copy /y "%XEngine_Lib64%\XEngine_Client\XClient_APIHelp.dll" "./" copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" diff --git a/XEngine_Source/VSCopy_x86.bat b/XEngine_Source/VSCopy_x86.bat index da0981d..ddd01a1 100644 --- a/XEngine_Source/VSCopy_x86.bat +++ b/XEngine_Source/VSCopy_x86.bat @@ -6,6 +6,7 @@ copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_ManagePool.dll" "./" copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_Cryption.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" copy /y "%XEngine_Lib32%\XEngine_Client\XClient_APIHelp.dll" "./" copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" diff --git a/XEngine_Source/XEngine_Depend b/XEngine_Source/XEngine_Depend index bcf8d94..fda9f7d 160000 --- a/XEngine_Source/XEngine_Depend +++ b/XEngine_Source/XEngine_Depend @@ -1 +1 @@ -Subproject commit bcf8d946890a2f2fb39eec16e64a634a8ece52c7 +Subproject commit fda9f7d9140cc6a32eecb499e2acb67e8e1c7e6f diff --git a/XEngine_Source/XEngine_MQServiceApp.sln b/XEngine_Source/XEngine_MQServiceApp.sln index 3315a56..0e0bd2a 100644 --- a/XEngine_Source/XEngine_MQServiceApp.sln +++ b/XEngine_Source/XEngine_MQServiceApp.sln @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_MQServiceApp", "XEngine_MQServiceApp\XEngine_MQServiceApp.vcxproj", "{34C9695F-7097-412F-ACC2-A3979A91D776}" ProjectSection(ProjectDependencies) = postProject {32D3FC68-6252-4D20-BB07-6C98BD753D11} = {32D3FC68-6252-4D20-BB07-6C98BD753D11} + {4B061F8B-A783-45EA-A8D1-78F9668C49D2} = {4B061F8B-A783-45EA-A8D1-78F9668C49D2} {5475F316-F9E9-4FF5-95ED-F7C9474709A3} = {5475F316-F9E9-4FF5-95ED-F7C9474709A3} {77321E0D-15DB-4C6E-8872-115CBBE41F27} = {77321E0D-15DB-4C6E-8872-115CBBE41F27} {8C55D3E0-FEC2-4A6C-A374-651516ED8F99} = {8C55D3E0-FEC2-4A6C-A374-651516ED8F99} @@ -47,78 +48,126 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_InfoReport", "XEngi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MQCore_MemoryCache", "MQCore_MemoryCache\MQCore_MemoryCache.vcxproj", "{8C55D3E0-FEC2-4A6C-A374-651516ED8F99}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MQCore_HelpModule", "MQCore_HelpModule\MQCore_HelpModule.vcxproj", "{4B061F8B-A783-45EA-A8D1-78F9668C49D2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|ARM64.Build.0 = Debug|ARM64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|x64.ActiveCfg = Debug|x64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|x64.Build.0 = Debug|x64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|x86.ActiveCfg = Debug|Win32 {34C9695F-7097-412F-ACC2-A3979A91D776}.Debug|x86.Build.0 = Debug|Win32 + {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|ARM64.ActiveCfg = Release|ARM64 + {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|ARM64.Build.0 = Release|ARM64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|x64.ActiveCfg = Release|x64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|x64.Build.0 = Release|x64 {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|x86.ActiveCfg = Release|Win32 {34C9695F-7097-412F-ACC2-A3979A91D776}.Release|x86.Build.0 = Release|Win32 + {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|ARM64.Build.0 = Debug|ARM64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|x64.ActiveCfg = Debug|x64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|x64.Build.0 = Debug|x64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|x86.ActiveCfg = Debug|Win32 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Debug|x86.Build.0 = Debug|Win32 + {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|ARM64.ActiveCfg = Release|ARM64 + {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|ARM64.Build.0 = Release|ARM64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|x64.ActiveCfg = Release|x64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|x64.Build.0 = Release|x64 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|x86.ActiveCfg = Release|Win32 {32D3FC68-6252-4D20-BB07-6C98BD753D11}.Release|x86.Build.0 = Release|Win32 + {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|ARM64.Build.0 = Debug|ARM64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|x64.ActiveCfg = Debug|x64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|x64.Build.0 = Debug|x64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|x86.ActiveCfg = Debug|Win32 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Debug|x86.Build.0 = Debug|Win32 + {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|ARM64.ActiveCfg = Release|ARM64 + {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|ARM64.Build.0 = Release|ARM64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|x64.ActiveCfg = Release|x64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|x64.Build.0 = Release|x64 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|x86.ActiveCfg = Release|Win32 {B0EB2A7A-53C1-4E9F-A851-19539099671C}.Release|x86.Build.0 = Release|Win32 + {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|ARM64.Build.0 = Debug|ARM64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|x64.ActiveCfg = Debug|x64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|x64.Build.0 = Debug|x64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|x86.ActiveCfg = Debug|Win32 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Debug|x86.Build.0 = Debug|Win32 + {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|ARM64.ActiveCfg = Release|ARM64 + {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|ARM64.Build.0 = Release|ARM64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|x64.ActiveCfg = Release|x64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|x64.Build.0 = Release|x64 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|x86.ActiveCfg = Release|Win32 {77321E0D-15DB-4C6E-8872-115CBBE41F27}.Release|x86.Build.0 = Release|Win32 + {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|ARM64.Build.0 = Debug|ARM64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|x64.ActiveCfg = Debug|x64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|x64.Build.0 = Debug|x64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|x86.ActiveCfg = Debug|Win32 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Debug|x86.Build.0 = Debug|Win32 + {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|ARM64.ActiveCfg = Release|ARM64 + {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|ARM64.Build.0 = Release|ARM64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|x64.ActiveCfg = Release|x64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|x64.Build.0 = Release|x64 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|x86.ActiveCfg = Release|Win32 {5475F316-F9E9-4FF5-95ED-F7C9474709A3}.Release|x86.Build.0 = Release|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|ARM64.Build.0 = Debug|ARM64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.ActiveCfg = Debug|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.Build.0 = Debug|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.ActiveCfg = Debug|Win32 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.Build.0 = Debug|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|ARM64.ActiveCfg = Release|ARM64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|ARM64.Build.0 = Release|ARM64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.ActiveCfg = Release|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.Build.0 = Release|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.ActiveCfg = Release|Win32 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.Build.0 = Release|Win32 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|ARM64.Build.0 = Debug|ARM64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.ActiveCfg = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.Build.0 = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x86.ActiveCfg = Debug|Win32 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x86.Build.0 = Debug|Win32 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|ARM64.ActiveCfg = Release|ARM64 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|ARM64.Build.0 = Release|ARM64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x64.ActiveCfg = Release|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x64.Build.0 = Release|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x86.ActiveCfg = Release|Win32 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x86.Build.0 = Release|Win32 + {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|ARM64.Build.0 = Debug|ARM64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|x64.ActiveCfg = Debug|x64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|x64.Build.0 = Debug|x64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|x86.ActiveCfg = Debug|Win32 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Debug|x86.Build.0 = Debug|Win32 + {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|ARM64.ActiveCfg = Release|ARM64 + {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|ARM64.Build.0 = Release|ARM64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|x64.ActiveCfg = Release|x64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|x64.Build.0 = Release|x64 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|x86.ActiveCfg = Release|Win32 {8C55D3E0-FEC2-4A6C-A374-651516ED8F99}.Release|x86.Build.0 = Release|Win32 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|ARM64.Build.0 = Debug|ARM64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|x64.ActiveCfg = Debug|x64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|x64.Build.0 = Debug|x64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|x86.ActiveCfg = Debug|Win32 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Debug|x86.Build.0 = Debug|Win32 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|ARM64.ActiveCfg = Release|ARM64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|ARM64.Build.0 = Release|ARM64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|x64.ActiveCfg = Release|x64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|x64.Build.0 = Release|x64 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|x86.ActiveCfg = Release|Win32 + {4B061F8B-A783-45EA-A8D1-78F9668C49D2}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp index 22a9ab7..34cf122 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp @@ -36,6 +36,22 @@ bool MQ_Service_Parament(int argc, char** argv, XENGINE_SERVERCONFIG* pSt_Startl { pSt_StartlParam->nHttpPort = _ttxoi(argv[++i]); } + else if (0 == _tcsxcmp("-WP", argv[i])) + { + pSt_StartlParam->nWSPort = _ttxoi(argv[++i]); + } + else if (0 == _tcsxcmp("-MP", argv[i])) + { + pSt_StartlParam->nMQTTPort = _ttxoi(argv[++i]); + } + else if (0 == _tcsxcmp("-LL", argv[i])) + { + pSt_StartlParam->st_XLog.nLogLeave = _ttxoi(argv[++i]); + } + else if (0 == _tcsxcmp("-LT", argv[i])) + { + pSt_StartlParam->st_XLog.nLogType = _ttxoi(argv[++i]); + } else if (0 == _tcsxcmp("-d",argv[i])) { pSt_StartlParam->bDeamon = _ttxoi(argv[++i]); diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h b/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h index fd4c49c..5028709 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h @@ -55,6 +55,8 @@ using namespace std; #include "../MQCore_DBModule/DBModule_Error.h" #include "../MQCore_ProtocolModule/Protocol_Define.h" #include "../MQCore_ProtocolModule/Protocol_Error.h" +#include "../MQCore_HelpModule/APIHelp_Define.h" +#include "../MQCore_HelpModule/APIHelp_Error.h" #include "../MQCore_MemoryCache/MemoryCache_Define.h" #include "../MQCore_MemoryCache/MemoryCache_Error.h" @@ -99,34 +101,54 @@ extern MESSAGEQUEUE_DBCONFIG st_DBConfig; #pragma comment(lib,"Ws2_32.lib") #pragma comment(lib,"Dbghelp.lib") #ifdef _DEBUG -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Debug/MQCore_ConfigModule.lib") #pragma comment(lib,"../x64/Debug/MQCore_ProtocolModule.lib") #pragma comment(lib,"../x64/Debug/MQCore_SessionModule.lib") #pragma comment(lib,"../x64/Debug/MQCore_DBModule.lib") +#pragma comment(lib,"../x64/Debug/MQCore_HelpModule.lib") #pragma comment(lib,"../x64/Debug/XEngine_InfoReport.lib") #pragma comment(lib,"../x64/Debug/MQCore_MemoryCache.lib") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/MQCore_ConfigModule.lib") +#pragma comment(lib,"../ARM64/Debug/MQCore_ProtocolModule.lib") +#pragma comment(lib,"../ARM64/Debug/MQCore_SessionModule.lib") +#pragma comment(lib,"../ARM64/Debug/MQCore_DBModule.lib") +#pragma comment(lib,"../ARM64/Debug/MQCore_HelpModule.lib") +#pragma comment(lib,"../ARM64/Debug/XEngine_InfoReport.lib") +#pragma comment(lib,"../ARM64/Debug/MQCore_MemoryCache.lib") +#elif _M_IX86 #pragma comment(lib,"../Debug/MQCore_ConfigModule.lib") #pragma comment(lib,"../Debug/MQCore_ProtocolModule.lib") #pragma comment(lib,"../Debug/MQCore_SessionModule.lib") #pragma comment(lib,"../Debug/MQCore_DBModule.lib") +#pragma comment(lib,"../Debug/MQCore_HelpModule.lib") #pragma comment(lib,"../Debug/XEngine_InfoReport.lib") #pragma comment(lib,"../Debug/MQCore_MemoryCache.lib") #endif #else -#ifdef _WIN64 +#ifdef _M_X64 #pragma comment(lib,"../x64/Release/MQCore_ConfigModule.lib") #pragma comment(lib,"../x64/Release/MQCore_ProtocolModule.lib") #pragma comment(lib,"../x64/Release/MQCore_SessionModule.lib") #pragma comment(lib,"../x64/Release/MQCore_DBModule.lib") +#pragma comment(lib,"../x64/Release/MQCore_HelpModule.lib") #pragma comment(lib,"../x64/Release/XEngine_InfoReport.lib") #pragma comment(lib,"../x64/Release/MQCore_MemoryCache.lib") -#else +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/MQCore_ConfigModule.lib") +#pragma comment(lib,"../ARM64/Release/MQCore_ProtocolModule.lib") +#pragma comment(lib,"../ARM64/Release/MQCore_SessionModule.lib") +#pragma comment(lib,"../ARM64/Release/MQCore_DBModule.lib") +#pragma comment(lib,"../ARM64/Release/MQCore_HelpModule.lib") +#pragma comment(lib,"../ARM64/Release/XEngine_InfoReport.lib") +#pragma comment(lib,"../ARM64/Release/MQCore_MemoryCache.lib") +#elif _M_IX86 #pragma comment(lib,"../Release/MQCore_ConfigModule.lib") #pragma comment(lib,"../Release/MQCore_ProtocolModule.lib") #pragma comment(lib,"../Release/MQCore_SessionModule.lib") #pragma comment(lib,"../Release/MQCore_DBModule.lib") +#pragma comment(lib,"../Release/MQCore_HelpModule.lib") #pragma comment(lib,"../Release/XEngine_InfoReport.lib") #pragma comment(lib,"../Release/MQCore_MemoryCache.lib") #endif diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp index 4ce4914..8e0d9ca 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp @@ -55,86 +55,178 @@ bool MessageQueue_Http_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXST LPCXSTR lpszAPIUser = _X("user"); LPCXSTR lpszAPITopic = _X("topic"); LPCXSTR lpszAPIOnline = _X("online"); + LPCXSTR lpszAPIDelete = _X("delete"); + int nUrlCount = 0; + XCHAR** ppSt_ListUrl; + HttpProtocol_ServerHelp_GetParament(pSt_HTTPParam->tszHttpUri, &ppSt_ListUrl, &nUrlCount); + if (nUrlCount < 1) + { + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, ERROR_XENGINE_MESSAGE_HTTP_PARAMENT, "url parament is incorrent"); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求HTTP管理接口失败,参数错误:%s"), lpszClientAddr, pSt_HTTPParam->tszHttpUri); + return false; + } + int nMethodPos = 0; + //判断是否需要验证 + if (st_ServiceCfg.st_XAuthorize.bHTTPAuth) + { + //http://127.0.0.1:5202/api?function=user&auth=XENGINE_MQPasskey + BaseLib_String_GetKeyValue(ppSt_ListUrl[1], _X("="), tszKey, tszValue); + if (_tcsxlen(st_ServiceCfg.st_XAuthorize.tszHTTPPass) > 0) + { + int nHTTPCode = 0; + ProtocolModule_Packet_PassHttp(tszPKTBuffer, &nPKTLen, pptszListHdr[1], pptszListHdr[0], pSt_HTTPParam->tszHttpMethod); + APIClient_Http_Request("POST", st_ServiceCfg.st_XAuthorize.tszHTTPPass, tszPKTBuffer, &nHTTPCode); + if (200 != nHTTPCode) + { + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, ERROR_XENGINE_MESSAGE_HTTP_AUTHORIZE, "auth key is incorrent"); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求HTTP管理接口失败,验证失败:%s"), lpszClientAddr, pSt_HTTPParam->tszHttpUri); + return false; + } + } + else + { + if (0 != _tcsxncmp(st_ServiceCfg.st_XAuthorize.tszToken, tszValue, _tcsxlen(st_ServiceCfg.st_XAuthorize.tszToken))) + { + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, ERROR_XENGINE_MESSAGE_HTTP_AUTHORIZE, "auth key is incorrent"); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求HTTP管理接口失败,验证失败:%s"), lpszClientAddr, pSt_HTTPParam->tszHttpUri); + return false; + } + } + nMethodPos++; + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求HTTP管理接口验证成功,验证TOKEN:%s"), lpszClientAddr, ppSt_ListUrl[1]); + } + //判断请求 if (0 == _tcsxnicmp(lpszPostMethod, pSt_HTTPParam->tszHttpMethod, _tcsxlen(lpszPostMethod))) { + } else if (0 == _tcsxnicmp(lpszGetMethod, pSt_HTTPParam->tszHttpMethod, _tcsxlen(lpszGetMethod))) { - int nUrlCount = 0; - XCHAR** ppSt_ListUrl; - HttpProtocol_ServerHelp_GetParament(pSt_HTTPParam->tszHttpUri, &ppSt_ListUrl, &nUrlCount); - if (nUrlCount < 1) + //获取函数 + memset(tszValue, '\0', MAX_PATH); + BaseLib_String_GetKeyValue(ppSt_ListUrl[0], _X("="), tszKey, tszValue); + if (0 == _tcsxnicmp(lpszAPIUser, tszValue, _tcsxlen(lpszAPIUser))) { - ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, 400, "url parament is incorrent"); + //用户 http://127.0.0.1:5202/api?function=user + int nListCount = 0; + XENGINE_PROTOCOL_USERINFO** ppSt_UserInfo; + DBModule_MQUser_UserList(&ppSt_UserInfo, &nListCount); + ProtocolModule_Packet_UserList(tszPKTBuffer, &nPKTLen, &ppSt_UserInfo, nListCount); + BaseLib_Memory_Free((XPPPMEM)&ppSt_UserInfo, nListCount); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); - return false; + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,发送的获取用户列表请求成功,获取到的用户列表个数:%d"), lpszClientAddr, nListCount); } - //获取函数 - BaseLib_String_GetKeyValue(ppSt_ListUrl[0], _X("="), tszKey, tszValue); - if (0 == _tcsxnicmp(lpszAPIGet, tszValue, _tcsxlen(lpszAPIGet))) + else if (0 == _tcsxnicmp(lpszAPIOnline, tszValue, _tcsxlen(lpszAPIOnline))) { - memset(tszValue, '\0', MAX_PATH); - BaseLib_String_GetKeyValue(ppSt_ListUrl[1], _X("="), tszKey, tszValue); - if (0 == _tcsxnicmp(lpszAPIUser, tszValue, _tcsxlen(lpszAPIUser))) + //获取在线用户 http://127.0.0.1:5202/api?function=online&type=0 + int nListCount = 0; + XCHAR** pptszListAddr; + + BaseLib_String_GetKeyValue(ppSt_ListUrl[nMethodPos + 1], _X("="), tszKey, tszValue); + SessionModule_Client_GetListAddr(&pptszListAddr, &nListCount, _ttxoi(tszValue)); + ProtocolModule_Packet_OnlineList(tszPKTBuffer, &nPKTLen, &pptszListAddr, nListCount); + BaseLib_Memory_Free((XPPPMEM)&pptszListAddr, nListCount); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,发送的获取在线用户列表请求成功,获取到的列表个数:%d"), lpszClientAddr, nListCount); + } + else if (0 == _tcsxnicmp(lpszAPITopic, tszValue, _tcsxlen(lpszAPITopic))) + { + //主题 http://127.0.0.1:5202/api?function=topic&name=comm + if (2 == nUrlCount) { - //用户 http://127.0.0.1:5202/api?function=get&method=user int nListCount = 0; - XENGINE_PROTOCOL_USERINFO** ppSt_UserInfo; - DBModule_MQUser_UserList(&ppSt_UserInfo, &nListCount); - ProtocolModule_Packet_UserList(tszPKTBuffer, &nPKTLen, &ppSt_UserInfo, nListCount); - BaseLib_Memory_Free((XPPPMEM)&ppSt_UserInfo, nListCount); - + XCHAR** ppszTableName; + DBModule_MQData_ShowTable(&ppszTableName, &nListCount); + ProtocolModule_Packet_TopicList(tszPKTBuffer, &nPKTLen, &ppszTableName, nListCount); + BaseLib_Memory_Free((XPPPMEM)&ppszTableName, nListCount); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,发送的获取主题列表请求成功,获取到的主题列表个数:%d"), lpszClientAddr, nListCount); + } + else + { + int nDBCount = 0; + BaseLib_String_GetKeyValue(ppSt_ListUrl[nMethodPos + 1], _X("="), tszKey, tszValue); + DBModule_MQData_GetLeftCount(tszValue, 0, &nDBCount); + ProtocolModule_Packet_TopicName(tszPKTBuffer, &nPKTLen, tszValue, nDBCount); XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_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, nDBCount); } - else if (0 == _tcsxnicmp(lpszAPIOnline, tszValue, _tcsxlen(lpszAPIOnline))) + } + else if (0 == _tcsxnicmp(lpszAPIDelete, tszValue, _tcsxlen(lpszAPIDelete))) + { + //http://127.0.0.1:5202/api?function=delete&type=0&name=comm + + memset(tszValue, '\0', MAX_PATH); + BaseLib_String_GetKeyValue(ppSt_ListUrl[nMethodPos + 2], _X("="), tszKey, tszValue); + if (0 == _ttxoi(tszValue)) { - //获取在线用户 http://127.0.0.1:5202/api?function=get&method=online&type=0 - if (3 != nUrlCount) + //type = 0 删除主题 + memset(tszValue, '\0', MAX_PATH); + BaseLib_String_GetKeyValue(ppSt_ListUrl[nMethodPos + 3], _X("="), tszKey, tszValue); + + XENGINE_DBTOPICOWNER st_DBOwner = {}; + XENGINE_DBUSERKEY st_UserKey = {}; + XENGINE_DBTIMERELEASE st_DBInfo = {}; + + _tcsxcpy(st_DBOwner.tszQueueName, tszValue); + _tcsxcpy(st_UserKey.tszKeyName, tszValue); + _tcsxcpy(st_DBInfo.tszQueueName, tszValue); + if (!DBModule_MQUser_OwnerDelete(&st_DBOwner)) { - ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, 400, "url parament is incorrent"); + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, ERROR_XENGINE_MESSAGE_HTTP_NOTFOUND, "topic name not found"); XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求HTTP删除主题失败,主题不存在:%s"), lpszClientAddr, tszValue); return false; } - int nListCount = 0; - XCHAR** pptszListAddr; - - BaseLib_String_GetKeyValue(ppSt_ListUrl[2], _X("="), tszKey, tszValue); - SessionModule_Client_GetListAddr(&pptszListAddr, &nListCount, _ttxoi(tszValue)); - ProtocolModule_Packet_OnlineList(tszPKTBuffer, &nPKTLen, &pptszListAddr, nListCount); - BaseLib_Memory_Free((XPPPMEM)&pptszListAddr, nListCount); + //清楚数据库 + APIHelp_Counter_SerialDel(tszValue); + DBModule_MQData_DeleteTable(tszValue); + DBModule_MQUser_KeyDelete(&st_UserKey); + DBModule_MQUser_TimeDelete(&st_DBInfo); + + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen); XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_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,请求主题删除成功,主题名:%s"), lpszClientAddr, tszValue); } - else if (0 == _tcsxnicmp(lpszAPITopic, tszValue, _tcsxlen(lpszAPITopic))) + else { - //主题 http://127.0.0.1:5202/api?function=get&method=topic&name=comm - if (2 == nUrlCount) - { - int nListCount = 0; - XCHAR** ppszTableName; - DBModule_MQData_ShowTable(&ppszTableName, &nListCount); - ProtocolModule_Packet_TopicList(tszPKTBuffer, &nPKTLen, &ppszTableName, nListCount); - BaseLib_Memory_Free((XPPPMEM)&ppszTableName, nListCount); - XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,发送的获取主题列表请求成功,获取到的主题列表个数:%d"), lpszClientAddr, nListCount); - } - else + // 删除用户 + memset(tszValue, '\0', MAX_PATH); + BaseLib_String_GetKeyValue(ppSt_ListUrl[nMethodPos + 3], _X("="), tszKey, tszValue); + + XENGINE_PROTOCOL_USERINFO st_UserInfo = {}; + XENGINE_DBUSERKEY st_UserKey = {}; + XENGINE_DBTOPICOWNER st_DBOwner = {}; + + _tcsxcpy(st_UserInfo.tszUserName, tszValue); + _tcsxcpy(st_UserKey.tszUserName, tszValue); + _tcsxcpy(st_DBOwner.tszUserName, tszValue); + + if (!DBModule_MQUser_UserQuery(&st_UserInfo)) { - int nDBCount = 0; - BaseLib_String_GetKeyValue(ppSt_ListUrl[2], _X("="), tszKey, tszValue); - DBModule_MQData_GetLeftCount(tszValue, 0, &nDBCount); - ProtocolModule_Packet_TopicName(tszPKTBuffer, &nPKTLen, tszValue, nDBCount); + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen, ERROR_XENGINE_MESSAGE_HTTP_NOTFOUND, "user name not found"); XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,发送的获取主题列表请求成功,获取到的主题消息个数:%d"), lpszClientAddr, nDBCount); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求HTTP删除用户失败,用户不存在:%s"), lpszClientAddr, st_UserInfo.tszUserName); + return false; } + DBModule_MQUser_UserDelete(&st_UserInfo); + DBModule_MQUser_KeyDelete(&st_UserKey); + DBModule_MQUser_OwnerDelete(&st_DBOwner); + + ProtocolModule_Packet_Http(tszPKTBuffer, &nPKTLen); + XEngine_MQXService_Send(lpszClientAddr, tszPKTBuffer, nPKTLen, XENGINE_MQAPP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求用户删除成功,用户名:%s"), lpszClientAddr, st_UserInfo.tszUserName); } } } else { - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("HTTP消息端:%s,协议错误"), lpszClientAddr); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("HTTP客户端:%s,协议错误"), lpszClientAddr); } return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp index 31a35b6..465a86f 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp @@ -122,6 +122,14 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else { + if (_tcsxlen(st_UserInfo.tszUserPass) <= 0) + { + pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_AUTH_USERPASS; + ProtocolModule_Packet_Common(nNetType, pSt_ProtocolHdr, NULL, tszSDBuffer, &nSDLen); + XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("%s客户端:%s,请求本地验证失败,密码为空"), lpszClientType, lpszClientAddr); + return false; + } if (!DBModule_MQUser_UserQuery(&st_UserInfo)) { pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_AUTH_USERPASS; @@ -210,6 +218,14 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else { + if (_tcsxlen(st_UserInfo.tszUserPass) <= 0) + { + pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_AUTH_USERPASS; + ProtocolModule_Packet_Common(nNetType, pSt_ProtocolHdr, NULL, tszSDBuffer, &nSDLen); + XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("%s客户端:%s,请求本地验证失败,密码为空"), lpszClientType, lpszClientAddr); + return false; + } if (DBModule_MQUser_UserQuery(&st_UserInfo)) { pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_AUTH_EXISTED; @@ -377,15 +393,19 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else { - //序列号为0,自加 - if (DBModule_MQData_GetSerial(st_DBQueue.tszQueueName, NULL, NULL, &st_DBIndex)) - { - st_DBQueue.nQueueSerial = st_DBIndex.nQueueSerial + 1; - } - else + if (!APIHelp_Counter_SerialGet(st_DBQueue.tszQueueName, &st_DBQueue.nQueueSerial)) { - //可能为空表 - st_DBQueue.nQueueSerial = 1; + //序列号为0,自加 + if (DBModule_MQData_GetSerial(st_DBQueue.tszQueueName, NULL, NULL, &st_DBIndex)) + { + st_DBQueue.nQueueSerial = st_DBIndex.nQueueSerial + 1; + } + else + { + //可能为空表 + st_DBQueue.nQueueSerial = 1; + } + APIHelp_Counter_SerialSet(st_DBQueue.tszQueueName, st_DBQueue.nQueueSerial); } } //是否被设置定时发布 @@ -681,6 +701,25 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQTOPICCREATE == pSt_ProtocolHdr->unOperatorCode) { pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REPTOPICCREATE; + + int nListCount = 0; + XCHAR** ppszTableName; + //检查表是否存在 + DBModule_MQData_ShowTable(&ppszTableName, &nListCount); + for (int i = 0; i < nListCount; i++) + { + if (0 == _tcsxnicmp(ppszTableName[i], st_MQProtocol.tszMQKey, _tcsxlen(ppszTableName[i]))) + { + if (pSt_ProtocolHdr->byIsReply) + { + pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_XMQ_EXISTED; + ProtocolModule_Packet_Common(nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen); + XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("%s消息端:%s,创建主题失败,主题名称:%s,主题存在,无法继续"), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey); + return false; + } + } //创建表 if (!DBModule_MQData_CreateTable(st_MQProtocol.tszMQKey)) { @@ -737,6 +776,17 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC _tcsxcpy(st_UserKey.tszKeyName, st_MQProtocol.tszMQKey); _tcsxcpy(st_DBInfo.tszQueueName, st_MQProtocol.tszMQKey); + if (_tcsxlen(st_DBOwner.tszUserName) <= 0) + { + if (pSt_ProtocolHdr->byIsReply) + { + pSt_ProtocolHdr->wReserve = ERROR_XENGINE_MESSAGE_XMQ_DELOWNER; + ProtocolModule_Packet_Common(nNetType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen); + XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, nNetType); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("%s消息端:%s,删除主题失败,删除所有者失败,主题名称:%s,用户名为空"), lpszClientType, lpszClientAddr, st_MQProtocol.tszMQKey, tszUserName); + return false; + } if (!DBModule_MQUser_OwnerDelete(&st_DBOwner)) { if (pSt_ProtocolHdr->byIsReply) @@ -749,6 +799,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC return false; } //清楚数据库 + APIHelp_Counter_SerialDel(st_MQProtocol.tszMQKey); DBModule_MQData_DeleteTable(st_MQProtocol.tszMQKey); DBModule_MQUser_KeyDelete(&st_UserKey); DBModule_MQUser_TimeDelete(&st_DBInfo); diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp index 7b13e65..e37030e 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp @@ -28,6 +28,8 @@ void CALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, st_DBInfo.nQueueSerial = pSt_DBInfo->nIDMsg; _tcsxcpy(st_DBInfo.tszQueueName, pSt_DBInfo->tszQueueName); DBModule_MQData_Query(&st_DBInfo); + + memcpy(&st_MQProtocol.st_MSGAttr, &st_DBInfo.nMsgAttr, sizeof(st_DBInfo.nMsgAttr)); //是否需要通知 int nListCount = 0; XENGINE_DBUSERKEY** ppSt_ListUser; diff --git a/XEngine_Source/XEngine_MQServiceApp/Makefile b/XEngine_Source/XEngine_MQServiceApp/Makefile index e6710ce..62bd490 100644 --- a/XEngine_Source/XEngine_MQServiceApp/Makefile +++ b/XEngine_Source/XEngine_MQServiceApp/Makefile @@ -4,10 +4,10 @@ PLATVER = PLATDIR = RELEASE = 0 LOADHDR = -I ./ -LOADSO = -L ../MQCore_ConfigModule -L ../MQCore_ProtocolModule -L ../MQCore_SessionModule -L ../MQCore_MemoryCache -L ../MQCore_DBModule \ +LOADSO = -L ../MQCore_ConfigModule -L ../MQCore_ProtocolModule -L ../MQCore_SessionModule -L ../MQCore_MemoryCache -L ../MQCore_DBModule -L ../MQCore_HelpModule \ -L ../XEngine_Depend/XEngine_Module/jsoncpp -L ../XEngine_Depend/XEngine_Module/XEngine_InfoReport LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXClient_APIHelp -lXEngine_SystemApi -lHelpComponents_XLog -lHelpComponents_Packets -lRfcComponents_WSProtocol -lRfcComponents_HttpProtocol -lRfcComponents_MQTTProtocol \ - -lMQCore_ConfigModule -lMQCore_ProtocolModule -lMQCore_SessionModule -lMQCore_MemoryCache -lMQCore_DBModule \ + -lMQCore_ConfigModule -lMQCore_ProtocolModule -lMQCore_SessionModule -lMQCore_MemoryCache -lMQCore_DBModule -lMQCore_HelpModule\ -ljsoncpp -lXEngine_InfoReport LIBEX = OBJECTS = MQService_Net.o MQService_Config.o MQService_TCPTask.o MQService_HttpTask.o MQService_WSTask.o MQService_Task.o MQService_MQTTTask.o XEngine_MQServiceApp.o diff --git a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp index 5842154..e5dcd2a 100644 --- a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp @@ -147,13 +147,13 @@ int main(int argc, char** argv) st_XLogConfig.XLog_MaxSize = st_ServiceCfg.st_XLog.nMaxSize; _tcsxcpy(st_XLogConfig.tszFileName, st_ServiceCfg.st_XLog.tszLOGFile); - xhLog = HelpComponents_XLog_Init(HELPCOMPONENTS_XLOG_OUTTYPE_STD | HELPCOMPONENTS_XLOG_OUTTYPE_FILE, &st_XLogConfig); + xhLog = HelpComponents_XLog_Init(st_ServiceCfg.st_XLog.nLogType, &st_XLogConfig); if (NULL == xhLog) { printf("启动服务器失败,启动日志失败,错误:%lX", XLog_GetLastError()); goto NETSERVICEEXIT; } - HelpComponents_XLog_SetLogPriority(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO); + HelpComponents_XLog_SetLogPriority(xhLog, st_ServiceCfg.st_XLog.nLogLeave); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化日志系统成功")); if (!Config_Json_DBFile(lpszDBConfig, &st_DBConfig)) diff --git a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.vcxproj b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.vcxproj index 1923395..8c20b2d 100644 --- a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.vcxproj +++ b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + Application + true + v143 + Unicode + Application false @@ -52,6 +66,13 @@ true Unicode + + Application + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -140,6 +177,20 @@ true + + + Level3 + true + _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Console + true + + Level3 @@ -161,6 +212,27 @@ true + + + Level3 + true + true + true + WIN64;NDEBUG;_CONSOLE;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreaded + 4819 + stdcpp20 + stdc17 + /utf-8 %(AdditionalOptions) + + + Console + true + true + true + + diff --git a/XEngine_Source/XQueue_ProtocolHdr.h b/XEngine_Source/XQueue_ProtocolHdr.h index d03b55f..9148158 100644 --- a/XEngine_Source/XQueue_ProtocolHdr.h +++ b/XEngine_Source/XQueue_ProtocolHdr.h @@ -54,33 +54,37 @@ /////////////////////////////////////////////////////////////////////////// // 协议错误定义 /////////////////////////////////////////////////////////////////////////// -#define ERROR_XENGINE_MESSAGE_AUTH_LOGGED 0x1001 //已经登陆过了 -#define ERROR_XENGINE_MESSAGE_AUTH_HTTP 0x1002 //HTTP PASS验证失败 -#define ERROR_XENGINE_MESSAGE_AUTH_USERPASS 0x1003 //用户或者密码错误 -#define ERROR_XENGINE_MESSAGE_AUTH_NOTLOGIN 0x1004 //没有登陆,禁止操作 -#define ERROR_XENGINE_MESSAGE_AUTH_APIREG 0x1005 //HTTP 远程注册失败 -#define ERROR_XENGINE_MESSAGE_AUTH_EXISTED 0x1006 //用户已经存在 -#define ERROR_XENGINE_MESSAGE_AUTH_REGISTER 0x1007 //用户注册失败,数据错误 -#define ERROR_XENGINE_MESSAGE_AUTH_APIDEL 0x1008 //HTTP API删除失败 -#define ERROR_XENGINE_MESSAGE_AUTH_DELETE 0x1009 //本地删除失败 +#define ERROR_XENGINE_MESSAGE_AUTH_LOGGED 0x001 //已经登陆过了 +#define ERROR_XENGINE_MESSAGE_AUTH_HTTP 0x002 //HTTP PASS验证失败 +#define ERROR_XENGINE_MESSAGE_AUTH_USERPASS 0x003 //用户或者密码错误 +#define ERROR_XENGINE_MESSAGE_AUTH_NOTLOGIN 0x004 //没有登陆,禁止操作 +#define ERROR_XENGINE_MESSAGE_AUTH_APIREG 0x005 //HTTP 远程注册失败 +#define ERROR_XENGINE_MESSAGE_AUTH_EXISTED 0x006 //用户已经存在 +#define ERROR_XENGINE_MESSAGE_AUTH_REGISTER 0x007 //用户注册失败,数据错误 +#define ERROR_XENGINE_MESSAGE_AUTH_APIDEL 0x008 //HTTP API删除失败 +#define ERROR_XENGINE_MESSAGE_AUTH_DELETE 0x009 //本地删除失败 -#define ERROR_XENGINE_MESSAGE_XMQ_EXISTED 0x2001 //消息存在 -#define ERROR_XENGINE_MESSAGE_XMQ_INSERT 0x2002 //插入数据库失败 -#define ERROR_XENGINE_MESSAGE_XMQ_MSGQUERY 0x2003 //查询消息失败 -#define ERROR_XENGINE_MESSAGE_XMQ_BELONG 0x2004 //指定用户消息,无权使用 -#define ERROR_XENGINE_MESSAGE_XMQ_TIMEOUT 0x2005 //消息超时,无权使用 -#define ERROR_XENGINE_MESSAGE_XMQ_PUBTIME 0x2006 //定时消息,无权使用 -#define ERROR_XENGINE_MESSAGE_XMQ_KEYQUERY 0x2007 //查询绑定消息失败 -#define ERROR_XENGINE_MESSAGE_XMQ_SERIAL 0x2008 //消息序号错误 -#define ERROR_XENGINE_MESSAGE_XMQ_CREATEKEY 0x2009 //创建消息KEY失败 -#define ERROR_XENGINE_MESSAGE_XMQ_BINDOWNER 0x2010 //绑定所有者失败 -#define ERROR_XENGINE_MESSAGE_XMQ_DELOWNER 0x2011 //删除所有者失败 -#define ERROR_XENGINE_MESSAGE_XMQ_KEYUP 0x2012 //更新KEY失败 -#define ERROR_XENGINE_MESSAGE_XMQ_BINDKEY 0x2013 //绑定KEY失败 -#define ERROR_XENGINE_MESSAGE_XMQ_DELKEY 0x2014 //删除KEY失败 -#define ERROR_XENGINE_MESSAGE_XMQ_QUERYOWNER 0x2015 //查询所有者失败 -#define ERROR_XENGINE_MESSAGE_XMQ_MODIFYTOPIC 0x2016 //修改主题失败 -#define ERROR_XENGINE_MESSAGE_XMQ_MODIFYMSG 0x2017 //修改消息失败 +#define ERROR_XENGINE_MESSAGE_XMQ_EXISTED 0x101 //消息存在 +#define ERROR_XENGINE_MESSAGE_XMQ_INSERT 0x102 //插入数据库失败 +#define ERROR_XENGINE_MESSAGE_XMQ_MSGQUERY 0x103 //查询消息失败 +#define ERROR_XENGINE_MESSAGE_XMQ_BELONG 0x104 //指定用户消息,无权使用 +#define ERROR_XENGINE_MESSAGE_XMQ_TIMEOUT 0x105 //消息超时,无权使用 +#define ERROR_XENGINE_MESSAGE_XMQ_PUBTIME 0x106 //定时消息,无权使用 +#define ERROR_XENGINE_MESSAGE_XMQ_KEYQUERY 0x107 //查询绑定消息失败 +#define ERROR_XENGINE_MESSAGE_XMQ_SERIAL 0x108 //消息序号错误 +#define ERROR_XENGINE_MESSAGE_XMQ_CREATEKEY 0x109 //创建消息KEY失败 +#define ERROR_XENGINE_MESSAGE_XMQ_BINDOWNER 0x110 //绑定所有者失败 +#define ERROR_XENGINE_MESSAGE_XMQ_DELOWNER 0x111 //删除所有者失败 +#define ERROR_XENGINE_MESSAGE_XMQ_KEYUP 0x112 //更新KEY失败 +#define ERROR_XENGINE_MESSAGE_XMQ_BINDKEY 0x113 //绑定KEY失败 +#define ERROR_XENGINE_MESSAGE_XMQ_DELKEY 0x114 //删除KEY失败 +#define ERROR_XENGINE_MESSAGE_XMQ_QUERYOWNER 0x115 //查询所有者失败 +#define ERROR_XENGINE_MESSAGE_XMQ_MODIFYTOPIC 0x116 //修改主题失败 +#define ERROR_XENGINE_MESSAGE_XMQ_MODIFYMSG 0x117 //修改消息失败 + +#define ERROR_XENGINE_MESSAGE_HTTP_PARAMENT 0x201 //HTTP请求参数错误 +#define ERROR_XENGINE_MESSAGE_HTTP_AUTHORIZE 0x202 //验证失败没有权限 +#define ERROR_XENGINE_MESSAGE_HTTP_NOTFOUND 0x203 //没有找到请求的数据 /////////////////////////////////////////////////////////////////////////// // 导出的数据结构 ///////////////////////////////////////////////////////////////////////////