Skip to content

Commit fa24104

Browse files
committed
added:api function help module
support:load balance
1 parent 9fb0c69 commit fa24104

27 files changed

+660
-39
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"tszIPAddr": "127.0.0.1",
3+
"bDistributed": 1,
4+
"LBConfig": {
5+
"nServerMode": 1
6+
},
7+
"LoadBalance": {
8+
"nUseMode": [
9+
0
10+
],
11+
"CenterAddr": [
12+
"http://192.168.1.9:5100"
13+
],
14+
"DownloadAddr": [
15+
"http://192.168.1.9:5101"
16+
],
17+
"UPLoaderAddr": [
18+
"http://192.168.1.9:5102"
19+
]
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
/********************************************************************
3+
// Created: 2021/07/08 15:37:18
4+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Define.h
5+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp
6+
// File Base: APIHelp_Define
7+
// File Ext: h
8+
// Project: XEngine(网络通信引擎)
9+
// Author: qyt
10+
// Purpose: 导出定义
11+
// History:
12+
*********************************************************************/
13+
//////////////////////////////////////////////////////////////////////////
14+
// 导出函数
15+
//////////////////////////////////////////////////////////////////////////
16+
extern "C" DWORD StorageHelp_GetLastError(int* pInt_SysError = NULL);
17+
/************************************************************************/
18+
/* */
19+
/************************************************************************/
20+
extern "C" BOOL APIHelp_Distributed_IsMode(list<int>*pStl_ListMode, int nMode);
21+
extern "C" BOOL APIHelp_Distributed_RandomAddr(list<tstring>* pStl_ListAddr, TCHAR* ptszAddr);
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include "pch.h"
2+
#include "APIHelp_Distributed.h"
3+
/********************************************************************
4+
// Created: 2021/07/08 15:26:13
5+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Distributed\APIHelp_Distributed.cpp
6+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Distributed
7+
// File Base: APIHelp_Distributed
8+
// File Ext: cpp
9+
// Project: XEngine(网络通信引擎)
10+
// Author: qyt
11+
// Purpose: 分布式帮助函数
12+
// History:
13+
*********************************************************************/
14+
CAPIHelp_Distributed::CAPIHelp_Distributed()
15+
{
16+
17+
}
18+
CAPIHelp_Distributed::~CAPIHelp_Distributed()
19+
{
20+
21+
}
22+
BOOL CAPIHelp_Distributed::APIHelp_Distributed_IsMode(list<int>* pStl_ListMode, int nMode)
23+
{
24+
BOOL bFound = FALSE;
25+
list<int>::const_iterator stl_ListIterator = pStl_ListMode->begin();
26+
for (; stl_ListIterator != pStl_ListMode->end(); stl_ListIterator++)
27+
{
28+
if (nMode == *stl_ListIterator)
29+
{
30+
bFound = TRUE;
31+
break;
32+
}
33+
}
34+
return bFound;
35+
}
36+
BOOL CAPIHelp_Distributed::APIHelp_Distributed_RandomAddr(list<tstring>* pStl_ListAddr, TCHAR* ptszAddr)
37+
{
38+
BOOL bFound = FALSE;
39+
XNETHANDLE xhToken = 0;
40+
41+
BaseLib_OperatorHandle_Create(&xhToken, 1, pStl_ListAddr->size());
42+
list<tstring>::const_iterator stl_ListIterator = pStl_ListAddr->begin();
43+
for (int i = 0; stl_ListIterator != pStl_ListAddr->end(); stl_ListIterator++, i++)
44+
{
45+
if (xhToken == i)
46+
{
47+
bFound = TRUE;
48+
_tcscpy(ptszAddr, stl_ListIterator->c_str());
49+
break;
50+
}
51+
}
52+
return bFound;
53+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
/********************************************************************
3+
// Created: 2021/07/08 15:24:30
4+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Distributed\APIHelp_Distributed.h
5+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Distributed
6+
// File Base: APIHelp_Distributed
7+
// File Ext: h
8+
// Project: XEngine(网络通信引擎)
9+
// Author: qyt
10+
// Purpose: 分布式帮助函数
11+
// History:
12+
*********************************************************************/
13+
14+
15+
class CAPIHelp_Distributed
16+
{
17+
public:
18+
CAPIHelp_Distributed();
19+
~CAPIHelp_Distributed();
20+
public:
21+
BOOL APIHelp_Distributed_IsMode(list<int>* pStl_ListMode, int nMode);
22+
BOOL APIHelp_Distributed_RandomAddr(list<tstring>* pStl_ListAddr, TCHAR* ptszAddr);
23+
protected:
24+
private:
25+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
/********************************************************************
3+
// Created: 2021/07/08 15:37:34
4+
// File Name: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp\APIHelp_Error.h
5+
// File Path: D:\XEngine_Storage\XEngine_Source\StorageModule_APIHelp
6+
// File Base: APIHelp_Error
7+
// File Ext: h
8+
// Project: XEngine(网络通信引擎)
9+
// Author: qyt
10+
// Purpose: 导出错误
11+
// History:
12+
*********************************************************************/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
LIBRARY
2+
3+
EXPORTS
4+
StorageHelp_GetLastError
5+
6+
APIHelp_Distributed_IsMode
7+
APIHelp_Distributed_RandomAddr
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{d8c24395-605f-4c73-aa50-aba6b7cd84d6}</ProjectGuid>
25+
<RootNamespace>StorageModuleAPIHelp</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>DynamicLibrary</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v142</PlatformToolset>
33+
<CharacterSet>MultiByte</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>DynamicLibrary</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v142</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>DynamicLibrary</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v142</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>DynamicLibrary</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v142</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<LinkIncremental>true</LinkIncremental>
75+
<IncludePath>$(XEngine_Include);$(IncludePath)</IncludePath>
76+
<LibraryPath>$(XEngine_Library);$(LibraryPath)</LibraryPath>
77+
</PropertyGroup>
78+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
79+
<LinkIncremental>false</LinkIncremental>
80+
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
82+
<LinkIncremental>true</LinkIncremental>
83+
</PropertyGroup>
84+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
85+
<LinkIncremental>false</LinkIncremental>
86+
</PropertyGroup>
87+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
88+
<ClCompile>
89+
<WarningLevel>Level3</WarningLevel>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;STORAGEMODULEAPIHELP_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
<PrecompiledHeader>Use</PrecompiledHeader>
94+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
95+
<DisableSpecificWarnings>4819</DisableSpecificWarnings>
96+
</ClCompile>
97+
<Link>
98+
<SubSystem>Windows</SubSystem>
99+
<GenerateDebugInformation>true</GenerateDebugInformation>
100+
<EnableUAC>false</EnableUAC>
101+
<ModuleDefinitionFile>StorageModule_APIHelp.def</ModuleDefinitionFile>
102+
</Link>
103+
</ItemDefinitionGroup>
104+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
105+
<ClCompile>
106+
<WarningLevel>Level3</WarningLevel>
107+
<FunctionLevelLinking>true</FunctionLevelLinking>
108+
<IntrinsicFunctions>true</IntrinsicFunctions>
109+
<SDLCheck>true</SDLCheck>
110+
<PreprocessorDefinitions>WIN32;NDEBUG;STORAGEMODULEAPIHELP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
111+
<ConformanceMode>true</ConformanceMode>
112+
<PrecompiledHeader>Use</PrecompiledHeader>
113+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
114+
</ClCompile>
115+
<Link>
116+
<SubSystem>Windows</SubSystem>
117+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
118+
<OptimizeReferences>true</OptimizeReferences>
119+
<GenerateDebugInformation>true</GenerateDebugInformation>
120+
<EnableUAC>false</EnableUAC>
121+
<ModuleDefinitionFile>StorageModule_APIHelp.def</ModuleDefinitionFile>
122+
</Link>
123+
</ItemDefinitionGroup>
124+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
125+
<ClCompile>
126+
<WarningLevel>Level3</WarningLevel>
127+
<SDLCheck>true</SDLCheck>
128+
<PreprocessorDefinitions>_DEBUG;STORAGEMODULEAPIHELP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
129+
<ConformanceMode>true</ConformanceMode>
130+
<PrecompiledHeader>Use</PrecompiledHeader>
131+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
132+
</ClCompile>
133+
<Link>
134+
<SubSystem>Windows</SubSystem>
135+
<GenerateDebugInformation>true</GenerateDebugInformation>
136+
<EnableUAC>false</EnableUAC>
137+
<ModuleDefinitionFile>StorageModule_APIHelp.def</ModuleDefinitionFile>
138+
</Link>
139+
</ItemDefinitionGroup>
140+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
141+
<ClCompile>
142+
<WarningLevel>Level3</WarningLevel>
143+
<FunctionLevelLinking>true</FunctionLevelLinking>
144+
<IntrinsicFunctions>true</IntrinsicFunctions>
145+
<SDLCheck>true</SDLCheck>
146+
<PreprocessorDefinitions>NDEBUG;STORAGEMODULEAPIHELP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
147+
<ConformanceMode>true</ConformanceMode>
148+
<PrecompiledHeader>Use</PrecompiledHeader>
149+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
150+
</ClCompile>
151+
<Link>
152+
<SubSystem>Windows</SubSystem>
153+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
154+
<OptimizeReferences>true</OptimizeReferences>
155+
<GenerateDebugInformation>true</GenerateDebugInformation>
156+
<EnableUAC>false</EnableUAC>
157+
<ModuleDefinitionFile>StorageModule_APIHelp.def</ModuleDefinitionFile>
158+
</Link>
159+
</ItemDefinitionGroup>
160+
<ItemGroup>
161+
<ClInclude Include="APIHelp_Define.h" />
162+
<ClInclude Include="APIHelp_Distributed\APIHelp_Distributed.h" />
163+
<ClInclude Include="APIHelp_Error.h" />
164+
<ClInclude Include="framework.h" />
165+
<ClInclude Include="pch.h" />
166+
</ItemGroup>
167+
<ItemGroup>
168+
<ClCompile Include="APIHelp_Distributed\APIHelp_Distributed.cpp" />
169+
<ClCompile Include="dllmain.cpp" />
170+
<ClCompile Include="pch.cpp">
171+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
172+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
173+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
174+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
175+
</ClCompile>
176+
</ItemGroup>
177+
<ItemGroup>
178+
<None Include="StorageModule_APIHelp.def" />
179+
</ItemGroup>
180+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
181+
<ImportGroup Label="ExtensionTargets">
182+
</ImportGroup>
183+
</Project>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="资源文件">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
<Filter Include="头文件\APIHelp_Distributed">
17+
<UniqueIdentifier>{d66f2b5b-5378-4b12-af64-9423b3ed8dc2}</UniqueIdentifier>
18+
</Filter>
19+
<Filter Include="源文件\APIHelp_Distributed">
20+
<UniqueIdentifier>{5b2628b8-77c6-475d-b982-4b4b8815b907}</UniqueIdentifier>
21+
</Filter>
22+
</ItemGroup>
23+
<ItemGroup>
24+
<ClInclude Include="framework.h">
25+
<Filter>头文件</Filter>
26+
</ClInclude>
27+
<ClInclude Include="pch.h">
28+
<Filter>头文件</Filter>
29+
</ClInclude>
30+
<ClInclude Include="APIHelp_Distributed\APIHelp_Distributed.h">
31+
<Filter>头文件\APIHelp_Distributed</Filter>
32+
</ClInclude>
33+
<ClInclude Include="APIHelp_Define.h">
34+
<Filter>头文件</Filter>
35+
</ClInclude>
36+
<ClInclude Include="APIHelp_Error.h">
37+
<Filter>头文件</Filter>
38+
</ClInclude>
39+
</ItemGroup>
40+
<ItemGroup>
41+
<ClCompile Include="dllmain.cpp">
42+
<Filter>源文件</Filter>
43+
</ClCompile>
44+
<ClCompile Include="pch.cpp">
45+
<Filter>源文件</Filter>
46+
</ClCompile>
47+
<ClCompile Include="APIHelp_Distributed\APIHelp_Distributed.cpp">
48+
<Filter>源文件\APIHelp_Distributed</Filter>
49+
</ClCompile>
50+
</ItemGroup>
51+
<ItemGroup>
52+
<None Include="StorageModule_APIHelp.def">
53+
<Filter>源文件</Filter>
54+
</None>
55+
</ItemGroup>
56+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

0 commit comments

Comments
 (0)