diff --git a/.github/workflows/Rocky_build.yml b/.github/workflows/Rocky_build.yml index d3350e7..c78dfb6 100644 --- a/.github/workflows/Rocky_build.yml +++ b/.github/workflows/Rocky_build.yml @@ -16,7 +16,7 @@ jobs: build: runs-on: ${{ matrix.runner }} container: - image: rockylinux/rockylinux:9.5 + image: rockylinux/rockylinux:${{ matrix.version }} options: --platform ${{ matrix.platform }} strategy: matrix: @@ -25,10 +25,22 @@ jobs: runner: ubuntu-24.04 platform: linux/amd64 artifact: x86-64 + version: 9 + - arch: amd64 + runner: ubuntu-24.04 + platform: linux/amd64 + artifact: x86-64 + version: 10 + - arch: arm64 + runner: ubuntu-24.04-arm + platform: linux/arm64 + artifact: Arm64 + version: 9 - arch: arm64 runner: ubuntu-24.04-arm platform: linux/arm64 artifact: Arm64 + version: 10 steps: - name: Checkout main repository code @@ -46,7 +58,7 @@ jobs: uses: actions/checkout@v4 with: repository: libxengine/XEngine_OPenSource - path: XEngine_Source/XEngine_Depend + path: XEngine_Source/XEngine_DependLibrary - name: Set TERM variable run: echo "TERM=xterm" >> $GITHUB_ENV @@ -59,9 +71,9 @@ jobs: - 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_${{ matrix.artifact }}.zip - unzip ./XEngine_RockyLinux_9_${{ matrix.artifact }}.zip -d ./XEngine_RockyLinux_9_${{ matrix.artifact }} - cd XEngine_RockyLinux_9_${{ matrix.artifact }} + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_RockyLinux_${{ matrix.version }}_${{ matrix.artifact }}.zip + unzip ./XEngine_RockyLinux_${{ matrix.version }}_${{ matrix.artifact }}.zip -d ./XEngine_RockyLinux_${{ matrix.version }}_${{ matrix.artifact }} + cd XEngine_RockyLinux_${{ matrix.version }}_${{ matrix.artifact }} chmod 777 * ./XEngine_LINEnv.sh -i 3 @@ -85,6 +97,6 @@ jobs: - name: Upload folder as artifact with RockyLinux uses: actions/upload-artifact@v4 with: - name: XEngine_MQServiceApp-RockyLinux_9_${{ matrix.artifact }} + name: XEngine_MQServiceApp-RockyLinux_${{ matrix.version }}_${{ matrix.artifact }} path: XEngine_Release/ retention-days: 1 diff --git a/.github/workflows/debian_build.yml b/.github/workflows/debian_build.yml index 1781146..3b48baa 100644 --- a/.github/workflows/debian_build.yml +++ b/.github/workflows/debian_build.yml @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@v4 with: repository: libxengine/XEngine_OPenSource - path: XEngine_Source/XEngine_Depend + path: XEngine_Source/XEngine_DependLibrary - name: Set TERM variable run: echo "TERM=xterm" >> $GITHUB_ENV diff --git a/.github/workflows/fedora_build.yml b/.github/workflows/fedora_build.yml index 93dfc85..2c2f61c 100644 --- a/.github/workflows/fedora_build.yml +++ b/.github/workflows/fedora_build.yml @@ -46,7 +46,7 @@ jobs: uses: actions/checkout@v4 with: repository: libxengine/XEngine_OPenSource - path: XEngine_Source/XEngine_Depend + path: XEngine_Source/XEngine_DependLibrary - name: install system package run: | diff --git a/.gitmodules b/.gitmodules index 1cc1974..3949a92 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "XEngine_Source/XEngine_Depend"] - path = XEngine_Source/XEngine_Depend + path = XEngine_Source/XEngine_DependLibrary url = https://github.com/libxengine/XEngine_OPenSource.git diff --git a/CHANGELOG b/CHANGELOG index a3b41ee..33c6da4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,33 @@ +XEngine_MQService V3.17.0.1001 + +增加:rocky linux 10 支持 +增加:http basic和digest验证支持 +增加:电子邮件通知功能 +更新:依赖库 +更新:匹配最新xengine 版本 +优化:消息响应设置 +修改:依赖库目录名 +修改:启动参数不区分大小写 +修改:消息协议头大小 +修正:某些时候配置读取内存溢出 +修正:版本输出错误 +修正:未读消息协议头字段不正确 +删除:注册验证 + +added:ci rocky linux 10 support +added:http basic and digest verification support +added:email notify support +update:depend library +update:match xengine last version +improved:reply message protocol set +modify:depend library direction name +modify:start parameter are not case sensitive +modify:message header size +fixed:sometime load configure memory leak +fixed:version print failure when set -v parameter +fixed:header protocol field incorrect when unread message reply +delete:register authorize +====================================================================================== XEngine_MQService V3.16.0.1001 增加:使用内存池发送数据 diff --git a/README.en.md b/README.en.md index ba1f938..c967926 100644 --- a/README.en.md +++ b/README.en.md @@ -35,6 +35,9 @@ this software support following features 19. message attritube 20. point to point message 21. Memory Database +22. http verification +23. email notify +24. sms notify(plan) ## install @@ -54,7 +57,7 @@ Requires MYSQL service support, execute XEngine_SQLFile/CreateDatabase.sql to cr Execute XEngine_SQLFile/XEngine_MQData.sql and XEngine_SQLFile/XEngine_MQUser.sql to create the table #### sub module -Due to the dependent sub-modules, after you checkout the warehouse, execute the following command in the warehouse directory to pull the sub-modules +Due to the dependent sub-modules, after you checkout the resprepository, execute the following command in the resprepository directory to pull the sub-modules git submodule init git submodule update diff --git a/README.md b/README.md index 87fdfd5..63144b5 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ c c++Message Service 19. 消息属性 20. 点对点消息 21. 高速缓存 +22. http验证 +23. 电子邮件通知 +24. 短信通知(plan) ## 安装教程 @@ -59,7 +62,7 @@ macos执行:./XEngine_LINEnv.sh -i 3 由于依赖的子模块,在你checkout仓库后,在仓库目录下执行下面的命令拉取子模块 git submodule init git submodule update -如果github访问失败,你也可以clone该项目,在主目录下使用命令:git clone https://gitee.com/xengine/XEngine_OPenSource.git XEngine_Source/XEngine_Depend +如果github访问失败,你也可以clone该项目,在主目录下使用命令:git clone https://gitee.com/xengine/XEngine_OPenSource.git XEngine_Source/XEngine_DependLibrary #### Windows 使用VS打开并且编译,支持WINDOWS 7SP1以上系统 diff --git a/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj b/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj index 37db60e..91905eb 100644 --- a/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj +++ b/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj @@ -72,7 +72,7 @@ true - $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../../XEngine_Source/XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib32);$(LibraryPath) @@ -80,7 +80,7 @@ true - $(XEngine_Include);$(IncludePath) + $(XEngine_Include);../../XEngine_Source/XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) diff --git a/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj.filters b/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj.filters index 733e87a..a658faa 100644 --- a/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj.filters +++ b/XEngine_Apps/MQCore_HTTPApp/MQCore_HTTPApp.vcxproj.filters @@ -5,14 +5,14 @@ {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 + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + diff --git a/XEngine_Apps/MQCore_TCPApp/MQCore_TCPApp.cpp b/XEngine_Apps/MQCore_TCPApp/MQCore_TCPApp.cpp index a6eaac5..a200676 100644 --- a/XEngine_Apps/MQCore_TCPApp/MQCore_TCPApp.cpp +++ b/XEngine_Apps/MQCore_TCPApp/MQCore_TCPApp.cpp @@ -25,7 +25,7 @@ using namespace std; XSOCKET m_Socket; __int64x nLastNumber = 0; LPCXSTR lpszKey = _X("XEngine_CommKey"); //主题 -LPCXSTR lpszUser = _X("aaadddzxc"); +LPCXSTR lpszUser = _X("123123aa"); LPCXSTR lpszPass = _X("123123"); void MQ_Authorize() @@ -247,6 +247,56 @@ void MQ_Post(LPCXSTR lpszMsgBuffer, int nType = 0, int nPubTime = -1, bool bSelf memcpy(&st_XMQProtocol, ptszMsgBuffer, sizeof(XENGINE_PROTOCOL_XMQ)); BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); } +void MQ_PostEMail(LPCXSTR lpszMsgBuffer) +{ + int nLen = 0; + XENGINE_PROTOCOLHDR st_ProtocolHdr; + XENGINE_PROTOCOL_XMQ st_XMQProtocol; + XCHAR tszMsgBuffer[2048]; + + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR)); + memset(&st_XMQProtocol, '\0', sizeof(XENGINE_PROTOCOL_XMQ)); + + st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER; + st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ; + st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQPOST; + st_ProtocolHdr.byIsReply = true; //获得处理返回结果 + st_ProtocolHdr.byVersion = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_STRING; + st_ProtocolHdr.unPacketSize = sizeof(XENGINE_PROTOCOL_XMQ) + strlen(lpszMsgBuffer); + st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL; + + st_XMQProtocol.nSerial = 0; //序列号,0服务会自动处理 + st_XMQProtocol.nKeepTime = 0; + st_XMQProtocol.nPubTime = 0; + strcpy(st_XMQProtocol.tszMQKey, lpszKey); + strcpy(st_XMQProtocol.tszMQUsr, "486179@qq.com"); + + st_XMQProtocol.st_MSGAttr.byAttrEMail = 1; + + nLen = sizeof(XENGINE_PROTOCOLHDR) + st_ProtocolHdr.unPacketSize; + memcpy(tszMsgBuffer, &st_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR)); + memcpy(tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR), &st_XMQProtocol, sizeof(XENGINE_PROTOCOL_XMQ)); + memcpy(tszMsgBuffer + sizeof(XENGINE_PROTOCOLHDR) + sizeof(XENGINE_PROTOCOL_XMQ), lpszMsgBuffer, strlen(lpszMsgBuffer)); + + if (!XClient_TCPSelect_SendMsg(m_Socket, tszMsgBuffer, nLen)) + { + _xtprintf("发送投递失败!\n"); + return; + } + nLen = 2048; + XCHAR* ptszMsgBuffer; + memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR)); + + if (!XClient_TCPSelect_RecvPkt(m_Socket, &ptszMsgBuffer, &nLen, &st_ProtocolHdr)) + { + _xtprintf("接受数据失败!\n"); + return; + } + memset(&st_XMQProtocol, '\0', sizeof(XENGINE_PROTOCOL_XMQ)); + memcpy(&st_XMQProtocol, ptszMsgBuffer, sizeof(XENGINE_PROTOCOL_XMQ)); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); +} void MQ_Get(int nType = 0) { int nLen = 0; @@ -529,6 +579,7 @@ int main(int argc, char** argv) _xtprintf("连接成功!\n"); MQ_Authorize(); + //MQ_PostEMail("test for email"); MQ_GetUNRead(); MQ_Create(); MQ_Post(NULL, ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_BIN, -1, true); diff --git a/XEngine_Apps/MQCore_WSApp/MQCore_WSApp.vcxproj b/XEngine_Apps/MQCore_WSApp/MQCore_WSApp.vcxproj index 21d4d52..af1f394 100644 --- a/XEngine_Apps/MQCore_WSApp/MQCore_WSApp.vcxproj +++ b/XEngine_Apps/MQCore_WSApp/MQCore_WSApp.vcxproj @@ -72,7 +72,7 @@ true - $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../../XEngine_Source/XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib32);$(LibraryPath) @@ -80,7 +80,7 @@ true - $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../../XEngine_Source/XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 7c700ba..43eade6 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 ada521d..0da0a4b 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 2e64c81..d7e6a71 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -1,53 +1,67 @@ { - "tszIPAddr":"127.0.0.1", - "tszTopic":"XEngine_CommKey", - "bDeamon":0, - "nTCPPort":5200, - "nWSPort":5201, - "nHttpPort":5202, - "nMQTTPort":5203, - "XMax":{ - "nMaxClient":10000, - "nMaxQueue":10000, - "nIOThread":2, - "nTCPThread":2, - "nHttpThread":2, - "nWSThread":2, - "nMQTTThread":2 + "tszIPAddr": "127.0.0.1", + "tszTopic": "XEngine_CommKey", + "bDeamon": 0, + "nTCPPort": 5200, + "nWSPort": 5201, + "nHttpPort": 5202, + "nMQTTPort": 5203, + "XMax": { + "nMaxClient": 10000, + "nMaxQueue": 10000, + "nIOThread": 2, + "nTCPThread": 2, + "nHttpThread": 2, + "nWSThread": 2, + "nMQTTThread": 2 }, - "XLog":{ - "tszLOGFile":"./XEngine_Log/XEngine_MQServiceApp.Log", - "MaxSize":1024000, - "MaxCount":10, - "LogLeave":32, - "LogType":17 + "XLog": { + "tszLOGFile": "./XEngine_Log/XEngine_MQServiceApp.Log", + "MaxSize": 1024000, + "MaxCount": 10, + "LogLeave": 32, + "LogType": 17 }, - "XSql":{ - "SQLAddr":"10.0.4.150", - "SQLPort":3306, - "SQLUser":"root", - "SQLPass":"123123aa" + "XSql": { + "SQLAddr": "127.0.0.1", + "SQLPort": 3306, + "SQLUser": "root", + "SQLPass": "123123" }, - "XPass":{ - "nTimeout":2, - "tszPassRegister":"", - "tszPassUNReg":"", - "tszPassLogin":"", - "tszPassLogout":"" + "XPass": { + "nTimeout": 2, + "tszPassRegister": "", + "tszPassUNReg": "", + "tszPassLogin": "", + "tszPassLogout": "" }, - "XMemory":{ - "bDataQueryEnable":true, - "bDataInsertEnable":true, - "bUserQueryEnable":true, - "nTimeLast":3600, - "nTimeCount":0 + "XMemory": { + "bDataQueryEnable": true, + "bDataInsertEnable": true, + "bUserQueryEnable": true, + "nTimeLast": 3600, + "nTimeCount": 0 }, - "XAuthorize":{ - "bHTTPAuth":true + "XVerification": { + "bEnable": false, + "nVType": 1, + "tszAuthPass": "" }, - "XReport":{ - "bEnable":true, - "tszServiceName":"XEngine_MQService", - "tszAPIUrl":"http://app.xyry.org:5501/api?function=machine" + "XNotify": { + "EmailNotify": { + "bEnable": true, + "tszEMailSubject": "XEngine MessageQueue Notify", + "tszServiceAddr": "smtp://smtp.163.com", + "tszUser": "ggqytgodlove@163.com", + "tszPass": "1" + }, + "SMSNotify": { + "bEnable": false + } + }, + "XReport": { + "bEnable": true, + "tszServiceName": "XEngine_MQService", + "tszAPIUrl": "http://app.xyry.org:5501/api?function=machine" } } \ No newline at end of file diff --git a/XEngine_Release/XEngine_Config/XEngine_VerConfig.json b/XEngine_Release/XEngine_Config/XEngine_VerConfig.json index 5fc8e48..296adc0 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VerConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VerConfig.json @@ -1,5 +1,6 @@ { "XVer":[ + "3.17.0.1001 Build20250901", "3.16.0.1001 Build20250524", "3.15.0.1001 Build20250313", "3.14.0.1001 Build20250120", diff --git a/XEngine_Source/MQCore_ConfigModule/Config_Define.h b/XEngine_Source/MQCore_ConfigModule/Config_Define.h index 438f52f..05ae453 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Define.h +++ b/XEngine_Source/MQCore_ConfigModule/Config_Define.h @@ -34,7 +34,7 @@ typedef struct }st_XMax; struct { - XCHAR tszLOGFile[MAX_PATH]; + XCHAR tszLOGFile[XPATH_MAX]; int nMaxSize; int nMaxCount; int nLogLeave; @@ -50,10 +50,10 @@ typedef struct }st_XSql; struct { - XCHAR tszPassRegister[MAX_PATH]; - XCHAR tszPassUNReg[MAX_PATH]; - XCHAR tszPassLogin[MAX_PATH]; - XCHAR tszPassLogout[MAX_PATH]; + XCHAR tszPassRegister[XPATH_MAX]; + XCHAR tszPassUNReg[XPATH_MAX]; + XCHAR tszPassLogin[XPATH_MAX]; + XCHAR tszPassLogout[XPATH_MAX]; int nTimeout; }st_XPass; struct @@ -66,12 +66,29 @@ typedef struct }st_XMemory; struct { - bool bHTTPAuth; - }st_XAuthorize; + bool bEnable; + int nVType; + XCHAR tszAuthPass[XPATH_MID]; + }st_XVerification; + struct + { + struct + { + XCHAR tszEMailSubject[XPATH_MID]; + XCHAR tszServiceAddr[XPATH_MIN]; + XCHAR tszUser[XPATH_MIN]; + XCHAR tszPass[XPATH_MIN]; + bool bEnable; + }st_EMailNotify; + struct + { + bool bEnable; + }st_SMSNotify; + }st_XNotify; struct { bool bEnable; - XCHAR tszAPIUrl[MAX_PATH]; + XCHAR tszAPIUrl[XPATH_MAX]; XCHAR tszServiceName[128]; }st_XReport; struct diff --git a/XEngine_Source/MQCore_ConfigModule/Config_Error.h b/XEngine_Source/MQCore_ConfigModule/Config_Error.h index e3dda9a..e86d4e3 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Error.h +++ b/XEngine_Source/MQCore_ConfigModule/Config_Error.h @@ -23,4 +23,5 @@ #define ERROR_MQ_MODULE_CONFIG_JSON_XVER 0x0020008 #define ERROR_MQ_MODULE_CONFIG_JSON_XREPORT 0x0020009 #define ERROR_MQ_MODULE_CONFIG_JSON_XMEMORY 0x0020010 -#define ERROR_MQ_MODULE_CONFIG_JSON_XAUTHORIZE 0x0020011 \ No newline at end of file +#define ERROR_MQ_MODULE_CONFIG_JSON_XAUTHORIZE 0x0020011 +#define ERROR_MQ_MODULE_CONFIG_JSON_XNOTIFY 0x0020012 \ 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 f6b7f8f..ce25227 100644 --- a/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp +++ b/XEngine_Source/MQCore_ConfigModule/Config_Json/Config_Json.cpp @@ -43,21 +43,12 @@ bool CConfig_Json::Config_Json_File(LPCXSTR lpszConfigFile,XENGINE_SERVERCONFIG Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARAMENT; return false; } - int nCount = 0; - XCHAR tszMsgBuffer[4096]; - while (1) - { - int nRet = fread(tszMsgBuffer + nCount, 1, 2048, pSt_File); - if (nRet <= 0) - { - break; - } - nCount += nRet; - } + XCHAR tszMsgBuffer[4096] = {}; + size_t nSize = fread(tszMsgBuffer, 1, sizeof(tszMsgBuffer), pSt_File); fclose(pSt_File); std::unique_ptr const pSt_JsonReader(st_JsonBuilder.newCharReader()); - if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nCount, &st_JsonRoot, &st_JsonError)) + if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nSize, &st_JsonRoot, &st_JsonError)) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_PARSE; @@ -137,15 +128,36 @@ 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() || (1 != st_JsonRoot["XAuthorize"].size())) + if (st_JsonRoot["XVerification"].empty() || (3 != st_JsonRoot["XVerification"].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(); + Json::Value st_JsonXVerification = st_JsonRoot["XVerification"]; + pSt_ServerConfig->st_XVerification.bEnable = st_JsonXVerification["bEnable"].asBool(); + pSt_ServerConfig->st_XVerification.nVType = st_JsonXVerification["nVType"].asInt(); + _tcsxcpy(pSt_ServerConfig->st_XVerification.tszAuthPass, st_JsonXVerification["tszAuthPass"].asCString()); + + if (st_JsonRoot["XNotify"].empty() || (2 != st_JsonRoot["XNotify"].size())) + { + Config_IsErrorOccur = true; + Config_dwErrorCode = ERROR_MQ_MODULE_CONFIG_JSON_XNOTIFY; + return false; + } + Json::Value st_JsonXNotify = st_JsonRoot["XNotify"]; + Json::Value st_JsonEMailNotify = st_JsonXNotify["EmailNotify"]; + Json::Value st_JsonSMSNotify = st_JsonXNotify["SMSNotify"]; + + pSt_ServerConfig->st_XNotify.st_EMailNotify.bEnable = st_JsonEMailNotify["bEnable"].asBool(); + _tcsxcpy(pSt_ServerConfig->st_XNotify.st_EMailNotify.tszEMailSubject, st_JsonEMailNotify["tszEMailSubject"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XNotify.st_EMailNotify.tszServiceAddr, st_JsonEMailNotify["tszServiceAddr"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XNotify.st_EMailNotify.tszUser, st_JsonEMailNotify["tszUser"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XNotify.st_EMailNotify.tszPass, st_JsonEMailNotify["tszPass"].asCString()); + + pSt_ServerConfig->st_XNotify.st_SMSNotify.bEnable = st_JsonSMSNotify["bEnable"].asBool(); + _tcsxcpy(pSt_ServerConfig->st_XVerification.tszAuthPass, st_JsonXVerification["tszAuthPass"].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 40c57e1..6bc93e2 100644 --- a/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj +++ b/XEngine_Source/MQCore_ConfigModule/MQCore_ConfigModule.vcxproj @@ -99,29 +99,29 @@ true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;..\MQCore_ConfigModule;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;..\MQCore_ConfigModule;$(IncludePath) $(XEngine_Library);$(LibraryPath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Library);$(LibraryPath) true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) diff --git a/XEngine_Source/MQCore_ConfigModule/Makefile b/XEngine_Source/MQCore_ConfigModule/Makefile index 62da2d6..e7db6c5 100644 --- a/XEngine_Source/MQCore_ConfigModule/Makefile +++ b/XEngine_Source/MQCore_ConfigModule/Makefile @@ -2,8 +2,8 @@ CC = g++ -Wall -std=c++20 -fPIC PLATVER = FILEEXT = LIBFLAG = -LOADHDR = -I ./ -I ../XEngine_Depend/XEngine_Module/jsoncpp -LOADSO = -L ../XEngine_Depend/XEngine_Module/jsoncpp +LOADHDR = -I ./ -I ../XEngine_DependLibrary/XEngine_Module/jsoncpp +LOADSO = -L ../XEngine_DependLibrary/XEngine_Module/jsoncpp LIB = -ljsoncpp LIBEX = OBJECTS = Config_Json.o pch.o diff --git a/XEngine_Source/MQCore_DBModule/DBModule_Define.h b/XEngine_Source/MQCore_DBModule/DBModule_Define.h index f107773..5515bab 100644 --- a/XEngine_Source/MQCore_DBModule/DBModule_Define.h +++ b/XEngine_Source/MQCore_DBModule/DBModule_Define.h @@ -39,8 +39,8 @@ typedef struct //用户消息 typedef struct { - XCHAR tszUserName[MAX_PATH]; //用户名 - XCHAR tszKeyName[MAX_PATH]; //绑定的KEY + XCHAR tszUserName[XPATH_MAX]; //用户名 + XCHAR tszKeyName[XPATH_MAX]; //绑定的KEY XCHAR tszUPTime[64]; //最后更新时间 XCHAR tszCreateTime[64]; //创建的时间 __int64x nKeySerial; //包序列号 @@ -55,7 +55,7 @@ typedef struct ////////////////////////////////////////////////////////////////////////// // 导出的回调 ////////////////////////////////////////////////////////////////////////// -typedef void(CALLBACK* CALLBACK_MESSAGEQUEUE_MODULE_DATABASE_TIMEPUBLISH)(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam); +typedef void(XCALLBACK* CALLBACK_MESSAGEQUEUE_MODULE_DATABASE_TIMEPUBLISH)(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam); ////////////////////////////////////////////////////////////////////////// // 导出的函数 ////////////////////////////////////////////////////////////////////////// diff --git a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp index be3ef70..aea78cc 100644 --- a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp +++ b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.cpp @@ -1173,7 +1173,7 @@ bool CDBModule_MQUser::DBModule_MQUser_OwnerTopicUPDate(LPCXSTR lpszSourceTable, ////////////////////////////////////////////////////////////////////////// // 线程函数 ////////////////////////////////////////////////////////////////////////// -XHTHREAD CALLBACK CDBModule_MQUser::DBModule_MQUser_TimeThread(XPVOID lParam) +XHTHREAD XCALLBACK CDBModule_MQUser::DBModule_MQUser_TimeThread(XPVOID lParam) { CDBModule_MQUser* pClass_This = (CDBModule_MQUser*)lParam; diff --git a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.h b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.h index 51473ce..eb662e0 100644 --- a/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.h +++ b/XEngine_Source/MQCore_DBModule/DBModule_MQUser/DBModule_MQUser.h @@ -44,7 +44,7 @@ class CDBModule_MQUser bool DBModule_MQUser_OwnerQuery(XENGINE_DBTOPICOWNER* pSt_DBOwner); bool DBModule_MQUser_OwnerTopicUPDate(LPCXSTR lpszSourceTable, LPCXSTR lpszDestTable); protected: - static XHTHREAD CALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); + static XHTHREAD XCALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); private: shared_ptr pSTDThread; private: diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp index 6921db8..acc4431 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.cpp @@ -286,7 +286,7 @@ bool CMemoryCache_DBData::MemoryCache_DBData_QueueInsert(LPCXSTR lpszSQLStr, XEN ////////////////////////////////////////////////////////////////////////// // 线程函数 ////////////////////////////////////////////////////////////////////////// -XHTHREAD CALLBACK CMemoryCache_DBData::DBModule_MQUser_TimeThread(XPVOID lParam) +XHTHREAD XCALLBACK CMemoryCache_DBData::DBModule_MQUser_TimeThread(XPVOID lParam) { CMemoryCache_DBData* pClass_This = (CMemoryCache_DBData*)lParam; @@ -325,7 +325,7 @@ XHTHREAD CALLBACK CMemoryCache_DBData::DBModule_MQUser_TimeThread(XPVOID lParam) } return 0; } -XHTHREAD CALLBACK CMemoryCache_DBData::DBModule_MQUser_InsertThread(XPVOID lParam) +XHTHREAD XCALLBACK CMemoryCache_DBData::DBModule_MQUser_InsertThread(XPVOID lParam) { CMemoryCache_DBData* pClass_This = (CMemoryCache_DBData*)lParam; diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h index 6870c48..0af6e9f 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBData/MemoryCache_DBData.h @@ -52,8 +52,8 @@ class CMemoryCache_DBData public: bool MemoryCache_DBData_QueueInsert(LPCXSTR lpszSQLStr, XENGINE_DBMESSAGEQUEUE* pSt_DBMessageInfo); protected: - static XHTHREAD CALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); - static XHTHREAD CALLBACK DBModule_MQUser_InsertThread(XPVOID lParam); + static XHTHREAD XCALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); + static XHTHREAD XCALLBACK DBModule_MQUser_InsertThread(XPVOID lParam); private: bool bIsRun = false; int m_nTimeLast = 0; diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp index fc0e9a8..c962963 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.cpp @@ -214,7 +214,7 @@ bool CMemoryCache_DBUser::MemoryCache_DBUser_DataDelete(XENGINE_PROTOCOL_USERINF ////////////////////////////////////////////////////////////////////////// // 线程函数 ////////////////////////////////////////////////////////////////////////// -XHTHREAD CALLBACK CMemoryCache_DBUser::DBModule_MQUser_TimeThread(XPVOID lParam) +XHTHREAD XCALLBACK CMemoryCache_DBUser::DBModule_MQUser_TimeThread(XPVOID lParam) { CMemoryCache_DBUser* pClass_This = (CMemoryCache_DBUser*)lParam; diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.h b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.h index 171dc88..5de8359 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.h +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_DBUser/MemoryCache_DBUser.h @@ -31,7 +31,7 @@ class CMemoryCache_DBUser bool MemoryCache_DBUser_DataQuery(XENGINE_PROTOCOL_USERINFO* pSt_DBUserInfo); bool MemoryCache_DBUser_DataDelete(XENGINE_PROTOCOL_USERINFO* pSt_DBUserInfo); protected: - static XHTHREAD CALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); + static XHTHREAD XCALLBACK DBModule_MQUser_TimeThread(XPVOID lParam); private: bool bIsRun = false; int m_nTimeLast = 0; diff --git a/XEngine_Source/MQCore_MemoryCache/MemoryCache_Define.h b/XEngine_Source/MQCore_MemoryCache/MemoryCache_Define.h index 7f27fd2..4dfa424 100644 --- a/XEngine_Source/MQCore_MemoryCache/MemoryCache_Define.h +++ b/XEngine_Source/MQCore_MemoryCache/MemoryCache_Define.h @@ -19,7 +19,7 @@ typedef enum ////////////////////////////////////////////////////////////////////////// // 导出的回调 ////////////////////////////////////////////////////////////////////////// -typedef void(CALLBACK* CALLBACK_MESSAGEQUEUE_MODULE_DATABASE_CACHE)(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam); +typedef void(XCALLBACK* CALLBACK_MESSAGEQUEUE_MODULE_DATABASE_CACHE)(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam); ////////////////////////////////////////////////////////////////////////// // 导出的函数 ////////////////////////////////////////////////////////////////////////// diff --git a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj index da45755..39d5e37 100644 --- a/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj +++ b/XEngine_Source/MQCore_ProtocolModule/MQCore_ProtocolModule.vcxproj @@ -99,32 +99,32 @@ true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;..\MQCore_ProtocolModule;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;..\MQCore_ProtocolModule;$(IncludePath) $(XEngine_Lib32);$(LibraryPath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib32);$(LibraryPath) true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) true - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_LibArm64);$(LibraryPath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) false - $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Include);../XEngine_DependLibrary/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_LibArm64);$(LibraryPath) diff --git a/XEngine_Source/MQCore_ProtocolModule/Makefile b/XEngine_Source/MQCore_ProtocolModule/Makefile index e7ffeba..9b852fd 100644 --- a/XEngine_Source/MQCore_ProtocolModule/Makefile +++ b/XEngine_Source/MQCore_ProtocolModule/Makefile @@ -2,8 +2,8 @@ CC = g++ -Wall -std=c++20 -fPIC PLATVER = FILEEXT = LIBFLAG = -LOADHDR = -I ./ -I ../XEngine_Depend/XEngine_Module/jsoncpp -LOADSO = -L ../XEngine_Depend/XEngine_Module/jsoncpp +LOADHDR = -I ./ -I ../XEngine_DependLibrary/XEngine_Module/jsoncpp +LOADSO = -L ../XEngine_DependLibrary/XEngine_Module/jsoncpp LIB = -ljsoncpp -lXEngine_BaseLib -lXEngine_Cryption -lRfcComponents_MQTTProtocol LIBEX = OBJECTS = ProtocolModule_Packet.o ProtocolModule_Parse.o pch.o diff --git a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp index cfdeb65..b5ea1a5 100644 --- a/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp +++ b/XEngine_Source/MQCore_ProtocolModule/ProtocolModule_Packet/ProtocolModule_Packet.cpp @@ -641,13 +641,20 @@ XHANDLE CProtocolModule_Packet::ProtocolModule_Packet_UNReadCreate(XENGINE_PROTO pSt_UNRead->nType = enPayType; if (pSt_UNRead->nType == ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_BIN) { + pSt_UNRead->st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER; + pSt_UNRead->st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL; + pSt_UNRead->st_ProtocolHdr.unOperatorType = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ; + pSt_UNRead->st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REPUNREAD; pSt_UNRead->st_ProtocolHdr.byVersion = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON; } else { + pSt_UNRead->st_JsonRoot["wHeader"] = pSt_ProtocolHdr->wHeader; + pSt_UNRead->st_JsonRoot["wTail"] = pSt_ProtocolHdr->wTail; pSt_UNRead->st_JsonRoot["unOperatorType"] = pSt_ProtocolHdr->unOperatorType; pSt_UNRead->st_JsonRoot["unOperatorCode"] = pSt_ProtocolHdr->unOperatorCode; - pSt_UNRead->st_JsonRoot["wReserve"] = pSt_ProtocolHdr->wReserve; + pSt_UNRead->st_JsonRoot["byVersion"] = ENUM_XENGINE_PROTOCOLHDR_PAYLOAD_TYPE_JSON; + pSt_UNRead->st_JsonRoot["wReserve"] = 0; } return pSt_UNRead; } diff --git a/XEngine_Source/Makefile b/XEngine_Source/Makefile index 653611d..1d9a4bd 100644 --- a/XEngine_Source/Makefile +++ b/XEngine_Source/Makefile @@ -3,9 +3,11 @@ UNICODE = 0 PLATFORM=linux FLAGS= #要编译的模块 -BASE_THIRDPART_JSONCPP = ./XEngine_Depend/XEngine_Module/jsoncpp -BASE_THIRDPART_REPORT = ./XEngine_Depend/XEngine_Module/XEngine_InfoReport -BASE_THIRDPART_TOKEN = ./XEngine_Depend/XEngine_Module/XEngine_Token +BASE_THIRDPART_JSONCPP = ./XEngine_DependLibrary/XEngine_Module/jsoncpp +BASE_THIRDPART_REPORT = ./XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport +BASE_THIRDPART_TOKEN = ./XEngine_DependLibrary/XEngine_Module/XEngine_Token +BASE_THIRDPART_VERIFICATION = ./XEngine_DependLibrary/XEngine_Module/XEngine_Verification +BASE_THIRDPART_NOTIFY = ./XEngine_DependLibrary/XEngine_Module/XEngine_MSGNotify BASE_CONFIG_PATH = ./MQCore_ConfigModule BASE_PROTOCOL_PATH = ./MQCore_ProtocolModule @@ -22,7 +24,7 @@ else ifeq ($(PLATFORM),mac) FILEEXT = dylib endif -XENGINE_MODULES = libjsoncpp.so libXEngine_InfoReport.so libXEngine_Token.so \ +XENGINE_MODULES = libjsoncpp.so libXEngine_InfoReport.so libXEngine_Token.so libXEngine_Verification.so libXEngine_MSGNotify.so \ libMQCore_ConfigModule.so libMQCore_ProtocolModule.so libMQCore_SessionModule.so libMQCore_MemoryCache.so libMQCore_DBModule.so libMQCore_HelpModule.so \ XEngine_MQServiceApp.exe @@ -48,6 +50,18 @@ ifeq ($(FLAGS), InstallAll) else make -C $(BASE_THIRDPART_TOKEN) PLATFORM=$(PLATFORM) $(FLAGS) endif +libXEngine_Verification.so: +ifeq ($(FLAGS), InstallAll) + cp $(BASE_THIRDPART_VERIFICATION)/libXEngine_Verification.$(FILEEXT) ../XEngine_Release/ +else + make -C $(BASE_THIRDPART_VERIFICATION) PLATFORM=$(PLATFORM) $(FLAGS) +endif +libXEngine_MSGNotify.so: +ifeq ($(FLAGS), InstallAll) + cp $(BASE_THIRDPART_NOTIFY)/libXEngine_MSGNotify.$(FILEEXT) ../XEngine_Release/ +else + make -C $(BASE_THIRDPART_NOTIFY) PLATFORM=$(PLATFORM) $(FLAGS) +endif libMQCore_ConfigModule.so: make -C $(BASE_CONFIG_PATH) PLATFORM=$(PLATFORM) UNICODE=$(UNICODE) RELEASE=$(RELEASE) $(FLAGS) diff --git a/XEngine_Source/VSClean.bat b/XEngine_Source/VSClean.bat index bf8eca3..1ca651d 100644 --- a/XEngine_Source/VSClean.bat +++ b/XEngine_Source/VSClean.bat @@ -5,6 +5,7 @@ FOR /R . %%d IN (.) DO rd /s /q "%%d\Release" 2>nul FOR /R . %%d IN (.) DO rd /s /q "%%d\x64" 2>nul FOR /R . %%d IN (.) DO rd /s /q "%%d\Debug" 2>nul FOR /R . %%d IN (.) DO rd /s /q "%%d\ipch" 2>nul +FOR /R . %%d IN (.) DO rd /s /q "%%d\ARM64" 2>nul rem If the Properties directory is empty, remove it FOR /R . %%d in (.) do rd /q "%%d\Properties" 2> nul diff --git a/XEngine_Source/VSCopy_Arm64.bat b/XEngine_Source/VSCopy_Arm64.bat index 2d90d25..01a6cc6 100644 --- a/XEngine_Source/VSCopy_Arm64.bat +++ b/XEngine_Source/VSCopy_Arm64.bat @@ -10,6 +10,8 @@ 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_NetHelp\NetHelp_XSocket.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" diff --git a/XEngine_Source/VSCopy_Debug.bat b/XEngine_Source/VSCopy_Debug.bat index 04cfcec..1f5aeea 100644 --- a/XEngine_Source/VSCopy_Debug.bat +++ b/XEngine_Source/VSCopy_Debug.bat @@ -10,6 +10,8 @@ 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" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_XSocket.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_APIAddr.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_Packets.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_XLog.dll" "./" diff --git a/XEngine_Source/VSCopy_x64.bat b/XEngine_Source/VSCopy_x64.bat index 6091a6f..fad27b5 100644 --- a/XEngine_Source/VSCopy_x64.bat +++ b/XEngine_Source/VSCopy_x64.bat @@ -10,6 +10,8 @@ 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" "./" +copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" diff --git a/XEngine_Source/VSCopy_x86.bat b/XEngine_Source/VSCopy_x86.bat index ddd01a1..24115df 100644 --- a/XEngine_Source/VSCopy_x86.bat +++ b/XEngine_Source/VSCopy_x86.bat @@ -10,6 +10,8 @@ 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" "./" +copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" diff --git a/XEngine_Source/XEngine_Depend b/XEngine_Source/XEngine_Depend deleted file mode 160000 index b9427ac..0000000 --- a/XEngine_Source/XEngine_Depend +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b9427ac1eb1183eb76ae73c61b2cf0fb27448aa4 diff --git a/XEngine_Source/XEngine_DependLibrary b/XEngine_Source/XEngine_DependLibrary new file mode 160000 index 0000000..6a2fd03 --- /dev/null +++ b/XEngine_Source/XEngine_DependLibrary @@ -0,0 +1 @@ +Subproject commit 6a2fd030257062f98b2a2751e9d5b6559901a53e diff --git a/XEngine_Source/XEngine_MQServiceApp.sln b/XEngine_Source/XEngine_MQServiceApp.sln index 389dc75..f6b6988 100644 --- a/XEngine_Source/XEngine_MQServiceApp.sln +++ b/XEngine_Source/XEngine_MQServiceApp.sln @@ -10,7 +10,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_MQServiceApp", "XEn {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} + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256} = {A8E43EC0-698A-4807-8A61-B2BE5FAB7256} {B0EB2A7A-53C1-4E9F-A851-19539099671C} = {B0EB2A7A-53C1-4E9F-A851-19539099671C} + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA} = {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA} {E17E889F-D826-413F-854E-DBA6000B4DA7} = {E17E889F-D826-413F-854E-DBA6000B4DA7} {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} = {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} @@ -38,20 +40,24 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MQCore_DBModule", "MQCore_D {8C55D3E0-FEC2-4A6C-A374-651516ED8F99} = {8C55D3E0-FEC2-4A6C-A374-651516ED8F99} EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_Depend", "XEngine_Depend", "{BAC91AAE-D438-4999-9541-EB8804B12F0C}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_DependLibrary", "XEngine_DependLibrary", "{BAC91AAE-D438-4999-9541-EB8804B12F0C}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsoncpp", "XEngine_Depend\XEngine_Module\jsoncpp\jsoncpp.vcxproj", "{F1736B3F-03A2-4FC7-B045-A12BA8D724FB}" +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 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsoncpp", "XEngine_DependLibrary\XEngine_Module\jsoncpp\jsoncpp.vcxproj", "{F1736B3F-03A2-4FC7-B045-A12BA8D724FB}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_InfoReport", "XEngine_Depend\XEngine_Module\XEngine_InfoReport\XEngine_InfoReport.vcxproj", "{F6520D2C-BB8E-45BB-964B-F5D6A4318A89}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_InfoReport", "XEngine_DependLibrary\XEngine_Module\XEngine_InfoReport\XEngine_InfoReport.vcxproj", "{F6520D2C-BB8E-45BB-964B-F5D6A4318A89}" ProjectSection(ProjectDependencies) = postProject {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MQCore_MemoryCache", "MQCore_MemoryCache\MQCore_MemoryCache.vcxproj", "{8C55D3E0-FEC2-4A6C-A374-651516ED8F99}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_Token", "XEngine_DependLibrary\XEngine_Module\XEngine_Token\XEngine_Token.vcxproj", "{E17E889F-D826-413F-854E-DBA6000B4DA7}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MQCore_HelpModule", "MQCore_HelpModule\MQCore_HelpModule.vcxproj", "{4B061F8B-A783-45EA-A8D1-78F9668C49D2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_Verification", "XEngine_DependLibrary\XEngine_Module\XEngine_Verification\XEngine_Verification.vcxproj", "{A8E43EC0-698A-4807-8A61-B2BE5FAB7256}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_Token", "XEngine_Depend\XEngine_Module\XEngine_Token\XEngine_Token.vcxproj", "{E17E889F-D826-413F-854E-DBA6000B4DA7}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_MSGNotify", "XEngine_DependLibrary\XEngine_Module\XEngine_MSGNotify\XEngine_MSGNotify.vcxproj", "{E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -123,30 +129,6 @@ Global {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 @@ -171,6 +153,30 @@ Global {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 + {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 {E17E889F-D826-413F-854E-DBA6000B4DA7}.Debug|ARM64.ActiveCfg = Debug|ARM64 {E17E889F-D826-413F-854E-DBA6000B4DA7}.Debug|ARM64.Build.0 = Debug|ARM64 {E17E889F-D826-413F-854E-DBA6000B4DA7}.Debug|x64.ActiveCfg = Debug|x64 @@ -183,6 +189,30 @@ Global {E17E889F-D826-413F-854E-DBA6000B4DA7}.Release|x64.Build.0 = Release|x64 {E17E889F-D826-413F-854E-DBA6000B4DA7}.Release|x86.ActiveCfg = Release|Win32 {E17E889F-D826-413F-854E-DBA6000B4DA7}.Release|x86.Build.0 = Release|Win32 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|ARM64.Build.0 = Debug|ARM64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|x64.ActiveCfg = Debug|x64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|x64.Build.0 = Debug|x64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|x86.ActiveCfg = Debug|Win32 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Debug|x86.Build.0 = Debug|Win32 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|ARM64.ActiveCfg = Release|ARM64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|ARM64.Build.0 = Release|ARM64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|x64.ActiveCfg = Release|x64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|x64.Build.0 = Release|x64 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|x86.ActiveCfg = Release|Win32 + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256}.Release|x86.Build.0 = Release|Win32 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|ARM64.Build.0 = Debug|ARM64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|x64.ActiveCfg = Debug|x64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|x64.Build.0 = Debug|x64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|x86.ActiveCfg = Debug|Win32 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Debug|x86.Build.0 = Debug|Win32 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|ARM64.ActiveCfg = Release|ARM64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|ARM64.Build.0 = Release|ARM64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|x64.ActiveCfg = Release|x64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|x64.Build.0 = Release|x64 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|x86.ActiveCfg = Release|Win32 + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -191,6 +221,8 @@ Global {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {BAC91AAE-D438-4999-9541-EB8804B12F0C} {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} = {BAC91AAE-D438-4999-9541-EB8804B12F0C} {E17E889F-D826-413F-854E-DBA6000B4DA7} = {BAC91AAE-D438-4999-9541-EB8804B12F0C} + {A8E43EC0-698A-4807-8A61-B2BE5FAB7256} = {BAC91AAE-D438-4999-9541-EB8804B12F0C} + {E1087BA3-1074-4C6A-B770-A53B7BA1F4EA} = {BAC91AAE-D438-4999-9541-EB8804B12F0C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EFADBBBD-43B1-4B9B-9DD8-04415EBEFDA7} diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp index 34cf122..ea5be9d 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Config.cpp @@ -18,47 +18,59 @@ bool MQ_Service_Parament(int argc, char** argv, XENGINE_SERVERCONFIG* pSt_Startl for (int i = 0;i < argc;i++) { - if ((0 == _tcsxcmp("-h",argv[i])) || (0 == _tcsxcmp("-H",argv[i]))) + if (0 == _tcsxicmp("-h",argv[i])) { MQ_Service_ParamentHelp(); return false; } - else if ((0 == _tcsxcmp("-v",argv[i])) || (0 == _tcsxcmp("-V",argv[i]))) + else if (0 == _tcsxicmp("-v",argv[i])) { - printf("Version:V1.1.0\n"); + printf("Version:%s\n", st_ServiceCfg.st_XVer.pStl_ListStorage->front().c_str()); return false; } - else if (0 == _tcsxcmp("-TP",argv[i])) + else if (0 == _tcsxicmp("-tp",argv[i])) { pSt_StartlParam->nTCPPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxcmp("-HP",argv[i])) + else if (0 == _tcsxicmp("-hp",argv[i])) { pSt_StartlParam->nHttpPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxcmp("-WP", argv[i])) + else if (0 == _tcsxicmp("-wp", argv[i])) { pSt_StartlParam->nWSPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxcmp("-MP", argv[i])) + else if (0 == _tcsxicmp("-mp", argv[i])) { pSt_StartlParam->nMQTTPort = _ttxoi(argv[++i]); } - else if (0 == _tcsxcmp("-LL", argv[i])) + else if (0 == _tcsxicmp("-d",argv[i])) + { + pSt_StartlParam->bDeamon = _ttxoi(argv[++i]); + } + else if (0 == _tcsxicmp("-t", argv[i])) { - pSt_StartlParam->st_XLog.nLogLeave = _ttxoi(argv[++i]); + bIsTest = true; } - else if (0 == _tcsxcmp("-LT", argv[i])) + else if (0 == _tcsxicmp("-lt", argv[i])) { pSt_StartlParam->st_XLog.nLogType = _ttxoi(argv[++i]); } - else if (0 == _tcsxcmp("-d",argv[i])) - { - pSt_StartlParam->bDeamon = _ttxoi(argv[++i]); - } - else if (0 == _tcsxcmp("-t", argv[i])) + else if (0 == _tcsxicmp("-l", argv[i])) { - bIsTest = true; + LPCXSTR lpszLogLevel = argv[++i]; + if (0 == _tcsxicmp("debug", lpszLogLevel)) + { + pSt_StartlParam->st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DETAIL; + } + else if (0 == _tcsxicmp("detail", lpszLogLevel)) + { + pSt_StartlParam->st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DETAIL; + } + else if (0 == _tcsxicmp("info", lpszLogLevel)) + { + pSt_StartlParam->st_XLog.nLogLeave = XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO; + } } } diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPGet.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPGet.cpp index 36c02d2..230faf7 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPGet.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPGet.cpp @@ -14,7 +14,7 @@ bool MessageQueue_HttpTask_Get(LPCXSTR lpszClientAddr, LPCXSTR lpszFuncName, XCH { int nSDLen = 0; XCHAR tszSDBuffer[1024] = {}; - XCHAR tszKeyStr[MAX_PATH] = {}; + XCHAR tszKeyStr[XPATH_MAX] = {}; LPCXSTR lpszAPILogin = _X("login"); LPCXSTR lpszAPIUPDate = _X("update"); diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPPost.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPPost.cpp index 8b6cf3c..240bc34 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPPost.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_HTTPTask/MQService_HTTPPost.cpp @@ -15,8 +15,8 @@ bool MessageQueue_HttpTask_Post(LPCXSTR lpszClientAddr, LPCXSTR lpszFuncName, LP int nSDLen = 0; XNETHANDLE xhToken = 0; XCHAR tszSDBuffer[1024] = {}; - XCHAR tszKeyStr[MAX_PATH] = {}; - XCHAR tszVluStr[MAX_PATH] = {}; + XCHAR tszKeyStr[XPATH_MAX] = {}; + XCHAR tszVluStr[XPATH_MAX] = {}; LPCXSTR lpszAPIRegister = _X("register"); LPCXSTR lpszAPIGetUser = _X("getuser"); LPCXSTR lpszAPIGetTopic = _X("gettopic"); @@ -25,21 +25,6 @@ bool MessageQueue_HttpTask_Post(LPCXSTR lpszClientAddr, LPCXSTR lpszFuncName, LP LPCXSTR lpszAPICreateTopic = _X("createtopic"); LPCXSTR lpszAPIDelTopic = _X("deletetopic"); LPCXSTR lpszAPIDelUser = _X("deleteuser"); - - //判断是否需要验证,不是注册协议 - if (st_ServiceCfg.st_XAuthorize.bHTTPAuth && (0 != _tcsxnicmp(lpszAPIRegister, lpszFuncName, _tcsxlen(lpszAPIRegister)))) - { - if (ProtocolModule_Parse_Token(lpszMsgBuffer, nMsgLen, &xhToken)) - { - if (!Session_Token_Get(xhToken)) - { - ProtocolModule_Packet_Http(tszSDBuffer, &nSDLen, ERROR_XENGINE_MESSAGE_HTTP_AUTHORIZE, "not authorize"); - XEngine_MQXService_Send(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_MQAPP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求的API:%s 失败,因为没有经过验证"), lpszClientAddr, lpszFuncName); - return false; - } - } - } //判断请求 if (0 == _tcsxnicmp(lpszAPIRegister, lpszFuncName, _tcsxlen(lpszAPIRegister))) { @@ -131,7 +116,7 @@ bool MessageQueue_HttpTask_Post(LPCXSTR lpszClientAddr, LPCXSTR lpszFuncName, LP { //主题 http://127.0.0.1:5202/api?function=gettopic int nDBCount = 0; - XCHAR tszTopicName[MAX_PATH] = {}; + XCHAR tszTopicName[XPATH_MAX] = {}; ProtocolModule_Parse_Name(lpszMsgBuffer, nMsgLen, tszTopicName); DBModule_MQData_GetLeftCount(tszTopicName, 0, &nDBCount); ProtocolModule_Packet_TopicName(tszSDBuffer, &nSDLen, tszTopicName, nDBCount); diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h b/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h index f9f2269..ee9ab7c 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Hdr.h @@ -31,6 +31,8 @@ using namespace std; #include #include #include +#include +#include #include #include #include @@ -43,10 +45,14 @@ using namespace std; #include #include #include -#include "../XEngine_Depend/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h" -#include "../XEngine_Depend/XEngine_Module/XEngine_InfoReport/InfoReport_Error.h" -#include "../XEngine_Depend/XEngine_Module/XEngine_Token/Session_Define.h" -#include "../XEngine_Depend/XEngine_Module/XEngine_Token/Session_Error.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_Verification/Verification_Define.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_Verification/Verification_Error.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport/InfoReport_Error.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_Token/Session_Define.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_Token/Session_Error.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_MSGNotify/MSGNotify_Define.h" +#include "../XEngine_DependLibrary/XEngine_Module/XEngine_MSGNotify/MSGNotify_Error.h" #include "../XQueue_ProtocolHdr.h" #include "../MQCore_ConfigModule/Config_Define.h" #include "../MQCore_ConfigModule/Config_Error.h" @@ -98,6 +104,7 @@ extern MESSAGEQUEUE_DBCONFIG st_DBConfig; #pragma comment(lib,"XEngine_Core/XEngine_Core.lib") #pragma comment(lib,"XEngine_Core/XEngine_ManagePool.lib") #pragma comment(lib,"XEngine_Client/XClient_APIHelp.lib") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIAddr.lib") #pragma comment(lib,"XEngine_HelpComponents/HelpComponents_XLog.lib") #pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Packets.lib") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_HttpProtocol.lib") @@ -112,27 +119,33 @@ extern MESSAGEQUEUE_DBCONFIG st_DBConfig; #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/MQCore_MemoryCache.lib") #pragma comment(lib,"../x64/Debug/XEngine_InfoReport.lib") #pragma comment(lib,"../x64/Debug/XEngine_Token.lib") -#pragma comment(lib,"../x64/Debug/MQCore_MemoryCache.lib") +#pragma comment(lib,"../x64/Debug/XEngine_Verification.lib") +#pragma comment(lib,"../x64/Debug/XEngine_MSGNotify.lib") #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/MQCore_MemoryCache.lib") #pragma comment(lib,"../ARM64/Debug/XEngine_InfoReport.lib") #pragma comment(lib,"../ARM64/Debug/XEngine_Token.lib") -#pragma comment(lib,"../ARM64/Debug/MQCore_MemoryCache.lib") +#pragma comment(lib,"../ARM64/Debug/XEngine_Verification.lib") +#pragma comment(lib,"../ARM64/Debug/XEngine_MSGNotify.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/MQCore_MemoryCache.lib") #pragma comment(lib,"../Debug/XEngine_InfoReport.lib") #pragma comment(lib,"../Debug/XEngine_Token.lib") -#pragma comment(lib,"../Debug/MQCore_MemoryCache.lib") +#pragma comment(lib,"../Debug/XEngine_Verification.lib") +#pragma comment(lib,"../Debug/XEngine_MSGNotify.lib") #endif #else #ifdef _M_X64 @@ -141,27 +154,33 @@ extern MESSAGEQUEUE_DBCONFIG st_DBConfig; #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/MQCore_MemoryCache.lib") #pragma comment(lib,"../x64/Release/XEngine_InfoReport.lib") #pragma comment(lib,"../x64/Release/XEngine_Token.lib") -#pragma comment(lib,"../x64/Release/MQCore_MemoryCache.lib") +#pragma comment(lib,"../x64/Release/XEngine_Verification.lib") +#pragma comment(lib,"../x64/Release/XEngine_MSGNotify.lib") #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/MQCore_MemoryCache.lib") #pragma comment(lib,"../ARM64/Release/XEngine_InfoReport.lib") #pragma comment(lib,"../ARM64/Release/XEngine_Token.lib") -#pragma comment(lib,"../ARM64/Release/MQCore_MemoryCache.lib") +#pragma comment(lib,"../ARM64/Release/XEngine_Verification.lib") +#pragma comment(lib,"../ARM64/Release/XEngine_MSGNotify.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/MQCore_MemoryCache.lib") #pragma comment(lib,"../Release/XEngine_InfoReport.lib") #pragma comment(lib,"../Release/XEngine_Token.lib") -#pragma comment(lib,"../Release/MQCore_MemoryCache.lib") +#pragma comment(lib,"../Release/XEngine_Verification.lib") +#pragma comment(lib,"../Release/XEngine_MSGNotify.lib") #endif #endif #endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp index 7d43b8f..2c444f7 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.cpp @@ -1,6 +1,6 @@ #include "MQService_Hdr.h" -XHTHREAD CALLBACK MessageQueue_HttpThread(XPVOID lParam) +XHTHREAD XCALLBACK MessageQueue_HttpThread(XPVOID lParam) { int nThreadPos = *(int*)lParam; nThreadPos++; @@ -29,7 +29,7 @@ XHTHREAD CALLBACK MessageQueue_HttpThread(XPVOID lParam) if (HttpProtocol_Server_GetMemoryEx(xhHTTPPacket, ppSst_ListAddr[i]->tszClientAddr, &ptszMsgBuffer, &nMsgLen, &st_HTTPReqparam, &ppszHdrList, &nHdrCount)) { MessageQueue_Http_Handle(&st_HTTPReqparam, ppSst_ListAddr[i]->tszClientAddr, ptszMsgBuffer, nMsgLen, ppszHdrList, nHdrCount); - BaseLib_Memory_FreeCStyle((VOID**)&ptszMsgBuffer); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); BaseLib_Memory_Free((XPPPMEM)&ppszHdrList, nHdrCount); } } @@ -42,12 +42,101 @@ bool MessageQueue_Http_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXST { int nPKTLen = 4096; XCHAR tszPKTBuffer[4096] = {}; - XCHAR tszKey[MAX_PATH] = {}; - XCHAR tszValue[MAX_PATH] = {}; + XCHAR tszKey[XPATH_MAX] = {}; + XCHAR tszValue[XPATH_MAX] = {}; LPCXSTR lpszPostMethod = _X("POST"); LPCXSTR lpszGetMethod = _X("GET"); + if (st_ServiceCfg.st_XVerification.bEnable) + { + int nVType = 0; + RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam = {}; + + st_HDRParam.nHttpCode = 401; + st_HDRParam.bIsClose = true; + st_HDRParam.bAuth = true; + //打包验证信息 + int nHDRLen = 0; + XCHAR tszHDRBuffer[XPATH_MAX] = {}; + if (1 == st_ServiceCfg.st_XVerification.nVType) + { + Verification_HTTP_BasicServerPacket(tszHDRBuffer, &nHDRLen); + } + else + { + XCHAR tszNonceStr[64] = {}; + XCHAR tszOpaqueStr[64] = {}; + Verification_HTTP_DigestServerPacket(tszHDRBuffer, &nHDRLen, tszNonceStr, tszOpaqueStr); + } + //后去验证方法 + if (!Verification_HTTP_GetType(pptszListHdr, nHdrCount, &nVType)) + { + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,验证方式:%d,错误:%lX"), lpszClientAddr, st_ServiceCfg.st_XVerification.nVType, Verification_GetLastError()); + return false; + } + //验证方式是否一致 + if (st_ServiceCfg.st_XVerification.nVType != nVType) + { + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,验证方式错误,请求:%d,需求:%d"), lpszClientAddr, nVType, st_ServiceCfg.st_XVerification.nVType); + return false; + } + bool bRet = false; + int nHTTPCode = 0; + int nMSGLen = 0; + XCLIENT_APIHTTP st_APIHttp = {}; + + XCHAR* ptszMSGBuffer = NULL; + if (!APIClient_Http_Request(_X("GET"), st_ServiceCfg.st_XVerification.tszAuthPass, NULL, &nHTTPCode, &ptszMSGBuffer, &nMSGLen, NULL, NULL, &st_APIHttp)) + { + st_HDRParam.nHttpCode = 500; + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,GET请求验证服务:%s 失败,错误码:%lX"), lpszClientAddr, st_ServiceCfg.st_XVerification.tszAuthPass, APIClient_GetLastError()); + return false; + } + if (200 != nHTTPCode) + { + st_HDRParam.nHttpCode = 500; + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,GET请求验证服务:%s 失败,错误:%d"), lpszClientAddr, st_ServiceCfg.st_XVerification.tszAuthPass, nHTTPCode); + return false; + } + XENGINE_PROTOCOL_USERINFO st_UserAuth = {}; + if (!ProtocolModule_Parse_Register(ptszMSGBuffer, nMsgLen, &st_UserAuth)) + { + st_HDRParam.nHttpCode = 500; + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,返回内容:%s 错误,无法继续"), lpszClientAddr, ptszMSGBuffer); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMSGBuffer); + return false; + } + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMSGBuffer); + + if (1 == nVType) + { + bRet = Verification_HTTP_Basic(st_UserAuth.tszUserName, st_UserAuth.tszUserPass, pptszListHdr, nHdrCount); + } + else if (2 == nVType) + { + bRet = Verification_HTTP_Digest(st_UserAuth.tszUserName, st_UserAuth.tszUserPass, pSt_HTTPParam->tszHttpMethod, pptszListHdr, nHdrCount); + } + + if (!bRet) + { + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszPKTBuffer, &nPKTLen, &st_HDRParam, NULL, 0, tszHDRBuffer); + NetCore_TCPXCore_SendEx(xhHTTPSocket, lpszClientAddr, tszPKTBuffer, nPKTLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户验证失败,验证处理错误,可能用户密码登信息不匹配,类型:%d"), lpszClientAddr, nVType); + return false; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,HTTP验证类型:%d 通过"), lpszClientAddr, nVType); + } int nUrlCount = 0; XCHAR** ppSt_ListUrl; HttpProtocol_ServerHelp_GetParament(pSt_HTTPParam->tszHttpUri, &ppSt_ListUrl, &nUrlCount); diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.h b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.h index 826c6bd..f4b4be1 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_HttpTask.h @@ -1,4 +1,4 @@ #pragma once -XHTHREAD CALLBACK MessageQueue_HttpThread(XPVOID lParam); +XHTHREAD XCALLBACK MessageQueue_HttpThread(XPVOID lParam); bool MessageQueue_Http_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR** pptszListHdr, int nHdrCount); \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.cpp index 0e84c1c..ee1e8fa 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.cpp @@ -1,6 +1,6 @@ #include "MQService_Hdr.h" -XHTHREAD CALLBACK MessageQueue_MQTTThread(XPVOID lParam) +XHTHREAD XCALLBACK MessageQueue_MQTTThread(XPVOID lParam) { int nThreadPos = *(int*)lParam; nThreadPos++; @@ -108,7 +108,7 @@ bool MQService_MQTT_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt else if (XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_SUBSCRIBE == pSt_MQTTHdr->byMsgType) { XSHOT wMsgID = 0; - XCHAR tszTopicName[MAX_PATH] = {}; + XCHAR tszTopicName[XPATH_MAX] = {}; int nListCount = 0; MQTTPROTOCOL_HDRPROPERTY** ppSt_HDRProperty; MQTTPROTOCOL_HDRSUBSCRIBE st_SubScribe = {}; @@ -137,7 +137,7 @@ bool MQService_MQTT_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt else if (XENGINE_RFCCOMPONENTS_MQTT_PROTOCOL_TYPE_UNSUBSCRIBE == pSt_MQTTHdr->byMsgType) { XSHOT wMsgID = 0; - XCHAR tszTopicName[MAX_PATH] = {}; + XCHAR tszTopicName[XPATH_MAX] = {}; int nListCount = 0; MQTTPROTOCOL_HDRPROPERTY** ppSt_HDRProperty; @@ -166,7 +166,7 @@ bool MQService_MQTT_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt { int nListCount = 0; XSHOT wMsgID = 0; - XCHAR tszTopicName[MAX_PATH] = {}; + XCHAR tszTopicName[XPATH_MAX] = {}; XENGINE_PROTOCOLHDR st_ProtocolHdr = {}; MQTTPROTOCOL_HDRPROPERTY** ppSt_HDRProperty; diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.h b/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.h index fb6d6c7..b8c7fe9 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_MQTTTask.h @@ -1,4 +1,4 @@ #pragma once -XHTHREAD CALLBACK MessageQueue_MQTTThread(XPVOID lParam); +XHTHREAD XCALLBACK MessageQueue_MQTTThread(XPVOID lParam); bool MQService_MQTT_Handle(LPCXSTR lpszClientAddr, MQTTPROTOCOL_FIXEDHEADER* pSt_MQTTHdr, LPCXSTR lpszMSGBuffer, int nMSGLen); \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Net.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_Net.cpp index ce31543..65ec8c2 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Net.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Net.cpp @@ -1,12 +1,12 @@ #include "MQService_Hdr.h" ////////////////////////////////////////////////////////////////////////// -bool CALLBACK MessageQueue_Callback_TCPLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +bool XCALLBACK MessageQueue_Callback_TCPLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { HelpComponents_Datas_CreateEx(xhTCPPacket, lpszClientAddr, 0); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO,_X("TCP客户端连接,TCP客户端地址:%s"),lpszClientAddr); return true; } -void CALLBACK MessageQueue_Callback_TCPRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg,int nMsgLen,XPVOID lParam) +void XCALLBACK MessageQueue_Callback_TCPRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg,int nMsgLen,XPVOID lParam) { if (!HelpComponents_Datas_PostEx(xhTCPPacket, lpszClientAddr, lpszRecvMsg, nMsgLen)) { @@ -15,17 +15,17 @@ void CALLBACK MessageQueue_Callback_TCPRecv(LPCXSTR lpszClientAddr, XSOCKET hSoc } XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("投递TCP数据包到消息队列成功,%d"), nMsgLen); } -void CALLBACK MessageQueue_Callback_TCPLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_TCPLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { XEngine_MQXService_Close(lpszClientAddr, XENGINE_MQAPP_NETTYPE_TCP, false); } ////////////////////////////////////////////////////////////////////////// -bool CALLBACK MessageQueue_Callback_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +bool XCALLBACK MessageQueue_Callback_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { MQTTProtocol_Parse_Insert(lpszClientAddr); return true; } -void CALLBACK MessageQueue_Callback_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) { if (!MQTTProtocol_Parse_Send(lpszClientAddr, lpszRecvMsg, nMsgLen)) { @@ -34,18 +34,18 @@ void CALLBACK MessageQueue_Callback_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSo } XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("投递MQTT数据包到消息队列成功,%d"), nMsgLen); } -void CALLBACK MessageQueue_Callback_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { XEngine_MQXService_Close(lpszClientAddr, XENGINE_MQAPP_NETTYPE_MQTT, false); } ////////////////////////////////////////////////////////////////////////// -bool CALLBACK MessageQueue_Callback_HttpLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +bool XCALLBACK MessageQueue_Callback_HttpLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { HttpProtocol_Server_CreateClientEx(xhHTTPPacket, lpszClientAddr, 0); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端连接,HTTP客户端地址:%s"), lpszClientAddr); return true; } -void CALLBACK MessageQueue_Callback_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) { if (!HttpProtocol_Server_InserQueueEx(xhHTTPPacket, lpszClientAddr, lpszRecvMsg, nMsgLen)) { @@ -53,18 +53,18 @@ void CALLBACK MessageQueue_Callback_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSo return; } } -void CALLBACK MessageQueue_Callback_HttpLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_HttpLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { XEngine_MQXService_Close(lpszClientAddr, XENGINE_MQAPP_NETTYPE_HTTP, false); } ////////////////////////////////////////////////////////////////////////// -bool CALLBACK MessageQueue_Callback_WSLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +bool XCALLBACK MessageQueue_Callback_WSLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { RfcComponents_WSPacket_CreateEx(xhWSPacket, lpszClientAddr, 0); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("Websocket客户端连接,Websocket客户端地址:%s"), lpszClientAddr); return true; } -void CALLBACK MessageQueue_Callback_WSRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_WSRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam) { bool bLogin = false; RfcComponents_WSPacket_GetLoginEx(xhWSPacket, lpszClientAddr, &bLogin); @@ -88,7 +88,7 @@ void CALLBACK MessageQueue_Callback_WSRecv(LPCXSTR lpszClientAddr, XSOCKET hSock XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("WEBSOCKET客户端:%s 与服务器握手成功"), lpszClientAddr); } } -void CALLBACK MessageQueue_Callback_WSLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) +void XCALLBACK MessageQueue_Callback_WSLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam) { XEngine_MQXService_Close(lpszClientAddr, XENGINE_MQAPP_NETTYPE_WEBSOCKET, false); } @@ -165,18 +165,18 @@ void XEngine_MQXService_Close(LPCXSTR lpszClientAddr, int nIPProto, bool bHeart) SessionModule_Client_Delete(lpszClientAddr); } ////////////////////////////////////////////////////////////////////////// -bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nIPProto) +bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nIPProto, XENGINE_PROTOCOL_MSGATTR* pSt_MSGAttr, LPCXSTR lpszUserName) { - if (XENGINE_MQAPP_NETTYPE_TCP == nIPProto) - { - if (!NetCore_TCPXCore_SendEx(xhTCPSocket, lpszClientAddr, lpszMsgBuffer, nMsgLen)) - { - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给TCP客户端:%s,失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError()); - return false; - } - } - else if (XENGINE_MQAPP_NETTYPE_HTTP == nIPProto) - { + if (XENGINE_MQAPP_NETTYPE_TCP == nIPProto) + { + if (!NetCore_TCPXCore_SendEx(xhTCPSocket, lpszClientAddr, lpszMsgBuffer, nMsgLen)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给TCP客户端:%s,失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError()); + return false; + } + } + else if (XENGINE_MQAPP_NETTYPE_HTTP == nIPProto) + { CMQService_MemoryPool m_MQMemoryPool(XENGINE_MEMORY_SIZE_MAX); int nSDLen = XENGINE_MEMORY_SIZE_MAX; RFCCOMPONENTS_HTTP_HDRPARAM st_HTTPHdr = {}; @@ -191,17 +191,17 @@ bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给HTTP客户端:%s,失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError()); return false; } - } - else if (XENGINE_MQAPP_NETTYPE_WEBSOCKET == nIPProto) - { + } + else if (XENGINE_MQAPP_NETTYPE_WEBSOCKET == nIPProto) + { CMQService_MemoryPool m_MQMemoryPool(XENGINE_MEMORY_SIZE_MAX); - RfcComponents_WSCodec_EncodeMsg(lpszMsgBuffer, m_MQMemoryPool.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); + RfcComponents_WSCodec_EncodeMsg(lpszMsgBuffer, m_MQMemoryPool.get(), &nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_TEXT); if (!NetCore_TCPXCore_SendEx(xhWSSocket, lpszClientAddr, m_MQMemoryPool.get(), nMsgLen)) { XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给Websocket客户端:%s,失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError()); return false; } - } + } else if (XENGINE_MQAPP_NETTYPE_MQTT == nIPProto) { if (!NetCore_TCPXCore_SendEx(xhMQTTSocket, lpszClientAddr, lpszMsgBuffer, nMsgLen)) @@ -210,5 +210,32 @@ bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int return false; } } + + if (NULL != pSt_MSGAttr) + { + XENGINE_PROTOCOL_USERINFO st_UserInfo = {}; + _tcsxcpy(st_UserInfo.tszUserName, lpszUserName); + + if (!DBModule_MQUser_UserQuery(&st_UserInfo)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("客户端:%s,用户名:%s 请求消息通知失败,因为没有找到指定的用户信息,错误码:%lX"), lpszClientAddr,lpszUserName, DBModule_GetLastError()); + return false; + } + //是否需要邮件通知 + if (pSt_MSGAttr->byAttrEMail) + { + if (!APIAddr_EMail_IsEMailAddr(st_UserInfo.tszEMailAddr)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("客户端:%s,用户名:%s 请求消息通知失败,通知邮件地址不正确,错误码:%lX"), lpszClientAddr, lpszUserName, APIAddr_GetLastError()); + return false; + } + if (!MSGNotify_EMail_Send(st_ServiceCfg.st_XNotify.st_EMailNotify.tszServiceAddr, st_ServiceCfg.st_XNotify.st_EMailNotify.tszUser, st_ServiceCfg.st_XNotify.st_EMailNotify.tszPass, lpszClientAddr, st_ServiceCfg.st_XNotify.st_EMailNotify.tszEMailSubject, lpszMsgBuffer)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("发送数据给EMail地址:%s 失败,错误码:%lX"), lpszClientAddr, MSGNotify_GetLastError()); + return false; + } + } + } + return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Net.h b/XEngine_Source/XEngine_MQServiceApp/MQService_Net.h index 78b8b52..723b1dd 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Net.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Net.h @@ -1,20 +1,20 @@ #pragma once -bool CALLBACK MessageQueue_Callback_TCPLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); //用户连接 -void CALLBACK MessageQueue_Callback_TCPRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg,int nMsgLen,XPVOID lParam); //接受到数据 -void CALLBACK MessageQueue_Callback_TCPLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); //用户离开 +bool XCALLBACK MessageQueue_Callback_TCPLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); //用户连接 +void XCALLBACK MessageQueue_Callback_TCPRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg,int nMsgLen,XPVOID lParam); //接受到数据 +void XCALLBACK MessageQueue_Callback_TCPLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); //用户离开 -bool CALLBACK MessageQueue_Callback_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); -void CALLBACK MessageQueue_Callback_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); -void CALLBACK MessageQueue_Callback_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +bool XCALLBACK MessageQueue_Callback_MQTTLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_MQTTRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_MQTTLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); -bool CALLBACK MessageQueue_Callback_HttpLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); -void CALLBACK MessageQueue_Callback_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); -void CALLBACK MessageQueue_Callback_HttpLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +bool XCALLBACK MessageQueue_Callback_HttpLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_HttpRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_HttpLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); -bool CALLBACK MessageQueue_Callback_WSLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); -void CALLBACK MessageQueue_Callback_WSRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); -void CALLBACK MessageQueue_Callback_WSLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +bool XCALLBACK MessageQueue_Callback_WSLogin(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_WSRecv(LPCXSTR lpszClientAddr, XSOCKET hSocket, LPCXSTR lpszRecvMsg, int nMsgLen, XPVOID lParam); +void XCALLBACK MessageQueue_Callback_WSLeave(LPCXSTR lpszClientAddr, XSOCKET hSocket, XPVOID lParam); void XEngine_MQXService_Close(LPCXSTR lpszClientAddr, int nIPProto, bool bHeart); -bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nIPProto); \ No newline at end of file +bool XEngine_MQXService_Send(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nIPProto, XENGINE_PROTOCOL_MSGATTR* pSt_MSGAttr = NULL, LPCXSTR lpszUserName = NULL); \ 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 b0d53ce..6349207 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.cpp @@ -1,6 +1,6 @@ #include "MQService_Hdr.h" -XHTHREAD CALLBACK MessageQueue_TCPThread(XPVOID lParam) +XHTHREAD XCALLBACK MessageQueue_TCPThread(XPVOID lParam) { int nThreadPos = *(int*)lParam; nThreadPos++; @@ -26,7 +26,7 @@ XHTHREAD CALLBACK MessageQueue_TCPThread(XPVOID lParam) if (HelpComponents_Datas_GetMemoryEx(xhTCPPacket, ppSst_ListAddr[i]->tszClientAddr, &ptszMsgBuffer, &nMsgLen, &st_ProtocolHdr)) { MessageQueue_TCP_Handle(&st_ProtocolHdr, ppSst_ListAddr[i]->tszClientAddr, ptszMsgBuffer, nMsgLen, XENGINE_MQAPP_NETTYPE_TCP); - BaseLib_Memory_FreeCStyle((VOID**)&ptszMsgBuffer); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); } } } @@ -153,7 +153,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else if (XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_REQUSEROUT == pSt_ProtocolHdr->unOperatorCode) { - XCHAR tszUserName[MAX_PATH] = {}; + XCHAR tszUserName[XPATH_MAX] = {}; XENGINE_PROTOCOL_USERINFO st_ProtocolInfo = {}; if (!SessionModule_Client_GetUser(lpszClientAddr, tszUserName)) @@ -197,7 +197,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else if (ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_XMQ == pSt_ProtocolHdr->unOperatorType) { - XCHAR tszUserName[MAX_PATH] = {}; + XCHAR tszUserName[XPATH_MAX] = {}; XENGINE_PROTOCOL_XMQ st_MQProtocol = {}; //根据协议处理 if (XENGINE_MQAPP_NETTYPE_HTTP == nNetType) @@ -312,6 +312,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } else if (0 == st_MQProtocol.nPubTime) { + pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_MSGNOTIFY; //设置为0,不是定时发布,即时通知 if (1 == st_MQProtocol.st_MSGAttr.byAttrAll) { @@ -327,20 +328,18 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC } nSDLen = 0; int nClientType = 0; + XCHAR tszTmpUser[XPATH_MID] = {}; memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_MSGNOTIFY; - SessionModule_Client_GetType(pptszListAddr[i], &nClientType); + SessionModule_Client_GetUser(pptszListAddr[i], tszTmpUser); ProtocolModule_Packet_Common(nClientType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen, lpszMsgBuffer + sizeof(XENGINE_PROTOCOL_XMQ), nMsgLen - sizeof(XENGINE_PROTOCOL_XMQ)); - XEngine_MQXService_Send(pptszListAddr[i], tszSDBuffer, nSDLen, nClientType); + XEngine_MQXService_Send(pptszListAddr[i], tszSDBuffer, nSDLen, nClientType, &st_MQProtocol.st_MSGAttr, tszTmpUser); BaseLib_Memory_Free((XPPPMEM)&pptszListAddr, nListCount); } } else { - pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_MQ_MSGNOTIFY; - if (_tcsxlen(st_MQProtocol.tszMQUsr) > 0) { //如果发送指定用户被指定. @@ -348,11 +347,13 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC { int nClientType = 0; XCHAR tszUserAddr[128] = {}; + XCHAR tszTmpUser[XPATH_MID] = {}; SessionModule_Client_GetAddr(st_MQProtocol.tszMQUsr, tszUserAddr); SessionModule_Client_GetType(tszUserAddr, &nClientType); + SessionModule_Client_GetUser(tszUserAddr, tszTmpUser); ProtocolModule_Packet_Common(nClientType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen, lpszMsgBuffer + sizeof(XENGINE_PROTOCOL_XMQ), nMsgLen - sizeof(XENGINE_PROTOCOL_XMQ)); - XEngine_MQXService_Send(tszUserAddr, tszSDBuffer, nSDLen, nClientType); + XEngine_MQXService_Send(tszUserAddr, tszSDBuffer, nSDLen, nClientType, &st_MQProtocol.st_MSGAttr, tszTmpUser); } } else @@ -379,7 +380,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC SessionModule_Client_GetAddr(ppSt_ListUser[i]->tszUserName, tszUserAddr); SessionModule_Client_GetType(tszUserAddr, &nClientType); ProtocolModule_Packet_Common(nClientType, pSt_ProtocolHdr, &st_MQProtocol, tszSDBuffer, &nSDLen, lpszMsgBuffer + sizeof(XENGINE_PROTOCOL_XMQ), nMsgLen - sizeof(XENGINE_PROTOCOL_XMQ)); - XEngine_MQXService_Send(tszUserAddr, tszSDBuffer, nSDLen, nClientType); + XEngine_MQXService_Send(tszUserAddr, tszSDBuffer, nSDLen, nClientType, &st_MQProtocol.st_MSGAttr, ppSt_ListUser[i]->tszUserName); } } BaseLib_Memory_Free((XPPPMEM)&ppSt_ListUser, nListCount); @@ -455,7 +456,7 @@ bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszC { //有过期时间,判断是否过期 __int64x nTimeRet = 0; - XCHAR tszTimeStr[MAX_PATH] = {}; + XCHAR tszTimeStr[XPATH_MAX] = {}; BaseLib_Time_TimeToStr(tszTimeStr); BaseLib_TimeSpan_GetForStr(st_MessageQueue.tszQueueLeftTime, tszTimeStr, &nTimeRet, 3); //如果超时并且不允许主动获取,返回错误 diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.h b/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.h index fe77a25..65370fb 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_TCPTask.h @@ -1,4 +1,4 @@ #pragma once -XHTHREAD CALLBACK MessageQueue_TCPThread(XPVOID lParam); +XHTHREAD XCALLBACK MessageQueue_TCPThread(XPVOID lParam); bool MessageQueue_TCP_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nNetType); \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp index e37030e..9bdbdbf 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.cpp @@ -1,6 +1,6 @@ #include "MQService_Hdr.h" -void CALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam) +void XCALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam) { int nMsgLen = 0; XCHAR tszMsgBuffer[4096]; @@ -47,7 +47,7 @@ void CALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, SessionModule_Client_GetAddr(ppSt_ListUser[i]->tszUserName, tszUserAddr); SessionModule_Client_GetType(tszUserAddr, &nNetType); ProtocolModule_Packet_Common(nNetType, &st_ProtocolHdr, &st_MQProtocol, tszMsgBuffer, &nMsgLen, st_DBInfo.tszMsgBuffer, st_DBInfo.nMsgLen); - XEngine_MQXService_Send(tszUserAddr, tszMsgBuffer, nMsgLen, nNetType); + XEngine_MQXService_Send(tszUserAddr, tszMsgBuffer, nMsgLen, nNetType, &st_MQProtocol.st_MSGAttr, ppSt_ListUser[i]->tszUserName); } BaseLib_Memory_Free((XPPPMEM)&ppSt_ListUser, nListCount); @@ -63,7 +63,7 @@ void CALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, } XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("定时任务,消息主题:%s,序列:%lld,定时任务分发成功,客户端个数:%d"), pSt_DBInfo->tszQueueName, pSt_DBInfo->nIDMsg, nListCount); } -void CALLBACK MessageQueue_CBTask_MemoryCache(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam) +void XCALLBACK MessageQueue_CBTask_MemoryCache(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam) { if (ENUM_MEMORYCACHE_CALLBACK_TYPE_DATA_QUERY == enMemoryType) { diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.h b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.h index 2f5f5a5..42ba7b0 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_Task.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_Task.h @@ -1,4 +1,4 @@ #pragma once -void CALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam); -void CALLBACK MessageQueue_CBTask_MemoryCache(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam); \ No newline at end of file +void XCALLBACK MessageQueue_CBTask_TimePublish(XENGINE_DBTIMERELEASE* pSt_DBInfo, XPVOID lParam); +void XCALLBACK MessageQueue_CBTask_MemoryCache(ENUM_MEMORYCACHE_CALLBACK_TYPE enMemoryType, bool bSuccess, size_t nListCount, XPVOID pSt_DBInfo, XPVOID lParam); \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.cpp b/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.cpp index e85eeda..a8ceb30 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.cpp @@ -1,6 +1,6 @@ #include "MQService_Hdr.h" -XHTHREAD CALLBACK MessageQueue_WebsocketThread(XPVOID lParam) +XHTHREAD XCALLBACK MessageQueue_WebsocketThread(XPVOID lParam) { int nThreadPos = *(int*)lParam; nThreadPos++; @@ -24,7 +24,7 @@ XHTHREAD CALLBACK MessageQueue_WebsocketThread(XPVOID lParam) if (RfcComponents_WSPacket_GetMemoryEx(xhWSPacket, ppSst_ListAddr[i]->tszClientAddr, &ptszMsgBuffer, &nMsgLen, &enOPCode)) { MessageQueue_Websocket_Handle(ppSst_ListAddr[i]->tszClientAddr, ptszMsgBuffer, nMsgLen, enOPCode); - BaseLib_Memory_FreeCStyle((VOID**)&ptszMsgBuffer); + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); } } } @@ -37,14 +37,14 @@ bool MessageQueue_Websocket_Handle(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer if (ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_CLOSE == enOPCode) { int nSDLen = 0; - XCHAR tszMSGBuffer[MAX_PATH] = {}; + XCHAR tszMSGBuffer[XPATH_MAX] = {}; RfcComponents_WSCodec_EncodeMsg(NULL, tszMSGBuffer, &nSDLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_CLOSE); NetCore_TCPXCore_SendEx(xhWSSocket, lpszClientAddr, tszMSGBuffer, nSDLen); } else if (ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_PING == enOPCode) { int nSDLen = 0; - XCHAR tszMSGBuffer[MAX_PATH] = {}; + XCHAR tszMSGBuffer[XPATH_MAX] = {}; RfcComponents_WSCodec_EncodeMsg(NULL, tszMSGBuffer, &nSDLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE_PONG); NetCore_TCPXCore_SendEx(xhWSSocket, lpszClientAddr, tszMSGBuffer, nSDLen); } diff --git a/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.h b/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.h index c4116c0..ee1b79c 100644 --- a/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.h +++ b/XEngine_Source/XEngine_MQServiceApp/MQService_WSTask.h @@ -1,4 +1,4 @@ #pragma once -XHTHREAD CALLBACK MessageQueue_WebsocketThread(XPVOID lParam); +XHTHREAD XCALLBACK MessageQueue_WebsocketThread(XPVOID lParam); bool MessageQueue_Websocket_Handle(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, ENUM_XENGINE_RFCOMPONENTS_WEBSOCKET_OPCODE enOPCode); \ No newline at end of file diff --git a/XEngine_Source/XEngine_MQServiceApp/Makefile b/XEngine_Source/XEngine_MQServiceApp/Makefile index 67f1521..92735b2 100644 --- a/XEngine_Source/XEngine_MQServiceApp/Makefile +++ b/XEngine_Source/XEngine_MQServiceApp/Makefile @@ -2,10 +2,10 @@ CC = g++ -Wall -std=c++20 PLATVER = LOADHDR = -I ./ 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 -L ../XEngine_Depend/XEngine_Module/XEngine_Token -LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXClient_APIHelp -lXEngine_SystemApi -lHelpComponents_XLog -lHelpComponents_Packets -lRfcComponents_WSProtocol -lRfcComponents_HttpProtocol -lRfcComponents_MQTTProtocol \ + -L ../XEngine_DependLibrary/XEngine_Module/jsoncpp -L ../XEngine_DependLibrary/XEngine_Module/XEngine_InfoReport -L ../XEngine_DependLibrary/XEngine_Module/XEngine_Token -L ../XEngine_DependLibrary/XEngine_Module/XEngine_Verification -L ../XEngine_DependLibrary/XEngine_Module/XEngine_MSGNotify +LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXClient_APIHelp -lNetHelp_APIAddr -lXEngine_SystemApi -lHelpComponents_XLog -lHelpComponents_Packets -lRfcComponents_WSProtocol -lRfcComponents_HttpProtocol -lRfcComponents_MQTTProtocol \ -lMQCore_ConfigModule -lMQCore_ProtocolModule -lMQCore_SessionModule -lMQCore_MemoryCache -lMQCore_DBModule -lMQCore_HelpModule \ - -ljsoncpp -lXEngine_InfoReport -lXEngine_Token + -ljsoncpp -lXEngine_InfoReport -lXEngine_Token -lXEngine_Verification -lXEngine_MSGNotify LIBEX = OBJECTS = MQService_Net.o MQService_Config.o MQService_TCPTask.o MQService_HttpTask.o MQService_WSTask.o MQService_Task.o MQService_MQTTTask.o MQService_HTTPPost.o MQService_HTTPGet.o XEngine_MQServiceApp.o diff --git a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp index 25a8e72..30aa972 100644 --- a/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp +++ b/XEngine_Source/XEngine_MQServiceApp/XEngine_MQServiceApp.cpp @@ -92,7 +92,7 @@ static int ServiceApp_Deamon(int wait) LONG WINAPI Coredump_ExceptionFilter(EXCEPTION_POINTERS* pExceptionPointers) { static int i = 0; - XCHAR tszFileStr[MAX_PATH] = {}; + XCHAR tszFileStr[XPATH_MAX] = {}; XCHAR tszTimeStr[128] = {}; BaseLib_Time_TimeToStr(tszTimeStr); _xstprintf(tszFileStr, _X("./XEngine_Coredump/dumpfile_%s_%d.dmp"), tszTimeStr, i++); diff --git a/XEngine_Source/XQueue_ProtocolHdr.h b/XEngine_Source/XQueue_ProtocolHdr.h index 35c88c4..04f80ef 100644 --- a/XEngine_Source/XQueue_ProtocolHdr.h +++ b/XEngine_Source/XQueue_ProtocolHdr.h @@ -14,6 +14,8 @@ #define XENGINE_MQAPP_NETTYPE_HTTP 2 #define XENGINE_MQAPP_NETTYPE_WEBSOCKET 3 #define XENGINE_MQAPP_NETTYPE_MQTT 4 +#define XENGINE_MQAPP_NETTYPE_EMAIL 10 +#define XENGINE_MQAPP_NETTYPE_SMS 11 /////////////////////////////////////////////////////////////////////////// // 导出的数据定义 /////////////////////////////////////////////////////////////////////////// @@ -98,8 +100,8 @@ typedef struct XBYTE byAttrSelf : 1; //自己也能接受 XBYTE byAttrReply : 1; //对方必须回复 XBYTE byAttrActive : 1; //主动获取不受限制,比如超时的,不是自己发给自己的 - XBYTE byAttrResver4 : 1; - XBYTE byAttrResver5 : 1; + XBYTE byAttrEMail : 1; //此消息需要邮件通知,仅限即时和定时消息 + XBYTE byAttrPhone : 1; //此消息需要短信通知,仅限即时和定时消息 XBYTE byAttrResver6 : 1; XBYTE byAttrResver7 : 1; XBYTE byAttrResver; @@ -107,8 +109,8 @@ typedef struct //消息队列服务协议 typedef struct { - XCHAR tszMQKey[MAX_PATH]; //此消息的KEY,不填就是 XEngine_CommKey - XCHAR tszMQUsr[MAX_PATH]; //此消息接受用户 + XCHAR tszMQKey[XPATH_MIN]; //此消息的KEY,不填就是 XEngine_CommKey + XCHAR tszMQUsr[XPATH_MIN]; //此消息接受用户 __int64x nSerial; //包序列号 __int64x nPubTime; //发布时间,根据自己需求配置时区,-1表示投递的消息通过用户主动获取,0表示即时发布消息给当前订阅的在线用户,>0表示发布的日期 int nKeepTime; //可用时间,单位秒,>0 超时秒数