...
 
Commits (9)
    https://gitcode.net/xengine/XEngine_Storage/-/commit/9cd56f7c62da48c9c3e7725aeabff6afe37a47a5 added:up file make list for client example 2022-11-08T14:06:34+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/5c55206d10de70dfdef3f221937264dd59aea6d9 added:update download and install for upfile example 2022-11-08T14:07:17+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/dd531081cbe103d6f1998ea3a72e0730a31e340f update:appclient project 2022-11-08T14:07:47+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/beb0deb9282b7ad19f00b95ccff10ebe39b7a07f fixed:build warn 2022-11-10T14:34:19+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/b58257df2f3d98824b006f6a1551098776df7023 modify:match xengine v7.45 2022-12-26T11:38:15+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/ce07f6fd2bb0331a16b64a2db18ca8965925541c modify:broadcast distinguishes send and recv ports 2022-12-26T14:57:50+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/fdf95d7fbdc6cfb60c0ba6a7f13d1fece7afde4e modify:p2p request can be distinguished 2022-12-26T15:43:04+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/d9281f30506613efdbac1e72e1841b5f4e87ca2c update:configure file and CHANGELOG 2022-12-27T09:39:38+08:00 qyt 486179@qq.com https://gitcode.net/xengine/XEngine_Storage/-/commit/683b34aa685869df34217e062404bb6ee0ac12d5 !28 V3.9.1.1001 Merge 2022-12-27T01:41:30+00:00 qyt 486179@qq.com Merge pull request !28 from qyt/develop
XEngine_Storage V3.9.1.1001
修改:p2p广播的每个请求都可以被区分了
修改:匹配XEngine V7.45版本
修正:编译警告
modify:p2p broadcast request can be distinguished
modify:match xengine v7.45
fixed:build warn
======================================================================================
XEngine_Storage V3.9.0.1001
添加:用户支持单独限速模式了
......
#include "APPClient_UPHdr.h"
#include "APPClient_UPInstall.h"
#include "APPClient_UPTask.h"
int main(int argc, char** argv)
{
#ifdef _MSC_BUILD
WSADATA st_WSAData;
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
#endif
LPCTSTR lpszLocalFile = _T("D:\\XEngine_Storage\\XEngine_APPClient\\Debug\\LocalFile.txt");
LPCTSTR lpszDownload = _T("http://192.168.1.8:5101/storagekey1/xengine/upfile.txt");
TCHAR* ptszMsgBuffer = NULL;
int nMsgLen = 0;
if (!APIHelp_HttpRequest_Custom(_T("GET"), lpszDownload, NULL, NULL, &ptszMsgBuffer, &nMsgLen))
{
printf("APIHelp_HttpRequest_Custom:%lX\n", APIHelp_GetLastError());
return 0;
}
string m_StrDes;
int nLocalCount = 0;
int nRemoteCount = 0;
__int64x nLocalVer = 0;
__int64x nRemoteVer = 0;
FILEPARSER_VERSIONINFO** ppSt_LocalList;
FILEPARSER_VERSIONINFO** ppSt_RemoteList;
if (!FileParser_ReadVer_GetRemote(ptszMsgBuffer, nMsgLen, &ppSt_RemoteList, &nRemoteCount, &nRemoteVer, &m_StrDes))
{
printf("FileParser_ReadVer_GetRemote error\n");
return 0;
}
if (!FileParser_ReadVer_GetLocal(lpszLocalFile, &ppSt_LocalList, &nLocalCount, &nLocalVer))
{
printf("FileParser_ReadVer_GetLocal error\n");
return 0;
}
if (nLocalVer >= nRemoteVer)
{
printf("没有新版本可以使用\n");
return 0;
}
list<FILEPARSER_VERSIONINFO> stl_ListUPDate;
if (!FileParser_Match_Start(&ppSt_RemoteList, nRemoteCount, &ppSt_LocalList, nLocalCount, &stl_ListUPDate))
{
printf("FileParser_ReadVer_GetLocal error\n");
return 0;
}
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_LocalList, nLocalCount);
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_RemoteList, nRemoteCount);
if (stl_ListUPDate.empty())
{
printf("有更新,但是更新列表为空,无法继续\n");
return 0;
}
list<FILEPARSER_VERSIONINFO>::const_iterator stl_ListIterator = stl_ListUPDate.begin();
for (; stl_ListIterator != stl_ListUPDate.end(); stl_ListIterator++)
{
if (0 == stl_ListIterator->st_LocalVersion.nModuleVersion)
{
printf(_T("增加一个模块,模块名称:%s,老模块版本:%lld,新模块版本:%lld\n"), stl_ListIterator->tszModuleName, stl_ListIterator->st_LocalVersion.nModuleVersion, stl_ListIterator->nModuleVersion);
}
else
{
printf(_T("更新一个模块,模块名称:%s,老模块版本:%lld,新模块版本:%lld\n"), stl_ListIterator->tszModuleName, stl_ListIterator->st_LocalVersion.nModuleVersion, stl_ListIterator->nModuleVersion);
}
}
stl_ListIterator = stl_ListUPDate.begin();
for (; stl_ListIterator != stl_ListUPDate.end(); stl_ListIterator++)
{
TCHAR tszPathFile[1024];
NETDOWNLOAD_TASKINFO st_TaskInfo;
memset(tszPathFile, '\0', sizeof(tszPathFile));
memset(&st_TaskInfo, '\0', sizeof(NETDOWNLOAD_TASKINFO));
_stprintf_s(tszPathFile, _T("%s%s"), stl_ListIterator->tszModulePath, stl_ListIterator->tszModuleName);
_tremove(tszPathFile);
XHANDLE xhDown = DownLoad_Http_Create(stl_ListIterator->tszModuleDownload, tszPathFile);
while (TRUE)
{
if (!DownLoad_Http_Query(xhDown, &st_TaskInfo))
{
break;
}
if (ENUM_XENGINE_DOWNLOAD_STATUS_DOWNLOADDING != st_TaskInfo.en_DownStatus)
{
break;
}
}
DownLoad_Http_Delete(xhDown);
}
if (!HelpModule_Api_Copy(&stl_ListUPDate))
{
printf("HelpModule_Api_Copy error\n");
return 0;
}
if (!HelpModule_Api_SetVersion(lpszLocalFile, ptszMsgBuffer, nMsgLen))
{
printf("HelpModule_Api_Copy error\n");
return 0;
}
if (!HelpModule_Api_RunExec(&stl_ListUPDate))
{
printf("HelpModule_Api_Copy error\n");
return 0;
}
if (!HelpModule_Api_Clear(ptszMsgBuffer, nMsgLen))
{
printf("HelpModule_Api_Copy error\n");
return 0;
}
#ifdef _MSC_BUILD
WSACleanup();
#endif
return 0;
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{d2b84345-ce80-4e29-8a3e-6ace68eb7adf}</ProjectGuid>
<RootNamespace>APPClientUPFile</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(XEngine_Include);../../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="APPClient_UPFile.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="APPClient_UPHdr.h" />
<ClInclude Include="APPClient_UPInstall.h" />
<ClInclude Include="APPClient_UPTask.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="APPClient_UPFile.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="APPClient_UPInstall.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="APPClient_UPTask.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="APPClient_UPHdr.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
#ifdef _MSC_BUILD
#include <Windows.h>
#include <tchar.h>
#pragma comment(lib,"Ws2_32.lib")
#pragma comment(lib,"../../../XEngine_Source/Debug/jsoncpp")
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib")
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib")
#pragma comment(lib,"XEngine_DownLoad/XEngine_DownLoad.lib")
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi.lib")
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <string>
#include <list>
#include <thread>
#include <json/json.h>
using namespace std;
#include <XEngine_Include/XEngine_CommHdr.h>
#include <XEngine_Include/XEngine_Types.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Define.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Error.h>
#include <XEngine_Include/XEngine_DownLoad/DownLoad_Define.h>
#include <XEngine_Include/XEngine_DownLoad/DownLoad_Error.h>
#include <XEngine_Include/XEngine_SystemSdk/ProcFile_Define.h>
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
typedef struct
{
CHAR tszModulePath[MAX_PATH]; //模块路径,新增加的必须拥有此值
CHAR tszModuleName[MAX_PATH]; //模块名称
CHAR tszModuleDownload[MAX_PATH]; //模块下载地址
CHAR tszModuleCode[MAX_PATH]; //远程模块标识符
__int64x nModuleVersion; //文件版本号
BOOL bIsRun; //安装完成是否运行
struct
{
__int64x nModuleVersion;
CHAR tszMoudelPath[MAX_PATH];
CHAR tszMoudelName[MAX_PATH];
CHAR tszMoudelCode[MAX_PATH];
}st_LocalVersion;
}FILEPARSER_VERSIONINFO, * LPFILEPARSER_VERSIONINFO;
\ No newline at end of file
#pragma once
/********************************************************************
函数名称:FileParser_ReadVer_GetRemote
函数功能:获取更新内容
参数.一:lpszJsonMsg
In/Out:In
类型:常量字符指针
可空:N
意思:通过获取到的新版本JSON信息来获取更新内容
参数.二:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入JSON缓冲区大小
参数.三:pppSt_FileList
In/Out:Out
类型:三级指针
可空:N
意思:导出获取到的文件列表
参数.四:pInt_Count
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
参数.五:pInt_Version
In/Out:Out
类型:整数型指针
可空:Y
意思:输出新版本值
参数.六:pStrDes
In/Out:Out
类型:string类
可空:Y
意思:输出获取到的更新描述
返回值
类型:逻辑型
意思:是否获取成功
备注:
*********************************************************************/
BOOL FileParser_ReadVer_GetRemote(LPCTSTR lpszJsonMsg, int nMsgLen, FILEPARSER_VERSIONINFO*** pppSt_FileList, int* pInt_Count, __int64x* pInt_Version, string* pStrDes)
{
Json::Value st_JsonRoot;
Json::Value st_JsonArray;
Json::CharReaderBuilder st_JsonBuild;
Json::CharReader* pSt_JsonReader(st_JsonBuild.newCharReader());
JSONCPP_STRING st_JsonError;
//先解析JSON是否正确
if (!pSt_JsonReader->parse(lpszJsonMsg, lpszJsonMsg + nMsgLen, &st_JsonRoot, &st_JsonError))
{
return FALSE;
}
delete pSt_JsonReader;
pSt_JsonReader = NULL;
if (NULL != pInt_Version)
{
*pInt_Version = st_JsonRoot["MainVersion"].asInt64();
}
if (NULL != pStrDes)
{
*pStrDes = st_JsonRoot["MainDescription"].asString();
}
st_JsonArray = st_JsonRoot["UPList"];
//判断是否有文件存在
if (st_JsonArray.size() == 0)
{
return FALSE;
}
*pInt_Count = st_JsonArray.size();
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_FileList, *pInt_Count, sizeof(FILEPARSER_VERSIONINFO));
for (unsigned int i = 0; i < st_JsonArray.size(); i++)
{
//开始读取文件列表内容
(*pppSt_FileList)[i]->bIsRun = st_JsonArray[i]["ModuleRun"].asBool();
(*pppSt_FileList)[i]->nModuleVersion = st_JsonArray[i]["ModuleVersion"].asInt64();
_tcscpy((*pppSt_FileList)[i]->tszModuleCode, st_JsonArray[i]["ModuleCode"].asCString());
if (!st_JsonArray[i]["ModulePath"].isNull())
{
_tcscpy((*pppSt_FileList)[i]->tszModulePath, st_JsonArray[i]["ModulePath"].asCString());
}
_tcscpy((*pppSt_FileList)[i]->tszModuleName, st_JsonArray[i]["ModuleName"].asCString());
_tcscpy((*pppSt_FileList)[i]->tszModuleDownload, st_JsonArray[i]["ModuleDownload"].asCString());
}
return TRUE;
}
/********************************************************************
函数名称:FileParser_ReadVer_GetLocal
函数功能:获取本地内容
参数.一:lpszFileList
In/Out:In
类型:常量字符指针
可空:N
意思:本地列表地址
参数.二:pppSt_FileList
In/Out:Out
类型:三级指针
可空:N
意思:导出获取到的文件列表
参数.三:pInt_Count
In/Out:Out
类型:整数型指针
可空:N
意思:输出获取到的列表个数
参数.四:pInt_Version
In/Out:Out
类型:整数型指针
可空:Y
意思:输出版本值
返回值
类型:逻辑型
意思:是否获取成功
备注:
*********************************************************************/
BOOL FileParser_ReadVer_GetLocal(LPCTSTR lpszFileList, FILEPARSER_VERSIONINFO*** pppSt_FileList, int* pInt_Count, __int64x* pInt_Version /* = NULL */)
{
int nCount = 0;
TCHAR* ptszJsonFile = (TCHAR*)malloc(1024 * 1024 * 10);
if (NULL == ptszJsonFile)
{
return FALSE;
}
memset(ptszJsonFile, '\0', 1024 * 1024 * 10);
FILE* pSt_File = _tfopen(lpszFileList, _T("rb"));
if (NULL == pSt_File)
{
free(ptszJsonFile);
ptszJsonFile = NULL;
return FALSE;
}
while (TRUE)
{
TCHAR tszJsonMsg[2048];
memset(tszJsonMsg, '\0', sizeof(tszJsonMsg));
int nRet = fread(tszJsonMsg, sizeof(TCHAR), sizeof(tszJsonMsg), pSt_File);
if (nRet <= 0)
{
break;
}
memcpy(ptszJsonFile + nCount, tszJsonMsg, nRet);
nCount += nRet;
}
fclose(pSt_File);
Json::Value st_JsonRoot;
Json::Value st_JsonArray;
Json::CharReaderBuilder st_JsonBuild;
Json::CharReader* pSt_JsonReader(st_JsonBuild.newCharReader());
JSONCPP_STRING st_JsonError;
if (!pSt_JsonReader->parse(ptszJsonFile, ptszJsonFile + nCount, &st_JsonRoot, &st_JsonError))
{
return FALSE;
}
delete pSt_JsonReader;
pSt_JsonReader = NULL;
if (NULL != pInt_Version)
{
*pInt_Version = st_JsonRoot["MainVersion"].asInt64();
}
st_JsonArray = st_JsonRoot["FileList"];
//判断是否有文件存在
if (st_JsonArray.size() == 0)
{
return FALSE;
}
*pInt_Count = st_JsonArray.size();
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_FileList, *pInt_Count, sizeof(FILEPARSER_VERSIONINFO));
for (unsigned int i = 0; i < st_JsonArray.size(); i++)
{
(*pppSt_FileList)[i]->st_LocalVersion.nModuleVersion = st_JsonArray[i]["ModuleVersion"].asInt64();
_tcscpy((*pppSt_FileList)[i]->st_LocalVersion.tszMoudelCode, st_JsonArray[i]["ModuleCode"].asCString());
_tcscpy((*pppSt_FileList)[i]->st_LocalVersion.tszMoudelName, st_JsonArray[i]["ModuleName"].asCString());
_tcscpy((*pppSt_FileList)[i]->st_LocalVersion.tszMoudelPath, st_JsonArray[i]["ModulePath"].asCString());
}
return TRUE;
}
/********************************************************************
函数名称:FileParser_Match_Start
函数功能:开始匹配新版本
参数.一:pppSt_ListRemote
In/Out:In
类型:三级指针
可空:N
意思:远程更新文件列表信息
参数.二:nRemoteCount
In/Out:In
类型:整数型
可空:N
意思:输入远程文件个数
参数.三:pppSt_ListLocal
In/Out:In
类型:三级指针
可空:N
意思:输入本地文件列表信息
参数.四:nLocalCount
In/Out:In
类型:整数型
可空:N
意思:输入本地列表文件信息
参数.五:pStl_ListUPDate
In/Out:Out
类型:整数型指针
可空:N
意思:输出要更新的文件列表信息
返回值
类型:逻辑型
意思:是否有新版本
备注:
*********************************************************************/
BOOL FileParser_Match_Start(FILEPARSER_VERSIONINFO*** pppSt_ListRemote, int nRemoteCount, FILEPARSER_VERSIONINFO*** pppSt_ListLocal, int nLocalCount, list<FILEPARSER_VERSIONINFO>* pStl_ListUPDate)
{
for (int i = 0; i < nRemoteCount; i++)
{
//版本比较
for (int j = 0; j < nLocalCount; j++)
{
if (0 == _tcsncmp((*pppSt_ListLocal)[j]->st_LocalVersion.tszMoudelCode, (*pppSt_ListRemote)[i]->tszModuleCode, _tcslen((*pppSt_ListRemote)[i]->tszModuleCode)))
{
if ((*pppSt_ListRemote)[i]->nModuleVersion > (*pppSt_ListLocal)[j]->st_LocalVersion.nModuleVersion)
{
(*pppSt_ListRemote)[i]->st_LocalVersion = (*pppSt_ListLocal)[j]->st_LocalVersion;
pStl_ListUPDate->push_back(*(*pppSt_ListRemote)[i]);
break;
}
else
{
break;
}
}
}
}
return TRUE;
}
\ No newline at end of file
#pragma once
/********************************************************************
函数名称:HelpModule_Api_Copy
函数功能:拷贝新文件到指定目录
参数.一:pStl_ListUPDate
In/Out:In
类型:容器指针
可空:N
意思:更新的文件列表信息
参数.二:lpszDlPath
In/Out:In
类型:常量字符指针
可空:Y
意思:下载的路径
参数.三:bDelFile
In/Out:In
类型:逻辑型
可空:Y
意思:是否删除原始文件
返回值
类型:逻辑型
意思:是否拷贝成功
备注:
*********************************************************************/
BOOL HelpModule_Api_Copy(list<FILEPARSER_VERSIONINFO>* pStl_ListUPDate, LPCTSTR lpszDlPath = NULL, BOOL bDelFile = TRUE)
{
TCHAR tszDlPath[1024];
TCHAR tszCpPath[1024];
if ((NULL == pStl_ListUPDate))
{
return FALSE;
}
list<FILEPARSER_VERSIONINFO>::const_iterator stl_ListIterator = pStl_ListUPDate->begin();
for (; stl_ListIterator != pStl_ListUPDate->end(); stl_ListIterator++)
{
memset(tszDlPath, '\0', sizeof(tszDlPath));
memset(tszCpPath, '\0', sizeof(tszCpPath));
//获取下载的文件路径和名称 组合成可以拷贝的路径地址
if (NULL != lpszDlPath)
{
_stprintf_s(tszDlPath, _T("%s%s"), lpszDlPath, stl_ListIterator->tszModuleName);
}
else
{
_tcscpy(tszDlPath, stl_ListIterator->tszModuleName);
}
if (0 == stl_ListIterator->st_LocalVersion.nModuleVersion)
{
_stprintf_s(tszCpPath, _T("%s%s"), stl_ListIterator->tszModulePath, stl_ListIterator->tszModuleName);
}
else
{
_stprintf_s(tszCpPath, _T("%s%s"), stl_ListIterator->st_LocalVersion.tszMoudelPath, stl_ListIterator->st_LocalVersion.tszMoudelName);
}
if (!SystemApi_File_CreateMutilFolder(stl_ListIterator->st_LocalVersion.tszMoudelPath))
{
return FALSE;
}
if (!SystemApi_File_CopyFile(tszDlPath, tszCpPath, FALSE))
{
return FALSE;
}
if (bDelFile)
{
//删除原始下载的文件
if (0 != _tremove(tszDlPath))
{
return FALSE;
}
}
}
return TRUE;
}
/********************************************************************
函数名称:HelpModule_Api_SetVersion
函数功能:设置文件版本
参数.一:lpszLocalListFile
In/Out:In
类型:常量字符指针
可空:N
意思:本地文件列表名称
参数.二:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:更新文件列表的信息结构
参数.三:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:缓冲区大小
返回值
类型:逻辑型
意思:是否设置成功
备注:
*********************************************************************/
BOOL HelpModule_Api_SetVersion(LPCTSTR lpszLocalFile, LPCTSTR lpszMsgBuffer, int nMsgLen)
{
//文件JSON
Json::Value st_JsonRoot;
Json::Value st_JsonArray;
//以前的JSON
Json::Value st_JsonLocalRoot;
Json::Value st_JsonLocalArray;
Json::CharReaderBuilder st_JsonLocalBuild;
Json::CharReader* pSt_JsonLocalReader(st_JsonLocalBuild.newCharReader());
//新的JSON
Json::Value st_JsonRemoteRoot;
Json::Value st_JsonRemoteArray;
Json::CharReaderBuilder st_JsonRemoteBuild;
Json::CharReader* pSt_JsonRemoteReader(st_JsonRemoteBuild.newCharReader());
JSONCPP_STRING st_JsonError;
if (!pSt_JsonRemoteReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRemoteRoot, &st_JsonError))
{
return FALSE;
}
delete pSt_JsonRemoteReader;
pSt_JsonRemoteReader = NULL;
int nCount = 0;
TCHAR* ptszJsonFile = new TCHAR[1024 * 1024 * 10];
if (NULL == ptszJsonFile)
{
return FALSE;
}
memset(ptszJsonFile, '\0', 1024 * 1024 * 10);
FILE* pSt_File = _tfopen(lpszLocalFile, _T("rb"));
if (NULL == pSt_File)
{
delete[]ptszJsonFile;
ptszJsonFile = NULL;
return FALSE;
}
while (TRUE)
{
TCHAR tszJsonMsg[2048];
memset(tszJsonMsg, '\0', sizeof(tszJsonMsg));
int nRet = fread(tszJsonMsg, sizeof(TCHAR), 2048, pSt_File);
if (nRet <= 0)
{
break;
}
memcpy(ptszJsonFile + nCount, tszJsonMsg, nRet);
nCount += nRet;
}
fclose(pSt_File);
if (!pSt_JsonLocalReader->parse(ptszJsonFile, ptszJsonFile + nCount, &st_JsonLocalRoot, &st_JsonError))
{
delete[]ptszJsonFile;
ptszJsonFile = NULL;
return FALSE;
}
delete pSt_JsonLocalReader;
delete[]ptszJsonFile;
ptszJsonFile = NULL;
pSt_JsonLocalReader = NULL;
st_JsonLocalArray = st_JsonLocalRoot["FileList"];
for (unsigned int i = 0; i < st_JsonLocalArray.size(); i++)
{
BOOL bIsFound = FALSE;
Json::Value st_JsonRemoteArray = st_JsonRemoteRoot["UPList"];
for (unsigned int j = 0; j < st_JsonRemoteArray.size(); j++)
{
if (0 == _tcscmp(st_JsonLocalArray[i]["ModuleCode"].asCString(), st_JsonRemoteArray[j]["ModuleCode"].asCString()))
{
Json::Value st_JsonObject;
st_JsonObject["ModuleVersion"] = st_JsonRemoteArray[j]["ModuleVersion"].asUInt64();
st_JsonObject["ModuleCode"] = st_JsonLocalArray[i]["ModuleCode"].asCString();
st_JsonObject["ModuleName"] = st_JsonLocalArray[i]["ModuleName"].asCString();
st_JsonObject["ModulePath"] = st_JsonLocalArray[i]["ModulePath"].asCString();
st_JsonArray.append(st_JsonObject);
bIsFound = TRUE;
break;
}
}
if (!bIsFound)
{
//没有找到更新的文件
BOOL bIsDelFound = FALSE;
Json::Value st_JsonDelArray;
st_JsonDelArray = st_JsonRemoteRoot["DelList"];
//查找是否有删除的文件内容
for (unsigned int k = 0; k < st_JsonDelArray.size(); k++)
{
if (0 == _tcscmp(st_JsonLocalArray[i]["ModuleName"].asCString(), st_JsonDelArray[k]["ModuleName"].asCString()))
{
bIsDelFound = TRUE;
break;
}
}
//如果没有删除的,那么这个JSON需要加到集合里面,如果有,那么这个JSON就不需要了
if (!bIsDelFound)
{
Json::Value st_JsonObject;
st_JsonObject["ModuleVersion"] = st_JsonLocalArray[i]["ModuleVersion"].asUInt64();
st_JsonObject["ModuleCode"] = st_JsonLocalArray[i]["ModuleCode"].asCString();
st_JsonObject["ModuleName"] = st_JsonLocalArray[i]["ModuleName"].asCString();
st_JsonObject["ModulePath"] = st_JsonLocalArray[i]["ModulePath"].asCString();
st_JsonArray.append(st_JsonObject);
}
}
}
//添加新增加的JSON
st_JsonRemoteArray = st_JsonRemoteRoot["UPList"];
for (unsigned int i = 0; i < st_JsonRemoteArray.size(); i++)
{
BOOL bIsFound = FALSE;
Json::Value st_JsonLocalArray = st_JsonLocalRoot["FileList"];
//查找远程元素是否在本地存在
for (unsigned int j = 0; j < st_JsonLocalArray.size(); j++)
{
if (0 == _tcscmp(st_JsonRemoteArray[i]["ModuleCode"].asCString(), st_JsonLocalArray[j]["ModuleCode"].asCString()))
{
bIsFound = TRUE;
break;
}
}
//如果不存在,就添加
if (!bIsFound)
{
Json::Value st_JsonObject;
st_JsonObject["ModuleVersion"] = st_JsonRemoteArray[i]["ModuleVersion"].asInt64();
st_JsonObject["ModuleCode"] = st_JsonRemoteArray[i]["ModuleCode"].asCString();
st_JsonObject["ModuleName"] = st_JsonRemoteArray[i]["ModuleName"].asCString();
st_JsonObject["ModulePath"] = st_JsonRemoteArray[i]["ModulePath"].asCString();
st_JsonArray.append(st_JsonObject);
}
}
st_JsonRoot["MainVersion"] = st_JsonRemoteRoot["MainVersion"].asInt64();
st_JsonRoot["FileList"] = st_JsonArray;
if (0 != _tremove(lpszLocalFile))
{
return FALSE;
}
if (!SystemApi_File_SaveBuffToFile(lpszLocalFile, st_JsonRoot.toStyledString().c_str(), st_JsonRoot.toStyledString().length()))
{
return FALSE;
}
return TRUE;
}
/********************************************************************
函数名称:HelpModule_Api_RunExec
函数功能:运行一个程序
参数.一:pStl_ListUPDate
In/Out:In
类型:容器指针
可空:N
意思:文件更新运行列表
返回值
类型:逻辑型
意思:是否执行成功
备注:
*********************************************************************/
BOOL HelpModule_Api_RunExec(list<FILEPARSER_VERSIONINFO>* pStl_ListUPDate)
{
list<FILEPARSER_VERSIONINFO>::const_iterator stl_ListIterator = pStl_ListUPDate->begin();
for (; stl_ListIterator != pStl_ListUPDate->end(); stl_ListIterator++)
{
//判断要执行的文件
if (stl_ListIterator->bIsRun)
{
DWORD dwProcessID = 0;
TCHAR tszPath[1024];
memset(tszPath, '\0', sizeof(tszPath));
//判断目录时候需要改变
_stprintf_s(tszPath, _T("%s%s"), stl_ListIterator->st_LocalVersion.tszMoudelPath, stl_ListIterator->st_LocalVersion.tszMoudelName);
if (!SystemApi_Process_CreateProcess(&dwProcessID, tszPath))
{
return FALSE;
}
}
}
return TRUE;
}
/********************************************************************
函数名称:HelpModule_Api_Clear
函数功能:清理工作执行
参数.一:lpszRemoteJson
In/Out:In
类型:常量字符指针
可空:N
意思:清理列表
参数.二:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入缓冲区大小
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL HelpModule_Api_Clear(LPCTSTR lpszRemoteJson, int nMsgLen)
{
Json::Value st_JsonRoot;
Json::Value st_JsonArray;
Json::CharReaderBuilder st_JsonBuild;
Json::CharReader* pSt_JsonReader(st_JsonBuild.newCharReader());
JSONCPP_STRING st_JsonError;
if (!pSt_JsonReader->parse(lpszRemoteJson, lpszRemoteJson + nMsgLen, &st_JsonRoot, &st_JsonError))
{
return FALSE;
}
delete pSt_JsonReader;
pSt_JsonReader = NULL;
st_JsonArray = st_JsonRoot["DelList"];
for (unsigned int i = 0; i < st_JsonArray.size(); i++)
{
if (0 != _tremove(st_JsonArray[i].asCString()))
{
return FALSE;
}
}
return TRUE;
}
\ No newline at end of file
#pragma once
#ifdef _MSC_BUILD
#include <Windows.h>
#include <tchar.h>
#pragma comment(lib,"Ws2_32.lib")
#pragma comment(lib,"../../../XEngine_Source/Debug/jsoncpp")
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib")
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi.lib")
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib")
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <string>
#include <list>
#include <thread>
#include <json/json.h>
using namespace std;
#include <XEngine_Include/XEngine_CommHdr.h>
#include <XEngine_Include/XEngine_Types.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
#include <XEngine_Include/XEngine_SystemSdk/ProcFile_Define.h>
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Define.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Error.h>
typedef struct
{
TCHAR tszFilePath[MAX_PATH];
TCHAR tszFileName[MAX_PATH];
}HELPMODULE_FILELIST, * LPHELPMODULE_FILELIST;
/********************************************************************
函数名称:HelpModule_Api_BuildVer
函数功能:构建应用更新文件
参数.一:lpszPath
In/Out:In
类型:常量字符指针
可空:N
意思:要构建哪个目录中的所有文件列表
参数.二:lpszLocalFile
In/Out:In
类型:常量字符指针
可空:N
意思:构建后保存的列表文件地址
参数.三:lpszRemoteFile
In/Out:In
类型:常量字符指针
可空:N
意思:更新匹配文件保存地址,这个文件需要上传的服务器用来与lpszLocalFile判断是否有更新
参数.四:lpszDlUrl
In/Out:In
类型:常量字符指针
可空:Y
意思:更新地址,用 http://www.xxx.com/UPFile/ 表示,我们会自动填充后面的文件名和路径
参数.五:bSubDir
In/Out:In
类型:逻辑型
可空:Y
意思:是否包含子目录,是否把子目录下的所有文件都构建成更新包
返回值
类型:逻辑型
意思:是否构建成功
备注:次函数可以帮助你快速构建一个可更新的文件列表,方便你快速使用我们的更新SDK
*********************************************************************/
BOOL HelpModule_Api_BuildVer(TCHAR* ptszLocalBuffer, TCHAR* ptszRemoteBuffer, int* pInt_LocalLen, int* pInt_RemoteLen, LPCTSTR lpszPath, LPCTSTR lpszDlUrl, BOOL bSubDir = TRUE)
{
int nListCount;
CHAR** ppszListDir;
list<HELPMODULE_FILELIST> stl_ListFile;
//枚举文件
if (!SystemApi_File_EnumFile(lpszPath, &ppszListDir, &nListCount, NULL, NULL, bSubDir, 1))
{
return FALSE;
}
for (int i = 0; i < nListCount; i++)
{
HELPMODULE_FILELIST st_FileList;
memset(&st_FileList, '\0', sizeof(HELPMODULE_FILELIST));
if (!BaseLib_OperatorString_GetFileAndPath(ppszListDir[i], st_FileList.tszFilePath, st_FileList.tszFileName))
{
return FALSE;
}
stl_ListFile.push_back(st_FileList);
}
BaseLib_OperatorMemory_Free((XPPPMEM)&ppszListDir, nListCount);
Json::Value st_JsonLocalRoot;
Json::Value st_JsonLocalArray;
Json::Value st_JsonLocalObject;
Json::Value st_JsonRemoteRoot;
Json::Value st_JsonRemoteArray;
Json::Value st_JsonRemoteObject;
Json::Value st_JsonRemoteOPtion;
Json::StreamWriterBuilder st_JsonBuilder;
//判断是否是自定义版本
TCHAR tszTimer[64];
XENGINE_LIBTIMER st_Timer;
memset(tszTimer, '\0', sizeof(tszTimer));
memset(&st_Timer, '\0', sizeof(XENGINE_LIBTIMER));
BaseLib_OperatorTime_GetSysTime(&st_Timer);
_stprintf_s(tszTimer, _T("%04d%02d%02d%02d%02d%02d"), st_Timer.wYear, st_Timer.wMonth, st_Timer.wDay, st_Timer.wHour, st_Timer.wMinute, st_Timer.wSecond);
__int64x m_nFileVer = _ttoi64(tszTimer);
st_JsonLocalRoot["MainVersion"] = (Json::UInt64)m_nFileVer;
st_JsonRemoteOPtion["st_JsonRemoteOPtion"] = 0;
st_JsonRemoteRoot["MainVersion"] = (Json::UInt64)m_nFileVer;
st_JsonRemoteRoot["MainDescription"] = _T("File UPData Des!");
st_JsonRemoteRoot["FileVerOPtion"] = st_JsonRemoteOPtion;
//开始构架JSON文件列表
list<HELPMODULE_FILELIST>::const_iterator stl_ListIterator = stl_ListFile.begin();
for (unsigned int i = 1; stl_ListIterator != stl_ListFile.end(); stl_ListIterator++, i++)
{
TCHAR tszFileCode[64];
memset(tszFileCode, '\0', sizeof(tszFileCode));
_stprintf_s(tszFileCode, _T("XYRYUPVERCODE%d"), i);
st_JsonLocalObject["ModuleVersion"] = (Json::UInt64)m_nFileVer;
st_JsonLocalObject["ModuleCode"] = tszFileCode;
st_JsonLocalObject["ModuleName"] = stl_ListIterator->tszFileName;
st_JsonLocalObject["ModulePath"] = stl_ListIterator->tszFilePath;
TCHAR tszDlPath[1024];
memset(tszDlPath, '\0', sizeof(tszDlPath));
//删除指定字符串
int nPathType = 0;
BaseLib_OperatorString_GetPath(stl_ListIterator->tszFilePath, &nPathType);
if (1 == nPathType)
{
TCHAR tszDelPath[MAX_PATH];
TCHAR tszSubPath[MAX_PATH];
memset(tszDelPath, '\0', MAX_PATH);
memset(tszSubPath, '\0', MAX_PATH);
_tcscpy(tszDelPath, lpszPath);
_tcscpy(tszSubPath, stl_ListIterator->tszFilePath);
tszDelPath[_tcslen(tszDelPath) - 2] = '\0';
BaseLib_OperatorString_DelLastForChar(tszDelPath, '\\');
_tcscat(tszDelPath, "\\");
BaseLib_OperatorString_DelSub(tszSubPath, tszDelPath);
BaseLib_OperatorString_FixPath(tszSubPath, 2);
_stprintf_s(tszDlPath, _T("%s%s%s"), lpszDlUrl, tszSubPath, stl_ListIterator->tszFileName);
}
else
{
_stprintf_s(tszDlPath, _T("%s%s%s"), lpszDlUrl, stl_ListIterator->tszFilePath + 2, stl_ListIterator->tszFileName);
}
st_JsonRemoteObject["ModuleRun"] = false;
st_JsonRemoteObject["ModuleVersion"] = (Json::UInt64)m_nFileVer;
st_JsonRemoteObject["ModuleCode"] = tszFileCode;
st_JsonRemoteObject["ModuleName"] = stl_ListIterator->tszFileName;
st_JsonRemoteObject["ModuleDownload"] = tszDlPath;
st_JsonRemoteArray.append(st_JsonRemoteObject);
st_JsonLocalArray.append(st_JsonLocalObject);
}
st_JsonLocalRoot["FileList"] = st_JsonLocalArray;
Json::Value st_JsonRemoteDel;
st_JsonRemoteRoot["UPList"] = st_JsonRemoteArray;
st_JsonRemoteRoot["DelList"] = st_JsonRemoteDel;
st_JsonBuilder["emitUTF8"] = true;
//写到JSON文件
*pInt_LocalLen = Json::writeString(st_JsonBuilder, st_JsonLocalRoot).length();
*pInt_RemoteLen = Json::writeString(st_JsonBuilder, st_JsonRemoteRoot).length();
memcpy(ptszLocalBuffer, Json::writeString(st_JsonBuilder, st_JsonLocalRoot).c_str(), *pInt_LocalLen);
memcpy(ptszRemoteBuffer, Json::writeString(st_JsonBuilder, st_JsonRemoteRoot).c_str(), *pInt_RemoteLen);
return TRUE;
}
int main(int argc, char** argv)
{
#ifdef _MSC_BUILD
WSADATA st_WSAData;
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
#endif
LPCTSTR lpszPath = _T("D:\\libxengine\\*");
LPCTSTR lpszLocalFile = _T("D:\\XEngine_Storage\\XEngine_APPClient\\Debug\\LocalFile.txt");
LPCTSTR lpszPostFile = _T("http://192.168.1.8:5102/api?filename=xengine/upfile.txt&storeagekey=storagekey1");
LPCTSTR lpszDownload = _T("http://192.168.1.8:5101/storagekey1/xengine/");
int nLocalLen = 1024 * 1024 * 10;
int nRemoteLen = 1024 * 1024 * 10;
TCHAR* ptszLocalBuffer = (TCHAR*)malloc(nLocalLen);
TCHAR* ptszRemoteBuffer = (TCHAR*)malloc(nRemoteLen);
memset(ptszLocalBuffer, '\0', nLocalLen);
memset(ptszRemoteBuffer, '\0', nRemoteLen);
if (!HelpModule_Api_BuildVer(ptszLocalBuffer, ptszRemoteBuffer, &nLocalLen, &nRemoteLen, lpszPath, lpszDownload))
{
printf("erron\n");
return 0;
}
SystemApi_File_SaveBuffToFile(lpszLocalFile, ptszLocalBuffer, nLocalLen);
//如果服务器支持,可以直接把更新数据提交到服务器
if (!APIHelp_HttpRequest_Custom(_T("POST"), lpszPostFile, ptszRemoteBuffer, NULL, NULL, &nRemoteLen))
{
printf("erron\n");
}
#ifdef _MSC_BUILD
WSACleanup();
#endif
return 0;
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{7a3d7491-0a28-423d-a8d6-ff4776bcecb7}</ProjectGuid>
<RootNamespace>APPClientUPMaker</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(XEngine_Include);../../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="APPClient_UPMaker.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="APPClient_UPMaker.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
......@@ -9,6 +9,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_UPDownload", "APP
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_RestApi", "APPClient_RestApi\APPClient_RestApi.vcxproj", "{1724FB68-563F-49E5-B36A-C1DF7BF67930}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "APPClient_UPDate", "APPClient_UPDate", "{919C65C2-D84E-46A1-B141-AD11502CB0F4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_UPMaker", "APPClient_UPDate\APPClient_UPMaker\APPClient_UPMaker.vcxproj", "{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_UPFile", "APPClient_UPDate\APPClient_UPFile\APPClient_UPFile.vcxproj", "{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
......@@ -41,10 +47,30 @@ Global
{1724FB68-563F-49E5-B36A-C1DF7BF67930}.Release|x64.Build.0 = Release|x64
{1724FB68-563F-49E5-B36A-C1DF7BF67930}.Release|x86.ActiveCfg = Release|Win32
{1724FB68-563F-49E5-B36A-C1DF7BF67930}.Release|x86.Build.0 = Release|Win32
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Debug|x64.ActiveCfg = Debug|x64
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Debug|x64.Build.0 = Debug|x64
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Debug|x86.ActiveCfg = Debug|Win32
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Debug|x86.Build.0 = Debug|Win32
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Release|x64.ActiveCfg = Release|x64
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Release|x64.Build.0 = Release|x64
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Release|x86.ActiveCfg = Release|Win32
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7}.Release|x86.Build.0 = Release|Win32
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Debug|x64.ActiveCfg = Debug|x64
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Debug|x64.Build.0 = Debug|x64
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Debug|x86.ActiveCfg = Debug|Win32
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Debug|x86.Build.0 = Debug|Win32
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Release|x64.ActiveCfg = Release|x64
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Release|x64.Build.0 = Release|x64
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Release|x86.ActiveCfg = Release|Win32
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7A3D7491-0A28-423D-A8D6-FF4776BCECB7} = {919C65C2-D84E-46A1-B141-AD11502CB0F4}
{D2B84345-CE80-4E29-8A3E-6ACE68EB7ADF} = {919C65C2-D84E-46A1-B141-AD11502CB0F4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87205685-E650-40ED-AE21-E975E7B1E405}
EndGlobalSection
......
......@@ -56,8 +56,8 @@
},
"XP2xp":{
"nTime":2,
"nSDPort":15000,
"nRVPort":15001
"nRVPort":15000,
"nSDPort":15001
},
"XCert":{
"bDLEnable":0,
......@@ -68,6 +68,7 @@
"tszCertKey":"./XEngine_Cert/2_www.xyry.org.key"
},
"XVer":[
"3.9.1.1001 Build20221227",
"3.9.0.1001 Build20221028",
"3.8.0.1001 Build20220727",
"3.7.0.1001 Build20220624",
......
......@@ -318,7 +318,6 @@ BOOL CAPIHelp_Api::APIHelp_Api_UrlParse(TCHAR*** ppptszList, int nListCount, TCH
LPCTSTR lpszHDRFile = _T("filename");
LPCTSTR lpszHDRKey = _T("storeagekey");
LPCTSTR lpszHDRPath = _T("path");
for (int i = 0; i < nListCount; i++)
{
......
......@@ -188,8 +188,8 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile, XENGINE_SERVERCONFIG
}
Json::Value st_JsonP2xp = st_JsonRoot["XP2xp"];
pSt_ServerConfig->st_P2xp.nTime = st_JsonP2xp["nTime"].asInt();
pSt_ServerConfig->st_P2xp.nRVPort = st_JsonP2xp["nRVPort"].asInt();
pSt_ServerConfig->st_P2xp.nSDPort = st_JsonP2xp["nSDPort"].asInt();
pSt_ServerConfig->st_P2xp.nRVPort = st_JsonP2xp["nRVPort"].asInt();
if (st_JsonRoot["XCert"].empty() || (6 != st_JsonRoot["XCert"].size()))
{
......
......@@ -55,12 +55,17 @@ CProtocol_StoragePacket::~CProtocol_StoragePacket()
类型:常量字符指针
可空:Y
意思:输入查询请求的结束时间
参数.七:xhToken
In/Out:In
类型:句柄
可空:Y
意思:输入返回的TOKEN,如果需要的话
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CProtocol_StoragePacket::Protocol_StoragePacket_QueryFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE*** pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart, LPCTSTR lpszTimeEnd)
BOOL CProtocol_StoragePacket::Protocol_StoragePacket_QueryFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE*** pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart /* = NULL */, LPCTSTR lpszTimeEnd /* = NULL */, XNETHANDLE xhToken /* = 0 */)
{
Protocol_IsErrorOccur = FALSE;
......@@ -101,6 +106,10 @@ BOOL CProtocol_StoragePacket::Protocol_StoragePacket_QueryFile(TCHAR* ptszMsgBuf
{
st_JsonRoot["lpszTimeEnd"] = lpszTimeEnd;
}
if (0 != xhToken)
{
st_JsonRoot["xhToken"] = xhToken;
}
st_JsonRoot["Code"] = 0;
st_JsonRoot["Msg"] = _T("ok");
//打包输出信息
......@@ -421,12 +430,17 @@ BOOL CProtocol_StoragePacket::Protocol_StoragePacket_UPDown(TCHAR* ptszMsgBuffer
类型:常量字符指针
可空:Y
意思:输入要查询的文件MD5
参数.五:xhToken
In/Out:In
类型:句柄
可空:Y
意思:消息的TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CProtocol_StoragePacket::Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName /* = NULL */, LPCTSTR lpszFileHash /* = NULL */)
BOOL CProtocol_StoragePacket::Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName /* = NULL */, LPCTSTR lpszFileHash /* = NULL */, XNETHANDLE xhToken /* = 0 */)
{
Protocol_IsErrorOccur = FALSE;
......@@ -445,6 +459,10 @@ BOOL CProtocol_StoragePacket::Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffe
{
st_JsonRoot["lpszFileHash"] = lpszFileHash;
}
if (0 != xhToken)
{
st_JsonRoot["xhToken"] = xhToken;
}
st_JsonRoot["unOperatorType"] = ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_STORAGE;
st_JsonRoot["unOperatorCode"] = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_STORAGE_REQQUERY;
//打包输出信息
......
......@@ -17,10 +17,10 @@ public:
CProtocol_StoragePacket();
~CProtocol_StoragePacket();
public:
BOOL Protocol_StoragePacket_QueryFile(TCHAR *ptszMsgBuffer, int *pInt_MsgLen, XSTORAGECORE_DBFILE*** pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart = NULL, LPCTSTR lpszTimeEnd = NULL);
BOOL Protocol_StoragePacket_QueryFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE*** pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart = NULL, LPCTSTR lpszTimeEnd = NULL, XNETHANDLE xhToken = 0);
BOOL Protocol_StoragePacket_Info(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, SESSION_STORAGEINFO*** pppSt_DLInfo, SESSION_STORAGEINFO*** pppSt_UPInfo, int nDLCount, int nUPCount);
BOOL Protocol_StoragePacket_DirOperator(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, TCHAR*** pppszListEnum, int nListCount);
BOOL Protocol_StoragePacket_BasicAuth(LPCTSTR lpszMethod, LPCTSTR lpszPostUrl, LPCTSTR lpszClientAddr, LPCTSTR lpszUser, LPCTSTR lpszPass, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
BOOL Protocol_StoragePacket_UPDown(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszBuckKey, LPCTSTR lpszFileName, LPCTSTR lpszClientAddr, __int64x nFileSize, BOOL bDown, LPCTSTR lpszFileHash = NULL);
BOOL Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFileHash = NULL);
BOOL Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFileHash = NULL, XNETHANDLE xhToken = 0);
};
......@@ -57,15 +57,20 @@ CProtocol_StorageParse::~CProtocol_StorageParse()
意思:查询的文件HASH
参数.七:pInt_Mode
In/Out:Out
类型:整数型
类型:整数型指针
可空:Y
意思:输出查询返回模式
参数.八:pxhToken
In/Out:Out
类型:整数型指针
可空:Y
意思:输出TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CProtocol_StorageParse::Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR* ptszTimeStart, TCHAR* ptszTimeEnd, TCHAR* ptszBuckKey /* = NULL */, TCHAR* ptszFileName /* = NULL */, TCHAR* ptszFileHash /* = NULL */, int* pInt_Mode /* = NULL */)
BOOL CProtocol_StorageParse::Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR* ptszTimeStart, TCHAR* ptszTimeEnd, TCHAR* ptszBuckKey /* = NULL */, TCHAR* ptszFileName /* = NULL */, TCHAR* ptszFileHash /* = NULL */, int* pInt_Mode /* = NULL */, XNETHANDLE* pxhToken /* = NULL */)
{
Protocol_IsErrorOccur = FALSE;
......@@ -132,6 +137,13 @@ BOOL CProtocol_StorageParse::Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuff
*pInt_Mode = st_JsonRoot["nMode"].asInt();
}
}
if (NULL != pxhToken)
{
if (!st_JsonRoot["xhToken"].isNull())
{
*pxhToken = st_JsonRoot["xhToken"].asUInt64();
}
}
return TRUE;
}
/********************************************************************
......@@ -363,7 +375,7 @@ BOOL CProtocol_StorageParse::Protocol_StorageParse_ProxyNotify(LPCTSTR lpszMsgBu
}
/********************************************************************
函数名称:Protocol_StorageParse_SpeedLimit
函数功能:
函数功能:速度限制请求解析函数
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -417,4 +429,61 @@ BOOL CProtocol_StorageParse::Protocol_StorageParse_SpeedLimit(LPCTSTR lpszMsgBuf
*pInt_Code = st_JsonRoot["code"].asInt();
*pInt_Limit = st_JsonRoot["nLimitSpeed"].asInt();
return TRUE;
}
/********************************************************************
函数名称:Protocol_StorageParse_P2PToken
函数功能:P2P查找文件TOKEN匹配函数
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:输入要解析的内容
参数.二:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pxhToken
In/Out:Out
类型:整数型指针
可空:N
意思:输出解析到的TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CProtocol_StorageParse::Protocol_StorageParse_P2PToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE *pxhToken)
{
Protocol_IsErrorOccur = FALSE;
if ((NULL == lpszMsgBuffer))
{
Protocol_IsErrorOccur = TRUE;
Protocol_dwErrorCode = ERROR_XENGINE_STORAGE_PROTOCOL_PARAMENT;
return FALSE;
}
Json::Value st_JsonRoot;
Json::CharReaderBuilder st_JsonBuild;
Json::CharReader* pSt_JsonReader(st_JsonBuild.newCharReader());
JSONCPP_STRING st_JsonError;
//解析JSON
if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + _tcslen(lpszMsgBuffer), &st_JsonRoot, &st_JsonError))
{
Protocol_IsErrorOccur = TRUE;
Protocol_dwErrorCode = ERROR_XENGINE_STORAGE_PROTOCOL_PARSE;
return FALSE;
}
delete pSt_JsonReader;
pSt_JsonReader = NULL;
if (st_JsonRoot["xhToken"].isNull())
{
Protocol_IsErrorOccur = TRUE;
Protocol_dwErrorCode = ERROR_XENGINE_STORAGE_PROTOCOL_TOKEN;
return FALSE;
}
*pxhToken = st_JsonRoot["xhToken"].asUInt64();
return TRUE;
}
\ No newline at end of file
......@@ -17,9 +17,10 @@ public:
CProtocol_StorageParse();
~CProtocol_StorageParse();
public:
BOOL Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR* ptszTimeStart, TCHAR* ptszTimeEnd, TCHAR* ptszBuckKey = NULL, TCHAR* ptszFileName = NULL, TCHAR* ptszFileHash = NULL, int* pInt_Mode = NULL);
BOOL Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR* ptszTimeStart, TCHAR* ptszTimeEnd, TCHAR* ptszBuckKey = NULL, TCHAR* ptszFileName = NULL, TCHAR* ptszFileHash = NULL, int* pInt_Mode = NULL, XNETHANDLE* pxhToken = NULL);
BOOL Protocol_StorageParse_ReportFile(LPCTSTR lpszMsgBuffer, int nMsgLen, XSTORAGECORE_DBFILE*** pppSt_DBFile, int* pInt_ListCount);
BOOL Protocol_StorageParse_DirOperator(LPCTSTR lpszMsgBuffer, TCHAR* ptszUserDir, TCHAR* ptszBuckKey, int* pInt_Operator);
BOOL Protocol_StorageParse_ProxyNotify(LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR* ptszClientAddr, TCHAR* ptszBuckKey, TCHAR* ptszFileName, TCHAR* ptszFileHash, __int64x* pInt_FileSize);
BOOL Protocol_StorageParse_SpeedLimit(LPCTSTR lpszMsgBuffer, int nMsgLen, int* pInt_Code, int* pInt_Limit);
BOOL Protocol_StorageParse_P2PToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE* pxhToken);
};
......@@ -9,6 +9,7 @@ EXPORTS
Protocol_StorageParse_ReportFile
Protocol_StorageParse_DirOperator
Protocol_StorageParse_SpeedLimit
Protocol_StorageParse_P2PToken
Protocol_StoragePacket_BasicAuth
Protocol_StoragePacket_UPDown
......
......@@ -79,27 +79,37 @@ extern "C" BOOL Protocol_StorageParse_ProxyNotify(LPCTSTR lpszMsgBuffer, int nMs
类型:字符指针
可空:N
意思:查询结束时间
参数.四:ptszFileName
参数.四:ptszBuckKey
In/Out:Out
类型:字符指针
可空:N
可空:Y
意思:输出文件所属BUCKET
参数.五:ptszFileName
In/Out:Out
类型:字符指针
可空:Y
意思:查询的文件名
参数.五:ptszFileMD5
参数.六:ptszFileHash
In/Out:Out
类型:字符指针
可空:N
意思:查询的文件MD5
可空:Y
意思:查询的文件HASH
参数.七:pInt_Mode
In/Out:Out
类型:整数型
类型:整数型指针
可空:Y
意思:输出查询返回模式
参数.八:pxhToken
In/Out:Out
类型:整数型指针
可空:Y
意思:输出TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_StorageParse_QueryFile(LPCSTR lpszMsgBuffer, CHAR * ptszTimeStart, CHAR * ptszTimeEnd, CHAR * ptszBuckKey = NULL, CHAR * ptszFileName = NULL, CHAR * ptszFileHash = NULL, int* pInt_Mode = NULL);
extern "C" BOOL Protocol_StorageParse_QueryFile(LPCSTR lpszMsgBuffer, CHAR * ptszTimeStart, CHAR * ptszTimeEnd, CHAR * ptszBuckKey = NULL, CHAR * ptszFileName = NULL, CHAR * ptszFileHash = NULL, int* pInt_Mode = NULL, XNETHANDLE * pxhToken = NULL);
/********************************************************************
函数名称:Protocol_StorageParse_ReportFile
函数功能:解析文件报告协议
......@@ -160,7 +170,7 @@ extern "C" BOOL Protocol_StorageParse_ReportFile(LPCTSTR lpszMsgBuffer, int nMsg
extern "C" BOOL Protocol_StorageParse_DirOperator(LPCSTR lpszMsgBuffer, CHAR * ptszUserDir, TCHAR * ptszBuckKey, int* pInt_Operator);
/********************************************************************
函数名称:Protocol_StorageParse_SpeedLimit
函数功能:
函数功能:速度限制请求解析函数
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -187,6 +197,30 @@ extern "C" BOOL Protocol_StorageParse_DirOperator(LPCSTR lpszMsgBuffer, CHAR * p
备注:
*********************************************************************/
extern "C" BOOL Protocol_StorageParse_SpeedLimit(LPCTSTR lpszMsgBuffer, int nMsgLen, int* pInt_Code, int* pInt_Limit);
/********************************************************************
函数名称:Protocol_StorageParse_P2PToken
函数功能:P2P查找文件TOKEN匹配函数
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:输入要解析的内容
参数.二:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pxhToken
In/Out:Out
类型:整数型指针
可空:N
意思:输出解析到的TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_StorageParse_P2PToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE* pxhToken);
/************************************************************************/
/* 打包协议导出 */
/************************************************************************/
......@@ -316,12 +350,17 @@ extern "C" BOOL Protocol_StoragePacket_UPDown(TCHAR * ptszMsgBuffer, int* pInt_M
类型:常量字符指针
可空:Y
意思:输入查询请求的结束时间
参数.七:xhToken
In/Out:In
类型:句柄
可空:Y
意思:输入返回的TOKEN,如果需要的话
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_StoragePacket_QueryFile(CHAR * ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE * **pppSt_DBFile, int nListCount, LPCSTR lpszTimeStart = NULL, LPCSTR lpszTimeEnd = NULL);
extern "C" BOOL Protocol_StoragePacket_QueryFile(CHAR * ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE * **pppSt_DBFile, int nListCount, LPCSTR lpszTimeStart = NULL, LPCSTR lpszTimeEnd = NULL, XNETHANDLE xhToken = 0);
/********************************************************************
函数名称:Protocol_StoragePacket_Info
函数功能:返回信息获取请求打包函数
......@@ -413,9 +452,14 @@ extern "C" BOOL Protocol_StoragePacket_DirOperator(CHAR * ptszMsgBuffer, int* pI
类型:常量字符指针
可空:Y
意思:输入要查询的文件MD5
参数.五:xhToken
In/Out:In
类型:句柄
可空:Y
意思:消息的TOKEN
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_StoragePacket_REQFile(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFileHash = NULL);
\ No newline at end of file
extern "C" BOOL Protocol_StoragePacket_REQFile(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName = NULL, LPCTSTR lpszFileHash = NULL, XNETHANDLE xhToken = 0);
\ No newline at end of file
......@@ -11,4 +11,5 @@
// History:
*********************************************************************/
#define ERROR_XENGINE_STORAGE_PROTOCOL_PARAMENT 0xB0F1001
#define ERROR_XENGINE_STORAGE_PROTOCOL_PARSE 0xB0F1002
\ No newline at end of file
#define ERROR_XENGINE_STORAGE_PROTOCOL_PARSE 0xB0F1002
#define ERROR_XENGINE_STORAGE_PROTOCOL_TOKEN 0xB0F1003
\ No newline at end of file
......@@ -33,9 +33,9 @@ extern "C" BOOL Protocol_StorageParse_ProxyNotify(LPCTSTR lpszMsgBuffer, int nMs
{
return m_StorageParse.Protocol_StorageParse_ProxyNotify(lpszMsgBuffer, nMsgLen, ptszClientAddr, ptszBuckKey, ptszFileName, ptszFileHash, pInt_FileSize);
}
extern "C" BOOL Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR * ptszTimeStart, TCHAR * ptszTimeEnd, CHAR * ptszBuckKey, TCHAR * ptszFileName, TCHAR * ptszFileHash, int* pInt_Mode)
extern "C" BOOL Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuffer, TCHAR * ptszTimeStart, TCHAR * ptszTimeEnd, CHAR * ptszBuckKey, TCHAR * ptszFileName, TCHAR * ptszFileHash, int* pInt_Mode, XNETHANDLE * pxhToken)
{
return m_StorageParse.Protocol_StorageParse_QueryFile(lpszMsgBuffer, ptszTimeStart, ptszTimeEnd, ptszBuckKey, ptszFileName, ptszFileHash, pInt_Mode);
return m_StorageParse.Protocol_StorageParse_QueryFile(lpszMsgBuffer, ptszTimeStart, ptszTimeEnd, ptszBuckKey, ptszFileName, ptszFileHash, pInt_Mode, pxhToken);
}
extern "C" BOOL Protocol_StorageParse_ReportFile(LPCTSTR lpszMsgBuffer, int nMsgLen, XSTORAGECORE_DBFILE * **pppSt_DBFile, int* pInt_ListCount)
{
......@@ -49,6 +49,10 @@ extern "C" BOOL Protocol_StorageParse_SpeedLimit(LPCTSTR lpszMsgBuffer, int nMsg
{
return m_StorageParse.Protocol_StorageParse_SpeedLimit(lpszMsgBuffer, nMsgLen, pInt_Code, pInt_Limit);
}
extern "C" BOOL Protocol_StorageParse_P2PToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE * pxhToken)
{
return m_StorageParse.Protocol_StorageParse_P2PToken(lpszMsgBuffer, nMsgLen, pxhToken);
}
/************************************************************************/
/* 打包协议导出 */
/************************************************************************/
......@@ -60,9 +64,9 @@ extern "C" BOOL Protocol_StoragePacket_UPDown(TCHAR * ptszMsgBuffer, int* pInt_M
{
return m_StoragePacket.Protocol_StoragePacket_UPDown(ptszMsgBuffer, pInt_MsgLen, lpszBuckKey, lpszFileName, lpszClientAddr, nFileSize, bDown, lpszFileHash);
}
extern "C" BOOL Protocol_StoragePacket_QueryFile(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE * **pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart, LPCTSTR lpszTimeEnd)
extern "C" BOOL Protocol_StoragePacket_QueryFile(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XSTORAGECORE_DBFILE * **pppSt_DBFile, int nListCount, LPCTSTR lpszTimeStart, LPCTSTR lpszTimeEnd, XNETHANDLE xhToken)
{
return m_StoragePacket.Protocol_StoragePacket_QueryFile(ptszMsgBuffer, pInt_MsgLen, pppSt_DBFile, nListCount, lpszTimeStart, lpszTimeEnd);
return m_StoragePacket.Protocol_StoragePacket_QueryFile(ptszMsgBuffer, pInt_MsgLen, pppSt_DBFile, nListCount, lpszTimeStart, lpszTimeEnd, xhToken);
}
extern "C" BOOL Protocol_StoragePacket_Info(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, SESSION_STORAGEINFO * **pppSt_DLInfo, SESSION_STORAGEINFO * **pppSt_UPInfo, int nDLCount, int nUPCount)
{
......@@ -72,7 +76,7 @@ extern "C" BOOL Protocol_StoragePacket_DirOperator(TCHAR * ptszMsgBuffer, int* p
{
return m_StoragePacket.Protocol_StoragePacket_DirOperator(ptszMsgBuffer, pInt_MsgLen, pppszListEnum, nListCount);
}
extern "C" BOOL Protocol_StoragePacket_REQFile(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName, LPCTSTR lpszFileHash)
extern "C" BOOL Protocol_StoragePacket_REQFile(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCTSTR lpszFileName, LPCTSTR lpszFileHash, XNETHANDLE xhToken)
{
return m_StoragePacket.Protocol_StoragePacket_REQFile(ptszMsgBuffer, pInt_MsgLen, lpszFileName, lpszFileHash);
return m_StoragePacket.Protocol_StoragePacket_REQFile(ptszMsgBuffer, pInt_MsgLen, lpszFileName, lpszFileHash, xhToken);
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ void CALLBACK XEngine_Download_CBSend(LPCSTR lpszClientAddr, SOCKET hSocket, LPV
{
__int64u nLimitTime = 0;
Algorithm_Calculation_GetSDFlow(st_StorageInfo.xhToken, &nLimitTime);
if (nLimitTime > st_StorageInfo.nLimit)
if (nLimitTime > (__int64u)st_StorageInfo.nLimit)
{
//当前平均速度大于限制速度,不做处理
NetCore_TCPXCore_CBSendEx(xhNetDownload, lpszClientAddr, XEngine_Download_CBSend);
......
......@@ -76,8 +76,8 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
else
{
//开始广播请求文件
SOCKET hSDSocket;
SOCKET hRVSocket;
SOCKET hSocket;
XNETHANDLE xhToken = 0;
list<APIHELP_LBFILEINFO> stl_ListFile;
if (_tcslen(tszFileHash) <= 0)
......@@ -90,19 +90,18 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("业务客户端:%s,发送广播请求失败,因为查询文件HASH为空"), lpszClientAddr);
return FALSE;
}
Protocol_StoragePacket_REQFile(tszSDBuffer, &nSDLen, NULL, tszFileHash);
NetCore_BroadCast_SDCreate(&hSDSocket, st_ServiceCfg.st_P2xp.nRVPort, st_ServiceCfg.tszIPAddr);
NetCore_BroadCast_RVCreate(&hRVSocket, st_ServiceCfg.st_P2xp.nSDPort);
BaseLib_OperatorHandle_Create(&xhToken);
Protocol_StoragePacket_REQFile(tszSDBuffer, &nSDLen, NULL, tszFileHash, xhToken);
NetCore_BroadCast_Create(&hSocket, st_ServiceCfg.st_P2xp.nSDPort, st_ServiceCfg.tszIPAddr);
if (!NetCore_BroadCast_Send(hSDSocket, tszSDBuffer, nSDLen))
if (!NetCore_BroadCast_Send(hSocket, tszSDBuffer, nSDLen))
{
st_HDRParam.bIsClose = TRUE;
st_HDRParam.nHttpCode = 500;
RfcComponents_HttpServer_SendMsgEx(xhCenterHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPCENTER);
NetCore_BroadCast_Close(hSDSocket);
NetCore_BroadCast_Close(hRVSocket);
NetCore_BroadCast_Close(hSocket);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("业务客户端:%s,发送广播请求失败,错误:%lX"), lpszClientAddr, NetCore_GetLastError());
return FALSE;
}
......@@ -114,9 +113,19 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
memset(&st_FileInfo, '\0', sizeof(APIHELP_LBFILEINFO));
st_FileInfo.nMsgLen = sizeof(st_FileInfo.tszMsgBuffer);
if (NetCore_BroadCast_Recv(hRVSocket, st_FileInfo.tszMsgBuffer, &st_FileInfo.nMsgLen))
if (NetCore_BroadCast_Recv(hSocket, st_FileInfo.tszMsgBuffer, &st_FileInfo.nMsgLen))
{
stl_ListFile.push_back(st_FileInfo);
XNETHANDLE xhP2PToken = 0;
Protocol_StorageParse_P2PToken(st_FileInfo.tszMsgBuffer, st_FileInfo.nMsgLen, &xhP2PToken);
if (xhToken == xhP2PToken)
{
stl_ListFile.push_back(st_FileInfo);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("业务客户端:%s,接受到P2P文件查询回复,TOKEN:%llu 一致"), lpszClientAddr, xhToken);
}
else
{
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("业务客户端:%s,接受到P2P文件查询回复,请求TOKEN:%llu,回复TOKEN:%llu 不一致"), lpszClientAddr, xhToken, xhP2PToken);
}
}
time_t nTimeEnd = time(NULL);
if ((nTimeEnd - nTimeStart) > st_ServiceCfg.st_P2xp.nTime)
......@@ -125,8 +134,7 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
break;
}
}
NetCore_BroadCast_Close(hSDSocket);
NetCore_BroadCast_Close(hRVSocket);
NetCore_BroadCast_Close(hSocket);
if (stl_ListFile.empty())
{
......
......@@ -23,8 +23,9 @@ XHTHREAD XEngine_Task_P2PThread()
if (NetCore_BroadCast_Recv(hBroadSocket, tszMsgBuffer, &nMsgLen, tszIPAddr))
{
XNETHANDLE xhToken = 0;
//收到文件查询请求
if (Protocol_StorageParse_QueryFile(tszMsgBuffer, tszTimeStart, tszTimeEnd, tszBuckKey, tszFileName, tszFileHash))
if (Protocol_StorageParse_QueryFile(tszMsgBuffer, tszTimeStart, tszTimeEnd, tszBuckKey, tszFileName, tszFileHash, NULL, &xhToken))
{
//查询文件是否存在数据库,不存在不关心
int nListCount = 0;
......@@ -33,14 +34,14 @@ XHTHREAD XEngine_Task_P2PThread()
if (nListCount > 0)
{
_stprintf(pppSt_ListFile[0]->tszTableName, _T("%s:%d"), st_ServiceCfg.tszIPAddr, st_ServiceCfg.nStorageDLPort);
Protocol_StoragePacket_QueryFile(tszMsgBuffer, &nMsgLen, &pppSt_ListFile, nListCount, tszTimeStart, tszTimeEnd);
Protocol_StoragePacket_QueryFile(tszMsgBuffer, &nMsgLen, &pppSt_ListFile, nListCount, tszTimeStart, tszTimeEnd, xhToken);
BaseLib_OperatorMemory_Free((XPPPMEM)&pppSt_ListFile, nListCount);
SOCKET hSDSocket;
NetCore_BroadCast_SDCreate(&hSDSocket, st_ServiceCfg.st_P2xp.nSDPort, st_ServiceCfg.tszIPAddr);
NetCore_BroadCast_Send(hSDSocket, tszMsgBuffer, nMsgLen);
NetCore_BroadCast_Close(hSDSocket);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("广播端:%s,请求查询文件成功,列表个数:%d"), tszIPAddr, nListCount);
SOCKET hSocket;
NetCore_BroadCast_Create(&hSocket, st_ServiceCfg.st_P2xp.nSDPort, st_ServiceCfg.tszIPAddr);
NetCore_BroadCast_Send(hSocket, tszMsgBuffer, nMsgLen);
NetCore_BroadCast_Close(hSocket);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("广播端:%s,请求查询文件成功,Token:%llu,列表个数:%d"), tszIPAddr, xhToken, nListCount);
}
}
}
......
......@@ -399,7 +399,7 @@ int main(int argc, char** argv)
//只有使用了数据库,才启用P2P
if (st_ServiceCfg.st_XSql.bEnable)
{
if (!NetCore_BroadCast_RVCreate(&hBroadSocket, st_ServiceCfg.st_P2xp.nRVPort))
if (!NetCore_BroadCast_Create(&hBroadSocket, st_ServiceCfg.st_P2xp.nRVPort))
{
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("启动服务中,启动P2P存储广播服务失败,错误:%d"), errno);
goto XENGINE_EXITAPP;
......