未验证 提交 9bc2e7b3 编写于 作者: xengine-qyt's avatar xengine-qyt 提交者: Gitee

!14 V3.1.0.1001 Merge

Merge pull request !14 from qyt/develop
XEngine_Authorize V3.1.0.1001
添加:删除TOKEN会话功能
添加:更新会话TOKEN时间功能
添加:HTTP管理端支持自动刷新
添加:HTTP管理客户端的登录功能
添加:TOKEN功能的支持
添加:http快速验证功能
添加:http解析和打包协议到协议模块
修改:移动TCP协议处理代码到HTTP用户处理中
修改:分割序列号和客户端管理器接口到单独文件
修改:modify:Protocol_Packet_SendPkt 名称到 Protocol_Packet_HDRComm function
修改:发送消息函数的参数
修改:移动用户协议到用户文件从客户端代码
修改:HTTPPOST和GET任务区别
修改:统一错误定义
修改:HTTP的API请求TOKEN验证
修改:支持仅仅展示在线客户端了
修改:禁用HTTP重复登录
修改:登录必须填写设备类型了
修复:用户注册结构不正确的问题
修复:分钟不支持快速验证的问题
修复:HTTP管理端刷新客户端列表在线程中崩溃的问题
修复:打包客户端列表协议崩溃
修复:获取客户端列表时间不正确的问题
修复:超时通知不正确的问题
修复:验证客户端重读登录的问题
优化:TCP登录代码
删除:重复的打包和解析websocket协议代码
删除:没有使用的websocket任务代码
删除:无用的代码
删除:HTTP登录代码
added:close token msg send server
added:update session token time
added:auto flush user list
added:http management client login support
added:token function support
added:fast ver for http protocol
added:http parse and packet protocol for protocol module
modify:move tcp protocol process code to http user cpp
modify:Split serial and client management interface into separate files
modify:Protocol_Packet_SendPkt to Protocol_Packet_HDRComm function
modify:Parameters of the send message function
modify:move user protocol to user file from client file
modify:http task distinguishes between post and get
modify:error define
modify:http api required token
modify:only show online client now
modify:Disable repeated HTTP user logins
modify:must set enDeviceType when you login
fixed:user register struct is incorrent
fixed:minute not support fast ver
fixed:the problem that flush list client crashed in thread
fixed:packet client list is crashed
fixed:get client list time is incorrent
fixed:timeout notify send msg is failed
fixed:auth client is repeat login
improved:TCP login code
delete:redundant packet and parse websocket code for protocol module
delete:websocket task not use code
delete:useless code
delete:login for http
======================================================================================
XEngine_Authorize V3.0.0.1001PT
添加:帮助模块
......
......@@ -11,6 +11,9 @@ network verification support tcp and websocket protocol verification.it is means
first open source C/C++ network authentication server, supporting various languages ​​and platforms for network authentication and authorization
This is a cross-platform simple high-performance network authorization server that provides a complete demo code
#### Version difference
V3 version, the protocol is basically reimplemented. It is no longer compatible with the V2 protocol. V3 is basically changed to the HTTP interface for management. The compatibility is better. Please check the documentation for more.
## Software feature
A simple and high-performance cross-platform network authentication and authorization server developed and implemented based on XEngine
feature list:
......@@ -64,11 +67,9 @@ address:app.xyry.org or 159.75.200.173
port :tcp port 5300,websocket port 5301,Transmission verification password: no encryption
## Screenshot of the program
![输入图片说明](https://www.xyry.org/authorize/1.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/2.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/3.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/4.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/5.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/1.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/2.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/3.png "在这里输入图片标题")
## Participate in contribution
......
......@@ -11,6 +11,9 @@ c c++network Authorize service
全国首款开源C/C++ 网络验证服务器,支持各种语言各种平台进行网络验证和授时服务
这是一个跨平台简单高性能网络授权服务器,提供了完整的演示代码
#### 版本区别
V3版本后协议基本重新实现,不在兼容V2协议,V3基本改为HTTP接口进行管理.兼容性更好.请查看文档获取更多.
## 软件特性
基于XEngine开发并实现的一套简洁高性能跨平台网络验证授权服务器
软件特性:
......@@ -64,11 +67,9 @@ make FLAGS=CleanAll 清理编译
端口:tcp端口 5300,websocket端口 5301,传输验证密码:无加密
## 程序截图
![输入图片说明](https://www.xyry.org/authorize/1.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/2.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/3.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/4.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/authorize/5.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/1.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/2.png "在这里输入图片标题")
![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/3.png "在这里输入图片标题")
## 参与贡献
......@@ -88,8 +89,8 @@ make FLAGS=CleanAll 清理编译
如果你有问题,可以在issues中提交
## 开发计划
重新设计界面版本,服务使用跨平台,管理端使用接口
mfc转qt界面库(我们需要会Qt的人员加入一起开发)
支持多端登录
生成会话TOKEN分布式鉴权
支持OAuth验证
mysql支持
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31410.357
# Visual Studio Version 17
VisualStudioVersion = 17.3.32804.467
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPClient", "Authorize_APPClient\Authorize_APPClient.vcxproj", "{4F263EAF-A748-46AF-A10E-8A25626E0571}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPLocal", "Authorize_APPLocal\Authorize_APPLocal.vcxproj", "{82D0E5EB-42B7-4A68-9896-20146F13E91E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
......@@ -23,14 +21,6 @@ Global
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x64.Build.0 = Release|x64
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.ActiveCfg = Release|Win32
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.Build.0 = Release|Win32
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x64.ActiveCfg = Debug|x64
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x64.Build.0 = Debug|x64
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x86.ActiveCfg = Debug|Win32
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Debug|x86.Build.0 = Debug|Win32
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x64.ActiveCfg = Release|x64
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x64.Build.0 = Release|x64
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x86.ActiveCfg = Release|Win32
{82D0E5EB-42B7-4A68-9896-20146F13E91E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -72,8 +72,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(XEngine_Include);$(IncludePath)</IncludePath>
<LibraryPath>$(XEngine_Library);$(LibraryPath)</LibraryPath>
<IncludePath>$(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
......
#ifdef _WINDOWS
#include <Windows.h>
#include <tchar.h>
#pragma comment(lib,"x86/XEngine_Core/XEngine_OPenSsl")
#pragma comment(lib,"x86/XEngine_SystemSdk/XEngine_SystemApi")
#pragma comment(lib,"x86/XEngine_HelpComponents/HelpComponents_Authorize")
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <XEngine_Include/XEngine_CommHdr.h>
#include <XEngine_Include/XEngine_ProtocolHdr.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
#include <XEngine_Include/XEngine_Core/OPenSsl_Define.h>
#include <XEngine_Include/XEngine_Core/OPenSsl_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_HelpComponents/Authorize_Define.h>
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Error.h>
#include "../../XEngine_Source/XAuth_Protocol.h"
#ifdef _WINDOWS
LPCTSTR lpszFile = _T("D:\\XEngine_Authorize\\XEngine_Apps\\Debug\\XEngine_Authorize.key");
#else
LPCTSTR lpszFile = _T("XEngine_Authorize.key");
#endif
//#define _ENCRYPTO
int main()
{
//////////////////////////////////////////////////////////////////////////生成CDKEY
__int64x nLeftTime = 0;
UCHAR tszEnBuffer[2048];
TCHAR tszDeBuffer[2048];
XENGINE_AUTHORIZE_LOCAL st_AuthLocal;
SYSTEMAPI_SERIAL_INFOMATION st_SDKSerial;
memset(tszDeBuffer, '\0', sizeof(tszDeBuffer));
memset(tszEnBuffer, '\0', sizeof(tszEnBuffer));
memset(&st_AuthLocal, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
memset(&st_SDKSerial, '\0', sizeof(SYSTEMAPI_SERIAL_INFOMATION));
strcpy(st_AuthLocal.tszAddr, _T("127.0.0.1"));
st_AuthLocal.nPort = 5000;
strcpy(st_AuthLocal.st_AuthAppInfo.tszAppName, "XEngine");
strcpy(st_AuthLocal.st_AuthAppInfo.tszAppVer, "7.29.0.1001");
st_AuthLocal.st_AuthRegInfo.enSerialType = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME;
st_AuthLocal.st_AuthRegInfo.enRegType = ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE_TRY;
st_AuthLocal.st_AuthRegInfo.enHWType = ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE_CPU;
SystemApi_HardWare_GetSerial(&st_SDKSerial);
strcpy(st_AuthLocal.st_AuthRegInfo.tszHardware, st_SDKSerial.tszCpuSerial);
strcpy(st_AuthLocal.st_AuthUserInfo.tszUserName, "XEngine");
strcpy(st_AuthLocal.st_AuthUserInfo.tszUserContact, "486179@qq.com");
//生成完毕后可以交给服务端来对key本地验证进行授权
if (!Authorize_Local_WriteKey(lpszFile, &st_AuthLocal))
{
return -1;
}
//需要加密?
#ifdef _ENCRYPTO
FILE* pSt_File = fopen(lpszFile, "rb");
int nRet = fread(tszDeBuffer, 1, sizeof(tszDeBuffer), pSt_File);
fclose(pSt_File);
if (!OPenSsl_Api_CryptEncodec(tszDeBuffer, tszEnBuffer, &nRet, "123123", XENGINE_OPENSSL_API_CRYPT_3DES))
{
return -1;
}
pSt_File = fopen(lpszFile, "wb");
fwrite(tszEnBuffer, 1, nRet, pSt_File);
fclose(pSt_File);
#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>{82d0e5eb-42b7-4a68-9896-20146f13e91e}</ProjectGuid>
<RootNamespace>AuthorizeAPPLocal</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'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(XEngine_Include);$(IncludePath)</IncludePath>
<LibraryPath>$(XEngine_Library);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WINDOWS;_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="Authorize_APPLocal.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="Authorize_APPLocal.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
......@@ -3,7 +3,7 @@
"nWSPort":5301,
"nHTTPPort":5302,
"bDeamon":false,
"nTimeNotify":true,
"bTimeNotify":true,
"XMax":{
"nMaxClient":10000,
"nMaxQueue":10000,
......@@ -14,6 +14,7 @@
},
"XVerification":{
"nUserTimeout":30,
"nTokenTimeout":3600,
"nVerTime":5,
"nVerMode":1,
"nTryTime":5,
......@@ -33,6 +34,7 @@
"LogLeave":32
},
"XVer":[
"V3.1.0.1001 Build20220826",
"V3.0.0.1001 Build20220816",
"V2.8.0.1001 Build20220809",
"V2.7.2.1001 Build20220715",
......
......@@ -32,6 +32,7 @@ typedef struct
struct
{
int nUserTimeout; //用户登录超时时间
int nTokenTimeout; //TOKEN登录超时时间
int nVerTime; //验证时间
int nVerMode; //验证模式
int nTryTime; //验证时间
......
......@@ -101,7 +101,7 @@ BOOL CModuleConfigure_Json::ModuleConfigure_Json_File(LPCTSTR lpszConfigFile, XE
pSt_ServerConfig->st_XMax.nWSThread = st_JsonXMax["nWSThread"].asInt();
pSt_ServerConfig->st_XMax.nHTTPThread = st_JsonXMax["nHTTPThread"].asInt();
//验证配置
if (st_JsonRoot["XVerification"].empty() || (5 != st_JsonRoot["XVerification"].size()))
if (st_JsonRoot["XVerification"].empty() || (6 != st_JsonRoot["XVerification"].size()))
{
Config_IsErrorOccur = TRUE;
Config_dwErrorCode = ERROR_AUTHORIZE_MODULE_CONFIGURE_XVER;
......@@ -109,6 +109,7 @@ BOOL CModuleConfigure_Json::ModuleConfigure_Json_File(LPCTSTR lpszConfigFile, XE
}
Json::Value st_JsonXVerification = st_JsonRoot["XVerification"];
pSt_ServerConfig->st_XVerification.nUserTimeout = st_JsonXVerification["nUserTimeout"].asInt();
pSt_ServerConfig->st_XVerification.nTokenTimeout = st_JsonXVerification["nTokenTimeout"].asInt();
pSt_ServerConfig->st_XVerification.nVerTime = st_JsonXVerification["nVerTime"].asInt();
pSt_ServerConfig->st_XVerification.nVerMode = st_JsonXVerification["nVerMode"].asInt();
pSt_ServerConfig->st_XVerification.nTryTime = st_JsonXVerification["nTryTime"].asInt();
......
......@@ -14,32 +14,23 @@
// 导出的错误表
//////////////////////////////////////////////////////////////////////////
/************************************************************************/
/* 数据库错误 */
/* 数据库错误 */
/************************************************************************/
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE 0x30D1001 //创建表失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_EXIST 0x30D1010 //用户已经存在
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_INSERT 0x30D1011 //插入内容失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_NOTUSER 0x30D1020 //用户不存在
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE 0x30D1021 //获取表失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_SERIAL 0x30DAA22 //不存在的序列号
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_DELETE_EXEC 0x30D1030 //删除执行失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_ISFAILED 0x30D1040 //序列号插入失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_EXIST 0x30D1041 //序列卡已经存在
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALDEL_ISFAILED 0x30D1042 //序列号删除失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_PARAMENT 0x30D1050 //充值失败,参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_NOTSUPPORT 0x30D1051 //不支持的充值卡
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_UPDATAUSEDNAME 0x30D1052 //更新序列卡使用者失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_ISUSED 0x30D1053 //充值卡已经被使用
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_NOTMATCH 0x30D1060 //充值方式不匹配
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATATYPE 0x30D1061 //更新用户充值卡类型失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_GETTIME 0x30D1062 //获取时间结构失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATA 0x30D1063 //更新数据库失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UPDATA 0x30D10A0 //离开处理失败,更新数据库失败
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UNKNOWTYPE 0x30D10A1 //无法识别的卡的类型,无法正确处理离开消息
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_GETTABLE 0x30D10B0 //获取表失败,内部数据库错误
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_NONE 0x30D10B1 //获取失败,没有任何记录
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_PARAMENT 0x30D10C0 //试用插入失败,参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_EXIST 0x30D10C1 //此序列号存在,无法继续
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_PARAMENT 0x30D10D0 //查询试用序列号失败,参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_NONE 0x30D10D1 //查询的内容为空
#define ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYDELETE_PARAMENT 0x30D10E0 //删除失败,参数错误
#define ERROR_AUTHORIZE_MODULE_DATABASE_CREATETABLE 0x0030001 //创建表失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_EXIST 0x0030002 //用户已经存在
#define ERROR_AUTHORIZE_MODULE_DATABASE_INSERT 0x0030003 //插入内容失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_NOTUSER 0x0030004 //用户不存在
#define ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE 0x0030005 //获取表失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_SERIAL 0x0030006 //不存在的序列号
#define ERROR_AUTHORIZE_MODULE_DATABASE_EXEC 0x0030007 //删除执行失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED 0x0030008 //序列号插入失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT 0x0030009 //充值失败,参数错误
#define ERROR_AUTHORIZE_MODULE_DATABASE_NOTSUPPORT 0x0030010 //不支持的充值卡
#define ERROR_AUTHORIZE_MODULE_DATABASE_UPDATAUSEDNAME 0x0030011 //更新序列卡使用者失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_ISUSED 0x0030012 //充值卡已经被使用
#define ERROR_AUTHORIZE_MODULE_DATABASE_NOTMATCH 0x0030013 //充值方式不匹配
#define ERROR_AUTHORIZE_MODULE_DATABASE_UPDATATYPE 0x0030014 //更新用户充值卡类型失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_GETTIME 0x0030015 //获取时间结构失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_UPDATA 0x0030016 //更新数据库失败
#define ERROR_AUTHORIZE_MODULE_DATABASE_UNKNOWTYPE 0x0030017 //无法识别的卡的类型,无法正确处理离开消息
#define ERROR_AUTHORIZE_MODULE_DATABASE_NONE 0x0030018 //获取失败,没有任何记录
\ No newline at end of file
......@@ -74,19 +74,19 @@ BOOL CDatabase_SQLite::Database_SQLite_Init(LPCTSTR lpszSQLFile, BOOL bIsChange
if (!DataBase_SQLite_Exec(xhData,_T("CREATE TABLE AuthReg_User(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,UserName TEXT,Password TEXT,LeftTime TEXT,EmailAddr TEXT,HardCode TEXT,CardSerialType integer,PhoneNumber integer,IDCard integer,nUserLevel integer,CreateTime TEXT NOT NULL)")))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_CREATETABLE;
return FALSE;
}
if (!DataBase_SQLite_Exec(xhData,_T("CREATE TABLE AuthReg_Serial(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,UserName TEXT,SerialNumber TEXT,MaxTime TEXT,CardSerialType integer,bIsUsed boolean,CreateTime TEXT NOT NULL)")))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_CREATETABLE;
return FALSE;
}
if (!DataBase_SQLite_Exec(xhData, _T("CREATE TABLE AuthReg_NetVer(ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,VerSerial TEXT NOT NULL,VerMode integer NOT NULL,TryTime integer NOT NULL,CreateTime TEXT NOT NULL)")))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_INIT_CREATETABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_CREATETABLE;
return FALSE;
}
}
......@@ -135,7 +135,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserDelete(LPCTSTR lpszUserName)
if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_DELETE_EXEC;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXEC;
return FALSE;
}
return TRUE;
......@@ -162,14 +162,14 @@ BOOL CDatabase_SQLite::Database_SQLite_UserRegister(AUTHREG_USERTABLE* pSt_UserI
if (Database_SQLite_UserQuery(pSt_UserInfo->st_UserInfo.tszUserName))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_EXIST;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST;
return FALSE;
}
_stprintf_s(tszSQLStatement, _T("INSERT INTO AuthReg_User(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, nUserLevel, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,5,datetime('now', 'localtime'))"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->enSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber);
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_REGISERT_INSERT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_INSERT;
return FALSE;
}
return TRUE;
......@@ -205,13 +205,13 @@ BOOL CDatabase_SQLite::Database_SQLite_UserQuery(LPCTSTR lpszUserName, AUTHREG_U
if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE;
return FALSE;
}
if ((0 == nRow) || (0 == nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_NOTUSER;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTUSER;
return FALSE;
}
//如果是NULL,表示不想知道结果
......@@ -288,7 +288,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz
if ((NULL == lpszUserName) || (NULL == lpszSerialName))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_PARAMENT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT;
return FALSE;
}
//查询充值卡是否存在
......@@ -300,7 +300,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz
if (st_SerialTable.bIsUsed)
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_ISUSED;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISUSED;
return FALSE;
}
//查询用户信息
......@@ -337,14 +337,14 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz
break;
default:
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_NOTSUPPORT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTSUPPORT;
return FALSE;
}
_stprintf_s(tszSQLStatement, _T("UPDATE AuthReg_Serial SET UserName = '%s',bIsUsed = '1' WHERE SerialNumber = '%s'"), lpszUserName, lpszSerialName);
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAY_UPDATAUSEDNAME;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_UPDATAUSEDNAME;
return FALSE;
}
return TRUE;
......@@ -394,14 +394,14 @@ BOOL CDatabase_SQLite::Database_SQLite_UserLeave(AUTHREG_PROTOCOL_TIME* pSt_Time
else
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UNKNOWTYPE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_UNKNOWTYPE;
return FALSE;
}
//更新用户剩余时间
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_LEAVE_UPDATA;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_UPDATA;
return FALSE;
}
return TRUE;
......@@ -468,13 +468,13 @@ BOOL CDatabase_SQLite::Database_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserI
if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE;
return FALSE;
}
if ((0 == nRow) || (0 == nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_NOTUSER;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTUSER;
return FALSE;
}
*pInt_ListCount = nRow;
......@@ -541,7 +541,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialInsert(LPCTSTR lpszSerialNumber)
if (Database_SQLite_SerialQuery(lpszSerialNumber))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_EXIST;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST;
return FALSE;
}
ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enAuthSerialType;
......@@ -579,7 +579,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialInsert(LPCTSTR lpszSerialNumber)
if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALINSERT_ISFAILED;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED;
return FALSE;
}
return TRUE;
......@@ -608,7 +608,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialDelete(LPCTSTR lpszSerialNumber)
if (!DataBase_SQLite_Exec(xhData,tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_SERIALDEL_ISFAILED;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED;
return FALSE;
}
return TRUE;
......@@ -644,13 +644,13 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQuery(LPCTSTR lpszSerialNumber,LPAU
if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_GETTABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE;
return FALSE;
}
if ((0 == nRow) || (0 == nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERY_SERIAL;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_SERIAL;
return FALSE;
}
if (NULL != pSt_SerialTable)
......@@ -714,13 +714,13 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQueryAll(AUTHREG_SERIALTABLE ***ppp
if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_GETTABLE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE;
return FALSE;
}
if ((0 == nRow) || (0 == nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_QUERYALL_NONE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NONE;
return FALSE;
}
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_SerialTable, nRow, sizeof(AUTHREG_SERIALTABLE));
......@@ -773,7 +773,7 @@ BOOL CDatabase_SQLite::Database_SQLite_TryInsert(AUTHREG_NETVER* pSt_AuthVer)
if (NULL == pSt_AuthVer)
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_PARAMENT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT;
return FALSE;
}
TCHAR tszSQLStatement[1024];
......@@ -787,7 +787,7 @@ BOOL CDatabase_SQLite::Database_SQLite_TryInsert(AUTHREG_NETVER* pSt_AuthVer)
if (Database_SQLite_TryQuery(&st_AuthVer))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYINSERT_EXIST;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST;
return FALSE;
}
//插入数据库
......@@ -820,7 +820,7 @@ BOOL CDatabase_SQLite::Database_SQLite_TryQuery(AUTHREG_NETVER* pSt_AuthVer)
if (NULL == pSt_AuthVer)
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_PARAMENT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT;
return FALSE;
}
int nRow = 0;
......@@ -840,7 +840,7 @@ BOOL CDatabase_SQLite::Database_SQLite_TryQuery(AUTHREG_NETVER* pSt_AuthVer)
if ((0 == nRow) || (0 == nColumn))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYQUERY_NONE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NONE;
return FALSE;
}
//ID
......@@ -879,7 +879,7 @@ BOOL CDatabase_SQLite::Database_SQLite_TryDelete(LPCTSTR lpszSerial)
if (NULL == lpszSerial)
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_TRYDELETE_PARAMENT;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT;
return FALSE;
}
TCHAR tszSQLStatement[1024];
......@@ -1079,7 +1079,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPayTime(LPCTSTR lpszUserName, LPCTSTR
if (!m_bChange)
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_NOTMATCH;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTMATCH;
return FALSE;
}
}
......@@ -1090,7 +1090,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPayTime(LPCTSTR lpszUserName, LPCTSTR
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATATYPE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_UPDATATYPE;
return FALSE;
}
//处理卡类型
......@@ -1173,7 +1173,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPayTime(LPCTSTR lpszUserName, LPCTSTR
if (6 != _stscanf_s(lpszUserTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_AuthTimer.wYear, &st_AuthTimer.wMonth, &st_AuthTimer.wDay, &st_AuthTimer.wHour, &st_AuthTimer.wMinute, &st_AuthTimer.wSecond))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_GETTIME;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTIME;
return FALSE;
}
st_EndTimer.wDay += _ttoi(lpszCardTime);
......@@ -1220,7 +1220,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPayTime(LPCTSTR lpszUserName, LPCTSTR
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
{
SQLPacket_IsErrorOccur = TRUE;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SQLPACKET_PAYTIME_UPDATA;
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_UPDATA;
return FALSE;
}
return TRUE;
......
......@@ -50,20 +50,20 @@ BOOL CAuthHelp_ClipBoard::AuthHelp_ClipBoard_Set(LPCTSTR lpszMsgBuffer, int nMsg
if (NULL == lpszMsgBuffer)
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_SET_PARRAMENT;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_PARRAMENT;
return FALSE;
}
//判断先我们可否打开剪贴板,如果可以
if (!OpenClipboard(NULL))
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_SET_OPEN;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_OPEN;
return FALSE;
}
if (!EmptyClipboard())
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_SET_OWNER;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_OWNER;
return FALSE;
}
HANDLE hGlobal = INVALID_HANDLE_VALUE;
......@@ -72,7 +72,7 @@ BOOL CAuthHelp_ClipBoard::AuthHelp_ClipBoard_Set(LPCTSTR lpszMsgBuffer, int nMsg
if (NULL == hGlobal)
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_SET_MALLOC;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_MALLOC;
return FALSE;
}
TCHAR* ptszBuffer = (TCHAR*)GlobalLock(hGlobal); //锁定一个全局内存对象 并且返回一个指向其第一个内存地址的指针 返回类型为 LPVOID
......@@ -116,13 +116,13 @@ BOOL CAuthHelp_ClipBoard::AuthHelp_ClipBoard_Get(TCHAR* ptszMsgBuffer, int* pInt
if (NULL == ptszMsgBuffer)
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_GET_PARAMENT;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_PARRAMENT;
return FALSE;
}
if (!OpenClipboard(NULL))
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_GET_OPEN;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_OPEN;
return FALSE;
}
......@@ -130,7 +130,7 @@ BOOL CAuthHelp_ClipBoard::AuthHelp_ClipBoard_Get(TCHAR* ptszMsgBuffer, int* pInt
if (NULL == (hCliBd = GetClipboardData(dwFormat)))
{
Help_IsErrorOccur = TRUE;
Help_dwErrorCode = ERROR_AUTH_HELP_CLIPBOARD_GET_GETDATA;
Help_dwErrorCode = ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_GETDATA;
return FALSE;
}
......
......@@ -16,10 +16,8 @@
/************************************************************************/
/* 剪贴板 */
/************************************************************************/
#define ERROR_AUTH_HELP_CLIPBOARD_SET_PARRAMENT 0x00E0001 //设置失败,参数错误
#define ERROR_AUTH_HELP_CLIPBOARD_SET_OPEN 0x00E0002 //打开剪贴板失败
#define ERROR_AUTH_HELP_CLIPBOARD_SET_OWNER 0x00E0003 //设置所有者失败
#define ERROR_AUTH_HELP_CLIPBOARD_SET_MALLOC 0x00E0004 //申请内存失败
#define ERROR_AUTH_HELP_CLIPBOARD_GET_PARAMENT 0x00E0010 //获取失败,参数错误
#define ERROR_AUTH_HELP_CLIPBOARD_GET_OPEN 0x00E0011 //打开剪贴板失败
#define ERROR_AUTH_HELP_CLIPBOARD_GET_GETDATA 0x00E0012 //获取内容失败
\ No newline at end of file
#define ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_PARRAMENT 0x0050001 //设置失败,参数错误
#define ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_OPEN 0x0050002 //打开剪贴板失败
#define ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_OWNER 0x0050003 //设置所有者失败
#define ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_MALLOC 0x0050004 //申请内存失败
#define ERROR_AUTHORIZE_MODULE_HELP_CLIPBOARD_GETDATA 0x0050005 //获取内容失败
\ No newline at end of file
......@@ -3,23 +3,22 @@ LIBRARY
EXPORTS
Protocol_GetLastError
Protocol_Packet_SendPkt
Protocol_Packet_WSPkt
Protocol_Packet_WSPktAuth
Protocol_Packet_WSPktInfo
Protocol_Packet_WSPktTime
Protocol_Packet_WSPktNote
Protocol_Packet_HDRComm
Protocol_Packet_HttpComm
Protocol_Packet_HttpUserPass
Protocol_Packet_HttpUserTime
Protocol_Packet_HttpClientInfo
Protocol_Packet_HttpClientList
Protocol_Packet_HttpSerialList
Protocol_Packet_HttpToken
Protocol_Parse_WSHdr
Protocol_Parse_WSUserInfo
Protocol_Parse_WSUserAuth
Protocol_Parse_WSUserPay
Protocol_Parse_WSUserNote
Protocol_Parse_HttpParseToken
Protocol_Parse_HttpParseAuth
Protocol_Parse_HttpParseUser
Protocol_Parse_HttpParsePay
Protocol_Parse_HttpParseTry
Protocol_Parse_HttpParseTable
Protocol_Parse_HttpParseSerial
Protocol_Parse_HttpParseSerial2
\ No newline at end of file
Protocol_Parse_HttpParseSerial2
Protocol_Parse_HttpParseOnline
\ No newline at end of file
......@@ -18,42 +18,8 @@ extern "C" DWORD Protocol_GetLastError(int *pInt_SysError = NULL);
/* 打包类协议 */
/************************************************************************/
/********************************************************************
函数名称:Protocol_Packet_SendPkt
函数功能:发送打包函数
参数.一:ptszMsgBuffer
In/Out:In
类型:字符指针
可空:N
意思:输出要打包的缓冲区
参数.二:pInt_MsgLen
In/Out:In
类型:整数型指针
可空:N
意思:输出打包大小
参数.三:pSt_ProtocolHdr
In/Out:In
类型:数据结构指针
可空:N
意思:输入协议头
参数.四:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:Y
意思:输入要发送的数据
参数.五:nMsgLen
In/Out:In
类型:整数型
可空:Y
意思:发送数据大小
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
/********************************************************************
函数名称:Protocol_Packet_WSPkt
函数功能:WEBSOCKET通过打包函数
函数名称:Protocol_Packet_HDRComm
函数功能:通用头打包函数
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
......@@ -69,102 +35,73 @@ extern "C" BOOL Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen,
类型:数据结构指针
可空:N
意思:输入要打包的数据
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_WSPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
/********************************************************************
函数名称:Protocol_Packet_WSPktAuth
函数功能:WEBSOCKET验证打包协议
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:输出打好包的数据
参数.二:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:输出数据大小
参数.三:pSt_ProtocolHdr
In/Out:In
类型:数据结构指针
可空:N
意思:输入要打包的数据
参数.四:pSt_UserAuth
参数.四:enDeviceType
In/Out:In
类型:数据结构指针
类型:整数型
可空:N
意思:输入要打包的数据
意思:输入设备类型
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_WSPktAuth(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
extern "C" BOOL Protocol_Packet_HDRComm(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, int enDeviceType);
/********************************************************************
函数名称:Protocol_Packet_WSPktInfo
函数功能:WEBSOCKET用户信息打包协议
函数名称:Protocol_Packet_HttpComm
函数功能:HTTP通用消息打包
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:输出打好包的数据
意思:导出包装好的缓冲区
参数.二:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:输出数据大小
参数.三:pSt_ProtocolHdr
意思:输出包装大小
参数.三:nCode
In/Out:In
类型:数据结构指针
可空:N
意思:输入要打包的数据
参数.四:pSt_UserInfo
类型:整数型
可空:Y
意思:输入返回的code
参数.四:lpszMsgBuffer
In/Out:In
类型:数据结构指针
类型:常量字符指针
可空:N
意思:输入要打包的数据
意思:输入返回的消息
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_WSPktInfo(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
extern "C" BOOL Protocol_Packet_HttpComm(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCTSTR lpszMsgBuffer = NULL);
/********************************************************************
函数名称:Protocol_Packet_WSPktTime
函数功能:WEBSOCKET时间打包协议
函数名称:Protocol_Packet_HttpUserPass
函数功能:HTTP客户端验证数据打包函数
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:输出打好包的数据
意思:导出包装好的缓冲区
参数.二:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:输出数据大小
参数.三:pSt_ProtocolHdr
意思:输出包装大小
参数.三:pSt_UserAuth
In/Out:In
类型:数据结构指针
可空:N
意思:输入要打包的数据
参数.四:pSt_ProtocolTime
In/Out:In
类型:数据结构指针
可空:N
意思:输入要打包的附加数据
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_WSPktTime(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime);
extern "C" BOOL Protocol_Packet_HttpUserPass(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
/********************************************************************
函数名称:Protocol_Packet_WSPktNote
函数功能:WEBSOCKET公告打包协议
函数名称:Protocol_Packet_HttpUserTime
函数功能:用户时间打包函数
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
......@@ -175,56 +112,17 @@ extern "C" BOOL Protocol_Packet_WSPktTime(TCHAR* ptszMsgBuffer, int* pInt_MsgLen
类型:整数型指针
可空:N
意思:输出数据大小
参数.三:pSt_ProtocolHdr
参数.三:pSt_ProtocolTime
In/Out:In
类型:数据结构指针
可空:N
意思:输入要打包的数据
参数.四:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:输入要打包的附加数据
参数.五:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入公告信息大小
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_WSPktNote(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen);
/********************************************************************
函数名称:Protocol_Packet_HttpComm
函数功能:HTTP通用消息打包
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:导出包装好的缓冲区
参数.二:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:输出包装大小
参数.三:nCode
In/Out:In
类型:整数型
可空:Y
意思:输入返回的code
参数.四:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:输入返回的消息
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_HttpComm(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCTSTR lpszMsgBuffer = NULL);
extern "C" BOOL Protocol_Packet_HttpUserTime(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime);
/********************************************************************
函数名称:Protocol_Packet_HttpClientInfo
函数功能:HTTP客户端包装函数
......@@ -287,7 +185,7 @@ extern "C" BOOL Protocol_Packet_HttpClientInfo(TCHAR* ptszMsgBuffer, int* pInt_M
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_HttpClientList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE*** pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE*** pppSt_OffClient, int nOffCount);
extern "C" BOOL Protocol_Packet_HttpClientList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHSESSION_NETCLIENT *** pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE*** pppSt_OffClient, int nOffCount);
/********************************************************************
函数名称:Protocol_Packet_HttpSerialList
函数功能:HTTP序列号打包函数
......@@ -317,6 +215,35 @@ extern "C" BOOL Protocol_Packet_HttpClientList(TCHAR* ptszMsgBuffer, int* pInt_M
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_HttpSerialList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_SERIALTABLE*** pppSt_SerialList, int nListCount);
/********************************************************************
函数名称:Protocol_Packet_HttpToken
函数功能:TOKEN创建打包函数
参数.一:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:导出包装好的缓冲区
参数.二:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:输出包装大小
参数.三:xhToken
In/Out:In
类型:三级指针
可空:N
意思:输入创建的TOKEN
参数.四:nTimeout
In/Out:In
类型:整数型
可空:N
意思:输入超时时间
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Packet_HttpToken(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XNETHANDLE xhToken, int nTimeout);
/************************************************************************/
/* 解析类协议 */
/************************************************************************/
......@@ -345,8 +272,8 @@ extern "C" BOOL Protocol_Packet_HttpSerialList(TCHAR* ptszMsgBuffer, int* pInt_M
*********************************************************************/
extern "C" BOOL Protocol_Parse_WSHdr(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
/********************************************************************
函数名称:Protocol_Parse_WSUserInfo
函数功能:获取信息结构相关协议内容
函数名称:Protocol_Parse_HttpParseToken
函数功能:解析TOKEN
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -357,25 +284,20 @@ extern "C" BOOL Protocol_Parse_WSHdr(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pSt_ProtocolHdr
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议头
参数.四:pSt_UserInfo
参数.三:pxhToken
In/Out:Out
类型:数据结构指针
类型:句柄
可空:N
意思:输出解析好的协议内容
意思:输出解析到的TOKEN值
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_WSUserInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
extern "C" BOOL Protocol_Parse_HttpParseToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE* pxhToken);
/********************************************************************
函数名称:Protocol_Parse_WSUserAuth
函数功能:获取验证协议相关内容
函数名称:Protocol_Parse_HttpParseAuth
函数功能:用户验证解析协议
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -386,25 +308,20 @@ extern "C" BOOL Protocol_Parse_WSUserInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XE
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pSt_ProtocolHdr
参数.三:pSt_UserAuth
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议头
参数.四:pSt_UserAuth
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议内容
意思:输出解析的数据
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_WSUserAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
extern "C" BOOL Protocol_Parse_HttpParseAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth);
/********************************************************************
函数名称:Protocol_Parse_WSUserPay
函数功能:获取用户支持相关协议内容
函数名称:Protocol_Parse_HttpParseUser
函数功能:解析用户信息
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -415,25 +332,20 @@ extern "C" BOOL Protocol_Parse_WSUserAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XE
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pSt_ProtocolHdr
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议头
参数.四:pSt_UserAuth
参数.三:pSt_UserInfo
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议内容
意思:输出解析的数据
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_WSUserPay(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, AUTHREG_PROTOCOL_USERPAY* pSt_UserPay);
extern "C" BOOL Protocol_Parse_HttpParseUser(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
/********************************************************************
函数名称:Protocol_Parse_WSUserNote
函数功能:解析用户通告和快速验证协议
函数名称:Protocol_Parse_HttpParsePay
函数功能:解析用户表信息
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -444,30 +356,20 @@ extern "C" BOOL Protocol_Parse_WSUserPay(LPCTSTR lpszMsgBuffer, int nMsgLen, XEN
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pSt_ProtocolHdr
参数.三:pSt_UserPay
In/Out:Out
类型:数据结构指针
可空:N
意思:输出解析好的协议头
参数.四:ptszMsgBuffer
In/Out:Out
类型:字符指针
可空:N
意思:输出解析好的协议内容
参数.五:pInt_MsgLen
In/Out:Out
类型:整数型指针
可空:N
意思:内容大小
意思:输出解析的数据
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_WSUserNote(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
extern "C" BOOL Protocol_Parse_HttpParsePay(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_PROTOCOL_USERPAY* pSt_UserPay);
/********************************************************************
函数名称:Protocol_Parse_HttpParseUser
函数功能:解析用户信息
函数名称:Protocol_Parse_HttpParseTry
函数功能:解析用户信息
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
......@@ -478,7 +380,7 @@ extern "C" BOOL Protocol_Parse_WSUserNote(LPCTSTR lpszMsgBuffer, int nMsgLen, XE
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pSt_UserInfo
参数.三:pSt_UserPay
In/Out:Out
类型:数据结构指针
可空:N
......@@ -488,7 +390,7 @@ extern "C" BOOL Protocol_Parse_WSUserNote(LPCTSTR lpszMsgBuffer, int nMsgLen, XE
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_HttpParseUser(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
extern "C" BOOL Protocol_Parse_HttpParseTry(LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR* ptszSerial);
/********************************************************************
函数名称:Protocol_Parse_HttpParseUser
函数功能:解析用户表信息
......@@ -580,4 +482,28 @@ extern "C" BOOL Protocol_Parse_HttpParseSerial(LPCTSTR lpszMsgBuffer, int nMsgLe
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_HttpParseSerial2(LPCTSTR lpszMsgBuffer, int nMsgLen, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE * penSerialType, int* pInt_NumberCount, int* pInt_SerialCount, TCHAR * ptszHasTime);
\ No newline at end of file
extern "C" BOOL Protocol_Parse_HttpParseSerial2(LPCTSTR lpszMsgBuffer, int nMsgLen, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE * penSerialType, int* pInt_NumberCount, int* pInt_SerialCount, TCHAR * ptszHasTime);
/********************************************************************
函数名称:Protocol_Parse_HttpParseOnline
函数功能:解析在线列表
参数.一:lpszMsgBuffer
In/Out:In
类型:常量字符指针
可空:N
意思:输入要解析的缓冲区
参数.二:nMsgLen
In/Out:In
类型:整数型
可空:N
意思:输入要解析的大小
参数.三:pbOnline
In/Out:Out
类型:逻辑型
可空:N
意思:导出是否只解析在线列表
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Protocol_Parse_HttpParseOnline(LPCTSTR lpszMsgBuffer, int nMsgLen, BOOL* pbOnline);
\ No newline at end of file
......@@ -10,5 +10,5 @@
// Purpose: 导出错误
// History:
*********************************************************************/
#define XENGINE_AUTHORIZE_PROTOCOL_PARAMENT 0x0010001
#define XENGINE_AUTHORIZE_PROTOCOL_PARSE 0x0010002
\ No newline at end of file
#define ERROR_AUTHORIZE_MODULE_PROTOCOL_PARAMENT 0x0040001
#define ERROR_AUTHORIZE_MODULE_PROTOCOL_PARSE 0x0040002
\ No newline at end of file
......@@ -17,17 +17,15 @@ public:
CProtocol_Packet();
~CProtocol_Packet();
public:
BOOL Protocol_Packet_SendPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
BOOL Protocol_Packet_WSPkt(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
BOOL Protocol_Packet_WSPktAuth(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
BOOL Protocol_Packet_WSPktInfo(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
BOOL Protocol_Packet_WSPktTime(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime);
BOOL Protocol_Packet_WSPktNote(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen);
BOOL Protocol_Packet_HDRComm(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, int enDeviceType);
public:
BOOL Protocol_Packet_HttpComm(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, int nCode = 0, LPCTSTR lpszMsgBuffer = NULL);
BOOL Protocol_Packet_HttpUserPass(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
BOOL Protocol_Packet_HttpUserTime(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_PROTOCOL_TIME* pSt_ProtocolTime);
BOOL Protocol_Packet_HttpClientInfo(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE* pSt_UserTable);
BOOL Protocol_Packet_HttpClientList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE*** pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE*** pppSt_OffClient, int nOffCount);
BOOL Protocol_Packet_HttpClientList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHSESSION_NETCLIENT*** pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE*** pppSt_OffClient, int nOffCount);
BOOL Protocol_Packet_HttpSerialList(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_SERIALTABLE*** pppSt_SerialList, int nListCount);
BOOL Protocol_Packet_HttpToken(TCHAR* ptszMsgBuffer, int* pInt_MsgLen, XNETHANDLE xhToken, int nTimeout);
protected:
private:
};
\ No newline at end of file
......@@ -18,15 +18,16 @@ public:
~CProtocol_Parse();
public:
BOOL Protocol_Parse_WSHdr(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr);
BOOL Protocol_Parse_WSUserInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
BOOL Protocol_Parse_WSUserAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
BOOL Protocol_Parse_WSUserPay(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, AUTHREG_PROTOCOL_USERPAY* pSt_UserPay);
BOOL Protocol_Parse_WSUserNote(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, TCHAR* ptszMsgBuffer, int* pInt_MsgLen);
public:
BOOL Protocol_Parse_HttpParseToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE* pxhToken);
BOOL Protocol_Parse_HttpParseAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH* pSt_UserAuth);
BOOL Protocol_Parse_HttpParseUser(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO* pSt_UserInfo);
BOOL Protocol_Parse_HttpParsePay(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_PROTOCOL_USERPAY* pSt_UserPay);
BOOL Protocol_Parse_HttpParseTry(LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR* ptszSerial);
BOOL Protocol_Parse_HttpParseTable(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_USERTABLE* pSt_UserTable);
BOOL Protocol_Parse_HttpParseSerial(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_SERIALTABLE*** pppSt_SerialTable, int* pInt_ListCount);
BOOL Protocol_Parse_HttpParseSerial2(LPCTSTR lpszMsgBuffer, int nMsgLen, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE* penSerialType, int* pInt_NumberCount, int* pInt_SerialCount, TCHAR* ptszHasTime);
BOOL Protocol_Parse_HttpParseOnline(LPCTSTR lpszMsgBuffer, int nMsgLen, BOOL* pbOnline);
protected:
private:
};
\ No newline at end of file
......@@ -31,39 +31,27 @@ extern "C" DWORD Protocol_GetLastError(int* pInt_SysError)
/************************************************************************/
/* 打包类协议 */
/************************************************************************/
extern "C" BOOL Protocol_Packet_SendPkt(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen)
extern "C" BOOL Protocol_Packet_HDRComm(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, int enDeviceType)
{
return m_ProtocolPacket.Protocol_Packet_SendPkt(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
return m_ProtocolPacket.Protocol_Packet_HDRComm(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, enDeviceType);
}
extern "C" BOOL Protocol_Packet_WSPkt(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr)
{
return m_ProtocolPacket.Protocol_Packet_WSPkt(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr);
}
extern "C" BOOL Protocol_Packet_WSPktAuth(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
{
return m_ProtocolPacket.Protocol_Packet_WSPktAuth(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, pSt_UserAuth);
}
extern "C" BOOL Protocol_Packet_WSPktInfo(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO * pSt_UserInfo)
{
return m_ProtocolPacket.Protocol_Packet_WSPktInfo(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, pSt_UserInfo);
}
extern "C" BOOL Protocol_Packet_WSPktTime(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, AUTHREG_PROTOCOL_TIME * pSt_ProtocolTime)
extern "C" BOOL Protocol_Packet_HttpComm(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, int nCode, LPCTSTR lpszMsgBuffer)
{
return m_ProtocolPacket.Protocol_Packet_WSPktTime(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, pSt_ProtocolTime);
return m_ProtocolPacket.Protocol_Packet_HttpComm(ptszMsgBuffer, pInt_MsgLen, nCode, lpszMsgBuffer);
}
extern "C" BOOL Protocol_Packet_WSPktNote(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, LPCTSTR lpszMsgBuffer, int nMsgLen)
extern "C" BOOL Protocol_Packet_HttpUserPass(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
{
return m_ProtocolPacket.Protocol_Packet_WSPktNote(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolHdr, lpszMsgBuffer, nMsgLen);
return m_ProtocolPacket.Protocol_Packet_HttpUserPass(ptszMsgBuffer, pInt_MsgLen, pSt_UserAuth);
}
extern "C" BOOL Protocol_Packet_HttpComm(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, int nCode, LPCTSTR lpszMsgBuffer)
extern "C" BOOL Protocol_Packet_HttpUserTime(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_PROTOCOL_TIME * pSt_ProtocolTime)
{
return m_ProtocolPacket.Protocol_Packet_HttpComm(ptszMsgBuffer, pInt_MsgLen, nCode, lpszMsgBuffer);
return m_ProtocolPacket.Protocol_Packet_HttpUserTime(ptszMsgBuffer, pInt_MsgLen, pSt_ProtocolTime);
}
extern "C" BOOL Protocol_Packet_HttpClientInfo(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE * pSt_UserTable)
{
return m_ProtocolPacket.Protocol_Packet_HttpClientInfo(ptszMsgBuffer, pInt_MsgLen, pSt_UserTable);
}
extern "C" BOOL Protocol_Packet_HttpClientList(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, AUTHREG_USERTABLE * **pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE * **pppSt_OffClient, int nOffCount)
extern "C" BOOL Protocol_Packet_HttpClientList(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, AUTHSESSION_NETCLIENT * **pppSt_OnClient, int nOnCount, AUTHREG_USERTABLE * **pppSt_OffClient, int nOffCount)
{
return m_ProtocolPacket.Protocol_Packet_HttpClientList(ptszMsgBuffer, pInt_MsgLen, pppSt_OnClient, nOnCount, pppSt_OffClient, nOffCount);
}
......@@ -71,6 +59,10 @@ extern "C" BOOL Protocol_Packet_HttpSerialList(TCHAR * ptszMsgBuffer, int* pInt_
{
return m_ProtocolPacket.Protocol_Packet_HttpSerialList(ptszMsgBuffer, pInt_MsgLen, pppSt_SerialList, nListCount);
}
extern "C" BOOL Protocol_Packet_HttpToken(TCHAR * ptszMsgBuffer, int* pInt_MsgLen, XNETHANDLE xhToken, int nTimeout)
{
return m_ProtocolPacket.Protocol_Packet_HttpToken(ptszMsgBuffer, pInt_MsgLen, xhToken, nTimeout);
}
/************************************************************************/
/* 解析类协议 */
/************************************************************************/
......@@ -78,25 +70,25 @@ extern "C" BOOL Protocol_Parse_WSHdr(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE
{
return m_ProtocolParse.Protocol_Parse_WSHdr(lpszMsgBuffer, nMsgLen, pSt_ProtocolHdr);
}
extern "C" BOOL Protocol_Parse_WSUserInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_PROTOCOL_USERINFO * pSt_UserInfo)
extern "C" BOOL Protocol_Parse_HttpParseToken(LPCTSTR lpszMsgBuffer, int nMsgLen, XNETHANDLE * pxhToken)
{
return m_ProtocolParse.Protocol_Parse_WSUserInfo(lpszMsgBuffer, nMsgLen, pSt_ProtocolHdr, pSt_UserInfo);
return m_ProtocolParse.Protocol_Parse_HttpParseToken(lpszMsgBuffer, nMsgLen, pxhToken);
}
extern "C" BOOL Protocol_Parse_WSUserAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
extern "C" BOOL Protocol_Parse_HttpParseAuth(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERAUTH * pSt_UserAuth)
{
return m_ProtocolParse.Protocol_Parse_WSUserAuth(lpszMsgBuffer, nMsgLen, pSt_ProtocolHdr, pSt_UserAuth);
return m_ProtocolParse.Protocol_Parse_HttpParseAuth(lpszMsgBuffer, nMsgLen, pSt_UserAuth);
}
extern "C" BOOL Protocol_Parse_WSUserPay(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, AUTHREG_PROTOCOL_USERPAY * pSt_UserPay)
extern "C" BOOL Protocol_Parse_HttpParseUser(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO * pSt_UserInfo)
{
return m_ProtocolParse.Protocol_Parse_WSUserPay(lpszMsgBuffer, nMsgLen, pSt_ProtocolHdr, pSt_UserPay);
return m_ProtocolParse.Protocol_Parse_HttpParseUser(lpszMsgBuffer, nMsgLen, pSt_UserInfo);
}
extern "C" BOOL Protocol_Parse_WSUserNote(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOLHDR * pSt_ProtocolHdr, TCHAR * ptszMsgBuffer, int* pInt_MsgLen)
extern "C" BOOL Protocol_Parse_HttpParsePay(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_PROTOCOL_USERPAY * pSt_UserPay)
{
return m_ProtocolParse.Protocol_Parse_WSUserNote(lpszMsgBuffer, nMsgLen, pSt_ProtocolHdr, ptszMsgBuffer, pInt_MsgLen);
return m_ProtocolParse.Protocol_Parse_HttpParsePay(lpszMsgBuffer, nMsgLen, pSt_UserPay);
}
extern "C" BOOL Protocol_Parse_HttpParseUser(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_PROTOCOL_USERINFO * pSt_UserInfo)
extern "C" BOOL Protocol_Parse_HttpParseTry(LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR * ptszSerial)
{
return m_ProtocolParse.Protocol_Parse_HttpParseUser(lpszMsgBuffer, nMsgLen, pSt_UserInfo);
return m_ProtocolParse.Protocol_Parse_HttpParseTry(lpszMsgBuffer, nMsgLen, ptszSerial);
}
extern "C" BOOL Protocol_Parse_HttpParseTable(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_USERTABLE * pSt_UserTable)
{
......@@ -109,4 +101,8 @@ extern "C" BOOL Protocol_Parse_HttpParseSerial(LPCTSTR lpszMsgBuffer, int nMsgLe
extern "C" BOOL Protocol_Parse_HttpParseSerial2(LPCTSTR lpszMsgBuffer, int nMsgLen, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE * penSerialType, int* pInt_NumberCount, int* pInt_SerialCount, TCHAR * ptszHasTime)
{
return m_ProtocolParse.Protocol_Parse_HttpParseSerial2(lpszMsgBuffer, nMsgLen, penSerialType, pInt_NumberCount, pInt_SerialCount, ptszHasTime);
}
extern "C" BOOL Protocol_Parse_HttpParseOnline(LPCTSTR lpszMsgBuffer, int nMsgLen, BOOL * pbOnline)
{
return m_ProtocolParse.Protocol_Parse_HttpParseOnline(lpszMsgBuffer, nMsgLen, pbOnline);
}
\ No newline at end of file
......@@ -25,6 +25,8 @@
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Define.h>
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Error.h>
#include "../XAuth_Protocol.h"
#include "../AuthorizeModule_Session/Session_Define.h"
#include "../AuthorizeModule_Session/Session_Error.h"
#include "Protocol_Define.h"
#include "Protocol_Error.h"
/********************************************************************
......
......@@ -11,4 +11,12 @@ EXPORTS
Session_Authorize_CloseClient
Session_Authorize_Destroy
Session_Authorize_Insert
Session_Authorize_SetUser
\ No newline at end of file
Session_Authorize_SetUser
Session_Token_Init
Session_Token_Destroy
Session_Token_Insert
Session_Token_Delete
Session_Token_UPDate
Session_Token_Get
Session_Token_GetUser
\ No newline at end of file
......@@ -164,6 +164,7 @@
<ClInclude Include="Session_Authorize\Session_Authorize.h" />
<ClInclude Include="Session_Define.h" />
<ClInclude Include="Session_Error.h" />
<ClInclude Include="Session_Token\Session_Token.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
......@@ -174,6 +175,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Session_Authorize\Session_Authorize.cpp" />
<ClCompile Include="Session_Token\Session_Token.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="AuthorizeModule_Session.def" />
......
......@@ -19,6 +19,12 @@
<Filter Include="源文件\Session_Authorize">
<UniqueIdentifier>{98019e80-6680-48fa-a755-702b5b3aab78}</UniqueIdentifier>
</Filter>
<Filter Include="头文件\Session_Token">
<UniqueIdentifier>{5ad6d359-09c2-4995-82f6-e5f2e32a14c1}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\Session_Token">
<UniqueIdentifier>{0b721944-f23e-4671-81dc-beb1970fe840}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
......@@ -36,6 +42,9 @@
<ClInclude Include="Session_Authorize\Session_Authorize.h">
<Filter>头文件\Session_Authorize</Filter>
</ClInclude>
<ClInclude Include="Session_Token\Session_Token.h">
<Filter>头文件\Session_Token</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
......@@ -47,6 +56,9 @@
<ClCompile Include="Session_Authorize\Session_Authorize.cpp">
<Filter>源文件\Session_Authorize</Filter>
</ClCompile>
<ClCompile Include="Session_Token\Session_Token.cpp">
<Filter>源文件\Session_Token</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="AuthorizeModule_Session.def">
......
......@@ -9,7 +9,7 @@ LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib
LIB = -lXEngine_BaseLib
LIBEX = -ldl -lpthread
LOADSO = -Wl,-rpath=
LIBINCLUDE = Session_Authorize.o pch.o
LIBINCLUDE = Session_Authorize.o Session_Token.o pch.o
ifeq ($(OS),Windows_NT)
else
......@@ -42,6 +42,8 @@ all:$(LIBINCLUDE)
Session_Authorize.o:./Session_Authorize/Session_Authorize.cpp
$(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./Session_Authorize/Session_Authorize.cpp
Session_Token.o:./Session_Token/Session_Token.cpp
$(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(INCLUDE) ./Session_Token/Session_Token.cpp
pch.o:pch.cpp
$(CC) $(DEBUG) $(FLAGS) $(UNICODE) pch.cpp
......
......@@ -39,14 +39,14 @@ CSession_Authorize::~CSession_Authorize()
意思:是否初始化成功
备注:
*********************************************************************/
BOOL CSession_Authorize::Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam /* = NULL */)
BOOL CSession_Authorize::Session_Authorize_Init(CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS fpCall_AuthEvent,LPVOID lParam /* = NULL */)
{
Session_IsErrorOccur = FALSE;
if (NULL == fpCall_AuthEvent)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
m_lParam = lParam;
......@@ -59,7 +59,7 @@ BOOL CSession_Authorize::Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE
{
bIsRun = FALSE;
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_CREATETHREAD;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_CREATETHREAD;
return FALSE;
}
return TRUE;
......@@ -87,41 +87,41 @@ BOOL CSession_Authorize::Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE
意思:是否获取成功
备注:参数一必须通过基础库的内存释放函数BaseLib_OperatorMemory_Free进行释放内存
*********************************************************************/
BOOL CSession_Authorize::Session_Authorize_GetClient(AUTHREG_USERTABLE*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr /* = NULL */)
BOOL CSession_Authorize::Session_Authorize_GetClient(AUTHSESSION_NETCLIENT*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr /* = NULL */)
{
Session_IsErrorOccur = FALSE;
if ((NULL == pppSt_ListClient) || (NULL == pInt_ListCount))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
st_Locker.lock_shared();
if (NULL == lpszClientAddr)
{
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHREG_USERTABLE));
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHSESSION_NETCLIENT));
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.begin();
unordered_map<tstring, AUTHSESSION_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.begin();
for (int i = 0; stl_MapIterator != stl_MapNetClient.cend(); stl_MapIterator++, i++)
{
*(*pppSt_ListClient)[i] = stl_MapIterator->second.st_AuthUser;
*(*pppSt_ListClient)[i] = stl_MapIterator->second;
}
*pInt_ListCount = stl_MapNetClient.size();
}
else
{
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
unordered_map<tstring, AUTHSESSION_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
if (stl_MapIterator == stl_MapNetClient.cend())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHREG_USERTABLE));
BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_ListClient, stl_MapNetClient.size(), sizeof(AUTHSESSION_NETCLIENT));
*(*pppSt_ListClient)[0] = stl_MapIterator->second.st_AuthUser;
*(*pppSt_ListClient)[0] = stl_MapIterator->second;
*pInt_ListCount = 1;
}
st_Locker.unlock_shared();
......@@ -129,7 +129,7 @@ BOOL CSession_Authorize::Session_Authorize_GetClient(AUTHREG_USERTABLE*** pppSt_
if (0 == *pInt_ListCount)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
return FALSE;
}
return TRUE;
......@@ -159,21 +159,21 @@ BOOL CSession_Authorize::Session_Authorize_GetTimer(LPCTSTR lpszUserName,AUTHREG
if ((NULL == lpszUserName) || (NULL == pSt_AuthTime))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
st_Locker.lock_shared();
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszUserName);
unordered_map<tstring, AUTHSESSION_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszUserName);
if (stl_MapIterator == stl_MapNetClient.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
pSt_AuthTime->nTimeLeft = stl_MapIterator->second.nLeftTime;
pSt_AuthTime->nTimeONLine = stl_MapIterator->second.nOnlineTime;
pSt_AuthTime->enSerialType = stl_MapIterator->second.st_AuthUser.enSerialType;
pSt_AuthTime->enSerialType = stl_MapIterator->second.st_UserTable.enSerialType;
_tcscpy(pSt_AuthTime->tszUserName, lpszUserName);
_tcscpy(pSt_AuthTime->tszLeftTime, stl_MapIterator->second.tszLeftTime);
......@@ -207,15 +207,15 @@ BOOL CSession_Authorize::Session_Authorize_GetAddrForUser(LPCTSTR lpszClientUser
if ((NULL == lpszClientUser) || (NULL == ptszClientAddr))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
st_Locker.lock_shared();
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientUser);
unordered_map<tstring, AUTHSESSION_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.find(lpszClientUser);
if (stl_MapIterator == stl_MapNetClient.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
......@@ -249,12 +249,12 @@ BOOL CSession_Authorize::Session_Authorize_GetUserForAddr(LPCTSTR lpszClientAddr
if ((NULL == lpszClientAddr) || (NULL == ptszClientUser))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
BOOL bIsFound = FALSE;
st_Locker.lock_shared();
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.begin();
unordered_map<tstring, AUTHSESSION_NETCLIENT>::const_iterator stl_MapIterator = stl_MapNetClient.begin();
for (;stl_MapIterator != stl_MapNetClient.end();stl_MapIterator++)
{
if (0 == _tcsncmp(lpszClientAddr, stl_MapIterator->second.tszClientAddr, _tcslen(lpszClientAddr)))
......@@ -266,7 +266,7 @@ BOOL CSession_Authorize::Session_Authorize_GetUserForAddr(LPCTSTR lpszClientAddr
if (!bIsFound)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
......@@ -293,7 +293,7 @@ BOOL CSession_Authorize::Session_Authorize_CloseClient(LPCTSTR lpszClientAddr)
Session_IsErrorOccur = FALSE;
st_Locker.lock();
unordered_map<tstring,AUTHREGSERVICE_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
unordered_map<tstring,AUTHSESSION_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(lpszClientAddr);
if (stl_MapIterator != stl_MapNetClient.end())
{
//移除元素
......@@ -351,27 +351,27 @@ BOOL CSession_Authorize::Session_Authorize_Insert(LPCTSTR lpszClientAddr, AUTHRE
if ((NULL == lpszClientAddr) || (NULL == pSt_UserTable))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
//验证是否登陆
st_Locker.lock_shared();
unordered_map<tstring,AUTHREGSERVICE_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
unordered_map<tstring,AUTHSESSION_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
if (stl_MapIterator != stl_MapNetClient.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_ISLOGIN;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_ISLOGIN;
st_Locker.unlock_shared();
return FALSE;
}
st_Locker.unlock_shared();
AUTHREGSERVICE_NETCLIENT st_Client;
memset(&st_Client,'\0',sizeof(AUTHREGSERVICE_NETCLIENT));
AUTHSESSION_NETCLIENT st_Client;
memset(&st_Client,'\0',sizeof(AUTHSESSION_NETCLIENT));
BaseLib_OperatorTime_GetSysTime(&st_Client.st_LibTimer);
_tcscpy(st_Client.tszClientAddr,lpszClientAddr);
memcpy(&st_Client.st_AuthUser, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
memcpy(&st_Client.st_UserTable, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
st_Locker.lock();
stl_MapNetClient.insert(make_pair(pSt_UserTable->st_UserInfo.tszUserName, st_Client));
......@@ -398,20 +398,20 @@ BOOL CSession_Authorize::Session_Authorize_SetUser(AUTHREG_USERTABLE* pSt_UserTa
if (NULL == pSt_UserTable)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_PARAMENT;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
//验证是否登陆
st_Locker.lock_shared();
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
unordered_map<tstring, AUTHSESSION_NETCLIENT>::iterator stl_MapIterator = stl_MapNetClient.find(pSt_UserTable->st_UserInfo.tszUserName);
if (stl_MapIterator == stl_MapNetClient.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_NOTFOUND;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
memcpy(&stl_MapIterator->second.st_AuthUser, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
memcpy(&stl_MapIterator->second.st_UserTable, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
st_Locker.unlock_shared();
return TRUE;
}
......@@ -429,7 +429,7 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
{
//开始轮训用户
pClass_This->st_Locker.lock_shared();
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT>::iterator stl_MapIterator = pClass_This->stl_MapNetClient.begin();
unordered_map<tstring, AUTHSESSION_NETCLIENT>::iterator stl_MapIterator = pClass_This->stl_MapNetClient.begin();
for (; stl_MapIterator != pClass_This->stl_MapNetClient.end(); stl_MapIterator++)
{
memset(&st_ProtocolTimer, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
......@@ -438,12 +438,12 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
//用户登录了多少分钟
BaseLib_OperatorTimeSpan_GetForStu(&stl_MapIterator->second.st_LibTimer, &st_LibTimer, &nOnlineSpan, ENUM_XENGINE_BASELIB_TIME_SPAN_TYPE_MINUTE);
//登陆成功的。我们要处理他过期
switch (stl_MapIterator->second.st_AuthUser.enSerialType)
switch (stl_MapIterator->second.st_UserTable.enSerialType)
{
case ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_MINUTE:
{
//分钟处理
__int64x nLeftTimer = _tcstoi64(stl_MapIterator->second.st_AuthUser.tszLeftTime, NULL, 10);
__int64x nLeftTimer = _tcstoi64(stl_MapIterator->second.st_UserTable.tszLeftTime, NULL, 10);
//获得过期日期
XENGINE_LIBTIMER st_TimeCal;
memset(&st_TimeCal, '\0', sizeof(XENGINE_LIBTIMER));
......@@ -464,11 +464,11 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
//赋值给回调函数
st_ProtocolTimer.nTimeONLine = nOnlineSpan;
st_ProtocolTimer.nTimeLeft = stl_MapIterator->second.nLeftTime;
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_AuthUser.enDeviceType;
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_UserTable.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_UserTable.enDeviceType;
_tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.tszLeftTime);
_tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_UserTable.st_UserInfo.tszUserName);
stl_ListNotify.push_back(st_ProtocolTimer);
}
break;
......@@ -476,16 +476,16 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
{
//次数处理
stl_MapIterator->second.nOnlineTime = nOnlineSpan;
stl_MapIterator->second.nLeftTime = _tcstoi64(stl_MapIterator->second.st_AuthUser.tszLeftTime, NULL, 10);
stl_MapIterator->second.nLeftTime = _tcstoi64(stl_MapIterator->second.st_UserTable.tszLeftTime, NULL, 10);
_stprintf(stl_MapIterator->second.tszLeftTime, _T("%lld"), stl_MapIterator->second.nLeftTime);
//次数处理不做任何时间操作
st_ProtocolTimer.nTimeONLine = nOnlineSpan;
st_ProtocolTimer.nTimeLeft = stl_MapIterator->second.nLeftTime;
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_AuthUser.enDeviceType;
_tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_UserTable.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_UserTable.enDeviceType;
_tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_UserTable.tszLeftTime);
_tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_UserTable.st_UserInfo.tszUserName);
stl_ListNotify.push_back(st_ProtocolTimer);
}
break;
......@@ -495,7 +495,7 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
XENGINE_LIBTIMER st_TimeLeft;
memset(&st_TimeLeft, '\0', sizeof(XENGINE_LIBTIMER));
//获取指定过期日期
if (6 != _stscanf_s(stl_MapIterator->second.st_AuthUser.tszLeftTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_TimeLeft.wYear, &st_TimeLeft.wMonth, &st_TimeLeft.wDay, &st_TimeLeft.wHour, &st_TimeLeft.wMinute, &st_TimeLeft.wSecond))
if (6 != _stscanf_s(stl_MapIterator->second.st_UserTable.tszLeftTime, _T("%04d-%02d-%02d %02d:%02d:%02d"), &st_TimeLeft.wYear, &st_TimeLeft.wMonth, &st_TimeLeft.wDay, &st_TimeLeft.wHour, &st_TimeLeft.wMinute, &st_TimeLeft.wSecond))
{
break;
}
......@@ -504,18 +504,18 @@ XHTHREAD CSession_Authorize::Session_Authorize_ActiveThread(LPVOID lParam)
//获取过期时间
stl_MapIterator->second.nLeftTime = nLeftTime;
stl_MapIterator->second.nOnlineTime = nOnlineSpan;
_tcscpy(stl_MapIterator->second.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
_tcscpy(stl_MapIterator->second.tszLeftTime, stl_MapIterator->second.st_UserTable.tszLeftTime);
//计算时间是否超过!
AUTHREG_PROTOCOL_TIME st_ProtocolTimer;
memset(&st_ProtocolTimer, '\0', sizeof(AUTHREG_PROTOCOL_TIME));
st_ProtocolTimer.nTimeONLine = nOnlineSpan;
st_ProtocolTimer.nTimeLeft = nLeftTime;
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_AuthUser.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_AuthUser.enDeviceType;
_tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_AuthUser.tszLeftTime);
st_ProtocolTimer.enSerialType = stl_MapIterator->second.st_UserTable.enSerialType;
st_ProtocolTimer.enDeviceType = stl_MapIterator->second.st_UserTable.enDeviceType;
_tcscpy(st_ProtocolTimer.tszLeftTime, stl_MapIterator->second.st_UserTable.tszLeftTime);
_tcscpy(st_ProtocolTimer.tszUserAddr, stl_MapIterator->second.tszClientAddr);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_AuthUser.st_UserInfo.tszUserName);
_tcscpy(st_ProtocolTimer.tszUserName, stl_MapIterator->second.st_UserTable.st_UserInfo.tszUserName);
stl_ListNotify.push_back(st_ProtocolTimer);
break;
}
......
......@@ -10,24 +10,15 @@
// Purpose: 会话管理器
// History:
*********************************************************************/
typedef struct
{
AUTHREG_USERTABLE st_AuthUser; //用户表
XENGINE_LIBTIMER st_LibTimer; //登录时间结构
TCHAR tszClientAddr[64];
TCHAR tszLeftTime[64]; //过期日期
__int64x nOnlineTime; //在线时间
__int64x nLeftTime; //剩余时间
}AUTHREGSERVICE_NETCLIENT,*LPAUTHREGSERVICE_NETCLIENT;
//////////////////////////////////////////////////////////////////////////
class CSession_Authorize
{
public:
CSession_Authorize();
~CSession_Authorize();
public:
BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
BOOL Session_Authorize_GetClient(AUTHREG_USERTABLE*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr = NULL);
BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
BOOL Session_Authorize_GetClient(AUTHSESSION_NETCLIENT*** pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr = NULL);
BOOL Session_Authorize_GetTimer(LPCTSTR lpszUserName, AUTHREG_PROTOCOL_TIME* pSt_AuthTime);
BOOL Session_Authorize_GetAddrForUser(LPCTSTR lpszClientUser,TCHAR *ptszClientAddr);
BOOL Session_Authorize_GetUserForAddr(LPCTSTR lpszClientAddr, TCHAR *ptszClientUser);
......@@ -43,9 +34,9 @@ private:
shared_ptr<std::thread> pSTDThread_hActive; //时间计算器线程句柄
private:
LPVOID m_lParam;
CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS lpCall_AuthregEvents;
CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS lpCall_AuthregEvents;
private:
shared_mutex st_Locker;
private:
unordered_map<tstring, AUTHREGSERVICE_NETCLIENT> stl_MapNetClient;
unordered_map<tstring, AUTHSESSION_NETCLIENT> stl_MapNetClient;
};
......@@ -10,17 +10,27 @@
// Purpose: 导出定义和函数
// History:
*********************************************************************/
typedef struct
{
AUTHREG_USERTABLE st_UserTable; //用户表
XENGINE_LIBTIMER st_LibTimer; //登录时间结构
TCHAR tszClientAddr[64];
TCHAR tszLeftTime[64]; //过期日期
__int64x nOnlineTime; //在线时间
__int64x nLeftTime; //剩余时间
}AUTHSESSION_NETCLIENT, * LPAUTHSESSION_NETCLIENT;
//////////////////////////////////////////////////////////////////////////
// 导出的回调函数
//////////////////////////////////////////////////////////////////////////
//用户在线时间事件回调处理函数,用户名 在线时间 剩余时间(分,天) 注册的卡类型 自定义参数
typedef void(CALLBACK* CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS)(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enSerialType, ENUM_PROTOCOLDEVICE_TYPE enDeviceType, LPVOID lParam);
typedef void(CALLBACK* CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS)(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enSerialType, ENUM_PROTOCOLDEVICE_TYPE enDeviceType, LPVOID lParam);
typedef void(CALLBACK* CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS)(XNETHANDLE xhToken, LPVOID lParam);
//////////////////////////////////////////////////////////////////////////
// 导出的函数
//////////////////////////////////////////////////////////////////////////
extern "C" DWORD Session_GetLastError(int *pInt_SysError = NULL);
/************************************************************************/
/* 网络服务导出函数 */
/* 网络验证导出函数 */
/************************************************************************/
/********************************************************************
函数名称:Session_Authorize_Init
......@@ -40,7 +50,7 @@ extern "C" DWORD Session_GetLastError(int *pInt_SysError = NULL);
意思:是否初始化成功
备注:
*********************************************************************/
extern "C" BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
extern "C" BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS fpCall_AuthEvent,LPVOID lParam = NULL);
/********************************************************************
函数名称:Session_Authorize_GetClient
函数功能:获取客户端信息
......@@ -64,7 +74,7 @@ extern "C" BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS f
意思:是否获取成功
备注:参数一必须通过基础库的内存释放函数BaseLib_OperatorMemory_Free进行释放内存
*********************************************************************/
extern "C" BOOL Session_Authorize_GetClient(AUTHREG_USERTABLE * **pppSt_ListClient, int* pInt_ListCount, LPCSTR lpszClientAddr = NULL);
extern "C" BOOL Session_Authorize_GetClient(AUTHSESSION_NETCLIENT * **pppSt_ListClient, int* pInt_ListCount, LPCSTR lpszClientAddr = NULL);
/********************************************************************
函数名称:Session_Authorize_GetTimer
函数功能:获取客户端时间信息
......@@ -178,3 +188,124 @@ extern "C" BOOL Session_Authorize_Insert(LPCSTR lpszClientAddr, AUTHREG_USERTABL
备注:
*********************************************************************/
extern "C" BOOL Session_Authorize_SetUser(AUTHREG_USERTABLE* pSt_UserTable);
/************************************************************************/
/* TOKEN会话导出函数 */
/************************************************************************/
/********************************************************************
函数名称:Session_Token_Init
函数功能:初始化会话
参数.一:nTimeout
In/Out:In
类型:整数型
可空:N
意思:超时时间,单位秒
参数.二:fpCall_AuthEvent
In/Out:In/Out
类型:回调函数
可空:N
意思:TOKEN登录的客户端连接超时回调
参数.三:lParam
In/Out:In/Out
类型:无类型指针
可空:Y
意思:回调函数自定义参数
返回值
类型:逻辑型
意思:是否初始化成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_Init(int nTimeout, CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS fpCall_AuthEvent, LPVOID lParam = NULL);
/********************************************************************
函数名称:Session_Token_Destroy
函数功能:销毁服务
返回值
类型:逻辑型
意思:是否销毁成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_Destroy();
/********************************************************************
函数名称:Session_Authorize_Insert
函数功能:用户登陆协议分析
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
参数.二:pSt_UserTable
In/Out:In
类型:数据结构指针
可空:N
意思:用户信息表
返回值
类型:逻辑型
意思:是否允许登陆
备注:
*********************************************************************/
extern "C" BOOL Session_Token_Insert(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable);
/********************************************************************
函数名称:Session_Token_Delete
函数功能:移除一个客户端
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
返回值
类型:逻辑型
意思:是否移除成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_Delete(XNETHANDLE xhToken);
/********************************************************************
函数名称:Session_Token_UPDate
函数功能:更新一个客户端的TOKEN时间
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_UPDate(XNETHANDLE xhToken);
/********************************************************************
函数名称:Session_Token_Get
函数功能:获取客户端信息
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
参数.二:pSt_UserTable
In/Out:Out
类型:数据结构指针
可空:Y
意思:输出TOKEN对应的信息
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_Get(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable = NULL);
/********************************************************************
函数名称:Session_Token_GetUser
函数功能:获取用户是否存在
参数.一:lpszUser
In/Out:In
类型:常量字符指针
可空:N
意思:用户名
参数.二:lpszPass
In/Out:In
类型:常量字符指针
可空:N
意思:密码
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
extern "C" BOOL Session_Token_GetUser(LPCTSTR lpszUser, LPCTSTR lpszPass);
\ No newline at end of file
......@@ -16,19 +16,10 @@
/************************************************************************/
/* 网络协议错误 */
/************************************************************************/
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_PARAMENT 0x30D0000 //参数错误,无法继续
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INIT_CREATETHREAD 0x30D0001 //创建线程失败
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_PARAMENT 0x30D0010 //参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETCLIENT_NOTFOUND 0x30D0011 //没有找到客户端
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_PARAMENT 0x30D0020 //参数错误,获取失败
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETTIME_NOTFOUND 0x30D0021 //没有找到制定的客户端
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_PARAMENT 0x30D0050 //参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_INSERT_ISLOGIN 0x30D0051 //用户已经登陆,无法第二次登陆
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETPASS_PARAMENT 0x30D0070 //参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETPASS_MATCH 0x30D0071 //找回密码失败,匹配资料错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_PARAMENT 0x30D0080 //获取失败,参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETADDR_NOTFOUND 0x30D0081 //没有找到
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_PARAMENT 0x30D0090 //获取失败,参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_GETUSER_NOTFOUND 0x30D0091 //没有找到
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_PARAMENT 0x30D00A0 //参数错误
#define ERROR_AUTHORIZE_COMPONENTS_SESSION_SETUSER_NOTFOUND 0x30D00A1 //没有找到
\ No newline at end of file
#define ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT 0x0020000 //参数错误,无法继续
#define ERROR_AUTHORIZE_MODULE_SESSION_CREATETHREAD 0x0020001 //创建线程失败
#define ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND 0x0020002 //没有找到客户端
#define ERROR_AUTHORIZE_MODULE_SESSION_ISLOGIN 0x0020003 //用户已经登陆,无法第二次登陆
#define ERROR_AUTHORIZE_MODULE_SESSION_MATCH 0x0020004 //找回密码失败,匹配资料错误
#define ERROR_AUTHORIZE_MODULE_SESSION_VER 0x0020005 //验证失败
#define ERROR_AUTHORIZE_MODULE_SESSION_EXIST 0x0020006 //已存在
\ No newline at end of file
#include "pch.h"
#include "Session_Token.h"
/********************************************************************
// Created: 2022/08/18 14:43:33
// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Session\Session_Token\Session_Token.cpp
// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Session\Session_Token
// File Base: Session_Token
// File Ext: cpp
// Project: XEngine(网络通信引擎)
// Author: qyt
// Purpose: TOKEN会话管理
// History:
*********************************************************************/
CSession_Token::CSession_Token()
{
bIsRun = FALSE;
}
CSession_Token::~CSession_Token()
{
}
//////////////////////////////////////////////////////////////////////////
// 公有函数
//////////////////////////////////////////////////////////////////////////
/********************************************************************
函数名称:Session_Token_Init
函数功能:初始化会话
参数.一:nTimeout
In/Out:In
类型:整数型
可空:N
意思:超时时间,单位秒
参数.二:fpCall_AuthEvent
In/Out:In/Out
类型:回调函数
可空:N
意思:TOKEN登录的客户端连接超时回调
参数.三:lParam
In/Out:In/Out
类型:无类型指针
可空:Y
意思:回调函数自定义参数
返回值
类型:逻辑型
意思:是否初始化成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_Init(int nTimeout, CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS fpCall_AuthEvent, LPVOID lParam /* = NULL */)
{
Session_IsErrorOccur = FALSE;
if (NULL == fpCall_AuthEvent)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
m_nTimeout = nTimeout;
m_lParam = lParam;
lpCall_AuthregEvents = fpCall_AuthEvent;
bIsRun = TRUE;
//创建线程
pSTDThread_hActive = make_shared<std::thread>(Session_Token_Thread, this);
if (!pSTDThread_hActive->joinable())
{
bIsRun = FALSE;
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_CREATETHREAD;
return FALSE;
}
return TRUE;
}
/********************************************************************
函数名称:Session_Token_Destroy
函数功能:销毁服务
返回值
类型:逻辑型
意思:是否销毁成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_Destroy()
{
Session_IsErrorOccur = FALSE;
bIsRun = FALSE;
//结束线程
if (NULL != pSTDThread_hActive)
{
pSTDThread_hActive->join();
}
//释放客户端资源
st_Locker.lock();
stl_MapToken.clear();
st_Locker.unlock();
return TRUE;
}
/********************************************************************
函数名称:Session_Authorize_Insert
函数功能:用户登陆协议分析
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
参数.二:pSt_UserTable
In/Out:In
类型:数据结构指针
可空:N
意思:用户信息表
返回值
类型:逻辑型
意思:是否允许登陆
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_Insert(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable)
{
Session_IsErrorOccur = FALSE;
if (NULL == pSt_UserTable)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
AUTHSESSION_TOKENCLIENT st_TokenClient;
memset(&st_TokenClient,'\0',sizeof(AUTHSESSION_TOKENCLIENT));
BaseLib_OperatorTime_GetSysTime(&st_TokenClient.st_LibTimer);
memcpy(&st_TokenClient.st_UserTable, pSt_UserTable, sizeof(AUTHREG_USERTABLE));
st_Locker.lock();
stl_MapToken.insert(make_pair(xhToken, st_TokenClient));
st_Locker.unlock();
return TRUE;
}
/********************************************************************
函数名称:Session_Token_Delete
函数功能:移除一个客户端
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
返回值
类型:逻辑型
意思:是否移除成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_Delete(XNETHANDLE xhToken)
{
Session_IsErrorOccur = FALSE;
st_Locker.lock();
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT>::iterator stl_MapIterator = stl_MapToken.find(xhToken);
if (stl_MapIterator != stl_MapToken.end())
{
//移除元素
stl_MapToken.erase(stl_MapIterator);
}
st_Locker.unlock();
return TRUE;
}
/********************************************************************
函数名称:Session_Token_UPDate
函数功能:更新一个客户端的TOKEN时间
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_UPDate(XNETHANDLE xhToken)
{
Session_IsErrorOccur = FALSE;
st_Locker.lock_shared();
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT>::iterator stl_MapIterator = stl_MapToken.find(xhToken);
if (stl_MapIterator == stl_MapToken.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
st_Locker.unlock_shared();
return FALSE;
}
BaseLib_OperatorTime_GetSysTime(&stl_MapIterator->second.st_LibTimer);
st_Locker.unlock_shared();
return TRUE;
}
/********************************************************************
函数名称:Session_Token_Get
函数功能:获取客户端信息
参数.一:xhToken
In/Out:In
类型:句柄
可空:N
意思:要操作的客户端
参数.二:pSt_UserTable
In/Out:Out
类型:数据结构指针
可空:Y
意思:输出TOKEN对应的信息
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_Get(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable /* = NULL */)
{
Session_IsErrorOccur = FALSE;
st_Locker.lock_shared();
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT>::iterator stl_MapIterator = stl_MapToken.find(xhToken);
if (stl_MapIterator == stl_MapToken.end())
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_NOTFOUND;
st_Locker.unlock_shared();
return FALSE;
}
if (NULL != pSt_UserTable)
{
*pSt_UserTable = stl_MapIterator->second.st_UserTable;
}
st_Locker.unlock_shared();
return TRUE;
}
/********************************************************************
函数名称:Session_Token_GetUser
函数功能:获取用户是否存在
参数.一:lpszUser
In/Out:In
类型:常量字符指针
可空:N
意思:用户名
参数.二:lpszPass
In/Out:In
类型:常量字符指针
可空:N
意思:密码
返回值
类型:逻辑型
意思:是否成功
备注:
*********************************************************************/
BOOL CSession_Token::Session_Token_GetUser(LPCTSTR lpszUser, LPCTSTR lpszPass)
{
Session_IsErrorOccur = FALSE;
if ((NULL == lpszUser) || (NULL == lpszPass))
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_PARAMENT;
return FALSE;
}
BOOL bFound = FALSE;
st_Locker.lock_shared();
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT>::iterator stl_MapIterator = stl_MapToken.begin();
for (; stl_MapIterator != stl_MapToken.end(); stl_MapIterator++)
{
//用户名
if (0 == _tcsncmp(lpszUser, stl_MapIterator->second.st_UserTable.st_UserInfo.tszUserName, _tcslen(lpszUser)))
{
//密码,验证密码防治冲突
if (0 == _tcsncmp(lpszPass, stl_MapIterator->second.st_UserTable.st_UserInfo.tszUserPass, _tcslen(lpszPass)))
{
bFound = TRUE;
break;
}
}
}
st_Locker.unlock_shared();
if (bFound)
{
Session_IsErrorOccur = TRUE;
Session_dwErrorCode = ERROR_AUTHORIZE_MODULE_SESSION_EXIST;
return FALSE;
}
return TRUE;
}
//////////////////////////////////////////////////////////////////////////
// 线程函数
//////////////////////////////////////////////////////////////////////////
XHTHREAD CSession_Token::Session_Token_Thread(LPVOID lParam)
{
CSession_Token *pClass_This = (CSession_Token *)lParam;
XENGINE_LIBTIMER st_LibTimer;
list<XNETHANDLE> stl_ListNotify;
while (pClass_This->bIsRun)
{
//开始轮训用户
pClass_This->st_Locker.lock_shared();
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT>::iterator stl_MapIterator = pClass_This->stl_MapToken.begin();
for (; stl_MapIterator != pClass_This->stl_MapToken.end(); stl_MapIterator++)
{
BaseLib_OperatorTime_GetSysTime(&st_LibTimer); //获取现在的系统时间
__int64x nOnlineSpan = 0; //在线时间
//用户登录了多少秒
BaseLib_OperatorTimeSpan_GetForStu(&stl_MapIterator->second.st_LibTimer, &st_LibTimer, &nOnlineSpan, ENUM_XENGINE_BASELIB_TIME_SPAN_TYPE_SECOND);
if (nOnlineSpan > pClass_This->m_nTimeout)
{
stl_ListNotify.push_back(stl_MapIterator->first);
}
}
pClass_This->st_Locker.unlock_shared();
//判断是否有需要关闭的客户端
if (!stl_ListNotify.empty())
{
list<XNETHANDLE>::iterator stl_ListIterator = stl_ListNotify.begin();
for (; stl_ListIterator != stl_ListNotify.end(); stl_ListIterator++)
{
pClass_This->lpCall_AuthregEvents(*stl_ListIterator, pClass_This->m_lParam);
}
stl_ListNotify.clear(); //清理元素
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
return 0;
}
#pragma once
/********************************************************************
// Created: 2022/08/18 14:29:38
// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Session\Session_Token\Session_Token.h
// File Path: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Session\Session_Token
// File Base: Session_Token
// File Ext: h
// Project: XEngine(网络通信引擎)
// Author: qyt
// Purpose: TOKEN会话
// History:
*********************************************************************/
typedef struct
{
AUTHREG_USERTABLE st_UserTable; //用户表
XENGINE_LIBTIMER st_LibTimer; //登录时间结构
__int64x nOnlineTime; //在线时间
}AUTHSESSION_TOKENCLIENT, * LPAUTHSESSION_TOKENCLIENT;
//////////////////////////////////////////////////////////////////////////
class CSession_Token
{
public:
CSession_Token();
~CSession_Token();
public:
BOOL Session_Token_Init(int nTimeout, CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS fpCall_AuthEvent, LPVOID lParam = NULL);
BOOL Session_Token_Destroy();
BOOL Session_Token_Insert(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable);
BOOL Session_Token_Delete(XNETHANDLE xhToken);
BOOL Session_Token_UPDate(XNETHANDLE xhToken);
BOOL Session_Token_Get(XNETHANDLE xhToken, AUTHREG_USERTABLE* pSt_UserTable = NULL);
BOOL Session_Token_GetUser(LPCTSTR lpszUser, LPCTSTR lpszPass);
protected:
static XHTHREAD Session_Token_Thread(LPVOID lParam);
private:
int m_nTimeout;
BOOL bIsRun;
shared_ptr<std::thread> pSTDThread_hActive;
private:
LPVOID m_lParam;
CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS lpCall_AuthregEvents;
private:
shared_mutex st_Locker;
private:
unordered_map<XNETHANDLE, AUTHSESSION_TOKENCLIENT> stl_MapToken;
};
#include "pch.h"
#include "Session_Authorize/Session_Authorize.h"
#include "Session_Token/Session_Token.h"
/********************************************************************
// Created: 2022/05/26 10:53:58
// File Name: D:\XEngine_Authorize\XEngine_Source\AuthorizeModule_Session\pch.cpp
......@@ -14,7 +15,8 @@
BOOL Session_IsErrorOccur = FALSE;
DWORD Session_dwErrorCode = 0;
//////////////////////////////////////////////////////////////////////////
CSession_Authorize m_Session;
CSession_Authorize m_SessionAuth;
CSession_Token m_SessionToken;
//////////////////////////////////////////////////////////////////////////
// 导出的函数
//////////////////////////////////////////////////////////////////////////
......@@ -29,39 +31,70 @@ extern "C" DWORD Session_GetLastError(int* pInt_SysError)
/************************************************************************/
/* 网络服务导出函数 */
/************************************************************************/
extern "C" BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHREG_SERVICE_EVENTS fpCall_AuthEvent, LPVOID lParam)
extern "C" BOOL Session_Authorize_Init(CALLBACK_XENGIEN_AUTHORIZE_SESSION_CLIENT_EVENTS fpCall_AuthEvent, LPVOID lParam)
{
return m_Session.Session_Authorize_Init(fpCall_AuthEvent, lParam);
return m_SessionAuth.Session_Authorize_Init(fpCall_AuthEvent, lParam);
}
extern "C" BOOL Session_Authorize_GetClient(AUTHREG_USERTABLE * **pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr)
extern "C" BOOL Session_Authorize_GetClient(AUTHSESSION_NETCLIENT * **pppSt_ListClient, int* pInt_ListCount, LPCTSTR lpszClientAddr)
{
return m_Session.Session_Authorize_GetClient(pppSt_ListClient, pInt_ListCount, lpszClientAddr);
return m_SessionAuth.Session_Authorize_GetClient(pppSt_ListClient, pInt_ListCount, lpszClientAddr);
}
extern "C" BOOL Session_Authorize_GetTimer(LPCTSTR lpszUserName, AUTHREG_PROTOCOL_TIME * pSt_AuthTime)
{
return m_Session.Session_Authorize_GetTimer(lpszUserName, pSt_AuthTime);
return m_SessionAuth.Session_Authorize_GetTimer(lpszUserName, pSt_AuthTime);
}
extern "C" BOOL Session_Authorize_GetAddrForUser(LPCTSTR lpszClientUser, TCHAR * ptszClientAddr)
{
return m_Session.Session_Authorize_GetAddrForUser(lpszClientUser, ptszClientAddr);
return m_SessionAuth.Session_Authorize_GetAddrForUser(lpszClientUser, ptszClientAddr);
}
extern "C" BOOL Session_Authorize_GetUserForAddr(LPCTSTR lpszClientAddr, TCHAR * ptszClientUser)
{
return m_Session.Session_Authorize_GetUserForAddr(lpszClientAddr, ptszClientUser);
return m_SessionAuth.Session_Authorize_GetUserForAddr(lpszClientAddr, ptszClientUser);
}
extern "C" BOOL Session_Authorize_CloseClient(LPCTSTR lpszClientUser)
{
return m_Session.Session_Authorize_CloseClient(lpszClientUser);
return m_SessionAuth.Session_Authorize_CloseClient(lpszClientUser);
}
extern "C" BOOL Session_Authorize_Destroy()
{
return m_Session.Session_Authorize_Destroy();
return m_SessionAuth.Session_Authorize_Destroy();
}
extern "C" BOOL Session_Authorize_Insert(LPCTSTR lpszClientAddr, AUTHREG_USERTABLE * pSt_UserTable)
{
return m_Session.Session_Authorize_Insert(lpszClientAddr, pSt_UserTable);
return m_SessionAuth.Session_Authorize_Insert(lpszClientAddr, pSt_UserTable);
}
extern "C" BOOL Session_Authorize_SetUser(AUTHREG_USERTABLE * pSt_UserTable)
{
return m_Session.Session_Authorize_SetUser(pSt_UserTable);
return m_SessionAuth.Session_Authorize_SetUser(pSt_UserTable);
}
/************************************************************************/
/* TOKEN会话导出函数 */
/************************************************************************/
extern "C" BOOL Session_Token_Init(int nTimeout, CALLBACK_XENGIEN_AUTHORIZE_SESSION_TOKEN_EVENTS fpCall_AuthEvent, LPVOID lParam)
{
return m_SessionToken.Session_Token_Init(nTimeout, fpCall_AuthEvent, lParam);
}
extern "C" BOOL Session_Token_Destroy()
{
return m_SessionToken.Session_Token_Destroy();
}
extern "C" BOOL Session_Token_Insert(XNETHANDLE xhToken, AUTHREG_USERTABLE * pSt_UserTable)
{
return m_SessionToken.Session_Token_Insert(xhToken, pSt_UserTable);
}
extern "C" BOOL Session_Token_Delete(XNETHANDLE xhToken)
{
return m_SessionToken.Session_Token_Delete(xhToken);
}
extern "C" BOOL Session_Token_UPDate(XNETHANDLE xhToken)
{
return m_SessionToken.Session_Token_UPDate(xhToken);
}
extern "C" BOOL Session_Token_Get(XNETHANDLE xhToken, AUTHREG_USERTABLE * pSt_UserTable)
{
return m_SessionToken.Session_Token_Get(xhToken, pSt_UserTable);
}
extern "C" BOOL Session_Token_GetUser(LPCTSTR lpszUser, LPCTSTR lpszPass)
{
return m_SessionToken.Session_Token_GetUser(lpszUser, lpszPass);
}
\ No newline at end of file
......@@ -26,12 +26,20 @@ void CDialog_Config::DoDataExchange(CDataExchange* pDX)
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT1, m_EditIPAddr);
DDX_Control(pDX, IDC_EDIT2, m_EditIPPort);
DDX_Control(pDX, IDC_EDIT3, m_EditUser);
DDX_Control(pDX, IDC_EDIT4, m_EditPass);
DDX_Control(pDX, IDC_EDIT9, m_EditToken);
DDX_Control(pDX, IDC_BUTTON1, m_BtnLogin);
DDX_Control(pDX, IDC_BUTTON2, m_BtnLogout);
DDX_Control(pDX, IDC_EDIT10, m_EditTimeout);
DDX_Control(pDX, IDC_BUTTON5, m_BtnUpdate);
}
BEGIN_MESSAGE_MAP(CDialog_Config, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON1, &CDialog_Config::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CDialog_Config::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON5, &CDialog_Config::OnBnClickedButton5)
END_MESSAGE_MAP()
......@@ -46,6 +54,11 @@ BOOL CDialog_Config::OnInitDialog()
m_EditIPAddr.SetWindowText(_T("127.0.0.1"));
m_EditIPPort.SetWindowText(_T("5302"));
m_EditUser.SetWindowText(_T("admin"));
m_EditPass.SetWindowText(_T("123123aa"));
m_BtnLogout.EnableWindow(FALSE);
m_BtnUpdate.EnableWindow(FALSE);
hConfigWnd = m_hWnd;
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
......@@ -55,10 +68,129 @@ BOOL CDialog_Config::OnInitDialog()
void CDialog_Config::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrUser;
CString m_StrPass;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
m_EditIPAddr.GetWindowText(m_StrIPAddr);
m_EditIPPort.GetWindowText(m_StrIPPort);
m_EditUser.GetWindowText(m_StrUser);
m_EditPass.GetWindowText(m_StrPass);
_stprintf(tszUrlAddr, _T("http://%s:%s/api?function=login&user=%s&pass=%s"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer(), m_StrUser.GetBuffer(), m_StrPass.GetBuffer());
//请求用户信息
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Get(tszUrlAddr, &ptszMsgBuffer, &nMsgLen);
Json::Value st_JsonRoot;
JSONCPP_STRING st_JsonError;
Json::CharReaderBuilder st_ReaderBuilder;
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_ReaderBuilder.newCharReader());
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
{
AfxMessageBox(_T("登录失败,无法继续"));
return;
}
if (0 != st_JsonRoot["code"].asInt())
{
AfxMessageBox(_T("登录失败,无法继续"));
return;
}
m_StrToken.Format(_T("%lld"), st_JsonRoot["xhToken"].asUInt64());
m_EditToken.SetWindowText(m_StrToken);
m_EditTimeout.SetWindowText(st_JsonRoot["tszTimeEnd"].asCString());
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
AfxMessageBox(_T("登录成功"));
m_BtnLogin.EnableWindow(FALSE);
m_BtnLogout.EnableWindow(TRUE);
m_BtnUpdate.EnableWindow(TRUE);
}
void CDialog_Config::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
m_EditIPAddr.GetWindowText(m_StrIPAddr);
m_EditIPPort.GetWindowText(m_StrIPPort);
m_EditToken.GetWindowText(m_StrToken);
_stprintf(tszUrlAddr, _T("http://%s:%s/api?function=close&token=%s"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer(), m_StrToken.GetBuffer());
//请求用户信息
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Get(tszUrlAddr, &ptszMsgBuffer, &nMsgLen);
Json::Value st_JsonRoot;
JSONCPP_STRING st_JsonError;
Json::CharReaderBuilder st_ReaderBuilder;
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_ReaderBuilder.newCharReader());
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
{
AfxMessageBox(_T("关闭失败,无法继续"));
return;
}
if (0 != st_JsonRoot["code"].asInt())
{
AfxMessageBox(_T("关闭失败,无法继续"));
return;
}
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
m_EditToken.SetWindowText("");
m_EditTimeout.SetWindowText("");
m_BtnLogin.EnableWindow(TRUE);
m_BtnLogout.EnableWindow(FALSE);
m_BtnUpdate.EnableWindow(FALSE);
}
void CDialog_Config::OnBnClickedButton5()
{
// TODO: 在此添加控件通知处理程序代码
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
m_EditIPAddr.GetWindowText(m_StrIPAddr);
m_EditIPPort.GetWindowText(m_StrIPPort);
m_EditToken.GetWindowText(m_StrToken);
_stprintf(tszUrlAddr, _T("http://%s:%s/api?function=update&token=%s"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer(), m_StrToken.GetBuffer());
//请求用户信息
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Get(tszUrlAddr, &ptszMsgBuffer, &nMsgLen);
Json::Value st_JsonRoot;
JSONCPP_STRING st_JsonError;
Json::CharReaderBuilder st_ReaderBuilder;
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_ReaderBuilder.newCharReader());
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
{
AfxMessageBox(_T("续期失败,无法继续"));
return;
}
if (0 != st_JsonRoot["code"].asInt())
{
AfxMessageBox(_T("续期失败,无法继续"));
return;
}
m_EditTimeout.SetWindowText(st_JsonRoot["tszTimeEnd"].asCString());
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
}
......@@ -27,4 +27,12 @@ public:
CEdit m_EditIPPort;
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton2();
CEdit m_EditUser;
CEdit m_EditPass;
CEdit m_EditToken;
CButton m_BtnLogin;
CButton m_BtnLogout;
CEdit m_EditTimeout;
afx_msg void OnBnClickedButton5();
CButton m_BtnUpdate;
};
......@@ -59,11 +59,14 @@ BOOL CDialog_Modify::OnInitDialog()
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
pConfigWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pConfigWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pConfigWnd->m_EditToken.GetWindowText(m_StrToken);
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/client/get"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer());
//请求用户信息
int nMsgLen = 0;
......@@ -73,6 +76,8 @@ BOOL CDialog_Modify::OnInitDialog()
st_JsonObject["tszUserName"] = m_StrUser.GetBuffer();
st_JsonRoot["st_UserInfo"] = st_JsonObject;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
APIHelp_HttpRequest_Post(tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen);
st_JsonObject.clear();
......@@ -146,6 +151,17 @@ void CDialog_Modify::OnBnClickedButton2()
Json::Value st_JsonRoot;
Json::Value st_JsonTable;
Json::Value st_JsonUser;
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
CDialog_Config* pConfigWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pConfigWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pConfigWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pConfigWnd->m_EditToken.GetWindowText(m_StrToken);
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/client/modify"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer());
st_JsonUser["tszUserName"] = st_UserTable.st_UserInfo.tszUserName;
st_JsonUser["tszUserPass"] = st_UserTable.st_UserInfo.tszUserPass;
......@@ -159,16 +175,7 @@ void CDialog_Modify::OnBnClickedButton2()
st_JsonTable["enSerialType"] = st_UserTable.enSerialType;
st_JsonTable["st_UserInfo"] = st_JsonUser;
st_JsonRoot["st_UserTable"] = st_JsonTable;
CString m_StrIPAddr;
CString m_StrIPPort;
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
//组合请求URL
CDialog_Config* pConfigWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pConfigWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pConfigWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/client/modify"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer());
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
......
......@@ -82,9 +82,11 @@ void CDialog_Serial::OnBnClickedButton1()
m_ListSerial.DeleteAllItems();
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pWnd->m_EditToken.GetWindowText(m_StrToken);
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
......@@ -92,11 +94,14 @@ void CDialog_Serial::OnBnClickedButton1()
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/serial/list"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Post(tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen);
Json::Value st_JsonRoot;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
APIHelp_HttpRequest_Post(tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen);
JSONCPP_STRING st_JsonError;
Json::CharReaderBuilder st_ReaderBuilder;
st_JsonRoot.clear();
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_ReaderBuilder.newCharReader());
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
......@@ -135,12 +140,14 @@ void CDialog_Serial::OnBnClickedButton2()
// TODO: 在此添加控件通知处理程序代码
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
memset(tszUrlAddr, '\0', MAX_PATH);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pWnd->m_EditToken.GetWindowText(m_StrToken);
CString m_StrHasTime;
CString m_StrSerialCount;
......@@ -157,6 +164,7 @@ void CDialog_Serial::OnBnClickedButton2()
st_JsonObject["nSerialCount"] = _ttoi(m_StrSerialCount.GetBuffer());
st_JsonObject["tszHasTime"] = m_StrHasTime.GetBuffer();
st_JsonRoot["st_SerialInfo"] = st_JsonObject;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
......@@ -200,12 +208,14 @@ void CDialog_Serial::OnBnClickedButton4()
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
TCHAR tszUrlAddr[MAX_PATH];
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
memset(tszUrlAddr, '\0', MAX_PATH);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pWnd->m_EditToken.GetWindowText(m_StrToken);
CString m_StrHasTime;
CString m_StrSerialCount;
......@@ -221,6 +231,7 @@ void CDialog_Serial::OnBnClickedButton4()
st_JsonObject["tszSerialNumber"] = m_StrSerial.GetBuffer();
st_JsonArray.append(st_JsonObject);
st_JsonRoot["Array"] = st_JsonArray;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
......
......@@ -25,6 +25,10 @@ void CDialog_User::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_ListCtrlClient);
DDX_Control(pDX, IDC_CHECK1, m_CheckOnlineList);
DDX_Control(pDX, IDC_EDIT1, m_EditFlushTime);
DDX_Control(pDX, IDC_CHECK2, m_CheckAuto);
DDX_Control(pDX, IDC_BUTTON4, m_BtnModifyClient);
}
......@@ -33,6 +37,7 @@ BEGIN_MESSAGE_MAP(CDialog_User, CDialogEx)
ON_BN_CLICKED(IDC_BUTTON2, &CDialog_User::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &CDialog_User::OnBnClickedButton3)
ON_BN_CLICKED(IDC_BUTTON4, &CDialog_User::OnBnClickedButton4)
ON_BN_CLICKED(IDC_CHECK2, &CDialog_User::OnBnClickedCheck2)
END_MESSAGE_MAP()
......@@ -46,14 +51,15 @@ BOOL CDialog_User::OnInitDialog()
// TODO: 在此添加额外的初始化
m_ListCtrlClient.InsertColumn(0, _T("序号"), LVCFMT_LEFT, 40);
m_ListCtrlClient.InsertColumn(1, _T("用户名"), LVCFMT_LEFT, 85);
m_ListCtrlClient.InsertColumn(2, _T("级别"), LVCFMT_LEFT, 90);
m_ListCtrlClient.InsertColumn(2, _T("级别"), LVCFMT_LEFT, 70);
m_ListCtrlClient.InsertColumn(3, _T("在线时间(分钟)"), LVCFMT_LEFT, 100);
m_ListCtrlClient.InsertColumn(4, _T("剩余时间/过期时间"), LVCFMT_LEFT, 110);
m_ListCtrlClient.InsertColumn(4, _T("剩余时间/过期时间"), LVCFMT_LEFT, 120);
m_ListCtrlClient.InsertColumn(5, _T("充值类型"), LVCFMT_LEFT, 80);
m_ListCtrlClient.InsertColumn(6, _T("设备类型"), LVCFMT_LEFT, 60);
m_ListCtrlClient.InsertColumn(7, _T("是否在线"), LVCFMT_LEFT, 60);
m_ListCtrlClient.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_EditFlushTime.SetWindowText("1");
hUserWnd = m_hWnd;
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
......@@ -64,23 +70,39 @@ void CDialog_User::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
m_ListCtrlClient.DeleteAllItems();
CString m_StrIPAddr;
CString m_StrIPPort;
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
TCHAR tszIPAddr[MAX_PATH];
TCHAR tszIPPort[MAX_PATH];
TCHAR tszToken[MAX_PATH];
TCHAR tszUrlAddr[MAX_PATH];
memset(tszIPAddr, '\0', MAX_PATH);
memset(tszIPPort, '\0', MAX_PATH);
memset(tszToken, '\0', MAX_PATH);
memset(tszUrlAddr, '\0', MAX_PATH);
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/client/list"), m_StrIPAddr.GetBuffer(),m_StrIPPort.GetBuffer());
::GetWindowText(::GetDlgItem(hConfigWnd, IDC_EDIT1), tszIPAddr, MAX_PATH);
::GetWindowText(::GetDlgItem(hConfigWnd, IDC_EDIT2), tszIPPort, MAX_PATH);
::GetWindowText(::GetDlgItem(hConfigWnd, IDC_EDIT9), tszToken, MAX_PATH);
_stprintf(tszUrlAddr, _T("http://%s:%s/auth/client/list"), tszIPAddr, tszIPPort);
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Post(tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen);
Json::Value st_JsonRoot;
st_JsonRoot["xhToken"] = _ttoi64(tszToken);
if (BST_CHECKED == m_CheckOnlineList.GetCheck())
{
st_JsonRoot["Online"] = true;
}
else
{
st_JsonRoot["Online"] = false;
}
APIHelp_HttpRequest_Post(tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen);
JSONCPP_STRING st_JsonError;
Json::CharReaderBuilder st_ReaderBuilder;
st_JsonRoot.clear();
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_ReaderBuilder.newCharReader());
if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
......@@ -88,9 +110,8 @@ void CDialog_User::OnBnClickedButton1()
AfxMessageBox(_T("解析客户列表接口数据错误,无法继续"));
return;
}
for (unsigned int i = 0; i < st_JsonRoot["Array"].size(); i++)
for (unsigned int i = 0, j = 0; i < st_JsonRoot["Array"].size(); i++)
{
m_ListCtrlClient.InsertItem(i, _T(""));
TCHAR tszIndex[10];
memset(tszIndex, '\0', 10);
_itot_s(i, tszIndex, 10);
......@@ -98,18 +119,17 @@ void CDialog_User::OnBnClickedButton1()
Json::Value st_JsonArray = st_JsonRoot["Array"][i];
Json::Value st_JsonObject = st_JsonArray["st_UserInfo"];
m_ListCtrlClient.InsertItem(i, _T(""));
m_ListCtrlClient.SetItemText(i, 0, tszIndex);
m_ListCtrlClient.SetItemText(i, 1, st_JsonObject["tszUserName"].asCString());
m_ListCtrlClient.SetItemText(i, 2, lpszXLevelType[st_JsonObject["nUserLevel"].asInt() + 1]);
if (1 == st_JsonObject["nUserState"].asInt())
{
__int64x nTime = 0;
TCHAR tszTimeStr[64];
memset(tszTimeStr, '\0', sizeof(tszTimeStr));
BaseLib_OperatorTime_TimeToStr(tszTimeStr);
BaseLib_OperatorTimeSpan_GetForStr(tszTimeStr, st_JsonObject["tszLoginTime"].asCString(), &nTime, 2);
__int64x nTime = st_JsonArray["nOnlineTime"].asUInt64();
_stprintf(tszTimeStr, _T("%lld"), nTime);
m_ListCtrlClient.SetItemText(i, 3, tszTimeStr);
}
......@@ -119,6 +139,7 @@ void CDialog_User::OnBnClickedButton1()
m_ListCtrlClient.SetItemText(i, 7, lpszStuType[st_JsonObject["nUserState"].asInt()]);
}
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
UpdateWindow();
}
......@@ -134,10 +155,13 @@ void CDialog_User::OnBnClickedButton2()
}
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
CString m_StrUser = m_ListCtrlClient.GetItemText(nSelect, 1);
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pWnd->m_EditToken.GetWindowText(m_StrToken);
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
......@@ -148,6 +172,7 @@ void CDialog_User::OnBnClickedButton2()
st_JsonObject["tszUserName"] = m_StrUser.GetBuffer();
st_JsonRoot["st_UserInfo"] = st_JsonObject;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
......@@ -189,10 +214,12 @@ void CDialog_User::OnBnClickedButton3()
}
CString m_StrIPAddr;
CString m_StrIPPort;
CString m_StrToken;
CString m_StrUser = m_ListCtrlClient.GetItemText(nSelect, 1);
CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd);
pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr);
pWnd->m_EditIPPort.GetWindowText(m_StrIPPort);
pWnd->m_EditToken.GetWindowText(m_StrToken);
TCHAR tszUrlAddr[MAX_PATH];
memset(tszUrlAddr, '\0', MAX_PATH);
......@@ -203,6 +230,7 @@ void CDialog_User::OnBnClickedButton3()
st_JsonObject["tszUserName"] = m_StrUser.GetBuffer();
st_JsonRoot["st_UserInfo"] = st_JsonObject;
st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer());
int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
......@@ -245,3 +273,46 @@ void CDialog_User::OnBnClickedButton4()
CDialog_Modify m_DlgModify;
m_DlgModify.DoModal();
}
void CDialog_User::OnBnClickedCheck2()
{
// TODO: 在此添加控件通知处理程序代码
if (BST_CHECKED == m_CheckAuto.GetCheck())
{
bThread = TRUE;
hThread = CreateThread(NULL, 0, Dialog_User_Thread, this, 0, NULL);
}
else
{
bThread = FALSE;
DWORD dwRet = WaitForSingleObject(hThread, INFINITE);
if (WAIT_OBJECT_0 != dwRet)
{
TerminateThread(hThread, -1);
}
CloseHandle(hThread);
}
}
DWORD CDialog_User::Dialog_User_Thread(LPVOID lParam)
{
CDialog_User* pClass_This = (CDialog_User*)lParam;
time_t nTimeStart = time(NULL);
CString m_StrTime;
pClass_This->m_EditFlushTime.GetWindowText(m_StrTime);
int nTimeSecond = _ttoi(m_StrTime.GetBuffer());
while (pClass_This->bThread)
{
time_t nTimeEnd = time(NULL);
if ((nTimeEnd - nTimeStart) > nTimeSecond)
{
pClass_This->OnBnClickedButton1();
nTimeStart = time(NULL);
}
Sleep(100);
}
return 0;
}
\ No newline at end of file
......@@ -21,6 +21,10 @@ protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
BOOL bThread;
HANDLE hThread;
static DWORD WINAPI Dialog_User_Thread(LPVOID lParam);
public:
virtual BOOL OnInitDialog();
CListCtrl m_ListCtrlClient;
......@@ -28,4 +32,9 @@ public:
afx_msg void OnBnClickedButton2();
afx_msg void OnBnClickedButton3();
afx_msg void OnBnClickedButton4();
CButton m_CheckOnlineList;
CEdit m_EditFlushTime;
afx_msg void OnBnClickedCheck2();
CButton m_CheckAuto;
CButton m_BtnModifyClient;
};
......@@ -18,12 +18,17 @@
#define IDC_EDIT5 1005
#define IDC_BUTTON2 1006
#define IDC_BUTTON3 1007
#define IDC_EDIT10 1007
#define IDC_BUTTON4 1008
#define IDC_EDIT9 1008
#define IDC_COMBO1 1009
#define IDC_BUTTON5 1009
#define IDC_COMBO2 1010
#define IDC_EDIT6 1012
#define IDC_EDIT7 1013
#define IDC_CHECK1 1013
#define IDC_EDIT8 1014
#define IDC_CHECK2 1014
// Next default values for new objects
//
......@@ -31,7 +36,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_CONTROL_VALUE 1015
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
#include "../Authorize_Hdr.h"
BOOL XEngine_AuthorizeHTTP_Token(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR** pptszList, int nListCount)
{
int nSDLen = 4096;
TCHAR tszSDBuffer[4096];
TCHAR tszURLKey[128];
TCHAR tszURLValue[128];
LPCTSTR lpszAPILogin = _T("login");
LPCTSTR lpszAPIUPDate = _T("update");
LPCTSTR lpszAPIClose = _T("close");
memset(tszSDBuffer, '\0', sizeof(tszSDBuffer));
memset(tszURLKey, '\0', sizeof(tszURLKey));
memset(tszURLValue, '\0', sizeof(tszURLValue));
BaseLib_OperatorString_GetKeyValue(pptszList[0], "=", tszURLKey, tszURLValue);
if (0 == _tcsnicmp(lpszAPILogin, tszURLValue, _tcslen(lpszAPILogin)))
{
//http://app.xyry.org:5302/api?function=login&user=123123aa&pass=123123
TCHAR tszUserName[128];
TCHAR tszUserPass[128];
AUTHREG_USERTABLE st_UserTable;
memset(tszUserName, '\0', sizeof(tszUserName));
memset(tszUserPass, '\0', sizeof(tszUserPass));
memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE));
BaseLib_OperatorString_GetKeyValue(pptszList[1], "=", tszURLKey, tszUserName);
BaseLib_OperatorString_GetKeyValue(pptszList[2], "=", tszURLKey, tszUserPass);
//禁止重复登录
if (!Session_Token_GetUser(tszUserName, tszUserPass))
{
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 423, "user locked");
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,登录失败,用户:%s ,已经登录,无法继续"), lpszClientAddr, tszUserName);
return FALSE;
}
if (!Database_SQLite_UserQuery(tszUserName, &st_UserTable))
{
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 404, "user not found");
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,登录失败,用户名不存在"), lpszClientAddr);
return FALSE;
}
if ((_tcslen(tszUserPass) != _tcslen(st_UserTable.st_UserInfo.tszUserPass)) || (0 != _tcsncmp(tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcslen(tszUserPass))))
{
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 400, "password is incorrent");
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,登录失败,密码错误"), lpszClientAddr);
return FALSE;
}
//权限必须足够
if (0 != st_UserTable.st_UserInfo.nUserLevel)
{
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 400, "User permission error");
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,登录失败,客户端权限不足"), lpszClientAddr);
return FALSE;
}
XNETHANDLE xhToken = 0;
BaseLib_OperatorHandle_Create(&xhToken);
Session_Token_Insert(xhToken, &st_UserTable);
Protocol_Packet_HttpToken(tszSDBuffer, &nSDLen, xhToken, st_AuthConfig.st_XVerification.nTokenTimeout);
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,请求登录获得TOKEN:%lld 成功"), lpszClientAddr, xhToken);
}
else if (0 == _tcsnicmp(lpszAPIUPDate, tszURLValue, _tcslen(lpszAPIUPDate)))
{
//http://app.xyry.org:5302/api?function=update&token=1000112345
TCHAR tszUserToken[128];
memset(tszUserToken, '\0', sizeof(tszUserToken));
BaseLib_OperatorString_GetKeyValue(pptszList[1], "=", tszURLKey, tszUserToken);
if (!Session_Token_UPDate(_ttoi64(tszUserToken)))
{
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 404, "user not found");
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,更新TOKEN失败,不存在的Token:%s"), lpszClientAddr, tszUserToken);
return FALSE;
}
Protocol_Packet_HttpToken(tszSDBuffer, &nSDLen, _ttoi64(tszUserToken), st_AuthConfig.st_XVerification.nTokenTimeout);
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,请求更新TOKEN:%s 成功"), lpszClientAddr, tszUserToken);
}
else if (0 == _tcsnicmp(lpszAPIClose, tszURLValue, _tcslen(lpszAPIClose)))
{
//http://app.xyry.org:5302/api?function=close&token=1000112345
TCHAR tszUserToken[128];
memset(tszUserToken, '\0', sizeof(tszUserToken));
BaseLib_OperatorString_GetKeyValue(pptszList[1], "=", tszURLKey, tszUserToken);
Session_Token_Delete(_ttoi64(tszUserToken));
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen);
XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,请求关闭TOKEN:%s 成功"), lpszClientAddr, tszUserToken);
}
return TRUE;
}
\ No newline at end of file
#pragma once
BOOL XEngine_AuthorizeHTTP_Token(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, TCHAR** pptszList, int nListCount);
\ No newline at end of file
#pragma once
BOOL XEngine_AuthorizeHTTP_Client(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, LPCTSTR lpszMsgBuffer, int nMsgLen);
\ No newline at end of file
#pragma once
BOOL XEngine_AuthorizeHTTP_Serial(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, LPCTSTR lpszMsgBuffer, int nMsgLen);
\ No newline at end of file
#pragma once
BOOL XEngine_AuthorizeHTTP_User(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, LPCTSTR lpszMsgBuffer, int nMsgLen);
\ No newline at end of file
......@@ -72,6 +72,10 @@ extern XENGINE_SERVICECONFIG st_AuthConfig;
#include "Authorize_TCPTask.h"
#include "Authorize_WSTask.h"
#include "Authorize_HttpTask.h"
#include "AuthorizeHTTP_Post/AuthorizeHTTP_User.h"
#include "AuthorizeHTTP_Post/AuthorizeHTTP_Client.h"
#include "AuthorizeHTTP_Post/AuthorizeHTTP_Serial.h"
#include "AuthorizeHTTP_GET/AuthorizeHTTP_Token.h"
#ifdef _WINDOWS
#ifdef _DEBUG
......
......@@ -14,5 +14,5 @@ void __stdcall XEngine_Client_HttpClose(LPCTSTR lpszClientAddr, SOCKET hSocket,
BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr);
BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, int nNetType, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0);
BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, int nNetType, LPCTSTR lpszMsgBuffer = NULL, int nMsgLen = 0, LPCTSTR lpszPass = NULL);
\ No newline at end of file
BOOL XEngine_Client_TaskSend(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, int nNetType);
BOOL XEngine_SendMsg(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int nMsgLen, int nNetType, LPCTSTR lpszPass = NULL);
\ No newline at end of file
#include "Authorize_Hdr.h"
LPCSTR lpszKeyType[] = { "未知类型","分钟卡","天数卡","次数卡","自定义卡" };
void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName, __int64x nOnlineTimer, __int64x nLeftTimer, LPCSTR lpszLeftDate, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enSerialType, ENUM_PROTOCOLDEVICE_TYPE enDeviceType, LPVOID lParam)
{
if (nLeftTimer <= 0)
{
int nMsgLen = 0;
TCHAR tszMsgBuffer[1024];
XENGINE_PROTOCOLHDR st_ProtocolHdr;
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
memset(&st_ProtocolHdr, '\0', sizeof(XENGINE_PROTOCOLHDR));
st_ProtocolHdr.wHeader = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_HEADER;
......@@ -13,12 +16,19 @@ void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName
st_ProtocolHdr.unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_AUTH_TIMEDOUT;
st_ProtocolHdr.wTail = XENGIEN_COMMUNICATION_PACKET_PROTOCOL_TAIL;
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("用户:%s,地址:%s,没有剩余时间,已经通知客户单超时\r\n"), lpszUserName, lpszUserAddr);
XEngine_Client_TaskSend(lpszUserAddr, &st_ProtocolHdr, enDeviceType == ENUM_PROTOCOL_FOR_DEVICE_TYPE_PC ? XENGINE_AUTH_APP_NETTYPE_TCP : XENGINE_AUTH_APP_NETTYPE_WS);
int nNetType = enDeviceType == ENUM_PROTOCOL_FOR_DEVICE_TYPE_WEB ? XENGINE_AUTH_APP_NETTYPE_WS : XENGINE_AUTH_APP_NETTYPE_TCP;
Protocol_Packet_HDRComm(tszMsgBuffer, &nMsgLen, &st_ProtocolHdr, nNetType);
XEngine_Client_TaskSend(lpszUserAddr, tszMsgBuffer, nMsgLen, nNetType);
if (!st_AuthConfig.bTimeNotify)
{
XEngine_CloseClient(lpszUserAddr);
}
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("地址:%s,用户:%s,没有剩余时间,已经通知客户单超时"), lpszUserName, lpszUserAddr);
}
}
void __stdcall XEngine_TaskEvent_Token(XNETHANDLE xhToken, LPVOID lParam)
{
Session_Token_Delete(xhToken);
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("Token:%lld,已经超时,被移除服务器"), xhToken);
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册