LosaDev source snapshot 2019
This commit is contained in:
commit
c198676e97
20588 files changed
+8812878
No files matched your search
@@ -0,0 +1,72 @@
|
||||
// LS_TTBot.cpp : 응용 프로그램에 대한 클래스 동작을 정의합니다.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "LS_TTBot.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
|
||||
// CLS_TTBotApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CLS_TTBotApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CLS_TTBotApp 생성
|
||||
|
||||
CLS_TTBotApp::CLS_TTBotApp()
|
||||
{
|
||||
// TODO: 여기에 생성 코드를 추가합니다.
|
||||
// InitInstance에 모든 중요한 초기화 작업을 배치합니다.
|
||||
}
|
||||
|
||||
|
||||
// 유일한 CLS_TTBotApp 개체입니다.
|
||||
|
||||
CLS_TTBotApp theApp;
|
||||
|
||||
|
||||
// CLS_TTBotApp 초기화
|
||||
|
||||
BOOL CLS_TTBotApp::InitInstance()
|
||||
{
|
||||
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
|
||||
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다.
|
||||
// InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다.
|
||||
InitCommonControls();
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// 표준 초기화
|
||||
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
|
||||
// 아래에서 필요 없는 특정 초기화 루틴을 제거해야 합니다.
|
||||
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
|
||||
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
|
||||
// 적절한 내용으로 수정해야 합니다.
|
||||
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성한 응용 프로그램"));
|
||||
|
||||
CLS_TTBotDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: 여기에 대화 상자가 확인을 눌러 없어지는 경우 처리할
|
||||
// 코드를 배치합니다.
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: 여기에 대화 상자가 취소를 눌러 없어지는 경우 처리할
|
||||
// 코드를 배치합니다.
|
||||
}
|
||||
|
||||
// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고
|
||||
// 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다.
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// LS_TTBot.h : PROJECT_NAME 응용 프로그램에 대한 주 헤더 파일입니다.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error PCH에서 이 파일을 포함하기 전에 'stdafx.h'를 포함하십시오.
|
||||
#endif
|
||||
|
||||
#include "resource.h" // 주 기호
|
||||
|
||||
|
||||
// CLS_TTBotApp:
|
||||
// 이 클래스의 구현에 대해서는 LS_TTBot.cpp을 참조하십시오.
|
||||
//
|
||||
|
||||
class CLS_TTBotApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CLS_TTBotApp();
|
||||
|
||||
// 재정의
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// 구현
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CLS_TTBotApp theApp;
|
||||
@@ -0,0 +1,213 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 한국어(대한민국) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
|
||||
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(949)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
|
||||
"LANGUAGE 18, 1\r\n"
|
||||
"#pragma code_page(949)\r\n"
|
||||
"#include ""res\\LS_TTBot.rc2"" // Microsoft Visual C++에서 편집되지 않은 리소스\r\n"
|
||||
"#include ""afxres.rc"" // 표준 구성 요소\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON "res\\LS_TTBot.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "LS_TTBot 정보"
|
||||
FONT 9, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||
LTEXT "LS_TTBot Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 2012",IDC_STATIC,40,25,119,8
|
||||
DEFPUSHBUTTON "확인",IDOK,178,7,50,16,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_LS_TTBOT_DIALOG DIALOGEX 0, 0, 203, 247
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "로스트사가 트래픽 테스트봇"
|
||||
FONT 9, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_IP,19,14,67,12,ES_AUTOHSCROLL
|
||||
LTEXT "IP",IDC_STATIC,8,15,8,8
|
||||
LTEXT "Port",IDC_STATIC,95,16,13,8
|
||||
EDITTEXT IDC_EDIT_PORT,110,15,40,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Connect",IDC_BUTTON_CONNECT,156,14,38,14
|
||||
PUSHBUTTON "Disconnect",IDC_BUTTON_DISCONNECT,156,31,38,15
|
||||
GROUPBOX "SERVER",IDC_STATIC,4,3,194,55
|
||||
GROUPBOX "CONDITION",IDC_STATIC,4,59,194,55
|
||||
LTEXT "Interval",IDC_STATIC,9,71,24,8
|
||||
EDITTEXT IDC_EDIT_INTERVAL,34,69,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "Duration",IDC_STATIC,84,72,27,8
|
||||
EDITTEXT IDC_EDIT_COUNT,111,69,40,14,ES_AUTOHSCROLL
|
||||
GROUPBOX "CASE",IDC_STATIC,4,119,194,101
|
||||
COMBOBOX IDC_COMBO_TESTCASE,44,131,103,88,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Test Case",IDC_STATIC,10,132,31,8
|
||||
PUSHBUTTON "Play",IDC_BUTTON_PLAY,26,226,50,14
|
||||
PUSHBUTTON "Stop",IDC_BUTTON_STOP,113,226,50,14
|
||||
LISTBOX IDC_LIST_LOG,11,150,179,63,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Concurrent",IDC_STATIC,9,93,36,8
|
||||
EDITTEXT IDC_EDIT_CONCURRENT,46,91,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "Static",IDC_STATIC_SENDRECV,7,35,90,18
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041203b5"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "TODO: <회사 이름>"
|
||||
VALUE "FileDescription", "TODO: <파일 설명>"
|
||||
VALUE "FileVersion", "1.0.0.1"
|
||||
VALUE "InternalName", "LS_TTBot.exe"
|
||||
VALUE "LegalCopyright", "TODO: (c) <회사 이름>. All rights reserved."
|
||||
VALUE "OriginalFilename", "LS_TTBot.exe"
|
||||
VALUE "ProductName", "TODO: <제품 이름>"
|
||||
VALUE "ProductVersion", "1.0.0.1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "변환", 0x412, 949
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 228
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
|
||||
IDD_LS_TTBOT_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 196
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 240
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ABOUTBOX "LS_TTBot 정보(&A)..."
|
||||
END
|
||||
|
||||
#endif // 한국어(대한민국) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
|
||||
LANGUAGE 18, 1
|
||||
#pragma code_page(949)
|
||||
#include "res\LS_TTBot.rc2" // Microsoft Visual C++에서 편집되지 않은 리소스
|
||||
#include "afxres.rc" // 표준 구성 요소
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LS_TTBot", "LS_TTBot.vcxproj", "{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
Template|Win32 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Release|Win32.Build.0 = Release|Win32
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}.Template|Win32.Build.0 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,322 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="LS_TTBot"
|
||||
ProjectGUID="{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}"
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../include"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="../lib/LS_CSocketD.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../include"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
|
||||
MinimalRebuild="FALSE"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="../lib/LS_CSocket.lib"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="소스 파일"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\LS_TTBot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LS_TTBotDlg.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="헤더 파일"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\include\common.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LS_TTBot.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LS_TTBotDlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="리소스 파일"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File
|
||||
RelativePath=".\res\LS_TTBot.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LS_TTBot.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\LS_TTBot.rc2">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="네트워크"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\cBuffer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\cBuffer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioClientSocketTCP.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioClientSocketTCP.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioClientSocketUDP.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioClientSocketUDP.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="전송"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\network\cryption.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\cryption.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\FSM.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\FSM.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\ioHashString.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\ioHashString.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\md5.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\md5.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\NetworkSecurity.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\NetworkSecurity.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\Packet.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\Packet.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SecurityTCP.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SecurityTCP.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SecurityUDP.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SecurityUDP.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SP2Packet.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\network\SP2Packet.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="테스트케이스"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\ioTestBot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestBot.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestCase.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestCase.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestClient.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestClient.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestConnection.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestConnection.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestEcho.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestEcho.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestLogin.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ioTestLogin.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Protocol.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\res\LS_TTBot.manifest">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="LS_TTBot.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" 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="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{9187A6EF-CA11-4ADC-B9DE-E6D638C5B46D}</ProjectGuid>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>../lib/LS_CSocketD.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>../lib/LS_CSocket.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ioTestls_loginsvr.cpp" />
|
||||
<ClCompile Include="ioTestQuerySend1.cpp" />
|
||||
<ClCompile Include="ioTestQuerySend2.cpp" />
|
||||
<ClCompile Include="ioTestSend.cpp" />
|
||||
<ClCompile Include="ioTestUDPSend.cpp" />
|
||||
<ClCompile Include="LS_TTBot.cpp" />
|
||||
<ClCompile Include="LS_TTBotDlg.cpp" />
|
||||
<ClCompile Include="QueryData\QueryData.cpp" />
|
||||
<ClCompile Include="QueryData\QueryResultData.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cBuffer.cpp" />
|
||||
<ClCompile Include="ioClientSocketTCP.cpp" />
|
||||
<ClCompile Include="ioClientSocketUDP.cpp" />
|
||||
<ClCompile Include="network\cryption.cpp" />
|
||||
<ClCompile Include="network\FSM.cpp" />
|
||||
<ClCompile Include="network\ioHashString.cpp" />
|
||||
<ClCompile Include="network\md5.cpp" />
|
||||
<ClCompile Include="network\NetworkSecurity.cpp" />
|
||||
<ClCompile Include="network\Packet.cpp" />
|
||||
<ClCompile Include="network\SecurityTCP.cpp" />
|
||||
<ClCompile Include="network\SecurityUDP.cpp" />
|
||||
<ClCompile Include="network\SP2Packet.cpp" />
|
||||
<ClCompile Include="ioTestBot.cpp" />
|
||||
<ClCompile Include="ioTestCase.cpp" />
|
||||
<ClCompile Include="ioTestClient.cpp" />
|
||||
<ClCompile Include="ioTestConnection.cpp" />
|
||||
<ClCompile Include="ioTestEcho.cpp" />
|
||||
<ClCompile Include="ioTestLogin.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\common.h" />
|
||||
<ClInclude Include="ioTestls_loginsvr.h" />
|
||||
<ClInclude Include="ioTestQuerySend1.h" />
|
||||
<ClInclude Include="ioTestQuerySend2.h" />
|
||||
<ClInclude Include="ioTestSend.h" />
|
||||
<ClInclude Include="ioTestUDPSend.h" />
|
||||
<ClInclude Include="LS_TTBot.h" />
|
||||
<ClInclude Include="LS_TTBotDlg.h" />
|
||||
<ClInclude Include="QueryData\cSerialize.h" />
|
||||
<ClInclude Include="QueryData\QueryData.h" />
|
||||
<ClInclude Include="QueryData\QueryResultData.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="cBuffer.h" />
|
||||
<ClInclude Include="ioClientSocketTCP.h" />
|
||||
<ClInclude Include="ioClientSocketUDP.h" />
|
||||
<ClInclude Include="network\cryption.h" />
|
||||
<ClInclude Include="network\FSM.h" />
|
||||
<ClInclude Include="network\ioHashString.h" />
|
||||
<ClInclude Include="network\md5.h" />
|
||||
<ClInclude Include="network\NetworkSecurity.h" />
|
||||
<ClInclude Include="network\Packet.h" />
|
||||
<ClInclude Include="network\SecurityTCP.h" />
|
||||
<ClInclude Include="network\SecurityUDP.h" />
|
||||
<ClInclude Include="network\SP2Packet.h" />
|
||||
<ClInclude Include="ioTestBot.h" />
|
||||
<ClInclude Include="ioTestCase.h" />
|
||||
<ClInclude Include="ioTestClient.h" />
|
||||
<ClInclude Include="ioTestConnection.h" />
|
||||
<ClInclude Include="ioTestEcho.h" />
|
||||
<ClInclude Include="ioTestLogin.h" />
|
||||
<ClInclude Include="Protocol.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\LS_TTBot.ico" />
|
||||
<None Include="res\LS_TTBot.rc2" />
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="LS_TTBot.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="res\LS_TTBot.manifest" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="LS_TTBot.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?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;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="헤더 파일">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;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</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="네트워크">
|
||||
<UniqueIdentifier>{027f3021-f4f7-4097-9b0b-a37ab1ac8da4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="네트워크\전송">
|
||||
<UniqueIdentifier>{55da98d8-a07d-4093-87d3-09351e2f523e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="테스트케이스">
|
||||
<UniqueIdentifier>{416f4c52-fa59-4366-beb7-75f61a4dece3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="QueryData">
|
||||
<UniqueIdentifier>{9a5461bc-54fd-46e6-b750-94fefa3c94fd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="LS_TTBot.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LS_TTBotDlg.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>소스 파일</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cBuffer.cpp">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioClientSocketTCP.cpp">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioClientSocketUDP.cpp">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\cryption.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\FSM.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\ioHashString.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\md5.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\NetworkSecurity.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\Packet.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\SecurityTCP.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\SecurityUDP.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="network\SP2Packet.cpp">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestBot.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestCase.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestClient.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestConnection.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestEcho.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestLogin.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestSend.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QueryData\QueryData.cpp">
|
||||
<Filter>QueryData</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QueryData\QueryResultData.cpp">
|
||||
<Filter>QueryData</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestQuerySend1.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestQuerySend2.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestls_loginsvr.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ioTestUDPSend.cpp">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\common.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LS_TTBot.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LS_TTBotDlg.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>헤더 파일</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="cBuffer.h">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioClientSocketTCP.h">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioClientSocketUDP.h">
|
||||
<Filter>네트워크</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\cryption.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\FSM.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\ioHashString.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\md5.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\NetworkSecurity.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\Packet.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\SecurityTCP.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\SecurityUDP.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="network\SP2Packet.h">
|
||||
<Filter>네트워크\전송</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestBot.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestCase.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestClient.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestConnection.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestEcho.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestLogin.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Protocol.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestSend.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="QueryData\QueryData.h">
|
||||
<Filter>QueryData</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="QueryData\cSerialize.h">
|
||||
<Filter>QueryData</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="QueryData\QueryResultData.h">
|
||||
<Filter>QueryData</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestQuerySend1.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestQuerySend2.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestls_loginsvr.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ioTestUDPSend.h">
|
||||
<Filter>테스트케이스</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\LS_TTBot.ico">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</None>
|
||||
<None Include="res\LS_TTBot.rc2">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</None>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="LS_TTBot.rc">
|
||||
<Filter>리소스 파일</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Manifest Include="res\LS_TTBot.manifest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,416 @@
|
||||
// LS_TTBotDlg.cpp : 구현 파일
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "LS_TTBot.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
//#include "ioTestls_loginsvr.h"
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
CLS_TTBotDlg* g_Log;
|
||||
|
||||
enum TestTimers
|
||||
{
|
||||
TESTTIMER_ID = 1
|
||||
};
|
||||
|
||||
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
|
||||
|
||||
class CAboutDlg : public CDialog
|
||||
{
|
||||
public:
|
||||
CAboutDlg();
|
||||
|
||||
// 대화 상자 데이터
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
|
||||
|
||||
// 구현
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||||
{
|
||||
}
|
||||
|
||||
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CLS_TTBotDlg 대화 상자
|
||||
|
||||
|
||||
|
||||
CLS_TTBotDlg::CLS_TTBotDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CLS_TTBotDlg::IDD, pParent)
|
||||
{
|
||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_EDIT_INTERVAL, m_interval);
|
||||
DDX_Control(pDX, IDC_EDIT_COUNT, m_count);
|
||||
DDX_Control(pDX, IDC_EDIT_IP, m_IP);
|
||||
DDX_Control(pDX, IDC_EDIT_PORT, m_port);
|
||||
DDX_Control(pDX, IDC_COMBO_TESTCASE, m_testCases);
|
||||
DDX_Control(pDX, IDC_LIST_LOG, m_logs);
|
||||
DDX_Control(pDX, IDC_EDIT_CONCURRENT, m_concurrent);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CLS_TTBotDlg, CDialog)
|
||||
ON_WM_SYSCOMMAND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
//}}AFX_MSG_MAP
|
||||
ON_BN_CLICKED(IDC_BUTTON_PLAY, OnBnClickedButtonPlay)
|
||||
ON_BN_CLICKED(IDC_BUTTON_STOP, OnBnClickedButtonStop)
|
||||
ON_BN_CLICKED(IDC_BUTTON_CONNECT, OnBnClickedButtonConnect)
|
||||
ON_BN_CLICKED(IDC_BUTTON_DISCONNECT, OnBnClickedButtonDisconnect)
|
||||
ON_MESSAGE(WM_LOG,LOG)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CLS_TTBotDlg 메시지 처리기
|
||||
|
||||
BOOL CLS_TTBotDlg::OnInitDialog()
|
||||
{
|
||||
g_Log = this;
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
|
||||
|
||||
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
|
||||
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||
|
||||
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||
if (pSysMenu != NULL)
|
||||
{
|
||||
CString strAboutMenu;
|
||||
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||||
if (!strAboutMenu.IsEmpty())
|
||||
{
|
||||
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||
}
|
||||
}
|
||||
|
||||
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
|
||||
// 프레임워크가 이 작업을 자동으로 수행합니다.
|
||||
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
|
||||
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
|
||||
|
||||
// TODO: 여기에 추가 초기화 작업을 추가합니다.
|
||||
SetDefault();
|
||||
|
||||
return TRUE; // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다.
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
{
|
||||
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||||
{
|
||||
CAboutDlg dlgAbout;
|
||||
dlgAbout.DoModal();
|
||||
}
|
||||
else
|
||||
{
|
||||
CDialog::OnSysCommand(nID, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
|
||||
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
|
||||
// 프레임워크에서 이 작업을 자동으로 수행합니다.
|
||||
|
||||
void CLS_TTBotDlg::OnPaint()
|
||||
{
|
||||
if (IsIconic())
|
||||
{
|
||||
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트
|
||||
|
||||
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||
|
||||
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
|
||||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||
|
||||
// 아이콘을 그립니다.
|
||||
dc.DrawIcon(x, y, m_hIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDialog::OnPaint();
|
||||
}
|
||||
}
|
||||
|
||||
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
|
||||
// 이 함수를 호출합니다.
|
||||
HCURSOR CLS_TTBotDlg::OnQueryDragIcon()
|
||||
{
|
||||
return static_cast<HCURSOR>(m_hIcon);
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::SetDefault()
|
||||
{
|
||||
m_sequence = 0;
|
||||
m_max = 0;
|
||||
|
||||
m_IP.SetWindowText("172.20.20.115");
|
||||
m_port.SetWindowText("30911");
|
||||
m_interval.SetWindowText("0");
|
||||
m_concurrent.SetWindowText("30");
|
||||
m_count.SetWindowText("900000");
|
||||
|
||||
m_logs.ResetContent();
|
||||
m_testCases.ResetContent();
|
||||
m_testCases.AddString("Case Connection");
|
||||
m_testCases.AddString("Case Login");
|
||||
m_testCases.AddString("Case Echo");
|
||||
m_testCases.AddString("case SendTest");
|
||||
m_testCases.AddString("case Query (simple)");
|
||||
m_testCases.AddString("case Query (guild)");
|
||||
m_testCases.SetCurSel(4);
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::LOG(const TCHAR *format, ...)
|
||||
{
|
||||
m_lock.lock();
|
||||
TCHAR buffer[2048];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, format );
|
||||
_vsnprintf( buffer, sizeof(buffer), format, marker );
|
||||
va_end( marker );
|
||||
|
||||
m_logs.AddString( buffer );
|
||||
m_logs.SetTopIndex(m_logs.GetCount()-1);
|
||||
m_lock.unlock();
|
||||
}
|
||||
LRESULT CLS_TTBotDlg::LOG(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
m_lock.lock();
|
||||
if(wParam == NULL)
|
||||
{
|
||||
int nCount = m_logs.GetCount();
|
||||
if(nCount > 1000)
|
||||
{
|
||||
m_logs.ResetContent();
|
||||
}
|
||||
m_logs.AddString( _T("receive") );
|
||||
|
||||
m_logs.SetTopIndex(m_logs.GetCount()-1);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
TCHAR* data = (char*)wParam;
|
||||
int nCount = m_logs.GetCount();
|
||||
if(nCount > 1000)
|
||||
{
|
||||
m_logs.ResetContent();
|
||||
}
|
||||
m_logs.AddString( data);
|
||||
|
||||
m_logs.SetTopIndex(m_logs.GetCount()-1);
|
||||
delete data;
|
||||
|
||||
|
||||
}
|
||||
m_lock.unlock();
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnBnClickedButtonPlay()
|
||||
{
|
||||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
||||
LOG("Do play");
|
||||
TimerBegin();
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnBnClickedButtonStop()
|
||||
{
|
||||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
||||
LOG("Do stop");
|
||||
TimerEnd();
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnBnClickedButtonConnect()
|
||||
{
|
||||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnBnClickedButtonDisconnect()
|
||||
{
|
||||
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::TimerBegin()
|
||||
{
|
||||
TimerEnd();
|
||||
|
||||
CString IP, port, interval, max, concurrent;
|
||||
m_IP.GetWindowText(IP);
|
||||
m_port.GetWindowText(port);
|
||||
m_interval.GetWindowText(interval);
|
||||
m_concurrent.GetWindowText(concurrent);
|
||||
m_count.GetWindowText(max);
|
||||
|
||||
m_max = atoi(max);
|
||||
m_sequence = 0;
|
||||
int testCount = atoi(concurrent);
|
||||
|
||||
// 테스트 케이스 선택
|
||||
int index = m_testCases.GetCurSel();
|
||||
switch(index)
|
||||
{
|
||||
case 0 :
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestConnection;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestLogin;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestEcho;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
break;
|
||||
case 3 :
|
||||
{
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestSend;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestQuerySend1;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
for(int i = 0 ; i < testCount ; i++)
|
||||
{
|
||||
ioTestCase* testCase = new ioTestQuerySend2;
|
||||
testCase->Startup(IP, atoi(port));
|
||||
m_cases.push_back(testCase);
|
||||
}
|
||||
SetTimer(TESTTIMER_ID, atoi(interval), NULL);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::TimerEnd()
|
||||
{
|
||||
LOG("End testing");
|
||||
KillTimer(TESTTIMER_ID);
|
||||
|
||||
// 초기화
|
||||
DestroyTestCases();
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::DestroyTestCases()
|
||||
{
|
||||
LOG("RUN DestroyTestCases\n");
|
||||
for(TESTCASES::iterator it = m_cases.begin() ; it != m_cases.end() ; ++it)
|
||||
{
|
||||
ioTestCase* testCase = *it;
|
||||
if(!testCase) continue;
|
||||
|
||||
testCase->DoDisconnect();
|
||||
}
|
||||
LOG("END DestroyTestCases\n");
|
||||
Sleep(100);
|
||||
LOG("WWWW");
|
||||
for(TESTCASES::iterator it = m_cases.begin() ; it != m_cases.end() ; ++it)
|
||||
{
|
||||
ioTestCase* testCase = *it;
|
||||
if(!testCase) continue;
|
||||
|
||||
delete testCase;
|
||||
}
|
||||
LOG("EEEE");
|
||||
m_cases.clear();
|
||||
}
|
||||
|
||||
void CLS_TTBotDlg::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
++m_sequence;
|
||||
if(m_sequence >= m_max)
|
||||
{
|
||||
TimerEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
|
||||
switch(nIDEvent)
|
||||
{
|
||||
case TESTTIMER_ID :
|
||||
{
|
||||
for(TESTCASES::iterator it = m_cases.begin() ; it != m_cases.end() ; ++it)
|
||||
{
|
||||
ioTestCase* testCase = *it;
|
||||
if(!testCase) continue;
|
||||
|
||||
testCase->Run();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default :
|
||||
TimerEnd();
|
||||
break;
|
||||
}
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// LS_TTBotDlg.h : 헤더 파일
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "afxwin.h"
|
||||
#include "ioTestCase.h"
|
||||
#include "ioTestConnection.h"
|
||||
#include "ioTestLogin.h"
|
||||
#include "ioTestEcho.h"
|
||||
#include "ioTestSend.h"
|
||||
#include "ioTestQuerySend1.h"
|
||||
#include "ioTestQuerySend2.h"
|
||||
#include <vector>
|
||||
#include <ppl.h>
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
// CLS_TTBotDlg 대화 상자
|
||||
class CLS_TTBotDlg : public CDialog
|
||||
{
|
||||
// 생성
|
||||
public:
|
||||
CLS_TTBotDlg(CWnd* pParent = NULL); // 표준 생성자
|
||||
|
||||
// 대화 상자 데이터
|
||||
enum { IDD = 102 };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
|
||||
|
||||
public:
|
||||
void LOG(const TCHAR *format, ...);
|
||||
LRESULT LOG(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// 구현
|
||||
protected:
|
||||
void SetDefault();
|
||||
|
||||
void TimerBegin();
|
||||
void TimerEnd();
|
||||
|
||||
void DestroyTestCases();
|
||||
|
||||
protected:
|
||||
typedef std::vector<ioTestCase*> TESTCASES;
|
||||
|
||||
uint32 m_sequence, m_max;
|
||||
TESTCASES m_cases;
|
||||
|
||||
// 구현
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
|
||||
// 메시지 맵 함수를 생성했습니다.
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
CEdit m_interval;
|
||||
CEdit m_count;
|
||||
CEdit m_IP;
|
||||
CEdit m_port;
|
||||
public:
|
||||
CComboBox m_testCases;
|
||||
afx_msg void OnBnClickedButtonPlay();
|
||||
afx_msg void OnBnClickedButtonStop();
|
||||
afx_msg void OnBnClickedButtonConnect();
|
||||
afx_msg void OnBnClickedButtonDisconnect();
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
CListBox m_logs;
|
||||
CEdit m_concurrent;
|
||||
Concurrency::critical_section m_lock;
|
||||
};
|
||||
|
||||
extern CLS_TTBotDlg* g_Log;
|
||||
@@ -0,0 +1,642 @@
|
||||
#pragma once
|
||||
|
||||
//CONNECT
|
||||
#define CONNECT_OK 1
|
||||
#define CONNECT_ID_NOT 2
|
||||
#define CONNECT_PW_NOT 3
|
||||
#define CONNECT_ID_ALREADY 4
|
||||
#define CONNECT_EXCEPT 5
|
||||
#define CONNECT_EXPIRE_KEY 6
|
||||
#define CONNECT_EXITING_SERVER 7
|
||||
#define CONNECT_WRONG_CLIENT_VER 8
|
||||
#define CONNECT_WRONG_LOCAL_VER 9
|
||||
#define CONNECT_GAMESERVER_FULL 10
|
||||
|
||||
//#define CTPK_ABSTRACT 0x0fff
|
||||
#define STPK_ABSTRACT 0x2fff
|
||||
|
||||
enum Protocols
|
||||
{
|
||||
DTPK_QUERY = 0x0001,
|
||||
CTPK_CONNECT = 0x0002,
|
||||
CTPK_ABSTRACT = 0x0fff,
|
||||
|
||||
STPK_RESERVE_LOGOUT = 0x2001,
|
||||
STPK_CONNECT,
|
||||
STPK_CHAR_CREATE,
|
||||
STPK_LOGOUT,
|
||||
STPK_CHAR_DELETE,
|
||||
STPK_CREATE_ROOM,
|
||||
STPK_JOIN_ROOM,
|
||||
|
||||
//CLIENT SEND UCP PACKET
|
||||
CUPK_CONNECT = 0x4001,
|
||||
CUPK_SYNCTIME,
|
||||
CUPK_CHAT,
|
||||
CUPK_HOLE_CHECK,
|
||||
CUPK_RESERVE_ROOM_JOIN = 0x4006,
|
||||
CUPK_CHECK_KING_PING,
|
||||
|
||||
CUPK_NEW_USER_INFO = 0x4101,
|
||||
CUPK_EXIST_USER_INFO,
|
||||
};
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct _OnTest_
|
||||
{
|
||||
const int nId;
|
||||
int nIndex;
|
||||
char strMsg[1024];
|
||||
_OnTest_(): nId(2)
|
||||
{
|
||||
strcpy_s(strMsg,"abcdefg!!\n");
|
||||
};
|
||||
}OnTest_;
|
||||
#pragma pack(pop)
|
||||
|
||||
//#define CTPK_CONNECT 0x0002
|
||||
//#define CTPK_CHAR_CREATE 0x0003
|
||||
//#define CTPK_LOGOUT 0x0004
|
||||
//#define CTPK_CHAR_DELETE 0x0005
|
||||
//#define CTPK_PLAZA_ROOM_LIST 0x0006
|
||||
//#define CTPK_JOIN_ROOM 0x0007
|
||||
//#define CTPK_EXIT_ROOM 0x0008
|
||||
//#define CTPK_DROP_ITEM 0x0009
|
||||
//#define CTPK_PICK_ITEM 0x0010
|
||||
//#define CTPK_DROP_DIE 0x0011
|
||||
//#define CTPK_WEAPON_DIE 0x0012
|
||||
//#define CTPK_SYMBOL_DIE 0x0013
|
||||
//#define CTPK_CREATE_PLAZA 0x0014
|
||||
//#define CTPK_PRISONER_ESCAPE 0x0016
|
||||
//#define CTPK_CHANGE_CHAR 0x0017
|
||||
//#define CTPK_PRISONER_DROP 0x0018
|
||||
//#define CTPK_PUSHSTRUCT_DIE 0x0019
|
||||
//#define CTPK_PUSHSTRUCT_CREATE 0x0020
|
||||
//#define CTPK_CURRENT_DAMAGELIST 0x0021
|
||||
//#define CTPK_USE_ITEM 0x0023
|
||||
//#define CTPK_BUY_ITEM 0x0024
|
||||
//#define CTPK_EQUIP_SLOT_ITEM 0x0025
|
||||
//#define CTPK_SELL_SLOT_ITEM 0x0027
|
||||
//#define CTPK_INC_STAT 0x0028
|
||||
//#define CTPK_INIT_STAT 0x0029
|
||||
//#define CTPK_CREATE_OBJECTITEM 0x0030
|
||||
//#define CTPK_EVENT_SCENE_END 0x0031
|
||||
//#define CTPK_LEVELUP_ITEM 0x0032
|
||||
//#define CTPK_REPOSITION_FIELDITEM 0x0033
|
||||
//#define CTPK_SELL_EQUIP_ITEM 0x0034
|
||||
//#define CTPK_JOIN_BATTLEROOM_LIST 0x0035
|
||||
//#define CTPK_CREATE_BATTLEROOM 0x0036
|
||||
//#define CTPK_USER_BATTLEROOM_JOIN 0x0040
|
||||
//#define CTPK_USER_BATTLEROOM_LEAVE 0x0041
|
||||
//#define CTPK_SYMBOL_DAMAMGED 0x0042
|
||||
//#define CTPK_MACRO_COMMAND 0x0043
|
||||
//#define CTPK_PRISONERMODE 0x0047
|
||||
//#define CTPK_CHAR_SLOT_CHANGE 0x0049
|
||||
//#define CTPK_CREATE_VIRTUAL_CHAR 0x0050
|
||||
//#define CTPK_PASSAGE 0x0052
|
||||
//#define CTPK_PLAZA_COMMAND 0x0054
|
||||
//#define CTPK_PLAZA_USER_INVITE 0x0055
|
||||
//#define CTPK_CATCH_CHAR 0x0056
|
||||
//#define CTPK_ESCAPE_CATCH_CHAR 0x0057
|
||||
//#define CTPK_MOVE_SLOT_ITEM 0x0059
|
||||
//#define CTPK_ABSORB_REQUEST 0x0060
|
||||
//#define CTPK_CHAT_MODE 0x0061
|
||||
//#define CTPK_TUTORIAL_STEP 0x0066
|
||||
//#define CTPK_CHAR_LIMIT_CHECK 0x0067
|
||||
//#define CTPK_CHAR_DECORATION_BUY 0x0068
|
||||
//#define CTPK_PLAYRECORD_INFO 0x0069
|
||||
//#define CTPK_LAST_PLAYRECORD_INFO 0x0070
|
||||
//#define CTPK_CHAR_EXTEND 0x0071
|
||||
//#define CTPK_CHANGE_SINGLE_CHAR 0x0072
|
||||
//#define CTPK_VOICE_INFO 0x0074
|
||||
//#define CTPK_SEARCH_PLAZA_ROOM 0x0075
|
||||
//#define CTPK_BATTLEROOM_INVITE 0x0076
|
||||
//#define CTPK_RESERVE_BATTLEROOM_DELETE 0x0078
|
||||
//#define CTPK_LADDER_TEAM_RANK_LIST 0x0079
|
||||
//#define CTPK_HACK_QUIZ 0x0080
|
||||
//#define CTPK_RELAY_CHAT 0x0081
|
||||
//#define CTPK_ABUSE_QUIZ_START 0x0082
|
||||
//#define CTPK_ABUSE_QUIZ 0x0083
|
||||
//#define CTPK_BATTLEROOM_JOIN_INFO 0x0084
|
||||
//#define CTPK_TRIAL 0x0085
|
||||
//#define CTPK_AWARDING_INFO 0x0089
|
||||
//#define CTPK_AWARDING_RESULT 0x0090
|
||||
//#define CTPK_FOLLOW_USER 0x0091
|
||||
//#define CTPK_DEVELOPER_MACRO 0x0092
|
||||
//#define CTPK_REQUEST_REVIVAL_TIME 0x0093
|
||||
//#define CTPK_ETCITEM_BUY 0x0095
|
||||
//#define CTPK_BATTLEROOM_COMMAND 0x0096
|
||||
//#define CTPK_MOVING_SERVER 0x0097
|
||||
//#define CTPK_FRIEND_LIST_MSG 0x0098
|
||||
//#define CTPK_FRIEND_COMMAND 0x0099
|
||||
//#define CTPK_FRIEND_DELETE 0x0100
|
||||
//#define CTPK_DELETE_FRIEND_BY_WEB 0x0101
|
||||
//#define CTPK_USER_LOGIN 0x0102
|
||||
//#define CTPK_REGISTERED_USER 0x0103
|
||||
//#define CTPK_USER_POS_REFRESH 0x0104
|
||||
//#define CTPK_PLAZA_INVITE_LIST 0x0105
|
||||
//#define CTPK_CHANNEL_INVITE 0x0106
|
||||
//#define CTPK_CHANNEL_LEAVE 0x0107
|
||||
//#define CTPK_CHANNEL_CHAT 0x0108
|
||||
//#define CTPK_CHANNEL_CREATE 0x0109
|
||||
//#define CTPK_BATTLEROOM_INVITE_LIST 0x0110
|
||||
//#define CTPK_EXERCISE_CHAR_CREATE 0x0111
|
||||
//#define CTPK_USER_INFO_REFRESH 0x0112
|
||||
//#define CTPK_MEMO_SEND_MSG 0x0113
|
||||
//#define CTPK_OFFLINE_MEMO_MSG 0x0114
|
||||
//#define CTPK_BANKRUPTCY_PESO 0x0115
|
||||
//#define CTPK_SERVICE_CHAR 0x0116
|
||||
//#define CTPK_USER_POS_INDEX 0x0117
|
||||
//#define CTPK_CHAR_CHARGE 0x0119
|
||||
//#define CTPK_JOIN_HEADQUARTERS 0x0120
|
||||
//#define CTPK_GUILD_RANK_LIST 0x0121
|
||||
//#define CTPK_GUILD_INFO 0x0122
|
||||
//#define CTPK_GUILD_JOINER_CHANGE 0x0123
|
||||
//#define CTPK_GUILD_ENTRY_APP 0x0124
|
||||
//#define CTPK_GUILD_ENTRY_CANCEL 0x0125
|
||||
//#define CTPK_GUILD_ENTRY_DELAY_MEMBER 0x0126
|
||||
//#define CTPK_GUILD_ENTRY_AGREE 0x0127
|
||||
//#define CTPK_GUILD_ENTRY_REFUSE 0x0128
|
||||
//#define CTPK_GUILD_INVITATION 0x0129
|
||||
//#define CTPK_GUILD_LEAVE 0x0130
|
||||
//#define CTPK_GUILD_TITLE_CHANGE 0x0131
|
||||
//#define CTPK_GUILD_MASTER_CHANGE 0x0132
|
||||
//#define CTPK_GUILD_POSITION_CHANGE 0x0133
|
||||
//#define CTPK_GUILD_KICK_OUT 0x0134
|
||||
//#define CTPK_FRIEND_REQUEST_LIST 0x0135
|
||||
//#define CTPK_FRIEND_APPLICATION 0x0136
|
||||
//#define CTPK_PLAZA_JOIN_INFO 0x0137
|
||||
//#define CTPK_USER_ENTRY_REFRESH 0x0138
|
||||
//#define CTPK_HEADQUARTERS_COMMAND 0x0139
|
||||
//#define CTPK_GUILD_CHAT 0x0140
|
||||
//#define CTPK_GUILD_EXIST 0x0141
|
||||
//#define CTPK_USER_INFO_EXIST 0x0142
|
||||
//#define CTPK_GUILD_MARK_KEY_VALUE 0x0143
|
||||
//#define CTPK_VOICE_INFO_USER 0x0144
|
||||
//#define CTPK_LADDER_TEAM_LIST 0x0145
|
||||
//#define CTPK_CREATE_LADDERTEAM 0x0146
|
||||
//#define CTPK_JOIN_LADDERTEAM 0x0147
|
||||
//#define CTPK_LADDERTEAM_MACRO 0x0148
|
||||
//#define CTPK_LADDERTEAM_JOIN_INFO 0x0149
|
||||
//#define CTPK_LADDERTEAM_LEAVE 0x0150
|
||||
//#define CTPK_LADDERTEAM_INVITE_LIST 0x0151
|
||||
//#define CTPK_LADDERTEAM_INVITE 0x0152
|
||||
//#define CTPK_LADDER_TEAM_RANKING 0x0153
|
||||
//#define CTPK_LADDER_BATTLE_RESTART 0x0154
|
||||
//#define CTPK_LADDER_OTHER_NAME_CHANGE 0x0155
|
||||
//#define CTPK_LADDER_BATTLE_REQUEST_AGREE 0x0156
|
||||
//#define CTPK_LADDER_USER_HQ_MOVE 0x0157
|
||||
//#define CTPK_GUILD_MARK_KEY_VALUE_DELETE 0x0158
|
||||
//#define CTPK_ETCITEM_USE 0x0159
|
||||
//#define CTPK_MOVIE_CONTROL 0x0160
|
||||
//#define CTPK_PRESENT_REQUEST 0x0161
|
||||
//#define CTPK_GUILD_TITLE_SYNC 0x0162
|
||||
//#define CTPK_PROTECT_CHECK 0x0163
|
||||
//#define CTPK_GET_CASH 0x0164
|
||||
//#define CTPK_HOLE_SEND_COMPLETE 0x0165
|
||||
//#define CTPK_UDP_RECV_TIMEOUT 0x0166
|
||||
//#define CTPK_JOIN_SERVER_LOBBY_INFO 0x0167
|
||||
//#define CTPK_SERVER_LOBBY_CHAT 0x0168
|
||||
//#define CTPK_GROWTH_LEVEL_UP 0x0169
|
||||
//#define CTPK_GROWTH_LEVEL_INIT 0x0170
|
||||
//#define CTPK_GUILD_USER_LIST 0x0171
|
||||
//#define CTPK_EVENT_DATA_UPDATE 0x0172
|
||||
//#define CTPK_USER_KICK_VOTE 0x0173
|
||||
//#define CTPK_CHAR_CHANGE_PERIOD 0x0174
|
||||
//#define CTPK_ETCITEM_ACTION 0x0175
|
||||
//#define CTPK_MYROOM_SERVER_CHANGE 0x0176
|
||||
//#define CTPK_SERVER_LOBBY_INFO 0x0177
|
||||
//#define CTPK_CAMP_DATA_SYNC 0x0178
|
||||
//#define CTPK_CAMP_CAHNGE_POS 0x0179
|
||||
//#define CTPK_CAMP_BATTLE_END_LEAVE_TEAM 0x0180
|
||||
//#define CTPK_FISHING 0x0181
|
||||
//#define CTPK_SERVER_ALARM_MSG 0x0182
|
||||
//#define CTPK_PRESENT_RECV 0x0183
|
||||
//#define CTPK_PRESENT_SELL 0x0184
|
||||
//#define CTPK_EXTRAITEM_BUY 0x0185
|
||||
//#define CTPK_EXTRAITEM_SELL 0x0186
|
||||
//#define CTPK_EXTRAITEM_CHANGE 0x0187
|
||||
//#define CTPK_ETCITEM_SELL 0x0188
|
||||
//#define CTPK_TIME_GROWTH_ADD 0x0189
|
||||
//#define CTPK_TIME_GROWTH_REMOVE 0x0190
|
||||
//#define CTPK_TIME_GROWTH_CHECK 0x0191
|
||||
//#define CTPK_USE_MONSTER_COIN 0x0192
|
||||
//#define CTPK_FIRST_CHANGE_ID 0x0193
|
||||
//#define CTPK_TURN_END_VIEW_STATE 0x0194
|
||||
//#define CTPK_ITEM_MOVE_DROP 0x0195
|
||||
//#define CTPK_PRESENT_BUY 0x0196
|
||||
//#define CTPK_ALL_ITEM_DROP 0x0197
|
||||
//#define CTPK_GASHAPON_LIST 0x0198
|
||||
//#define CTPK_EXCAVATION_COMMAND 0x0199
|
||||
//#define CTPK_BALLSTRUCT_REPOSITION 0x0200
|
||||
//#define CTPK_FOOTBALL_GOAL 0x0201
|
||||
//#define CTPK_CONTROL_KEYS 0x0202
|
||||
//#define CTPK_QUEST_OCCUR 0x0203
|
||||
//#define CTPK_QUEST_ATTAIN 0x0204
|
||||
//#define CTPK_QUEST_ALARM 0x0205
|
||||
//#define CTPK_QUEST_REWARD 0x0206
|
||||
//#define CTPK_QUEST_ALL_DELETE 0x0207
|
||||
//#define CTPK_MEDALITEM_CHANGE 0x0208
|
||||
//#define CTPK_PRESENT_ALL_DELETE 0x0209
|
||||
//#define CTPK_HERO_TOP100_DATA 0x0210
|
||||
//#define CTPK_HERO_MATCH_OTHER_INFO 0x0211
|
||||
//#define CTPK_TRADE_CREATE 0x0212
|
||||
//#define CTPK_TRADE_LIST 0x0213
|
||||
//#define CTPK_TRADE_ITEM 0x0214
|
||||
//#define CTPK_TRADE_CANCEL 0x0215
|
||||
//#define CTPK_CHANGE_GANGSI 0x0216
|
||||
//#define CTPK_MACHINESTRUCT 0x0218
|
||||
//#define CTPK_EVENT_SHOP_GOODS_LIST 0x0219
|
||||
//#define CTPK_EVENT_SHOP_GOODS_BUY 0x0220
|
||||
//#define CTPK_EVENT_SHOP_STATE 0x0221
|
||||
//#define CTPK_EVENT_SHOP_BUY_USER_CLEAR 0x0222
|
||||
//#define CTPK_ETCITEM_SWITCH 0x0223
|
||||
//
|
||||
//#define CTPK_ROOM_STEALTH_ENTER 0x0225
|
||||
//#define CTPK_CAMP_SEASON_BONUS 0x0226
|
||||
//#define CTPK_ETCITEM_MOTION_STATE 0x0227
|
||||
//#define CTPK_CUSTOM_ITEM_SKIN_UNIQUE_INDEX 0x0228
|
||||
//#define CTPK_CUSTOM_ITEM_SKIN_DELETE 0x0229
|
||||
//#define CTPK_PUSHSTRUCT_OWNER_CLEAR 0x0230
|
||||
//#define CTPK_ETCITEM_MOTION_OPTION 0x0231
|
||||
//#define CTPK_PRESENT_TEST_SEND 0x0232
|
||||
//#define CTPK_EXPERIENCE_MODE 0x0233
|
||||
//#define CTPK_CHANGE_MY_LEADER 0x0234
|
||||
//#define CTPK_SET_MY_RENTAL 0x0235
|
||||
//#define CTPK_USER_CHAR_INFO_REFRESH 0x0236
|
||||
//#define CTPK_USER_CHAR_SUB_INFO_REFRESH 0x0237
|
||||
//#define CTPK_USER_CHAR_RENTAL_REQUEST 0x0238
|
||||
//#define CTPK_USER_CHAR_RENTAL_AGREE 0x0239
|
||||
//#define CTPK_USER_CHAR_RENTAL_TIME_END 0x0240
|
||||
//#define CTPK_HEADQUARTERS_STATE_CHANGE 0x0241
|
||||
//#define CTPK_HEADQUARTERS_OPTION_CMD 0x0242
|
||||
//#define CTPK_HEADQUARTERS_INFO 0x0243
|
||||
//#define CTPK_HEADQUARTERS_USER_INVITE 0x0244
|
||||
//#define CTPK_HEADQUARTERS_JOIN_AGREE 0x0245
|
||||
//#define CTPK_INSERT_BESTFRIEND 0x0246
|
||||
//#define CTPK_INSERT_BESTFRIEND_FAILED 0x0247
|
||||
//#define CTPK_DISMISS_BESTFRIEND 0x0248
|
||||
//#define CTPK_HEADQUARTERS_INVITE_LIST 0x0249
|
||||
//#define CTPK_BESTFRIEND_EXCEPTION_LIST 0x0250
|
||||
//#define CTPK_PICK_REWARD_ITEM 0x0251
|
||||
//#define CTPK_GET_MILEAGE 0x0252
|
||||
//#define CTPK_SIMPLE_USER_INFO_REFRESH 0x0253
|
||||
//#define CTPK_MACRO_NOTIFY 0x0254
|
||||
////SERVER SEND TCP GAME PACKET
|
||||
//#define STPK_RESERVE_LOGOUT 0x2001
|
||||
//#define STPK_CONNECT 0x2002
|
||||
//#define STPK_CHAR_CREATE 0x2003
|
||||
//#define STPK_LOGOUT 0x2004
|
||||
//#define STPK_CHAR_DELETE 0x2005
|
||||
//#define STPK_CREATE_ROOM 0x2006
|
||||
//#define STPK_JOIN_ROOM 0x2007
|
||||
//#define STPK_JOIN_ROOMDATA 0x2008
|
||||
//#define STPK_JOIN_USERDATA 0x2009
|
||||
//#define STPK_LEAVE_USERDATA 0x2010
|
||||
//#define STPK_EXIT_ROOM 0x2011
|
||||
//#define STPK_HOST_USERID 0x2012
|
||||
//#define STPK_CHANGE_UDP_INFO 0x2013
|
||||
//#define STPK_DBCHAR_EQUIPDATA 0x2014
|
||||
//#define STPK_CHAR_EQUIPDATA 0x2015
|
||||
//#define STPK_PICK_ITEM_FAIL 0x2016
|
||||
//#define STPK_FIELD_ITEM_LIST 0x2017
|
||||
//#define STPK_ZERO_HP 0x2018
|
||||
//#define STPK_USER_REVIVAL 0x2019
|
||||
//#define STPK_ROUND_READY 0x2020
|
||||
//#define STPK_ROUND_START 0x2021
|
||||
//#define STPK_ROUND_END 0x2022
|
||||
//#define STPK_FIELD_ITEM_SUPPLY 0x2023
|
||||
//#define STPK_DROP_ITEM 0x2024
|
||||
//#define STPK_PICK_ITEM 0x2025
|
||||
//#define STPK_DROP_DIE 0x2026
|
||||
//#define STPK_WEAPON_DIE 0x2027
|
||||
//#define STPK_SYMBOL_DIE 0x2028
|
||||
//#define STPK_PLAZA_ROOM_LIST 0x2029
|
||||
//#define STPK_SYMBOL_ACTIVITY 0x2030
|
||||
//#define STPK_CREATE_PLAZA 0x2032
|
||||
//#define STPK_PRISONERMODE 0x2033
|
||||
//#define STPK_PRISONER_ESCAPE 0x2034
|
||||
//#define STPK_SLOT_ITEM 0x2035
|
||||
//#define STPK_CHANGE_CHAR 0x2036
|
||||
//#define STPK_START_SELECT_CHAR 0x2037
|
||||
//#define STPK_PUSHSTRUCT_DIE 0x2038
|
||||
//#define STPK_PUSHSTRUCT_INFO 0x2039
|
||||
//#define STPK_FINAL_ROUND_RESULT 0x2040
|
||||
//#define STPK_JOIN_ROOM_INFO_END 0x2041
|
||||
//#define STPK_MODE_SCORE 0x2042
|
||||
//#define STPK_KING_TAKE 0x2043
|
||||
//#define STPK_CHANGE_PERIOD 0x2044
|
||||
//#define STPK_JOIN_NEW_USERDATA 0x2046
|
||||
//#define STPK_PRISONER_DROP 0x2047
|
||||
//#define STPK_BUY_ITEM 0x2048
|
||||
//#define STPK_EQUIP_SLOT_ITEM 0x2049
|
||||
//#define STPK_SELL_SLOT_ITEM 0x2051
|
||||
//#define STPK_START_SET_NEXT_MODE 0x2052
|
||||
//#define STPK_END_SET_NEXT_MODE 0x2053
|
||||
//#define STPK_INC_STAT 0x2054
|
||||
//#define STPK_INIT_STAT 0x2055
|
||||
//#define STPK_MODE_INFO 0x2056
|
||||
//#define STPK_CHAR_LOAD 0x2058
|
||||
//#define STPK_CHAR_ALL_LOAD 0x2059
|
||||
//#define STPK_ROUND_TIME_STOP 0x2060
|
||||
//#define STPK_SELL_EQUIP_ITEM 0x2061
|
||||
//#define STPK_ROUND_JOIN_OBSERVER 0x2062
|
||||
//#define STPK_ROUND_JOIN 0x2063
|
||||
//#define STPK_ROUND_JOIN_VIEW 0x2064
|
||||
//#define STPK_LEVELUP_ITEM 0x2065
|
||||
//#define STPK_REPOSITION_FIELDITEM 0x2066
|
||||
//#define STPK_OBJECT_SUPPLY 0x2067
|
||||
//#define STPK_FIELD_ITEM_DELETE 0x2068
|
||||
//#define STPK_BATTLEROOM_LIST 0x2069
|
||||
//#define STPK_ABSORB_APPLY 0x2070
|
||||
//#define STPK_CREATE_BATTLEROOM 0x2071
|
||||
//#define STPK_LADDER_TEAM_RANK_LIST 0x2072
|
||||
//#define STPK_USER_BATTLEROOM_JOIN 0x2075
|
||||
//#define STPK_BATTLEROOM_INFO 0x2076
|
||||
//#define STPK_BATTLEROOM_USER_INFO 0x2077
|
||||
//#define STPK_BATTLEROOM_LEAVE 0x2078
|
||||
//#define STPK_DROP_ITEM_FAIL 0x2079
|
||||
//#define STPK_MACRO_COMMAND 0x2080
|
||||
//#define STPK_BATTLE_ROOM_END 0x2084
|
||||
//#define STPK_CHAR_SLOT_CHANGE 0x2085
|
||||
//#define STPK_PASSAGE 0x2086
|
||||
//#define STPK_PLAZA_COMMAND 0x2089
|
||||
//#define STPK_CATCH_CHAR 0x2090
|
||||
//#define STPK_ESCAPE_CATCH_CHAR 0x2091
|
||||
//#define STPK_MOVE_SLOT_ITEM 0x2092
|
||||
//#define STPK_PLAYING_USER_DATA 0x2099
|
||||
//#define STPK_TUTORIAL_STEP 0x2101
|
||||
//#define STPK_MOVING_ROOM 0x2102
|
||||
//#define STPK_CLASSEXPERT_SET 0x2103
|
||||
//#define STPK_CLASSPRICE 0x2104
|
||||
//#define STPK_CHAR_LIMIT_CHECK 0x2105
|
||||
//#define STPK_CHAR_DECORATION_BUY 0x2106
|
||||
//#define STPK_PLAYRECORD_INFO 0x2107
|
||||
//#define STPK_CHAR_EXTEND 0x2108
|
||||
//#define STPK_CHANGE_SINGLE_CHAR 0x2109
|
||||
//#define STPK_ANNOUNCE 0x2110
|
||||
//#define STPK_VOICE_INFO 0x2111
|
||||
//#define STPK_CHANGE_STAGE 0x2113
|
||||
//#define STPK_BATTLEROOM_INVITE 0x2114
|
||||
//#define STPK_PING 0x2116
|
||||
//#define STPK_HACK_ANNOUNCE 0x2117
|
||||
//#define STPK_CHAT_MODE 0x2118
|
||||
//#define STPK_HACK_QUIZ 0x2119
|
||||
//#define STPK_RELAY_CHAT 0x2120
|
||||
//#define STPK_ABUSE_ANNOUNCE 0x2121
|
||||
//#define STPK_ABUSE_QUIZ 0x2122
|
||||
//#define STPK_BATTLEROOM_JOIN_INFO 0x2123
|
||||
//#define STPK_BATTLEROOM_INVITE_RESULT 0x2125
|
||||
//#define STPK_EXIT_ROOM_PENALTY 0x2126
|
||||
//#define STPK_AWARDING_INFO 0x2127
|
||||
//#define STPK_AWARDING_RESULT 0x2128
|
||||
//#define STPK_FOLLOW_USER 0x2129
|
||||
//#define STPK_AWARD_DATA 0x2130
|
||||
//#define STPK_DEVELOPER_MACRO 0x2132
|
||||
//#define STPK_UPDATE_SCORE_GAUGE 0x2133
|
||||
//#define STPK_ANSWER_REVIVAL_TIME 0x2134
|
||||
//#define STPK_REQUEST_BANKRUPT 0x2135
|
||||
//#define STPK_ETCITEM_BUY 0x2136
|
||||
//#define STPK_GRADE_CLASS_UP_BONUS 0x2138
|
||||
//#define STPK_BATTLEROOM_COMMAND 0x2139
|
||||
//#define STPK_SEARCH_PLAZA_ROOM 0x2140
|
||||
//#define STPK_PLAZA_USER_INVITE 0x2141
|
||||
//#define STPK_MOVING_SERVER 0x2142
|
||||
//#define STPK_MOVING_SERVER_COMPLETE 0x2143
|
||||
//#define STPK_RESERVE_ROOM_JOIN 0x2144
|
||||
//#define STPK_FRIEND_LIST_MSG 0x2145
|
||||
//#define STPK_FRIEND_COMMAND 0x2146
|
||||
//#define STPK_FRIEND_DELETE 0x2147
|
||||
//#define STPK_USER_LOGIN 0x2148
|
||||
//#define STPK_REGISTERED_USER 0x2149
|
||||
//#define STPK_USER_POS_REFRESH 0x2151
|
||||
//#define STPK_PLAZA_INVITE_LIST 0x2152
|
||||
//#define STPK_CHANNEL_INVITE 0x2153
|
||||
//#define STPK_CHANNEL_JOIN 0x2154
|
||||
//#define STPK_CHANNEL_LEAVE 0x2155
|
||||
//#define STPK_CHANNEL_CHAT 0x2156
|
||||
//#define STPK_CHANNEL_ALL_USER 0x2157
|
||||
//#define STPK_CHANNEL_CREATE 0x2158
|
||||
//#define STPK_BATTLEROOM_INVITE_LIST 0x2159
|
||||
//#define STPK_EXERCISE_CHAR_CREATE 0x2160
|
||||
//#define STPK_USER_INFO_REFRESH 0x2161
|
||||
//#define STPK_MEMO_SEND_MSG 0x2162
|
||||
//#define STPK_OFFLINE_MEMO_MSG 0x2163
|
||||
//#define STPK_BANKRUPTCY_PESO 0x2164
|
||||
//#define STPK_USER_POS_INDEX 0x2165
|
||||
//#define STPK_PUSHSTRUCT_CREATE 0x2166
|
||||
//#define STPK_BATTLEROOM_ENTERUSER_SYNC 0x2167
|
||||
//#define STPK_RESERVE_SERVER_MOVE 0x2168
|
||||
//#define STPK_FINAL_RESULT_USER_INFO 0x2169
|
||||
//#define STPK_TOTAL_REG_USER_CNT 0x2171
|
||||
//#define STPK_START_CHAR_LIMITDATE 0x2172
|
||||
//#define STPK_UPDATE_CHAR_LIMITDATE 0x2173
|
||||
//#define STPK_CHAR_CHARGE 0x2174
|
||||
//#define STPK_EVENT_DATA 0x2175
|
||||
//#define STPK_USER_RECORD_DATA 0x2176
|
||||
//#define STPK_CREATE_GUILD 0x2177
|
||||
//#define STPK_MY_GUILD_INFO 0x2178
|
||||
//#define STPK_ENTRY_DELAY_GUILD_LIST 0x2179
|
||||
//#define STPK_GUILD_ENTRY_DELAY_MEMBER 0x2180
|
||||
//#define STPK_GUILD_RANK_LIST 0x2181
|
||||
//#define STPK_GUILD_INFO 0x2182
|
||||
//#define STPK_GUILD_MEMBER_LIST 0x2183
|
||||
//#define STPK_GUILD_JOINER_CHANGE 0x2184
|
||||
//#define STPK_GUILD_ENTRY_APP 0x2185
|
||||
//#define STPK_GUILD_ENTRY_AGREE 0x2186
|
||||
//#define STPK_ENTRY_DELAY_GUILD_DELETE 0x2187
|
||||
//#define STPK_GUILD_INVITATION 0x2188
|
||||
//#define STPK_GUILD_INVITED 0x2189
|
||||
//#define STPK_GUILD_LEAVE 0x2190
|
||||
//#define STPK_GUILD_MASTER_CHANGE 0x2191
|
||||
//#define STPK_GUILD_POSITION_CHANGE 0x2192
|
||||
//#define STPK_GUILD_KICK_OUT 0x2193
|
||||
//#define STPK_GUILD_SIMPLE_DATA 0x2194
|
||||
//#define STPK_SYMBOL_DIE_LIST 0x2196
|
||||
//#define STPK_FRIEND_REQUEST_LIST 0x2197
|
||||
//#define STPK_FRIEND_APPLICATION 0x2198
|
||||
//#define STPK_PLAZA_JOIN_INFO 0x2199
|
||||
//#define STPK_USER_ENTRY_REFRESH 0x2200
|
||||
//#define STPK_GUILD_MARK_CHANGE 0x2201
|
||||
//#define STPK_MYGUILD_MEMBER_LIST 0x2202
|
||||
//#define STPK_MYGUILD_LEAVE_LIST 0x2203
|
||||
//#define STPK_GUILD_CHAT 0x2204
|
||||
//#define STPK_GUILD_EXIST 0x2205
|
||||
//#define STPK_USER_INFO_EXIST 0x2206
|
||||
//#define STPK_GUILD_MARK_KEY_VALUE 0x2207
|
||||
//#define STPK_LADDER_TEAM_LIST 0x2208
|
||||
//#define STPK_CREATE_LADDERTEAM 0x2209
|
||||
//#define STPK_JOIN_LADDERTEAM 0x2210
|
||||
//#define STPK_LADDERTEAM_INFO 0x2211
|
||||
//#define STPK_LADDERTEAM_USER_INFO 0x2212
|
||||
//#define STPK_LADDERTEAM_LEAVE 0x2213
|
||||
//#define STPK_LADDERTEAM_MACRO 0x2214
|
||||
//#define STPK_LADDERTEAM_JOIN_INFO 0x2215
|
||||
//#define STPK_LADDERTEAM_INVITE_LIST 0x2216
|
||||
//#define STPK_LADDERTEAM_INVITED 0x2217
|
||||
//#define STPK_LADDER_TEAM_RANKING 0x2218
|
||||
//#define STPK_LADDER_OTHER_TEAM_INFO 0x2219
|
||||
//#define STPK_LADDER_OTHER_NAME_CHANGE 0x2220
|
||||
//#define STPK_LADDER_BATTLE_REQUEST_AGREE 0x2221
|
||||
//#define STPK_IMMEDIATELY_EQUIP 0x2223
|
||||
//#define STPK_USER_ETC_ITEM 0x2224
|
||||
//#define STPK_ETCITEM_USE 0x2225
|
||||
//#define STPK_SERVICE_CHAR 0x2226
|
||||
//#define STPK_MOVIE_CONTROL 0x2227
|
||||
//#define STPK_PRESENT_DATA 0x2228
|
||||
//#define STPK_DEFAULT_DECO_ITEM 0x2229
|
||||
//#define STPK_EVENT_DATA_UPDATE 0x2230
|
||||
//#define STPK_GUILD_TITLE_SYNC 0x2231
|
||||
//#define STPK_USER_BONUS_SYNC 0x2232
|
||||
//#define STPK_PROTECT_CHECK 0x2233
|
||||
//#define STPK_GET_CASH 0x2234
|
||||
//#define STPK_HOLE_SEND_COMPLETE 0x2235
|
||||
//#define STPK_UDP_RECV_TIMEOUT 0x2236
|
||||
//#define STPK_JOIN_SERVER_LOBBY_INFO 0x2237
|
||||
//#define STPK_SERVER_LOBBY_CHAT 0x2238
|
||||
//#define STPK_GROWTH_LEVEL_FIRST 0x2239
|
||||
//#define STPK_GROWTH_LEVEL_UP 0x2240
|
||||
//#define STPK_GROWTH_POINT_BONUS 0x2241
|
||||
//#define STPK_GROWTH_LEVEL_INIT 0x2242
|
||||
//#define STPK_WHOLE_CHAT 0x2243
|
||||
//#define STPK_START_ETC_ITEM_TIME 0x2244
|
||||
//#define STPK_UPDATE_ETC_ITEM_TIME 0x2245
|
||||
//#define STPK_CHANGE_BOSS 0x2246
|
||||
//#define STPK_EXERCISE_CHAR_DELETE 0x2247
|
||||
//#define STPK_USER_KICK_VOTE 0x2248
|
||||
//#define STPK_CHAR_CHANGE_PERIOD 0x2249
|
||||
//#define STPK_EVENT_ALIVE 0x2250
|
||||
//#define STPK_ETCITEM_ACTION 0x2251
|
||||
//#define STPK_UDP_RECV_TIMEOUT_RECHECK 0x2252
|
||||
//#define STPK_MYROOM_SERVER_CHANGE 0x2253
|
||||
//#define STPK_SERVER_LOBBY_INFO 0x2254
|
||||
//#define STPK_CHANGE_USER_NAME 0x2255
|
||||
//#define STPK_CAMP_DATA_SYNC 0x2256
|
||||
//#define STPK_CAMP_CAHNGE_POS 0x2257
|
||||
//#define STPK_USER_LADDER_POINT_RECORD_REFRESH 0x2258
|
||||
//#define STPK_GROWTH_LEVEL_DOWN 0x2259
|
||||
//#define STPK_DELETE_ETC_ITEM_DATE 0x2260
|
||||
//#define STPK_BAD_PING_CROWN_DROP 0x2261
|
||||
//#define STPK_CAMP_SEASON_BONUS 0x2262
|
||||
//#define STPK_BLOCK_TYPE 0x2263
|
||||
//#define STPK_FISHING 0x2264
|
||||
//#define STPK_GUILD_NAME_CHANGE 0x2265
|
||||
//#define STPK_PRESENT_RECV 0x2266
|
||||
//#define STPK_PRESENT_SELL 0x2267
|
||||
//#define STPK_USER_EXTRAITEM_DATA 0x2268
|
||||
//#define STPK_EXTRAITEM_BUY 0x2269
|
||||
//#define STPK_EXTRAITEM_SELL 0x2270
|
||||
//#define STPK_DELETE_EXTRAITEM_DATE 0x2271
|
||||
//#define STPK_EXTRAITEM_CHANGE 0x2272
|
||||
//#define STPK_TURN_START 0x2274
|
||||
//#define STPK_MONSTER_SYNC_CHANGE 0x2275
|
||||
//#define STPK_MONSTER_INFO_SYNC 0x2276
|
||||
//#define STPK_TURN_END 0x2277
|
||||
//#define STPK_ETCITEM_SELL 0x2278
|
||||
//#define STPK_PRISONER_REVIVAL 0x2279
|
||||
//#define STPK_REFILL_COIN 0x2280
|
||||
//#define STPK_TIME_GROWTH_CHECK 0x2281
|
||||
//#define STPK_TIME_GROWTH_ADD 0x2282
|
||||
//#define STPK_TIME_GROWTH_REMOVE 0x2283
|
||||
//#define STPK_ROUND_CONTINUE 0x2284
|
||||
//#define STPK_USE_MONSTER_COIN 0x2285
|
||||
//#define STPK_FIRST_CHANGE_ID 0x2286
|
||||
//#define STPK_MONSTER_FORCE_DIE 0x2287
|
||||
//#define STPK_ITEM_COMPOUND 0x2288
|
||||
//#define STPK_CHECK_SALE_PRICE 0x2289
|
||||
//#define STPK_MONSTER_REVIVAL 0x2290
|
||||
//#define STPK_ITEM_MOVE_DROP 0x2291
|
||||
//#define STPK_PRESENT_BUY 0x2292
|
||||
//#define STPK_ALL_ITEM_DROP 0x2293
|
||||
//#define STPK_GASHAPON_LIST 0x2294
|
||||
//#define STPK_EXCAVATION_COMMAND 0x2295
|
||||
//#define STPK_BALLSTRUCT_INFO 0x2296
|
||||
//#define STPK_BALLSTRUCT_REPOSITION 0x2297
|
||||
//#define STPK_FOOTBALL_GOAL 0x2298
|
||||
//#define STPK_CONTROL_KEYS 0x2299
|
||||
//#define STPK_LADDER_USER_HQ_MOVE 0x2300
|
||||
//#define STPK_QUEST_DATA 0x2301
|
||||
//#define STPK_QUEST_COMPLETE_DATA 0x2302
|
||||
//#define STPK_QUEST_OCCUR 0x2303
|
||||
//#define STPK_QUEST_ATTAIN 0x2304
|
||||
//#define STPK_QUEST_REWARD 0x2305
|
||||
//#define STPK_QUEST_DELETE 0x2306
|
||||
//#define STPK_QUEST_EVENT_ALIVE 0x2307
|
||||
//#define STPK_GRADE_SYNC 0x2308
|
||||
//#define STPK_USER_MEDALITEM_DATA 0x2309
|
||||
//#define STPK_MEDALITEM_CHANGE 0x2310
|
||||
//#define STPK_DELETE_MEDALITEM_DATE 0x2311
|
||||
//#define STPK_MEDALITEM_BUY 0x2312
|
||||
//#define STPK_ONEDAY_QUEST_DELETE 0x2313
|
||||
//#define STPK_USER_HERO_DATA 0x2314
|
||||
//#define STPK_HERO_TOP100_DATA 0x2315
|
||||
//#define STPK_HERO_MATCH_OTHER_NAME 0x2316
|
||||
//#define STPK_HERO_MATCH_OTHER_INFO 0x2317
|
||||
//#define STPK_TRADE_STATE_CHANGE 0x2318
|
||||
//#define STPK_TRADE_CREATE 0x2319
|
||||
//#define STPK_TRADE_LIST 0x2320
|
||||
//#define STPK_TRADE_ITEM_COMPLETE 0x2321
|
||||
//#define STPK_TRADE_CANCEL 0x2322
|
||||
//#define STPK_TRADE_TIME_OUT 0x2323
|
||||
//#define STPK_SELECT_GANGSI 0x2324
|
||||
//#define STPK_CHANGE_GANGSI 0x2325
|
||||
//#define STPK_EXTRAITEM_GROWTH_CATALYST 0x2326
|
||||
//#define STPK_MACHINESTRUCT 0x2327
|
||||
//#define STPK_QUEST_REPEAT_REWARD 0x2328
|
||||
//#define STPK_EVENT_SHOP_GOODS_LIST 0x2329
|
||||
//#define STPK_EVENT_SHOP_GOODS_BUY 0x2330
|
||||
//#define STPK_ETCITEM_SWITCH 0x2331
|
||||
//#define STPK_ROOM_USER_ETCITEM_SYNC 0x2332
|
||||
//#define STPK_ETCITEM_SKELETON_DELETE 0x2333
|
||||
//#define STPK_ROOM_STEALTH_ENTER 0x2335
|
||||
//#define STPK_ETCITEM_MOTION_STATE 0x2336
|
||||
//#define STPK_CUSTOM_ITEM_SKIN_UNIQUE_INDEX 0x2336
|
||||
//#define STPK_CUSTOM_ITEM_SKIN_DELETE 0x2337
|
||||
//#define STPK_MONSTER_DIE_REWARD 0x2338
|
||||
//#define STPK_PUSHSTRUCT_OWNER_CLEAR 0x2339
|
||||
//#define STPK_PUSHSTRUCT_INFO_ENTER 0x2340
|
||||
//#define STPK_MONSTER_DICE_RESULT 0x2341
|
||||
//#define STPK_BEST_FRIEND_LIST_MSG 0x2342
|
||||
//#define STPK_ETCITEM_LUCKY_COIN_RESULT 0x2343
|
||||
//#define STPK_ETCITEM_ITEM_COMPOUNDEX_RESULT 0x2344
|
||||
//#define STPK_EXPERIENCE_MODE 0x2345
|
||||
//#define STPK_CHANGE_MY_LEADER 0x2346
|
||||
//#define STPK_SET_MY_RENTAL 0x2347
|
||||
//#define STPK_USER_CHAR_INFO_REFRESH 0x2348
|
||||
//#define STPK_USER_CHAR_SUB_INFO_REFRESH 0x2349
|
||||
//#define STPK_USER_CHAR_RENTAL_REQUEST 0x2350
|
||||
//#define STPK_USER_CHAR_RENTAL_AGREE 0x2351
|
||||
//#define STPK_USER_CHAR_RENTAL_RETURN 0x2352
|
||||
//#define STPK_JOIN_HEADQUARTERS 0x2353
|
||||
//#define STPK_CHANGE_CHAR_BY_NPC 0x2354
|
||||
//#define STPK_HEADQUARTERS_STATE_CHANGE 0x2355
|
||||
//#define STPK_MODE_EXTRAITEM_UPDATE 0x2356
|
||||
//#define STPK_MODE_MEDAL_UPDATE 0x2357
|
||||
//#define STPK_MODE_CHAR_INSERT_DELETE 0x2358
|
||||
//#define STPK_HEADQUARTERS_OPTION 0x2359
|
||||
//#define STPK_HEADQUARTERS_INFO 0x2360
|
||||
//#define STPK_HEADQUARTERS_JOIN_REQUEST 0x2361
|
||||
//#define STPK_HEADQUARTERS_COMMAND 0x2362
|
||||
//#define STPK_HEADQUARTERS_USER_INVITE 0x2363
|
||||
//#define STPK_PCROOM_AUTHORITY 0x2364
|
||||
//#define STPK_INSERT_BESTFRIEND 0x2365
|
||||
//#define STPK_BESTFRIEND_DELETE_LIST 0x2366
|
||||
//#define STPK_DISMISS_BESTFRIEND 0x2367
|
||||
//#define STPK_HEADQUARTERS_INVITE_LIST 0x2368
|
||||
//#define STPK_ETCITEM_RAINBOW_MIXER_RESULT 0x2369
|
||||
//#define STPK_BESTFRIEND_EXCEPTION_LIST 0x2370
|
||||
//#define STPK_FIELD_REWARD_ITEM_LIST 0x2371
|
||||
//#define STPK_FIELD_REWARD_ITEM_CHANGE 0x2372
|
||||
//#define STPK_PICK_REWARD_ITEM 0x2373
|
||||
//#define STPK_ETCITEM_LOSTSAGA_MIXER_RESULT 0x2374
|
||||
//#define STPK_GET_MILEAGE 0x2375
|
||||
//#define STPK_ADD_MILEAGE 0x2376
|
||||
//#define STPK_ETCITEM_TIME_GASHAPON_UPDATE 0x2377
|
||||
//#define STPK_QUEST_ABUSE_ALARM 0x2378
|
||||
//#define STPK_SHUT_DOWN_USER 0x2379
|
||||
//#define STPK_SIMPLE_USER_INFO_REFRESH 0x2380
|
||||
//#define STPK_ETCITEM_GOLD_BOX_RESULT 0x2381
|
||||
//#define STPK_FRIEND_RECOMMEND_DATA 0x2382
|
||||
//#define STPK_MACRO_NOTIFY 0x2383
|
||||
//#define STPK_RUNNINGMAN_DECO_SYNC 0x2384
|
||||
//
|
||||
@@ -0,0 +1,166 @@
|
||||
// QueryData.cpp: implementation of the CQueryData class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "cSerialize.h"
|
||||
#include "QueryData.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CQueryData::CQueryData()
|
||||
{
|
||||
memset( m_szReturnBuf, 0, sizeof( m_szReturnBuf ) );
|
||||
m_iReturnLength = 0;
|
||||
|
||||
m_pBuffer = NULL;
|
||||
CQuery::Clear();
|
||||
}
|
||||
|
||||
CQueryData::~CQueryData()
|
||||
{
|
||||
CQuery::Clear();
|
||||
}
|
||||
|
||||
void CQueryData::GetFields(cSerialize& fieldTypes)
|
||||
{
|
||||
if(GetFieldSize() == 0)
|
||||
return;
|
||||
|
||||
if(m_pBuffer)
|
||||
{
|
||||
uint32 index = sizeof(int);
|
||||
|
||||
fieldTypes.Reset();
|
||||
fieldTypes.SetBuffer( (uint8*)(m_pBuffer + index), GetFieldSize() );
|
||||
}
|
||||
}
|
||||
|
||||
void CQueryData::GetResults(vVALUETYPE& valueTypes)
|
||||
{
|
||||
valueTypes.clear();
|
||||
|
||||
if(GetResultSize() == 0)
|
||||
return;
|
||||
|
||||
if(m_pBuffer)
|
||||
{
|
||||
uint32 index = sizeof(int) + GetFieldSize();
|
||||
for(int32 n = 0 ; n < GetResultSize() ; n += sizeof(ValueType) )
|
||||
{
|
||||
ValueType* type = (ValueType*)(m_pBuffer + index + n);
|
||||
valueTypes.push_back( *type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CQueryData::GetReturns(char* buffer, int &size)
|
||||
{
|
||||
if(m_pBuffer)
|
||||
{
|
||||
uint32 index = sizeof(int) + GetFieldSize() + GetResultSize();
|
||||
size = GetReturnSize();
|
||||
memcpy( buffer, m_pBuffer + index, size );
|
||||
}
|
||||
}
|
||||
|
||||
void CQueryData::SetReturnData( const void *pData, int iSize )
|
||||
{
|
||||
memcpy( &m_szReturnBuf[m_iReturnLength], pData, iSize );
|
||||
m_iReturnLength += iSize;
|
||||
|
||||
if( m_iReturnLength >= MAX_BUFFER )
|
||||
{
|
||||
//LOG.PrintTimeAndLog( 0, "CQueryData::SetReturnData Return Size : %d", m_iReturnLength );
|
||||
}
|
||||
}
|
||||
|
||||
void CQueryData::SetBuffer(const char *buffer)
|
||||
{
|
||||
memcpy(&m_queryHeader,buffer,sizeof(QueryHeader));
|
||||
buffer+= sizeof(QueryHeader);
|
||||
m_pBuffer = new char[m_queryHeader.nQueryBufferSize];
|
||||
memcpy(m_pBuffer,buffer,m_queryHeader.nQueryBufferSize);
|
||||
}
|
||||
|
||||
void CQueryData::SetBuffer(uint8 *buffer)
|
||||
{
|
||||
memcpy(&m_queryHeader,buffer,sizeof(QueryHeader));
|
||||
buffer+= sizeof(QueryHeader);
|
||||
m_pBuffer = new char[m_queryHeader.nQueryBufferSize];
|
||||
memcpy(m_pBuffer,buffer,m_queryHeader.nQueryBufferSize);
|
||||
}
|
||||
|
||||
void CQueryData::SetData(
|
||||
unsigned int nIndex,
|
||||
int nResult_Type,
|
||||
int nMsgType,
|
||||
int nQueryType,
|
||||
int queryId,
|
||||
cSerialize& fieldTypes,
|
||||
vVALUETYPE& valueTypes,
|
||||
int nSetValue)
|
||||
{
|
||||
CQuery::Clear();
|
||||
//헤더
|
||||
m_queryHeader.nIndex = nIndex;
|
||||
m_queryHeader.nResult_Type = nResult_Type;
|
||||
m_queryHeader.nMsgType = nMsgType;
|
||||
m_queryHeader.nQueryType = nQueryType;
|
||||
m_queryHeader.fieldLength = fieldTypes.GetLength();
|
||||
m_queryHeader.resultLength = sizeof(ValueType) * valueTypes.size();
|
||||
m_queryHeader.nValueTypeCnt = 0;
|
||||
m_queryHeader.returnLength = m_iReturnLength;
|
||||
m_queryHeader.nSetValue = nSetValue;
|
||||
m_queryHeader.queryId = queryId;
|
||||
m_queryHeader.databaseId = 1;
|
||||
m_queryHeader.nQueryBufferSize = sizeof(queryId) + m_queryHeader.fieldLength + m_queryHeader.resultLength + m_queryHeader.returnLength;
|
||||
|
||||
//버퍼 메모리 할당.
|
||||
if(m_queryHeader.nQueryBufferSize != 0)
|
||||
{
|
||||
m_pBuffer = new char[m_queryHeader.nQueryBufferSize];
|
||||
//데이터.
|
||||
int nSize = 0; //버퍼의 위치
|
||||
int nlen = 0;
|
||||
if(0 != queryId)
|
||||
{
|
||||
nlen = sizeof(queryId); //카피할 데이터 사이즈
|
||||
memcpy(&m_pBuffer[nSize], &queryId, nlen); //쿼리 내용
|
||||
}
|
||||
if(fieldTypes.GetLength() > 0)
|
||||
{
|
||||
nSize += nlen;
|
||||
nlen = m_queryHeader.fieldLength;
|
||||
memcpy(&m_pBuffer[nSize], fieldTypes.GetBuffer(), nlen); // 필드 타입
|
||||
}
|
||||
if(valueTypes.size() > 0)
|
||||
{
|
||||
nSize += nlen;
|
||||
nlen = m_queryHeader.resultLength;
|
||||
memcpy(&m_pBuffer[nSize], &valueTypes[0], nlen); // 결과 타입
|
||||
}
|
||||
if(m_iReturnLength > 0)
|
||||
{
|
||||
nSize += nlen;
|
||||
memcpy(&m_pBuffer[nSize], m_szReturnBuf, m_iReturnLength); //돌려받을 데이터.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CQueryData::Copy( CQueryData &queryData )
|
||||
{
|
||||
if(m_pBuffer)
|
||||
{
|
||||
delete []m_pBuffer;
|
||||
}
|
||||
|
||||
m_pBuffer = new char[queryData.GetBufferSize()];
|
||||
if(m_pBuffer)
|
||||
{
|
||||
m_queryHeader = queryData.m_queryHeader;
|
||||
memcpy( m_pBuffer, queryData.m_pBuffer, m_queryHeader.nQueryBufferSize );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
#pragma once
|
||||
|
||||
#include "../network/Packet.h"
|
||||
|
||||
// 변수의 타입과 사이즈
|
||||
enum VariableType
|
||||
{
|
||||
vChar = 100,
|
||||
vWChar,
|
||||
vTimeStamp,
|
||||
vLONG,
|
||||
vINT64,
|
||||
vSHORT,
|
||||
vWrong
|
||||
};
|
||||
|
||||
struct ValueType
|
||||
{
|
||||
VariableType type; // 어떤 타입의 데이터인가
|
||||
int size; // 사이즈는?
|
||||
ValueType()
|
||||
{
|
||||
type = vWrong;
|
||||
size = 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef vector<ValueType> vVALUETYPE;
|
||||
|
||||
class cSerialize;
|
||||
|
||||
// CQuery의 헤더
|
||||
struct QueryHeader
|
||||
{
|
||||
QueryHeader()
|
||||
{
|
||||
nMsgType = -1;
|
||||
nQueryType = -1;
|
||||
fieldLength = 0;
|
||||
resultLength = 0;
|
||||
returnLength = -1;
|
||||
nValueTypeCnt = -1;
|
||||
nSetValue = -1;
|
||||
nQueryBufferSize= -1;
|
||||
nIndex = 0;
|
||||
nResult_Type = 0;
|
||||
queryId = 0;
|
||||
databaseId = 0;
|
||||
}
|
||||
int nMsgType; // 메세지 타입, DB서버에서 사용하기보다 나중에 게임서버가 결과를 받아서 처리할때 필요
|
||||
int nQueryType; // 쿼리의 타입 (insert = 0, delete = 1, select = 2, update = 3)
|
||||
int fieldLength; // 쿼리 부분 사이즈
|
||||
int resultLength; // 결과 부분 사이즈
|
||||
int returnLength; // 다시 되돌려 받아야 하는 데이터의 사이즈
|
||||
int nValueTypeCnt; // 결과값의 갯수
|
||||
int nSetValue; // MoveNext : 한테이블에 몇개의 변수?
|
||||
int nQueryBufferSize; // 버퍼의 사이즈 (실제 데이터)
|
||||
unsigned int nIndex; // 쿼리 주인의 고유 인덱스.
|
||||
int nResult_Type; // 결과 에러시 행동.
|
||||
int queryId; // 실행하고자 하는 쿼리번호
|
||||
int databaseId; // 디비구분
|
||||
};
|
||||
|
||||
class CQuery
|
||||
{
|
||||
protected:
|
||||
QueryHeader m_queryHeader; // 쿼리헤더
|
||||
char *m_pBuffer; // 쿼리내용, 결과데이터타입들, 다시 돌려받아야할 데이터
|
||||
public:
|
||||
void Clear()
|
||||
{
|
||||
memset(&m_queryHeader,0,sizeof(QueryHeader));
|
||||
if(m_pBuffer != NULL)
|
||||
{
|
||||
delete[] m_pBuffer;
|
||||
m_pBuffer = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CQueryData : public CQuery
|
||||
{
|
||||
public://GET
|
||||
//HEADER
|
||||
int GetMsgType() { return m_queryHeader.nMsgType; }
|
||||
int GetQueryType() { return m_queryHeader.nQueryType; }
|
||||
int GetFieldSize() { return m_queryHeader.fieldLength; }
|
||||
int GetResultSize() { return m_queryHeader.resultLength; }
|
||||
int GetValueCnt() { return m_queryHeader.nValueTypeCnt; }
|
||||
int GetReturnSize() { return m_queryHeader.returnLength; }
|
||||
int GetSetValue() { return m_queryHeader.nSetValue; }
|
||||
int GetBufferSize() { return m_queryHeader.nQueryBufferSize; }
|
||||
unsigned int GetIndex() { return m_queryHeader.nIndex; }
|
||||
int GetResultType() { return m_queryHeader.nResult_Type; }
|
||||
int GetQueryID() { return m_queryHeader.queryId; }
|
||||
int GetDatabaseID() { return m_queryHeader.databaseId; }
|
||||
|
||||
//DATA
|
||||
QueryHeader *GetHeader(){ return &m_queryHeader; }
|
||||
char *GetBuffer() { return m_pBuffer; }
|
||||
|
||||
void GetFields(cSerialize& fieldTypes);
|
||||
void GetResults(vVALUETYPE& valueTypes);
|
||||
void GetReturns(char* buffer, int &size);
|
||||
|
||||
public:
|
||||
//SET
|
||||
void SetData(
|
||||
unsigned int nIndex,
|
||||
int nResult_Type,
|
||||
int nMsgType,
|
||||
int nQueryType,
|
||||
int queryId,
|
||||
cSerialize& fieldTypes,
|
||||
vVALUETYPE& valueTypes,
|
||||
int nSetValue = 1);
|
||||
void SetBuffer(const char *buffer);
|
||||
void SetBuffer(uint8 *buffer);
|
||||
|
||||
protected:
|
||||
//돌려받기 위해 저장하는 데이터
|
||||
char m_szReturnBuf[ MAX_BUFFER ];
|
||||
int m_iReturnLength;
|
||||
|
||||
public:
|
||||
void SetReturnData( const void *pData, int iSize );
|
||||
void Copy( CQueryData &queryData );
|
||||
|
||||
public:
|
||||
CQueryData();
|
||||
virtual ~CQueryData();
|
||||
};
|
||||
@@ -0,0 +1,224 @@
|
||||
// QueryResultData.cpp: implementation of the QueryResultData class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "QueryResultData.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CQueryResultData::CQueryResultData()
|
||||
{
|
||||
m_pBuffer = NULL;
|
||||
CQueryResult::Clear();
|
||||
InitPos();
|
||||
}
|
||||
CQueryResultData::~CQueryResultData()
|
||||
{
|
||||
CQueryResult::Clear();
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(bool &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(int &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(long &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(DWORD &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(char *value,int len)
|
||||
{
|
||||
if((m_nValuePos + len) > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(__int64 &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(short &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!!");
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(ioHashString &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!![0x%x]", GetMsgType() );
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
|
||||
char szBuf[MAX_PATH] = "";
|
||||
if( len < MAX_PATH )
|
||||
{
|
||||
memcpy(szBuf,&m_pBuffer[m_nValuePos],len);
|
||||
value = szBuf;
|
||||
m_nValuePos += len;
|
||||
}
|
||||
//else
|
||||
//LOG.PrintTimeAndLog(0,"Result GetValue Size Error!![0x%x] : %d", GetMsgType(), len );
|
||||
}
|
||||
|
||||
void CQueryResultData::GetValue(BYTE &value,int len)
|
||||
{
|
||||
if(m_nValuePos + len > m_queryResultHeader.nResultBufferSize)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer OVER!![0x%x]", GetMsgType() );
|
||||
return;
|
||||
}
|
||||
if(m_pBuffer == NULL)
|
||||
{
|
||||
//LOG.PrintTimeAndLog(0,"Result Buffer NULL POINTER!!");
|
||||
return;
|
||||
}
|
||||
memcpy(&value,&m_pBuffer[m_nValuePos],len);
|
||||
m_nValuePos += len;
|
||||
}
|
||||
|
||||
bool CQueryResultData::IsExist()
|
||||
{
|
||||
if( m_nValuePos < m_queryResultHeader.nResultBufferSize )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CQueryResultData::SetBuffer(const char *buffer)
|
||||
{
|
||||
memcpy(&m_queryResultHeader,buffer,sizeof(QueryResultHeader));
|
||||
buffer += sizeof(QueryResultHeader);
|
||||
m_pBuffer = new char[m_queryResultHeader.nResultBufferSize];
|
||||
memset(m_pBuffer,0,m_queryResultHeader.nResultBufferSize);
|
||||
memcpy(m_pBuffer,buffer,m_queryResultHeader.nResultBufferSize);
|
||||
}
|
||||
|
||||
void CQueryResultData::SetBuffer(uint8 *buffer)
|
||||
{
|
||||
memcpy(&m_queryResultHeader,buffer,sizeof(QueryResultHeader));
|
||||
buffer += sizeof(QueryResultHeader);
|
||||
m_pBuffer = new char[m_queryResultHeader.nResultBufferSize];
|
||||
memset(m_pBuffer,0,m_queryResultHeader.nResultBufferSize);
|
||||
memcpy(m_pBuffer,buffer,m_queryResultHeader.nResultBufferSize);
|
||||
}
|
||||
|
||||
void CQueryResultData::SetResultData(
|
||||
unsigned int nIndex,
|
||||
int nMsgType,
|
||||
int nResultType,
|
||||
char *pResultData,
|
||||
int nResultSize,
|
||||
int resultCount )
|
||||
{
|
||||
CQueryResult::Clear();
|
||||
m_queryResultHeader.nIndex = nIndex;
|
||||
m_queryResultHeader.nMsgType = nMsgType;
|
||||
m_queryResultHeader.nQueryResultType = nResultType;
|
||||
m_queryResultHeader.nResultBufferSize = nResultSize;
|
||||
m_queryResultHeader.resultCount = resultCount;
|
||||
|
||||
if(nResultSize != 0)
|
||||
{
|
||||
m_pBuffer = new char[nResultSize];
|
||||
memset(m_pBuffer,0,nResultSize);
|
||||
memcpy(m_pBuffer, pResultData, nResultSize);
|
||||
}
|
||||
else
|
||||
m_pBuffer = NULL;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
#pragma once
|
||||
|
||||
struct QueryResultHeader
|
||||
{
|
||||
QueryResultHeader()
|
||||
{
|
||||
nMsgType = -1;
|
||||
nQueryResultType = -1;
|
||||
nResultBufferSize = 0;
|
||||
resultCount = 0;
|
||||
nIndex = 0;
|
||||
}
|
||||
int nMsgType;
|
||||
int nQueryResultType;
|
||||
int nResultBufferSize;
|
||||
int resultCount;
|
||||
unsigned int nIndex;
|
||||
};
|
||||
|
||||
class CQueryResult
|
||||
{
|
||||
protected:
|
||||
QueryResultHeader m_queryResultHeader;
|
||||
char *m_pBuffer;
|
||||
|
||||
public:
|
||||
void Clear()
|
||||
{
|
||||
memset(&m_queryResultHeader,0,sizeof(QueryResultHeader));
|
||||
if(m_pBuffer != NULL)
|
||||
{
|
||||
delete[] m_pBuffer;
|
||||
m_pBuffer = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CQueryResultData : public CQueryResult
|
||||
{
|
||||
int m_nValuePos;
|
||||
public:
|
||||
//HEADER
|
||||
int GetMsgType() { return m_queryResultHeader.nMsgType; }
|
||||
int GetResultType() { return m_queryResultHeader.nQueryResultType; }
|
||||
int GetResultBufferSize() { return m_queryResultHeader.nResultBufferSize; }
|
||||
int GetResultCount() { return m_queryResultHeader.resultCount; }
|
||||
unsigned int GetIndex() { return m_queryResultHeader.nIndex; }
|
||||
|
||||
//DATA
|
||||
void GetValue(bool &vlaue,int len);
|
||||
void GetValue(int &vlaue,int len);
|
||||
void GetValue(long &vlaue,int len);
|
||||
void GetValue(DWORD &vlaue,int len);
|
||||
void GetValue(char *vlaue,int len);
|
||||
void GetValue(__int64 &value,int len);
|
||||
void GetValue(short &value,int len);
|
||||
void GetValue(ioHashString &value,int len);
|
||||
void GetValue( BYTE &value, int len );
|
||||
|
||||
bool IsExist();
|
||||
|
||||
QueryResultHeader *GetHeader(){ return &m_queryResultHeader; }
|
||||
char *GetBuffer(){ return m_pBuffer; }
|
||||
|
||||
public://SET
|
||||
void SetResultData(
|
||||
unsigned int nIndex,
|
||||
int nMsgType,
|
||||
int nResultType,
|
||||
char *pResultData,
|
||||
int nResultSize,
|
||||
int resultCount);
|
||||
void SetBuffer(const char *buffer);
|
||||
void SetBuffer(uint8 *buffer);
|
||||
|
||||
public:
|
||||
void InitPos(){ m_nValuePos = 0; }
|
||||
|
||||
public:
|
||||
CQueryResultData();
|
||||
virtual ~CQueryResultData();
|
||||
};
|
||||
@@ -0,0 +1,186 @@
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include "cBuffer.h"
|
||||
|
||||
|
||||
// ÃÖ´ë¹öÆÛ±æÀÌ
|
||||
const uint32 G_MAXSTORAGELENGTH = 1024 * 32;
|
||||
|
||||
class cSerialize
|
||||
{
|
||||
public:
|
||||
cSerialize(void)
|
||||
{
|
||||
m_storage.Create(G_MAXSTORAGELENGTH);
|
||||
|
||||
m_temporary = NULL;
|
||||
m_offset = 0;
|
||||
m_maxLength = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
void Reset()
|
||||
{
|
||||
m_storage.Erase();
|
||||
}
|
||||
|
||||
uint8* GetBuffer() { return m_storage.GetBuffer(); }
|
||||
uint32 GetLength() { return m_storage.GetLength(); }
|
||||
|
||||
public:
|
||||
void operator<<(const uint8 value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
void operator<<(const uint16 value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
void operator<<(const uint32 value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
void operator<<(const uint64 value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
void operator<<(const float value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
void operator<<(const double value) { m_storage.Append(reinterpret_cast<const uint8*>(&value), sizeof(value)); }
|
||||
|
||||
public:
|
||||
void Write( const uint8 value ) { m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const uint16 value ){ m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const uint32 value ){ m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const uint64 value ){ m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const float value ) { m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const double value ){ m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) );}
|
||||
void Write( const int value ) { m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
void Write( const int64 value ) { m_storage.Append( reinterpret_cast<const uint8*>(&value), sizeof(value) ); }
|
||||
|
||||
void Write( const uint8* value, uint32 length, BOOL saveLength = FALSE )
|
||||
{
|
||||
if( saveLength )
|
||||
Write( static_cast<uint16>(length) );
|
||||
m_storage.Append( value, length );
|
||||
}
|
||||
void Write( const char* value, uint32 length, BOOL saveLength = FALSE )
|
||||
{
|
||||
if( saveLength )
|
||||
Write( static_cast<uint16>(length) );
|
||||
m_storage.Append( value, length );
|
||||
}
|
||||
template<typename TD>
|
||||
void Write( std::vector<TD>& vcList, BOOL saveLength = TRUE )
|
||||
{
|
||||
if( saveLength )
|
||||
Write( static_cast<uint32>(vcList.size()) );
|
||||
|
||||
for( std::vector<TD>::iterator it = vcList.begin() ; it != vcList.end() ; ++it )
|
||||
{
|
||||
Write( *it );
|
||||
}
|
||||
}
|
||||
template<typename TD>
|
||||
void Write( std::list<TD>& vcList, BOOL saveLength = TRUE )
|
||||
{
|
||||
if( saveLength )
|
||||
Write( static_cast<uint32>(vcList.size()) );
|
||||
|
||||
for( std::list<TD>::iterator it = vcList.begin() ; it != vcList.end() ; ++it )
|
||||
{
|
||||
Write( *it );
|
||||
}
|
||||
}
|
||||
template<typename TD>
|
||||
void Read( const uint8* pBuffer, std::vector<TD>& vcList )
|
||||
{
|
||||
uint32 nLength = 0;
|
||||
CopyMemory( &nLength, pBuffer, sizeof(nLength) );
|
||||
|
||||
vcList.clear();
|
||||
vcList.reserve( nLength );
|
||||
|
||||
TD data;
|
||||
pBuffer += sizeof(nLength);
|
||||
for( uint32 i = 0 ; i < nLength ; i++ )
|
||||
{
|
||||
CopyMemory( &data, pBuffer+sizeof(TD)*i, sizeof(TD) );
|
||||
vcList.push_back( data );
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void SetBuffer( uint8* pBuffer, uint32 maxLength )
|
||||
{
|
||||
m_temporary = pBuffer;
|
||||
m_maxLength = maxLength;
|
||||
m_offset = 0;
|
||||
}
|
||||
BOOL GetStringLength(uint16& length)
|
||||
{
|
||||
CopyMemory( &length, m_temporary+m_offset, sizeof(length) );
|
||||
m_offset += sizeof(uint16);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetUInt(uint8& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetUInt(uint16& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetUInt(uint32& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetUInt(uint64& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetFloat(float& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetDouble(double& data)
|
||||
{
|
||||
CopyMemory( &data, m_temporary+m_offset, sizeof(data) );
|
||||
m_offset += sizeof(data);
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
BOOL GetString(const uint32 length, TCHAR* buffer, const uint32 size)
|
||||
{
|
||||
if( length < size )
|
||||
{
|
||||
CopyMemory( buffer, m_temporary+m_offset, length );
|
||||
buffer[length/sizeof(TCHAR)] = NULL;
|
||||
m_offset += length;
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
BOOL GetString(TCHAR* buffer, const uint32 size)
|
||||
{
|
||||
uint16 length;
|
||||
if(!GetStringLength(length)) return FALSE;
|
||||
|
||||
if( length < size )
|
||||
{
|
||||
CopyMemory( buffer, m_temporary+m_offset, length );
|
||||
buffer[length/sizeof(TCHAR)] = NULL;
|
||||
m_offset += length;
|
||||
return (m_offset <= m_maxLength) ? TRUE : FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const uint8* GetExtra() { return (m_offset <= m_maxLength) ? (m_temporary + m_offset) : NULL; }
|
||||
const uint32 GetExtraLength() { return (m_offset <= m_maxLength) ? (m_maxLength - m_offset) : 0; }
|
||||
|
||||
private:
|
||||
uint8* m_temporary;
|
||||
uint32 m_offset, m_maxLength;
|
||||
|
||||
cBuffer m_storage;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
================================================================================
|
||||
MFC 라이브러리 : LS_TTBot 프로젝트 개요
|
||||
================================================================================
|
||||
|
||||
응용 프로그램 마법사를 사용하여 LS_TTBot 응용 프로그램을 만듭니다. 이 응용
|
||||
프로그램에서는 기본적인 MFC 사용 밥법과 응용 프로그램 작성 방법을 설명합니다.
|
||||
|
||||
이 파일에는 LS_TTBot 응용 프로그램을 구성하는 각 파일에 대한 개요가 포함되어
|
||||
있습니다.
|
||||
|
||||
LS_TTBot.vcproj
|
||||
응용 프로그램 마법사를 사용하여 생성된 VC++ 프로젝트의 주 프로젝트 파일입니다.
|
||||
이 파일에는 파일을 생성한 Visual C++ 버전 정보 및 응용 프로그램 마법사에서 선택한 플랫폼,
|
||||
구성, 프로젝트 기능 등의 정보가 포함됩니다.
|
||||
|
||||
LS_TTBot.h
|
||||
응용 프로그램의 주 헤더 파일입니다. 이 파일에는 다른 프로젝트에 관련된 Resource.h와 같은
|
||||
특정 헤더가 포함되며 CLS_TTBotApp 응용 프로그램 클래스가 선언됩니다.
|
||||
|
||||
LS_TTBot.cpp
|
||||
CLS_TTBotApp 응용 프로그램 클래스를 포함하는 주 응용 프로그램의 소스 파일입니다.
|
||||
|
||||
LS_TTBot.rc
|
||||
프로그램에서 사용하는 모든 Microsoft Windows 리소스가 나열된 파일입니다.
|
||||
이 파일에는 RES 하위 디렉터리에 저장된 아이콘, 비트맵 및 커서가 포함되며
|
||||
Microsoft Visual C++에서 직접 이 파일을 편집할 수도 있습니다. 사용자의 프로젝트
|
||||
리소스는 1042에 들어 있습니다.
|
||||
|
||||
res\LS_TTBot.ico
|
||||
응용 프로그램의 아이콘으로 사용되는 아이콘 파일입니다.
|
||||
이 아이콘은 주 리소스 파일인 LS_TTBot.rc에 포함됩니다.
|
||||
|
||||
res\LS_TTBot.rc2
|
||||
Microsoft Visual C++에서 편집할 수 없는 리소스가 포함된 파일입니다.
|
||||
리소스 편집기에서 편집할 수 없는 모든 리소스는 이 파일에 포함되어 있습니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
응용 프로그램 마법사에서는 단일 대화 상자 클래스를 만듭니다.
|
||||
LS_TTBotDlg.h, LS_TTBotDlg.cpp - 대화 상자
|
||||
CLS_TTBotDlg 클래스를 포함하는 파일입니다. 이 클래스에는 응용 프로그램의
|
||||
주 대화 상자에 대한 동작이 정의됩니다. 대화 상자의 템플릿은 LS_TTBot.rc에
|
||||
있으며 Microsoft Visual C++에서 편집할 수 있습니다.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
기타 기능
|
||||
|
||||
ActiveX 컨트롤
|
||||
응용 프로그램에서 ActiveX 컨트롤을 사용할 수 있습니다.
|
||||
|
||||
인쇄 및 인쇄 미리보기 지원
|
||||
응용 프로그램 마법사에서 MFC 라이브러리의 CView 클래스에 있는 멤버 함수를 호출하여
|
||||
인쇄, 인쇄 설정, 인쇄 미리보기 명령을 처리할 수 있는 코드를 생성합니다.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
기타 표준 파일
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
미리 컴파일된 헤더 파일(PCH) LS_TTBot.pch 및 미리 컴파일된
|
||||
형식 파일 StdAfx.obj를 빌드할 때 사용되는 파일입니다.
|
||||
|
||||
Resource.h
|
||||
새로운 리소스 ID를 정의하는 표준 헤더 파일입니다.
|
||||
Microsoft Visual C++에서 이 파일을 읽고 업데이트합니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
기타 정보
|
||||
|
||||
응용 프로그램 마법사에서는 "TODO:"를 사용하여 추가하거나 사용자 지정해야 하는
|
||||
소스 코드를 나타냅니다.
|
||||
|
||||
응용 프로그램에서 공유 DLL에 MFC를 사용하고 응용 프로그램의 언어가 운영 체제의
|
||||
언어와 다른 경우 Microsoft Visual C++ CD-ROM의 Win\System 디렉터리에 있는
|
||||
해당 지역의 리소스인 MFC70XXX.DLL을 컴퓨터의 system 또는 system32 디렉터리에
|
||||
복사한 다음 MFCLOC.DLL로 이름을 바꾸어야 합니다. "XXX"는 해당 언어를 나타내는
|
||||
약어입니다. 예를 들어 MFC70DEU.DLL에는 독일어로 변환된 리소스가 포함됩니다.
|
||||
이런 작업을 하지 않으면 응용 프로그램의 일부 UI 요소가 운영 체제의 언어로
|
||||
남아 있게 됩니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,265 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cBuffer.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cBuffer::cBuffer() : m_pDT(NULL), m_length(0), m_max(0)
|
||||
{
|
||||
}
|
||||
|
||||
cBuffer::cBuffer( uint32 length ) : m_pDT(NULL), m_length(length), m_max(0)
|
||||
{
|
||||
Create( length );
|
||||
}
|
||||
|
||||
cBuffer::~cBuffer()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void cBuffer::Init()
|
||||
{
|
||||
m_pDT = NULL;
|
||||
m_length = 0;
|
||||
m_max = 0;
|
||||
}
|
||||
|
||||
void cBuffer::Destroy()
|
||||
{
|
||||
if( m_pDT )
|
||||
delete []m_pDT;
|
||||
|
||||
m_pDT = NULL;
|
||||
m_length = 0;
|
||||
m_max = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Create/Erase
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL cBuffer::Create( uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
Destroy();
|
||||
|
||||
m_pDT = new uint8[ length ];
|
||||
if( m_pDT )
|
||||
{
|
||||
m_length = 0;
|
||||
m_max = length;
|
||||
|
||||
Erase();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL cBuffer::Erase()
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
ZeroMemory( m_pDT, m_length );
|
||||
m_length = 0;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Copy/Append
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
BOOL cBuffer::Copy( const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( length <= m_max )
|
||||
{
|
||||
Erase();
|
||||
|
||||
m_length = length;
|
||||
CopyMemory( m_pDT, pDT, m_length );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL cBuffer::Copy( const uint32 segment, const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (segment+length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT + segment, pDT, length );
|
||||
m_length = segment + length;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL cBuffer::Append( const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (length+m_length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT + m_length, pDT, length );
|
||||
m_length += length;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
void cBuffer::Shift( uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( length <= m_length )
|
||||
{
|
||||
uint32 remain = m_length - length;
|
||||
//uint32 remain = m_max - length;
|
||||
|
||||
CopyMemory( m_pDT, m_pDT+length, remain );
|
||||
m_length = remain;
|
||||
//m_length = m_length - length;
|
||||
}
|
||||
else
|
||||
{
|
||||
Erase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool cBuffer::Copy( const TCHAR* pDT )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
uint32 length = (_tcslen( pDT ) + 1) * sizeof(TCHAR);
|
||||
if( length <= m_max )
|
||||
{
|
||||
Erase();
|
||||
|
||||
m_length = length;
|
||||
CopyMemory( m_pDT, pDT, m_length );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cBuffer::Copy( uint32 unDst, const TCHAR* pDT )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
uint32 length = (_tcslen( pDT ) + 1) * sizeof(TCHAR);
|
||||
if( (unDst+length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT+unDst, pDT, length );
|
||||
m_length = unDst + length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cBuffer::Copy( const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( length <= m_max )
|
||||
{
|
||||
Erase();
|
||||
|
||||
m_length = length;
|
||||
CopyMemory( m_pDT, pDT, m_length );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cBuffer::Copy( uint32 unDst, const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (unDst+length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT + unDst, pDT, length );
|
||||
m_length = unDst + length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool cBuffer::Append( const char pDT )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (sizeof(char)+m_length) <= m_max )
|
||||
{
|
||||
m_pDT[m_length] = pDT;
|
||||
m_length++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cBuffer::Append( const char* pDT )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
uint32 length = strlen( pDT ) + 1;
|
||||
if( (length+m_length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT+m_length, pDT, length );
|
||||
m_length += length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool cBuffer::Append( const uint8* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (length+m_length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT + m_length, pDT, length );
|
||||
m_length += length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cBuffer::Append( const char* pDT, uint32 length )
|
||||
{
|
||||
if( m_pDT )
|
||||
{
|
||||
if( (length+m_length) <= m_max )
|
||||
{
|
||||
CopyMemory( m_pDT + m_length, pDT, length );
|
||||
m_length += length;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
class cBuffer
|
||||
{
|
||||
public:
|
||||
cBuffer();
|
||||
cBuffer( uint32 length );
|
||||
virtual ~cBuffer();
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
BOOL Create( uint32 length );
|
||||
BOOL Erase();
|
||||
|
||||
public:
|
||||
void SetLength( uint32 length ) { m_length = length; }
|
||||
|
||||
uint32 GetMaxLength() { return m_max; }
|
||||
uint32 GetLength() { return m_length; }
|
||||
uint8* GetBuffer() const { return m_pDT; }
|
||||
|
||||
uint8* GetBuffer( uint32 length ) const { return (m_pDT+length); }
|
||||
|
||||
/*BOOL Copy( const uint8* pDT, uint32 length );
|
||||
BOOL Copy( const uint32 segment, const uint8* pDT, uint32 length );
|
||||
BOOL Append( const uint8* pDT, uint32 length );*/
|
||||
|
||||
void Shift( uint32 length );
|
||||
|
||||
bool Copy( const TCHAR* pDT );
|
||||
bool Copy( uint32 unDst, const TCHAR* pDT );
|
||||
bool Copy( const uint8* pDT, uint32 length );
|
||||
bool Copy( uint32 unDst, const uint8* pDT, uint32 length );
|
||||
|
||||
bool Append( const char pDT );
|
||||
bool Append( const char* pDT );
|
||||
bool Append( const uint8* pDT, uint32 length );
|
||||
bool Append( const char* pDT, uint32 length );
|
||||
|
||||
protected:
|
||||
uint8* m_pDT;
|
||||
uint32 m_length;
|
||||
uint32 m_max;
|
||||
};
|
||||
@@ -0,0 +1,182 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ioTestBot.h"
|
||||
#include "network/SecurityTCP.h"
|
||||
#include "ioClientSocketTCP.h"
|
||||
#include "protocol.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
|
||||
|
||||
extern void PacketProcess(ioTestBot* unit, SP2Packet& packet);
|
||||
|
||||
|
||||
ioClientSocketTCP::ioClientSocketTCP(void) : m_NS(NULL), m_storage(NULL)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioClientSocketTCP::~ioClientSocketTCP(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::Init()
|
||||
{
|
||||
//m_storage = new cBuffer(1024 * 4);
|
||||
m_storage = new cBuffer(1024 * 64);// 16384
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::Destroy()
|
||||
{
|
||||
if(m_NS)
|
||||
{
|
||||
delete m_NS;
|
||||
m_NS = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::OnConnect()
|
||||
{
|
||||
Startup();
|
||||
//SetNS(new SecurityTCP);
|
||||
SecurityTCP *pCS = reinterpret_cast<SecurityTCP*>(m_NS);
|
||||
|
||||
if( pCS )
|
||||
{
|
||||
pCS->InitState();
|
||||
}
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::OnDisconnect()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::OnSend()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::OnReceive(char* buffer, int& length)
|
||||
{
|
||||
if( length > 0 )
|
||||
{
|
||||
if(!m_storage->Append(reinterpret_cast<uint8*>(buffer), length))
|
||||
{
|
||||
// 버퍼가 모자르다
|
||||
TRACE("buffer error(%lu)", m_storage->GetLength());
|
||||
MessageBox( NULL, "buffer error", "error", MB_OK );
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
while( m_storage->GetLength() > 0 )
|
||||
{
|
||||
if( m_storage->GetLength() < sizeof(CPacket::PACKETHEADER) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CPacket kPacket( m_storage->GetBuffer(), m_storage->GetLength() );
|
||||
if( !kPacket.IsValidPacket() )
|
||||
{
|
||||
//받으려는 사이즈보다 적게 들어왔다
|
||||
//((CLS_TTBotDlg*)AfxGetMainWnd())->LOG("header error(%lu)", m_storage->GetLength());
|
||||
TRACE( "length : %lu, require : %lu\n", m_storage->GetLength(), kPacket.GetBufferSize() );
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_storage->GetLength() > kPacket.GetBufferSize() )
|
||||
{
|
||||
//받으려는 사이즈보다 크게 들어왔다
|
||||
if(kPacket.GetPacketID() != DTPK_QUERY)
|
||||
{
|
||||
MessageBox( NULL, "packet error", "error", MB_OK );
|
||||
}
|
||||
|
||||
SP2Packet packet = (SP2Packet&)kPacket;
|
||||
int bufferSize = kPacket.GetBufferSize();
|
||||
PacketProcess( (ioTestBot*)this, packet );
|
||||
|
||||
int length = m_storage->GetLength() - bufferSize;
|
||||
char *temp = new char[bufferSize];
|
||||
CopyMemory(temp, m_storage->GetBuffer(bufferSize), length);
|
||||
if(length >= sizeof(CPacket::PACKETHEADER))
|
||||
{
|
||||
CPacket packet( (uint8*)temp, length );
|
||||
if( packet.GetPacketID() != 1 )
|
||||
{
|
||||
int b;
|
||||
b = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if(m_storage->GetLength() > 35000)
|
||||
{
|
||||
int a;
|
||||
a = 0;
|
||||
}
|
||||
m_storage->Erase();
|
||||
m_storage->Copy((uint8*)temp, length);
|
||||
|
||||
//m_storage->Shift( bufferSize );
|
||||
}
|
||||
else if( m_storage->GetLength() == kPacket.GetBufferSize() )
|
||||
{
|
||||
if(kPacket.GetPacketID() != DTPK_QUERY)
|
||||
{
|
||||
MessageBox( NULL, "packet error", "error", MB_OK );
|
||||
}
|
||||
|
||||
SP2Packet packet = (SP2Packet&)kPacket;
|
||||
int bufferSize = kPacket.GetBufferSize();
|
||||
PacketProcess( (ioTestBot*)this, packet );
|
||||
m_storage->Erase();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_storage->Erase();
|
||||
// 소켓에러
|
||||
}
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::BeforeSend(CPacket &rkPacket)
|
||||
{
|
||||
if( m_NS )
|
||||
m_NS->PrepareMsg( rkPacket );
|
||||
}
|
||||
|
||||
void ioClientSocketTCP::AfterSend(CPacket &rkPacket)
|
||||
{
|
||||
if( m_NS )
|
||||
m_NS->CompletionMsg( rkPacket );
|
||||
}
|
||||
|
||||
|
||||
BOOL ioClientSocketTCP::SendPacket(CPacket &rkPacket)
|
||||
{
|
||||
if(IsConnected())
|
||||
{
|
||||
BeforeSend( rkPacket );
|
||||
|
||||
BOOL result = Send( reinterpret_cast<const char*>(rkPacket.GetBuffer()), rkPacket.GetBufferSize() );
|
||||
|
||||
AfterSend( rkPacket );
|
||||
return result;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ioClientSocketTCP::CheckNS( CPacket &rkPacket )
|
||||
{
|
||||
if( m_NS && m_NS->IsCheckSum( rkPacket ) && m_NS->CheckState( rkPacket ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioCSocketTCP.h"
|
||||
#include "cBuffer.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "network/NetworkSecurity.h"
|
||||
|
||||
class ioClientSocketTCP : public ioCSocketTCP
|
||||
{
|
||||
public:
|
||||
ioClientSocketTCP(void);
|
||||
~ioClientSocketTCP(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
void OnConnect();
|
||||
void OnDisconnect();
|
||||
void OnSend();
|
||||
void OnReceive(char* buffer, int& length);
|
||||
|
||||
void BeforeSend(CPacket &rkPacket);
|
||||
void AfterSend(CPacket &rkPacket);
|
||||
BOOL SendPacket(CPacket &rkPacket);
|
||||
|
||||
BOOL CheckNS( CPacket &rkPacket );
|
||||
void SetNS(NetworkSecurity* ns) { m_NS = ns; }
|
||||
|
||||
protected:
|
||||
NetworkSecurity *m_NS;
|
||||
cBuffer *m_storage;
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ioTestBot.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioClientSocketUDP.h"
|
||||
|
||||
|
||||
extern void PacketProcess(ioTestBot* unit, SP2Packet& packet);
|
||||
|
||||
|
||||
ioClientSocketUDP::ioClientSocketUDP(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioClientSocketUDP::~ioClientSocketUDP(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::OnConnect()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::OnDisconnect()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::OnSend()
|
||||
{
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::OnReceive(char* buffer, int& length)
|
||||
{
|
||||
CPacket kPacket( reinterpret_cast<uint8*>(buffer), length );
|
||||
if( kPacket.IsValidPacket() && (length >= kPacket.GetBufferSize()) )
|
||||
{
|
||||
if( CheckNS( kPacket ) )
|
||||
{
|
||||
SP2Packet &packet = (SP2Packet&)kPacket;
|
||||
PacketProcess( (ioTestBot*)this, packet );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::BeforeSend(CPacket &rkPacket)
|
||||
{
|
||||
if( m_NS )
|
||||
m_NS->PrepareMsg( rkPacket );
|
||||
}
|
||||
|
||||
void ioClientSocketUDP::AfterSend(CPacket &rkPacket)
|
||||
{
|
||||
if( m_NS )
|
||||
m_NS->CompletionMsg( rkPacket );
|
||||
}
|
||||
|
||||
BOOL ioClientSocketUDP::SendPacket(CPacket &rkPacket)
|
||||
{
|
||||
if(IsConnected())
|
||||
{
|
||||
BeforeSend( rkPacket );
|
||||
|
||||
BOOL result = Send( reinterpret_cast<const char*>(rkPacket.GetBuffer()), rkPacket.GetBufferSize() );
|
||||
|
||||
AfterSend( rkPacket );
|
||||
return result;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL ioClientSocketUDP::CheckNS( CPacket &rkPacket )
|
||||
{
|
||||
if( m_NS && m_NS->IsCheckSum( rkPacket ) && m_NS->CheckState( rkPacket ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioCSocketUDP.h"
|
||||
#include "network/NetworkSecurity.h"
|
||||
|
||||
class ioClientSocketUDP : public ioCSocketUDP
|
||||
{
|
||||
public:
|
||||
ioClientSocketUDP(void);
|
||||
~ioClientSocketUDP(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
void OnConnect();
|
||||
void OnDisconnect();
|
||||
void OnSend();
|
||||
void OnReceive(char* buffer, int& length);
|
||||
|
||||
void BeforeSend(CPacket &rkPacket);
|
||||
void AfterSend(CPacket &rkPacket);
|
||||
BOOL SendPacket(CPacket &rkPacket);
|
||||
|
||||
BOOL CheckNS( CPacket &rkPacket );
|
||||
void SetNS(NetworkSecurity* ns) { m_NS = ns; }
|
||||
|
||||
protected:
|
||||
NetworkSecurity *m_NS;
|
||||
};
|
||||
@@ -0,0 +1,205 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "ioTestBot.h"
|
||||
#include "common.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
|
||||
static int INDEX = 0;
|
||||
ioTestBot::ioTestBot(void) : m_index(++INDEX)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestBot::~ioTestBot(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestBot::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestBot::Destroy()
|
||||
{
|
||||
int loopCount = 0;
|
||||
|
||||
while(m_socketTCP.GetReceiveThreadID() )
|
||||
{
|
||||
Sleep(1);
|
||||
|
||||
++loopCount;
|
||||
if(loopCount > 1000)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ioTestBot::PacketProcess(SP2Packet& packet)
|
||||
{
|
||||
switch( packet.GetPacketID() )
|
||||
{
|
||||
case STPK_ABSTRACT:
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case DTPK_QUERY :
|
||||
{
|
||||
CQueryResultData query_data;
|
||||
packet >> query_data;
|
||||
break;
|
||||
|
||||
switch( query_data.GetMsgType() )
|
||||
{
|
||||
case DBAGENT_TOTAL_REG_USER_SET:
|
||||
{
|
||||
bool bServerDown;
|
||||
query_data.GetValue( bServerDown, sizeof(bool) );
|
||||
|
||||
int iTotalRegUser;
|
||||
query_data.GetValue( iTotalRegUser, sizeof(int) );
|
||||
|
||||
if( bServerDown == true || iTotalRegUser < 0 || iTotalRegUser > 10000 )
|
||||
{
|
||||
MessageBox( NULL, "query(simple) packet data break", "packet data break", MB_OK );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBAGENT_GUILD_INFO_GET:
|
||||
{
|
||||
while( query_data.IsExist() )
|
||||
{
|
||||
DWORD dwGuildIndex = 0;
|
||||
query_data.GetValue( dwGuildIndex, sizeof(DWORD) ); //길드 인덱스
|
||||
|
||||
if( dwGuildIndex > 50000 )
|
||||
{
|
||||
MessageBox( NULL, "query(guild) packet data break", "packet data break", MB_OK );
|
||||
}
|
||||
|
||||
ioHashString m_szGuildName; //길드 이름.
|
||||
ioHashString m_szGuildTitle; //길드 소개.
|
||||
|
||||
char szGuildName[GUILD_NAME_NUM_PLUS_ONE] = "";
|
||||
query_data.GetValue( szGuildName, GUILD_NAME_NUM_PLUS_ONE ); //길드 이름
|
||||
m_szGuildName = szGuildName;
|
||||
|
||||
char szGuildTitle[GUILD_TITLE_NUMBER_PLUS_ONE] = "";
|
||||
query_data.GetValue( szGuildTitle, GUILD_TITLE_NUMBER_PLUS_ONE ); //길드 소개
|
||||
m_szGuildTitle = szGuildTitle;
|
||||
|
||||
DWORD m_dwGuildMark;
|
||||
DWORD m_dwGuildPoint;
|
||||
DWORD m_dwGuildMaxEntry;
|
||||
|
||||
query_data.GetValue( m_dwGuildMark, sizeof(DWORD) ); //길드 마크
|
||||
query_data.GetValue( m_dwGuildPoint, sizeof(DWORD) ); //길드 포인트
|
||||
query_data.GetValue( m_dwGuildMaxEntry, sizeof(DWORD) );//길드 인원 제한
|
||||
|
||||
DWORD m_dwGuildRegDate;
|
||||
|
||||
DBTIMESTAMP dts;
|
||||
query_data.GetValue( (char*)&dts, sizeof(DBTIMESTAMP) ); //길드 생성일
|
||||
m_dwGuildRegDate = (dts.year * 10000) + (dts.month * 100) + dts.day;
|
||||
|
||||
DWORD m_dwGuildJoinUser;
|
||||
DWORD m_dwCurGuildPoint;
|
||||
DWORD m_dwGuildLevel;
|
||||
DWORD m_dwGuildCampPos;
|
||||
|
||||
query_data.GetValue( m_dwGuildJoinUser, sizeof(DWORD) );//길드 인원
|
||||
query_data.GetValue( m_dwCurGuildPoint, sizeof(DWORD) ); //금일 획득 포인트
|
||||
query_data.GetValue( m_dwGuildLevel, sizeof(DWORD) ); //길드 레벨
|
||||
query_data.GetValue( m_dwGuildCampPos, sizeof(DWORD) ); //길드 진영
|
||||
|
||||
// 전적 정보
|
||||
int m_iWin;
|
||||
int m_iLose;
|
||||
int m_iKill;
|
||||
int m_iDeath;
|
||||
query_data.GetValue( m_iWin, sizeof( int ) );
|
||||
query_data.GetValue( m_iLose, sizeof( int ) );
|
||||
query_data.GetValue( m_iKill, sizeof( int ) );
|
||||
query_data.GetValue( m_iDeath, sizeof( int ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EPROTOCOL::LSPTK_TIMEOUT_CLOSE_REQUEST:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case EPROTOCOL::LSTPK_SVR_STATUS_RESPONSE:
|
||||
{
|
||||
// TCHAR* ipaddr = new TCHAR[64];
|
||||
// int port;
|
||||
// packet >> ipaddr;
|
||||
// packet >> port;
|
||||
// g_Log->PostMessageA(WM_LOG,(WPARAM)ipaddr,0);
|
||||
|
||||
// ioTestCase* child = (ioTestCase*)this;
|
||||
// child->Current(TESTSTATE_DISCONNECT);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case STPK_CONNECT:
|
||||
{
|
||||
int result;
|
||||
packet >> result;
|
||||
|
||||
switch(result)
|
||||
{
|
||||
case CONNECT_OK :
|
||||
{
|
||||
DWORD userIndex;
|
||||
ioHashString publicId;
|
||||
packet >> userIndex >> publicId;
|
||||
|
||||
//UDP HOLE PUNCHING.
|
||||
SP2Packet output( CUPK_CONNECT );
|
||||
output << publicId;
|
||||
|
||||
SendUDP( output );
|
||||
}
|
||||
break;
|
||||
case CONNECT_ID_NOT :
|
||||
break;
|
||||
case CONNECT_PW_NOT :
|
||||
TRACE("CONNECT_PW_NOT");
|
||||
break;
|
||||
case CONNECT_ID_ALREADY :
|
||||
break;
|
||||
case CONNECT_EXCEPT :
|
||||
break;
|
||||
case CONNECT_EXPIRE_KEY :
|
||||
break;
|
||||
case CONNECT_EXITING_SERVER :
|
||||
break;
|
||||
case CONNECT_WRONG_CLIENT_VER :
|
||||
break;
|
||||
case CONNECT_WRONG_LOCAL_VER :
|
||||
break;
|
||||
case CONNECT_GAMESERVER_FULL :
|
||||
break;
|
||||
default :
|
||||
TRACE( "STPK_CONNECT : %lu", packet.GetPacketID() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
TRACE( "unknown packet : %lu", packet.GetPacketID() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PacketProcess(ioTestBot* unit, SP2Packet& packet)
|
||||
{
|
||||
unit->PacketProcess(packet);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestClient.h"
|
||||
|
||||
|
||||
class ioTestBot : public ioTestClient
|
||||
{
|
||||
public:
|
||||
ioTestBot(void);
|
||||
~ioTestBot(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
void PacketProcess(SP2Packet& packet);
|
||||
|
||||
protected:
|
||||
int m_index;
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "StdAfx.h"
|
||||
#include "LS_TTBot.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
#include "iotestcase.h"
|
||||
|
||||
ioTestCase::ioTestCase(void) : m_sequence(0), m_current(TESTSTATE_NONE)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestCase::~ioTestCase(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestCase::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestCase::Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestCase::Run()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestCase::LOG(const TCHAR *format, ...)
|
||||
{
|
||||
TCHAR buffer[2048];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, format );
|
||||
_vsnprintf( buffer, sizeof(buffer), format, marker );
|
||||
va_end( marker );
|
||||
|
||||
((CLS_TTBotDlg*)AfxGetMainWnd())->LOG("%s", buffer);
|
||||
}
|
||||
|
||||
void ioTestCase::AddState(int oldState, int newState)
|
||||
{
|
||||
m_testCases[oldState] = newState;
|
||||
}
|
||||
|
||||
int ioTestCase::GetNextState()
|
||||
{
|
||||
++m_sequence;
|
||||
TEST_CASES::iterator it = m_testCases.find(m_current);
|
||||
if(it != m_testCases.end())
|
||||
{
|
||||
int newState = it->second;
|
||||
return newState;
|
||||
}
|
||||
return TESTSTATE_NONE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "ioTestBot.h"
|
||||
|
||||
enum TestStates
|
||||
{
|
||||
TESTSTATE_NONE = 0,
|
||||
TESTSTATE_CONNECT,
|
||||
TESTSTATE_DISCONNECT,
|
||||
TESTSTATE_LOGIN,
|
||||
TESTSTATE_ECHO,
|
||||
TESTSTATE_SEND,
|
||||
|
||||
TESTSTATE_END
|
||||
};
|
||||
|
||||
class ioTestCase : public ioTestBot
|
||||
{
|
||||
public:
|
||||
ioTestCase(void);
|
||||
~ioTestCase(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
|
||||
void LOG(const TCHAR *format, ...);
|
||||
|
||||
public:
|
||||
void AddState(int oldState, int newState);
|
||||
int GetNextState();
|
||||
int GetCurrentState() { return m_current; }
|
||||
|
||||
|
||||
uint32 Current() const { return m_recvstate; }
|
||||
void Current(uint32 val) { m_recvstate = val; }
|
||||
protected:
|
||||
typedef std::map<int,int> TEST_CASES;
|
||||
|
||||
uint32 m_sequence;
|
||||
uint32 m_current;
|
||||
uint32 m_recvstate;
|
||||
TEST_CASES m_testCases;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "StdAfx.h"
|
||||
#include "network/SecurityTCP.h"
|
||||
#include "network/SecurityUDP.h"
|
||||
#include "iotestclient.h"
|
||||
|
||||
ioTestClient::ioTestClient(void) : m_port(0)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestClient::~ioTestClient(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestClient::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestClient::Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestClient::Startup(const char* IP, const uint32 port)
|
||||
{
|
||||
m_socketTCP.Startup();
|
||||
|
||||
m_socketUDP.SetBindPort(10515);
|
||||
m_socketUDP.SetNS(new SecurityUDP);
|
||||
|
||||
if(NULL != IP)
|
||||
{
|
||||
m_IP = IP;
|
||||
}
|
||||
if(0 != port)
|
||||
{
|
||||
m_port = port;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL ioTestClient::DoConnect(const BOOL thread)
|
||||
{
|
||||
DoDisconnect();
|
||||
|
||||
//if(m_socketTCP.Connect(m_IP, m_port, 10, thread))
|
||||
if(m_socketTCP.Connect(m_IP, m_port ))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL ioTestClient::DoDisconnect()
|
||||
{
|
||||
if(m_socketTCP.IsConnected())
|
||||
{
|
||||
m_socketTCP.Disconnect();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ioTestClient::SendTCP(SP2Packet& packet)
|
||||
{
|
||||
m_socketTCP.SendPacket(packet);
|
||||
}
|
||||
|
||||
void ioTestClient::SendUDP(SP2Packet& packet)
|
||||
{
|
||||
m_socketUDP.SendPacket(packet);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioClientSocketTCP.h"
|
||||
#include "ioClientSocketUDP.h"
|
||||
#include "network/SP2Packet.h"
|
||||
|
||||
class ioTestClient
|
||||
{
|
||||
public:
|
||||
ioTestClient(void);
|
||||
~ioTestClient(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
void Startup(const char* IP, const uint32 port);
|
||||
|
||||
BOOL DoConnect(const BOOL thread = TRUE);
|
||||
BOOL DoDisconnect();
|
||||
|
||||
public:
|
||||
void SendTCP(SP2Packet& packet);
|
||||
void SendUDP(SP2Packet& packet);
|
||||
|
||||
protected:
|
||||
ioClientSocketTCP m_socketTCP;
|
||||
ioClientSocketUDP m_socketUDP;
|
||||
|
||||
uint32 m_port;
|
||||
CString m_IP;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "StdAfx.h"
|
||||
#include "iotestconnection.h"
|
||||
|
||||
ioTestConnection::ioTestConnection(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestConnection::~ioTestConnection(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestConnection::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_DISCONNECT);
|
||||
AddState(TESTSTATE_DISCONNECT, TESTSTATE_CONNECT);
|
||||
}
|
||||
|
||||
void ioTestConnection::Destroy()
|
||||
{
|
||||
LOG("disconnected, %s", m_IP);
|
||||
}
|
||||
|
||||
void ioTestConnection::Run()
|
||||
{
|
||||
int oldState = GetCurrentState();
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect(FALSE))
|
||||
{
|
||||
SYSTEMTIME systime;
|
||||
GetLocalTime(&systime);
|
||||
LOG("[%02d:%02d:%02d]connected, %s", systime.wHour, systime.wMinute, systime.wSecond, m_IP);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("connect failed");
|
||||
}
|
||||
break;
|
||||
|
||||
case TESTSTATE_DISCONNECT :
|
||||
if(DoDisconnect())
|
||||
LOG("disconnected, %s", m_IP);
|
||||
else
|
||||
{
|
||||
LOG("disconnected failed");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestCase.h"
|
||||
|
||||
class ioTestConnection : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestConnection(void);
|
||||
~ioTestConnection(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioTestEcho.h"
|
||||
|
||||
ioTestEcho::ioTestEcho(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestEcho::~ioTestEcho(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestEcho::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_ECHO);
|
||||
AddState(TESTSTATE_ECHO, TESTSTATE_ECHO);
|
||||
}
|
||||
|
||||
void ioTestEcho::Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
static int COUNT = 0;
|
||||
|
||||
void ioTestEcho::Run()
|
||||
{
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect())
|
||||
LOG("connected, %s", m_IP);
|
||||
else
|
||||
LOG("connect failed");
|
||||
break;
|
||||
|
||||
case TESTSTATE_ECHO :
|
||||
{
|
||||
//LOG("[%lu]try echo", m_sequence);
|
||||
char temp[512];
|
||||
sprintf_s(temp, sizeof(temp), "@%d안녕하세요!안녕하세요!안녕하세요!안녕하세요!안녕하세요!안녕하세요!안녕하세요!", ++COUNT);
|
||||
for(int i = 0 ; i < 20 ; i++)
|
||||
{
|
||||
SP2Packet kPacket( CTPK_ABSTRACT );
|
||||
kPacket << 2930;
|
||||
kPacket << "테스트봇";
|
||||
kPacket << temp;
|
||||
//SP2Packet kPacket( CTPK_CONNECT );
|
||||
//kPacket << "e68a849fdd2d7662b96e91786a2486787080ffaa87c638" << "172.20.20.108" << 8652 << 119483910;
|
||||
SendTCP(kPacket);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestCase.h"
|
||||
|
||||
class ioTestEcho : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestEcho(void);
|
||||
~ioTestEcho(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioTestLogin.h"
|
||||
|
||||
ioTestLogin::ioTestLogin(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
ioTestLogin::~ioTestLogin(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestLogin::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_LOGIN);
|
||||
AddState(TESTSTATE_LOGIN, TESTSTATE_DISCONNECT);
|
||||
AddState(TESTSTATE_DISCONNECT, TESTSTATE_CONNECT);
|
||||
}
|
||||
|
||||
void ioTestLogin::Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
void ioTestLogin::Run()
|
||||
{
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect())
|
||||
LOG("connected, %s", m_IP);
|
||||
else
|
||||
LOG("connect failed");
|
||||
break;
|
||||
|
||||
case TESTSTATE_DISCONNECT :
|
||||
if(DoDisconnect())
|
||||
LOG("disconnected, %s", m_IP);
|
||||
else
|
||||
LOG("disconnected failed");
|
||||
break;
|
||||
|
||||
case TESTSTATE_LOGIN :
|
||||
{
|
||||
LOG("try login");
|
||||
|
||||
SP2Packet kPacket( CTPK_CONNECT );
|
||||
kPacket << "e68a849fdd2d7662b96e91786a2486787080ffaa87c638" << "172.20.20.108" << 8652 << 119483910;
|
||||
|
||||
SendTCP(kPacket);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestCase.h"
|
||||
|
||||
class ioTestLogin : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestLogin(void);
|
||||
~ioTestLogin(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
};
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioTestQuerySend1.h"
|
||||
|
||||
#include "LS_TTBotDlg.h"
|
||||
|
||||
//extern int m_iDBAgentThreadID;
|
||||
|
||||
ioTestQuerySend1::ioTestQuerySend1(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
ioTestQuerySend1::~ioTestQuerySend1(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestQuerySend1::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_SEND);
|
||||
AddState(TESTSTATE_SEND, TESTSTATE_SEND);
|
||||
}
|
||||
|
||||
void ioTestQuerySend1::Destroy()
|
||||
{
|
||||
LOG("disconnected, %s", m_IP);
|
||||
}
|
||||
|
||||
void ioTestQuerySend1::Run()
|
||||
{
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect())
|
||||
LOG("connected, %s", m_IP);
|
||||
else
|
||||
LOG("connect failed");
|
||||
break;
|
||||
case TESTSTATE_SEND:
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Test 1
|
||||
for( int i = 0 ; i < 10 ; ++i )
|
||||
{
|
||||
// Query
|
||||
const int queryId = 2002;
|
||||
|
||||
CQueryData query_data;
|
||||
cSerialize v_FT;
|
||||
vVALUETYPE v_VT;
|
||||
|
||||
query_data.SetData(
|
||||
++m_iDBAgentThreadID,
|
||||
_RESULT_CHECK,
|
||||
DBAGENT_TOTAL_REG_USER_SET,
|
||||
_SELECTDB,
|
||||
queryId,
|
||||
v_FT,
|
||||
v_VT );
|
||||
|
||||
SP2Packet kPacket( DTPK_QUERY );
|
||||
kPacket << query_data;
|
||||
|
||||
m_socketTCP.SendPacket( kPacket );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
|
||||
ValueType ioTestQuerySend1::GetValueType(VariableType nType,int len)
|
||||
{
|
||||
ValueType vt;
|
||||
vt.type = nType;
|
||||
vt.size = len;
|
||||
return vt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestCase.h"
|
||||
|
||||
class ioTestQuerySend1 : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestQuerySend1(void);
|
||||
virtual ~ioTestQuerySend1(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
|
||||
//int m_iDBAgentThreadID;
|
||||
ValueType GetValueType(VariableType nType,int len);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioTestQuerySend2.h"
|
||||
#include "LS_TTBotDlg.h"
|
||||
|
||||
ioTestQuerySend2::ioTestQuerySend2(void)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
ioTestQuerySend2::~ioTestQuerySend2(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestQuerySend2::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_SEND);
|
||||
AddState(TESTSTATE_SEND, TESTSTATE_SEND);
|
||||
|
||||
//m_iDBAgentThreadID = 0;
|
||||
}
|
||||
|
||||
void ioTestQuerySend2::Destroy()
|
||||
{
|
||||
LOG("disconnected, %s", m_IP);
|
||||
}
|
||||
|
||||
void ioTestQuerySend2::Run()
|
||||
{
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect())
|
||||
LOG("connected, %s", m_IP);
|
||||
else
|
||||
LOG("connect failed");
|
||||
break;
|
||||
|
||||
case TESTSTATE_SEND:
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// Test 2
|
||||
const int queryId = 2003;
|
||||
|
||||
cSerialize v_FT;
|
||||
vVALUETYPE v_VT;
|
||||
|
||||
v_FT.Write( (uint32)30 );
|
||||
v_FT.Write( (uint32) rand() % 35000 );
|
||||
|
||||
// 기본 정보
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 인덱스
|
||||
v_VT.push_back( GetValueType( vChar, GUILD_NAME_NUM_PLUS_ONE ) ); //길드 이름
|
||||
v_VT.push_back( GetValueType( vChar, GUILD_TITLE_NUMBER_PLUS_ONE ) );//길드 소개
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 마크
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 포인트
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 인원 제한
|
||||
v_VT.push_back(GetValueType(vTimeStamp,sizeof(DBTIMESTAMP))); //길드 생성일
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 현재 인원
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 금일 획득 포인트
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 레벨
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //길드 진영
|
||||
|
||||
// 길드 전적
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //승
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //패
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //킬
|
||||
v_VT.push_back( GetValueType( vLONG, sizeof(LONG) ) ); //데스
|
||||
|
||||
CQueryData query_data;
|
||||
query_data.SetData(
|
||||
++m_iDBAgentThreadID,
|
||||
_RESULT_CHECK,
|
||||
DBAGENT_GUILD_INFO_GET,
|
||||
_SELECTEX1DB,
|
||||
queryId,
|
||||
v_FT,
|
||||
v_VT );
|
||||
|
||||
SP2Packet kPacket( DTPK_QUERY );
|
||||
kPacket << query_data;
|
||||
for( int i = 0 ; i < 20 ; ++i )
|
||||
{
|
||||
m_socketTCP.SendPacket( kPacket );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TESTSTATE_DISCONNECT :
|
||||
if(DoDisconnect())
|
||||
LOG("disconnected, %s", m_IP);
|
||||
else
|
||||
LOG("disconnected failed");
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
|
||||
ValueType ioTestQuerySend2::GetValueType(VariableType nType,int len)
|
||||
{
|
||||
ValueType vt;
|
||||
vt.type = nType;
|
||||
vt.size = len;
|
||||
return vt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "ioTestCase.h"
|
||||
|
||||
class ioTestQuerySend2 : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestQuerySend2(void);
|
||||
virtual ~ioTestQuerySend2(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
|
||||
//int m_iDBAgentThreadID;
|
||||
ValueType GetValueType(VariableType nType,int len);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "Protocol.h"
|
||||
#include "network/SP2Packet.h"
|
||||
#include "ioTestSend.h"
|
||||
|
||||
ioTestSend::ioTestSend(void)
|
||||
{
|
||||
Init();
|
||||
|
||||
}
|
||||
|
||||
|
||||
ioTestSend::~ioTestSend(void)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void ioTestSend::Init()
|
||||
{
|
||||
AddState(TESTSTATE_NONE, TESTSTATE_CONNECT);
|
||||
AddState(TESTSTATE_CONNECT, TESTSTATE_SEND);
|
||||
AddState(TESTSTATE_SEND, TESTSTATE_SEND);
|
||||
}
|
||||
|
||||
void ioTestSend::Destroy()
|
||||
{
|
||||
LOG("disconnected, %s", m_IP);
|
||||
}
|
||||
|
||||
void ioTestSend::Run()
|
||||
{
|
||||
int newState = GetNextState();
|
||||
switch(newState)
|
||||
{
|
||||
case TESTSTATE_CONNECT :
|
||||
if(DoConnect())
|
||||
LOG("connected, %s", m_IP);
|
||||
else
|
||||
LOG("connect failed");
|
||||
break;
|
||||
case TESTSTATE_SEND:
|
||||
{
|
||||
SP2Packet kPacket( DTPK_QUERY );
|
||||
m_socketTCP.SendPacket( kPacket );
|
||||
}
|
||||
break;
|
||||
|
||||
case TESTSTATE_DISCONNECT :
|
||||
if(DoDisconnect())
|
||||
LOG("disconnected, %s", m_IP);
|
||||
else
|
||||
LOG("disconnected failed");
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_current = newState;
|
||||
}
|
||||
|
||||
ValueType ioTestSend::GetValueType(VariableType nType,int len)
|
||||
{
|
||||
ValueType vt;
|
||||
vt.type = nType;
|
||||
vt.size = len;
|
||||
return vt;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "ioTestCase.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class ioTestSend : public ioTestCase
|
||||
{
|
||||
public:
|
||||
ioTestSend(void);
|
||||
virtual ~ioTestSend(void);
|
||||
|
||||
void Init();
|
||||
void Destroy();
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
|
||||
ValueType GetValueType(VariableType nType,int len);
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "FSM.h"
|
||||
|
||||
FSM::FSM()
|
||||
{
|
||||
InitState();
|
||||
}
|
||||
|
||||
void FSM::InitState()
|
||||
{
|
||||
m_iState = MAGIC_TOKEN_FSM;
|
||||
}
|
||||
|
||||
bool FSM::IsFirst()
|
||||
{
|
||||
if( MAGIC_TOKEN_FSM == m_iState )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int FSM::GetState()
|
||||
{
|
||||
return m_iState;
|
||||
}
|
||||
|
||||
void FSM::SetState(int iState)
|
||||
{
|
||||
m_iState = iState;
|
||||
}
|
||||
|
||||
void FSM::UpdateState()
|
||||
{
|
||||
if( !IsFirst() )
|
||||
{
|
||||
m_iState = ( (~m_iState) + 5371 ) * 31;
|
||||
m_iState = m_iState ^ ( m_iState >> 16);
|
||||
|
||||
if( m_iState < 0 )
|
||||
m_iState = -m_iState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#define MAGIC_TOKEN_FSM -1
|
||||
|
||||
class FSM
|
||||
{
|
||||
protected:
|
||||
int m_iState;
|
||||
|
||||
public:
|
||||
void InitState();
|
||||
void UpdateState();
|
||||
|
||||
public:
|
||||
bool IsFirst();
|
||||
int GetState();
|
||||
void SetState(int iState);
|
||||
|
||||
public:
|
||||
FSM();
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "../StdAfx.h"
|
||||
#include "FSM.h"
|
||||
#include "NetworkSecurity.h"
|
||||
|
||||
NetworkSecurity::NetworkSecurity()
|
||||
{
|
||||
}
|
||||
|
||||
NetworkSecurity::~NetworkSecurity()
|
||||
{
|
||||
}
|
||||
|
||||
// DoS Attack
|
||||
bool NetworkSecurity::UpdateReceiveCount()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Packet CheckSum
|
||||
bool NetworkSecurity::IsCheckSum( CPacket &rkPacket )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Packet Replay
|
||||
int NetworkSecurity::GetSndState()
|
||||
{
|
||||
return MAGIC_TOKEN_FSM;
|
||||
}
|
||||
|
||||
void NetworkSecurity::UpdateSndState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int NetworkSecurity::GetRcvState()
|
||||
{
|
||||
return MAGIC_TOKEN_FSM;
|
||||
}
|
||||
|
||||
void NetworkSecurity::UpdateRcvState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool NetworkSecurity::CheckState( CPacket &rkPacket )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void NetworkSecurity::PrepareMsg( CPacket &rkPacket )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NetworkSecurity::CompletionMsg( CPacket &rkPacket )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "Packet.h"
|
||||
|
||||
class NetworkSecurity
|
||||
{
|
||||
// DoS Attack
|
||||
public:
|
||||
virtual bool UpdateReceiveCount();
|
||||
|
||||
// Packet CheckSum
|
||||
public:
|
||||
virtual bool IsCheckSum( CPacket &rkPacket );
|
||||
|
||||
// Packet Replay
|
||||
public:
|
||||
virtual int GetSndState();
|
||||
virtual void UpdateSndState();
|
||||
virtual int GetRcvState();
|
||||
virtual void UpdateRcvState();
|
||||
virtual bool CheckState( CPacket &rkPacket );
|
||||
|
||||
// Send
|
||||
public:
|
||||
virtual void PrepareMsg( CPacket &rkPacket );
|
||||
virtual void CompletionMsg( CPacket &rkPacket );
|
||||
|
||||
public:
|
||||
NetworkSecurity();
|
||||
virtual ~NetworkSecurity();
|
||||
};
|
||||
@@ -0,0 +1,157 @@
|
||||
// Packet.cpp: implementation of the CPacket class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "Packet.h"
|
||||
|
||||
#include "../LS_TTBotDlg.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CPacket::CPacket()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
CPacket::CPacket(DWORD ID)
|
||||
{
|
||||
Clear();
|
||||
*m_packet_header.m_ID = ID;
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
CPacket::CPacket(const uint8 *buffer, uint32 size)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if( size >= sizeof(PACKETHEADER) )
|
||||
{
|
||||
memcpy( m_pBuffer , buffer, sizeof(PACKETHEADER) );
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
|
||||
if( size >= GetBufferSize() )
|
||||
{
|
||||
if( GetBufferSize() < m_currentPos )
|
||||
{
|
||||
MessageBox(NULL, "CPacket error", "error", MB_OK );
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
memcpy( &m_pBuffer[m_currentPos], &buffer[m_currentPos], GetBufferSize() - m_currentPos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CPacket::~CPacket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CPacket::Clear()
|
||||
{
|
||||
memset(m_pBuffer,0,MAX_BUFFER);
|
||||
m_currentPos = 0;
|
||||
m_packet_header.m_ID = (DWORD*)&m_pBuffer[PK_ID_ADDR];
|
||||
m_packet_header.m_Size = (DWORD*)&m_pBuffer[PK_SIZE_ADDR];
|
||||
m_packet_header.m_CheckSum = (DWORD*)&m_pBuffer[PK_CKSUM_ADDR];
|
||||
m_packet_header.m_iState = (int*)&m_pBuffer[PK_FSM_ADDR];
|
||||
*m_packet_header.m_Size = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
void CPacket::SetBufferCopy(char *pBuf,int size)
|
||||
{
|
||||
Clear();
|
||||
|
||||
memcpy( m_pBuffer, pBuf, size );
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
void CPacket::SetDataAdd(char *pBuf,int size)
|
||||
{
|
||||
memcpy( &m_pBuffer[m_currentPos], pBuf, size );
|
||||
m_currentPos += size;
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
}
|
||||
|
||||
void CPacket::SetCheckSum( DWORD dwSum )
|
||||
{
|
||||
*m_packet_header.m_CheckSum = dwSum;
|
||||
}
|
||||
|
||||
void CPacket::SetState( int iState )
|
||||
{
|
||||
*m_packet_header.m_iState = iState;
|
||||
}
|
||||
|
||||
const uint8* CPacket::GetBuffer() const
|
||||
{
|
||||
return &m_pBuffer[0];
|
||||
}
|
||||
|
||||
const uint8* CPacket::GetData() const
|
||||
{
|
||||
return &m_pBuffer[0] + sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
uint32 CPacket::GetBufferSize() const
|
||||
{
|
||||
return *m_packet_header.m_Size;
|
||||
}
|
||||
|
||||
uint32 CPacket::GetDataSize() const
|
||||
{
|
||||
return *m_packet_header.m_Size - sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
DWORD CPacket::GetPacketID() const
|
||||
{
|
||||
return *m_packet_header.m_ID;
|
||||
}
|
||||
|
||||
DWORD CPacket::GetCheckSum() const
|
||||
{
|
||||
return *m_packet_header.m_CheckSum;
|
||||
}
|
||||
|
||||
int CPacket::GetState() const
|
||||
{
|
||||
return *m_packet_header.m_iState;
|
||||
}
|
||||
|
||||
bool CPacket::IsValidHeader() const
|
||||
{
|
||||
return (GetBufferSize() >= sizeof(PACKETHEADER) );
|
||||
}
|
||||
|
||||
bool CPacket::IsValidPacket() const
|
||||
{
|
||||
if(!IsValidHeader()) return false;
|
||||
|
||||
return (GetBufferSize() >= m_currentPos);
|
||||
}
|
||||
|
||||
bool CPacket::CheckLeftPacketSize( int iAddSize )
|
||||
{
|
||||
if( m_currentPos + iAddSize >= MAX_BUFFER )
|
||||
{
|
||||
//LOG.PrintTimeAndLog( 0,"[ID:%d - SIZE:%d] << Packat Size Overflow!", GetPacketID(), m_currentPos + iAddSize );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPacket::CheckRightPacketSize( int iAddSize )
|
||||
{
|
||||
if( m_currentPos + iAddSize >= MAX_BUFFER )
|
||||
{
|
||||
//LOG.PrintTimeAndLog( 0,"[ID:%d - SIZE:%d] >> Packat Size Overflow!", GetPacketID(), m_currentPos + iAddSize );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
const int MAX_BUFFER = 1024 * 32;
|
||||
|
||||
enum
|
||||
{
|
||||
PK_ID_ADDR = 0,
|
||||
PK_SIZE_ADDR = 4,
|
||||
PK_CKSUM_ADDR = 8,
|
||||
PK_FSM_ADDR = 12,
|
||||
PK_HEADER_SIZE = 16,
|
||||
};
|
||||
|
||||
class CPacket
|
||||
{
|
||||
public:
|
||||
struct PACKETHEADER
|
||||
{
|
||||
DWORD *m_ID;
|
||||
DWORD *m_Size;
|
||||
DWORD *m_CheckSum;
|
||||
int *m_iState;
|
||||
PACKETHEADER()
|
||||
{
|
||||
m_ID = m_Size = m_CheckSum = NULL;
|
||||
m_iState = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
PACKETHEADER m_packet_header;
|
||||
uint32 m_currentPos;
|
||||
uint8 m_pBuffer[MAX_BUFFER];
|
||||
|
||||
bool CheckLeftPacketSize( int iAddSize );
|
||||
bool CheckRightPacketSize( int iAddSize );
|
||||
public:
|
||||
void Clear();
|
||||
void SetBufferCopy(char *pBuf,int size);
|
||||
void SetDataAdd(char *pBuf,int size);
|
||||
void SetCheckSum( DWORD dwSum );
|
||||
void SetState( int iState );
|
||||
|
||||
public:
|
||||
const uint8* GetBuffer() const; //패킷 버퍼의 모든 내용(헤더 포함).
|
||||
const uint8* GetData() const; //패킷 버퍼의 데이터 내용(헤더 미포함).
|
||||
|
||||
uint32 GetBufferSize() const;
|
||||
uint32 GetDataSize() const;
|
||||
|
||||
DWORD GetPacketID() const;
|
||||
DWORD GetCheckSum() const;
|
||||
int GetState() const;
|
||||
|
||||
bool IsValidHeader() const;
|
||||
bool IsValidPacket() const;
|
||||
|
||||
public:
|
||||
CPacket();
|
||||
CPacket( DWORD ID );
|
||||
CPacket( const uint8 *buffer, uint32 size );
|
||||
virtual ~CPacket();
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "RecvBuffer.h"
|
||||
|
||||
RecvBuffer::RecvBuffer()
|
||||
{
|
||||
InitBuffer();
|
||||
}
|
||||
|
||||
RecvBuffer::~RecvBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
void RecvBuffer::InitBuffer()
|
||||
{
|
||||
m_iCurRcvSize = 0;
|
||||
}
|
||||
|
||||
void RecvBuffer::UpdateRecvSize( int iCurRcvSize )
|
||||
{
|
||||
m_iCurRcvSize += iCurRcvSize;
|
||||
}
|
||||
|
||||
void RecvBuffer::RewindBuffer( int iRewindSize )
|
||||
{
|
||||
m_iCurRcvSize -= iRewindSize;
|
||||
|
||||
memcpy( m_pRewindBuf, ( m_pBuf + iRewindSize ), m_iCurRcvSize );
|
||||
memcpy( m_pBuf, m_pRewindBuf, m_iCurRcvSize );
|
||||
}
|
||||
|
||||
char* RecvBuffer::GetStartPtr()
|
||||
{
|
||||
return m_pBuf;
|
||||
}
|
||||
|
||||
char* RecvBuffer::GetFreeSpacePtr()
|
||||
{
|
||||
return m_pBuf + m_iCurRcvSize;
|
||||
}
|
||||
|
||||
int RecvBuffer::GetCurRcvSize() const
|
||||
{
|
||||
return m_iCurRcvSize;
|
||||
}
|
||||
|
||||
int RecvBuffer::GetFreeSpaceSize() const
|
||||
{
|
||||
return MAX_BUFFER - m_iCurRcvSize;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
#ifndef _RecvBuffer_h_
|
||||
#define _RecvBuffer_h_
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
|
||||
class RecvBuffer
|
||||
{
|
||||
private:
|
||||
char m_pBuf[MAX_BUFFER];
|
||||
int m_iCurRcvSize;
|
||||
|
||||
char m_pRewindBuf[MAX_BUFFER];
|
||||
|
||||
public:
|
||||
void InitBuffer();
|
||||
void UpdateRecvSize( int iCurRcvSize );
|
||||
void RewindBuffer( int iRewindSize );
|
||||
|
||||
public:
|
||||
char* GetStartPtr();
|
||||
char* GetFreeSpacePtr();
|
||||
int GetCurRcvSize() const;
|
||||
int GetFreeSpaceSize() const;
|
||||
|
||||
public:
|
||||
RecvBuffer();
|
||||
~RecvBuffer();
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,397 @@
|
||||
#include "../stdafx.h"
|
||||
#include "SP2Packet.h"
|
||||
|
||||
SP2Packet::SP2Packet()
|
||||
{
|
||||
}
|
||||
|
||||
SP2Packet::SP2Packet( const SP2Packet &rhs )
|
||||
{
|
||||
Clear();
|
||||
memcpy( m_pBuffer, rhs.GetBuffer(), rhs.GetBufferSize() );
|
||||
m_currentPos = rhs.m_currentPos;
|
||||
}
|
||||
|
||||
SP2Packet::SP2Packet(DWORD ID) : CPacket( ID )
|
||||
{
|
||||
}
|
||||
|
||||
SP2Packet::SP2Packet(const uint8* buffer,int size) : CPacket( buffer, size )
|
||||
{
|
||||
}
|
||||
|
||||
SP2Packet::SP2Packet( DWORD dwUserIndex, SP2Packet &rhs )
|
||||
{
|
||||
Clear();
|
||||
|
||||
*m_packet_header.m_ID = rhs.GetPacketID();
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
*this << dwUserIndex;
|
||||
SetDataAdd( (char*)rhs.GetData(), rhs.GetDataSize() );
|
||||
}
|
||||
|
||||
SP2Packet::~SP2Packet()
|
||||
{
|
||||
}
|
||||
|
||||
const uint8* SP2Packet::GetData() const
|
||||
{
|
||||
return &m_pBuffer[0] + sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
int SP2Packet::GetDataSize() const
|
||||
{
|
||||
return *m_packet_header.m_Size - sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
const uint8* SP2Packet::GetBuffer() const
|
||||
{
|
||||
return &m_pBuffer[0];
|
||||
}
|
||||
|
||||
int SP2Packet::GetBufferSize() const
|
||||
{
|
||||
return *m_packet_header.m_Size;
|
||||
}
|
||||
|
||||
void SP2Packet::SetDataAdd( char *buffer, int size, bool bCurPosReSet )
|
||||
{
|
||||
memcpy( &m_pBuffer[m_currentPos], buffer, size );
|
||||
m_currentPos += size;
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
if( bCurPosReSet )
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
void SP2Packet::SetDataAddCreateUDP( DWORD dwIP, DWORD dwPort, char *buffer, int size, bool bCurPosReSet /* = false */ )
|
||||
{
|
||||
*this << dwIP << dwPort;
|
||||
memcpy( &m_pBuffer[m_currentPos], buffer, size );
|
||||
m_currentPos += size;
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
if( bCurPosReSet )
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
void SP2Packet::MovePointer( DWORD dwMoveBytes )
|
||||
{
|
||||
m_currentPos += dwMoveBytes;
|
||||
m_currentPos = min( m_currentPos, GetBufferSize() );
|
||||
}
|
||||
|
||||
void SP2Packet::SetPosBegin()
|
||||
{
|
||||
m_currentPos = sizeof(PACKETHEADER);
|
||||
}
|
||||
|
||||
|
||||
//operator
|
||||
SP2Packet& SP2Packet::operator = (const SP2Packet &packet)
|
||||
{
|
||||
Clear();
|
||||
memcpy(&m_pBuffer[0],packet.GetBuffer(),packet.GetBufferSize());
|
||||
m_currentPos = packet.m_currentPos;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (BYTE arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(BYTE) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(BYTE));
|
||||
m_currentPos += sizeof(BYTE);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (bool arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(bool) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(bool));
|
||||
m_currentPos += sizeof(bool);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (int arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(int) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(int));
|
||||
m_currentPos += sizeof(int);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (LONG arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(LONG) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(LONG));
|
||||
m_currentPos += sizeof(LONG);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (WORD arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(WORD) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(WORD));
|
||||
m_currentPos += sizeof(WORD);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (DWORD arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(DWORD) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(DWORD));
|
||||
m_currentPos += sizeof(DWORD);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (__int64 arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(__int64) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(__int64));
|
||||
m_currentPos += sizeof(__int64);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (LPTSTR arg)
|
||||
{
|
||||
int nlen = lstrlen(arg) * sizeof( TCHAR ) + sizeof( TCHAR );
|
||||
|
||||
if( !CheckLeftPacketSize( nlen ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],arg,nlen);
|
||||
m_currentPos += nlen;
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (double arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(double) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(double));
|
||||
m_currentPos += sizeof(double);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (float arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(float) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(float));
|
||||
m_currentPos += sizeof(float);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (short arg)
|
||||
{
|
||||
if( !CheckLeftPacketSize( sizeof(short) ) ) return *this;
|
||||
|
||||
memcpy(&m_pBuffer[m_currentPos],&arg,sizeof(short));
|
||||
m_currentPos += sizeof(short);
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//SP2Packet& SP2Packet::operator << ( CHARACTER &arg )
|
||||
//{
|
||||
// arg.FillData( *this );
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
SP2Packet& SP2Packet::operator << ( const ioHashString &arg )
|
||||
{
|
||||
int nlen = lstrlen( arg.c_str() ) + 1;
|
||||
|
||||
if( !CheckLeftPacketSize( nlen ) ) return *this;
|
||||
|
||||
memcpy( &m_pBuffer[m_currentPos], arg.c_str(), nlen );
|
||||
m_currentPos += nlen;
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (CQueryData &arg)
|
||||
{
|
||||
memcpy(&m_pBuffer[m_currentPos],arg.GetHeader(),sizeof(QueryHeader));
|
||||
m_currentPos += sizeof(QueryHeader);
|
||||
memcpy(&m_pBuffer[m_currentPos],arg.GetBuffer(),arg.GetBufferSize());
|
||||
m_currentPos += arg.GetBufferSize();
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator << (CQueryResultData &arg)
|
||||
{
|
||||
memcpy(&m_pBuffer[m_currentPos],arg.GetHeader(),sizeof(QueryResultHeader));
|
||||
m_currentPos += sizeof(QueryResultHeader);
|
||||
memcpy(&m_pBuffer[m_currentPos],arg.GetBuffer(),arg.GetResultBufferSize());
|
||||
m_currentPos += arg.GetResultBufferSize();
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (BYTE &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(BYTE) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(BYTE));
|
||||
m_currentPos += sizeof(BYTE);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (bool &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(bool) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(bool));
|
||||
m_currentPos += sizeof(bool);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (int &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(int) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(int));
|
||||
m_currentPos += sizeof(int);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (LONG &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(LONG) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(LONG));
|
||||
m_currentPos += sizeof(LONG);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (WORD &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(WORD) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(WORD));
|
||||
m_currentPos += sizeof(WORD);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (DWORD &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(DWORD) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(DWORD));
|
||||
m_currentPos += sizeof(DWORD);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (__int64 &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(__int64) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(__int64));
|
||||
m_currentPos += sizeof(__int64);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (LPTSTR arg)
|
||||
{
|
||||
int nlen = lstrlen((LPTSTR)&m_pBuffer[m_currentPos]) * sizeof( TCHAR ) + sizeof( TCHAR );
|
||||
|
||||
if( !CheckRightPacketSize( nlen ) ) return *this;
|
||||
|
||||
memcpy(arg,&m_pBuffer[m_currentPos],nlen);
|
||||
m_currentPos += nlen;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (double &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(double) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(double));
|
||||
m_currentPos += sizeof(double);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (float &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(float) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(float));
|
||||
m_currentPos += sizeof(float);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (short &arg)
|
||||
{
|
||||
if( !CheckRightPacketSize( sizeof(short) ) ) return *this;
|
||||
|
||||
memcpy(&arg,&m_pBuffer[m_currentPos],sizeof(short));
|
||||
m_currentPos += sizeof(short);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//SP2Packet& SP2Packet::operator >> (CHARACTER &arg)
|
||||
//{
|
||||
// arg.ApplyData( *this );
|
||||
//
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> ( ioHashString &arg )
|
||||
{
|
||||
int nlen = lstrlen((LPTSTR)&m_pBuffer[m_currentPos]) * sizeof( TCHAR ) + sizeof( TCHAR );
|
||||
|
||||
if( !CheckRightPacketSize( nlen ) ) return *this;
|
||||
|
||||
arg = reinterpret_cast<const char*>(&m_pBuffer[m_currentPos]);
|
||||
m_currentPos += nlen;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (CQueryData &arg)
|
||||
{
|
||||
arg.SetBuffer(&m_pBuffer[m_currentPos]);
|
||||
m_currentPos += sizeof(QueryHeader);
|
||||
m_currentPos += arg.GetBufferSize();
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SP2Packet& SP2Packet::operator >> (CQueryResultData &arg)
|
||||
{
|
||||
arg.SetBuffer(&m_pBuffer[m_currentPos]);
|
||||
m_currentPos += sizeof(QueryResultHeader);
|
||||
m_currentPos += arg.GetResultBufferSize();
|
||||
*m_packet_header.m_Size = m_currentPos;
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#ifndef _SP2Packet_h_
|
||||
#define _SP2Packet_h_
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ioHashString.h"
|
||||
|
||||
|
||||
class SP2Packet : public CPacket
|
||||
{
|
||||
public:
|
||||
SP2Packet();
|
||||
SP2Packet( const SP2Packet &rhs );
|
||||
SP2Packet(DWORD ID);
|
||||
SP2Packet(const uint8* buffer,int size);
|
||||
SP2Packet( DWORD dwUserIndex, SP2Packet &rhs );
|
||||
virtual ~SP2Packet();
|
||||
|
||||
const uint8* GetData() const;
|
||||
int GetDataSize() const;
|
||||
const uint8* GetBuffer() const;
|
||||
int GetBufferSize() const;
|
||||
void SetDataAdd( char *buffer, int size, bool bCurPosReSet = false );
|
||||
void SetDataAddCreateUDP( DWORD dwIP, DWORD dwPort, char *buffer, int size, bool bCurPosReSet = false );
|
||||
// >> ÂÊÀ¸·Î current_pos À̵¿
|
||||
void MovePointer( DWORD dwMoveBytes );
|
||||
void SetPosBegin();
|
||||
|
||||
//operator
|
||||
public:
|
||||
SP2Packet& operator = ( const SP2Packet& packet );
|
||||
SP2Packet& operator << (BYTE arg);
|
||||
SP2Packet& operator << (bool arg);
|
||||
SP2Packet& operator << (int arg);
|
||||
SP2Packet& operator << (LONG arg);
|
||||
SP2Packet& operator << (WORD arg);
|
||||
SP2Packet& operator << (DWORD arg);
|
||||
SP2Packet& operator << (__int64 arg);
|
||||
SP2Packet& operator << (LPTSTR arg);
|
||||
SP2Packet& operator << (double arg);
|
||||
SP2Packet& operator << (float arg);
|
||||
SP2Packet& operator << (short arg);
|
||||
//SP2Packet& operator << ( CHARACTER &arg );
|
||||
SP2Packet& operator << ( const ioHashString &arg );
|
||||
|
||||
SP2Packet& operator << (CQueryData &arg);
|
||||
SP2Packet& operator << (CQueryResultData &arg);
|
||||
|
||||
SP2Packet& operator >> (BYTE &arg);
|
||||
SP2Packet& operator >> (bool &arg);
|
||||
SP2Packet& operator >> (int &arg);
|
||||
SP2Packet& operator >> (LONG &arg);
|
||||
SP2Packet& operator >> (WORD &arg);
|
||||
SP2Packet& operator >> (DWORD &arg);
|
||||
SP2Packet& operator >> (__int64 &arg);
|
||||
SP2Packet& operator >> (LPTSTR arg);
|
||||
SP2Packet& operator >> (double &arg);
|
||||
SP2Packet& operator >> (float &arg);
|
||||
SP2Packet& operator >> (short &arg);
|
||||
//SP2Packet& operator >> (CHARACTER &arg);
|
||||
SP2Packet& operator >> ( ioHashString &arg );
|
||||
|
||||
SP2Packet& operator >> (CQueryData &arg);
|
||||
SP2Packet& operator >> (CQueryResultData &arg);
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
#include "../StdAfx.h"
|
||||
#include "cryption.h"
|
||||
#include "SecurityTCP.h"
|
||||
|
||||
SecurityTCP::SecurityTCP(void)
|
||||
{
|
||||
InitState();
|
||||
}
|
||||
|
||||
SecurityTCP::~SecurityTCP(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SecurityTCP::InitState()
|
||||
{
|
||||
m_SndState.InitState();
|
||||
m_RcvState.InitState();
|
||||
}
|
||||
|
||||
// Packet CheckSum
|
||||
void SecurityTCP::EncryptMsg( CPacket &rkPacket )
|
||||
{
|
||||
// Check Sum
|
||||
DWORD dwResult = MakeDigest( (BYTE*)rkPacket.GetBuffer(), rkPacket.GetBufferSize() );
|
||||
rkPacket.SetCheckSum( dwResult );
|
||||
|
||||
// Encryption
|
||||
BYTE *pSrc;
|
||||
pSrc = (BYTE*)rkPacket.GetBuffer() + PK_CKSUM_ADDR;
|
||||
Encrypt( pSrc, rkPacket.GetBufferSize() - PK_CKSUM_ADDR );
|
||||
}
|
||||
|
||||
void SecurityTCP::DecryptMsg( CPacket &rkPacket )
|
||||
{
|
||||
// Decryption
|
||||
BYTE *pSrc;
|
||||
pSrc = (BYTE*)rkPacket.GetBuffer() + PK_CKSUM_ADDR;
|
||||
Decrypt( pSrc, rkPacket.GetBufferSize() - PK_CKSUM_ADDR );
|
||||
}
|
||||
|
||||
bool SecurityTCP::IsCheckSum( CPacket &rkPacket )
|
||||
{
|
||||
//Decrypt
|
||||
DecryptMsg( rkPacket );
|
||||
|
||||
DWORD dwTemp = rkPacket.GetCheckSum(); //Àӽà ÀúÀå.
|
||||
rkPacket.SetCheckSum( 0 );
|
||||
|
||||
DWORD dwResult = MakeDigest( (BYTE*)rkPacket.GetBuffer(), rkPacket.GetBufferSize() );
|
||||
|
||||
rkPacket.SetCheckSum( dwTemp );
|
||||
|
||||
// Check Sum
|
||||
return ( dwResult == rkPacket.GetCheckSum() );
|
||||
}
|
||||
|
||||
// Packet Replay
|
||||
int SecurityTCP::GetSndState()
|
||||
{
|
||||
return m_SndState.GetState();
|
||||
}
|
||||
|
||||
void SecurityTCP::UpdateSndState()
|
||||
{
|
||||
m_SndState.UpdateState();
|
||||
}
|
||||
|
||||
int SecurityTCP::GetRcvState()
|
||||
{
|
||||
return m_RcvState.GetState();
|
||||
}
|
||||
|
||||
void SecurityTCP::UpdateRcvState()
|
||||
{
|
||||
m_RcvState.UpdateState();
|
||||
}
|
||||
|
||||
bool SecurityTCP::CheckState( CPacket &rkPacket )
|
||||
{
|
||||
if( GetRcvState() == MAGIC_TOKEN_FSM )
|
||||
{
|
||||
m_RcvState.SetState( rkPacket.GetState() );
|
||||
m_SndState.SetState( rkPacket.GetState() );
|
||||
UpdateSndState();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetRcvState() != rkPacket.GetState() )
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateRcvState();
|
||||
return true;
|
||||
}
|
||||
|
||||
void SecurityTCP::PrepareMsg( CPacket &rkPacket )
|
||||
{
|
||||
rkPacket.SetState( GetSndState() );
|
||||
|
||||
EncryptMsg( rkPacket );
|
||||
|
||||
UpdateSndState();
|
||||
}
|
||||
|
||||
void SecurityTCP::CompletionMsg( CPacket &rkPacket )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "FSM.h"
|
||||
#include "NetworkSecurity.h"
|
||||
|
||||
|
||||
class SecurityTCP : public NetworkSecurity
|
||||
{
|
||||
public:
|
||||
SecurityTCP(void);
|
||||
~SecurityTCP(void);
|
||||
|
||||
public:
|
||||
void InitState();
|
||||
|
||||
// Packet CheckSum
|
||||
protected:
|
||||
void EncryptMsg( CPacket &rkPacket );
|
||||
void DecryptMsg( CPacket &rkPacket );
|
||||
public:
|
||||
virtual bool IsCheckSum( CPacket &rkPacket );
|
||||
|
||||
// Packet Replay
|
||||
public:
|
||||
virtual int GetSndState();
|
||||
virtual void UpdateSndState();
|
||||
virtual int GetRcvState();
|
||||
virtual void UpdateRcvState();
|
||||
virtual bool CheckState( CPacket &rkPacket );
|
||||
|
||||
// Send
|
||||
public:
|
||||
virtual void PrepareMsg( CPacket &rkPacket );
|
||||
virtual void CompletionMsg( CPacket &rkPacket );
|
||||
|
||||
private:
|
||||
FSM m_SndState;
|
||||
FSM m_RcvState;
|
||||
};
|
||||
@@ -0,0 +1,127 @@
|
||||
#include "../StdAfx.h"
|
||||
#include "cryption.h"
|
||||
#include "SecurityUDP.h"
|
||||
|
||||
SecurityUDP::SecurityUDP(void)
|
||||
{
|
||||
m_SndState.InitState();
|
||||
m_RcvState.InitState();
|
||||
|
||||
m_recent_rcv_port = 0;
|
||||
memset(m_recent_rcv_ip, 0, sizeof(m_recent_rcv_ip));
|
||||
m_pre_recent_rcv_port = 0;
|
||||
memset( m_pre_recent_rcv_ip, 0, sizeof(m_pre_recent_rcv_ip) );
|
||||
}
|
||||
|
||||
SecurityUDP::~SecurityUDP(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SecurityUDP::RcvPeerInfo( char *iip, int iPort )
|
||||
{
|
||||
sprintf( m_recent_rcv_ip, iip );
|
||||
m_recent_rcv_port = iPort;
|
||||
}
|
||||
|
||||
// Packet CheckSum
|
||||
void SecurityUDP::EncryptMsg( CPacket &rkPacket )
|
||||
{
|
||||
// Check Sum
|
||||
DWORD dwResult = MakeDigest( (BYTE*)rkPacket.GetBuffer(), rkPacket.GetBufferSize() );
|
||||
rkPacket.SetCheckSum( dwResult );
|
||||
|
||||
// Encryption
|
||||
BYTE *pSrc;
|
||||
pSrc = (BYTE*)rkPacket.GetBuffer() + PK_CKSUM_ADDR;
|
||||
Encrypt( pSrc, rkPacket.GetBufferSize() - PK_CKSUM_ADDR );
|
||||
}
|
||||
|
||||
void SecurityUDP::DecryptMsg( CPacket &rkPacket )
|
||||
{
|
||||
// Decryption
|
||||
BYTE *pSrc;
|
||||
pSrc = (BYTE*)rkPacket.GetBuffer() + PK_CKSUM_ADDR;
|
||||
Decrypt( pSrc, rkPacket.GetBufferSize() - PK_CKSUM_ADDR );
|
||||
}
|
||||
|
||||
bool SecurityUDP::IsCheckSum( CPacket &rkPacket )
|
||||
{
|
||||
//Decrypt
|
||||
DecryptMsg( rkPacket );
|
||||
|
||||
DWORD dwTemp = rkPacket.GetCheckSum(); //Àӽà ÀúÀå.
|
||||
rkPacket.SetCheckSum( 0 );
|
||||
|
||||
DWORD dwResult = MakeDigest( (BYTE*)rkPacket.GetBuffer(), rkPacket.GetBufferSize() );
|
||||
|
||||
rkPacket.SetCheckSum( dwTemp );
|
||||
|
||||
// Check Sum
|
||||
if( dwResult != rkPacket.GetCheckSum() )
|
||||
{
|
||||
//LOG.PrintTimeAndLog( LOG_DEBUG_LEVEL, "SecurityUDP::IsCheckSum Check Sum Fail!! [0x%x](%s:%d)", rkPacket.GetPacketID(), m_recent_rcv_ip, m_recent_rcv_port );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Packet Replay
|
||||
int SecurityUDP::GetSndState()
|
||||
{
|
||||
return m_SndState.GetState();
|
||||
}
|
||||
|
||||
void SecurityUDP::UpdateSndState()
|
||||
{
|
||||
m_SndState.UpdateState();
|
||||
}
|
||||
|
||||
int SecurityUDP::GetRcvState()
|
||||
{
|
||||
return m_RcvState.GetState();
|
||||
}
|
||||
|
||||
void SecurityUDP::UpdateRcvState()
|
||||
{
|
||||
m_RcvState.UpdateState();
|
||||
}
|
||||
|
||||
bool SecurityUDP::CheckState( CPacket &rkPacket )
|
||||
{
|
||||
if( rkPacket.GetState() != MAGIC_TOKEN_FSM )
|
||||
{
|
||||
if( GetRcvState() == rkPacket.GetState() )
|
||||
{
|
||||
if( !strcmp( m_recent_rcv_ip, m_pre_recent_rcv_ip ) && m_recent_rcv_port == m_pre_recent_rcv_port )
|
||||
{
|
||||
//LOG.PrintTimeAndLog( LOG_DEBUG_LEVEL, "SecurityUDP::CheckState Type:[0x%x] State Not Same %d(%s:%d)",
|
||||
// rkPacket.GetPacketID(), rkPacket.GetState(), m_recent_rcv_ip, m_recent_rcv_port );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(m_pre_recent_rcv_ip, m_recent_rcv_ip);
|
||||
m_pre_recent_rcv_port = m_recent_rcv_port;
|
||||
|
||||
m_RcvState.SetState( rkPacket.GetState() );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SecurityUDP::PrepareMsg( CPacket &rkPacket )
|
||||
{
|
||||
if( GetSndState() == MAGIC_TOKEN_FSM ) // First
|
||||
m_SndState.SetState( rand() );
|
||||
|
||||
rkPacket.SetCheckSum( 0 );
|
||||
rkPacket.SetState( GetSndState() );
|
||||
|
||||
EncryptMsg( rkPacket );
|
||||
|
||||
UpdateSndState();
|
||||
}
|
||||
|
||||
void SecurityUDP::CompletionMsg( CPacket &rkPacket )
|
||||
{
|
||||
// DecryptMsg( rkPacket );
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "FSM.h"
|
||||
#include "NetworkSecurity.h"
|
||||
|
||||
class SecurityUDP : public NetworkSecurity
|
||||
{
|
||||
public:
|
||||
SecurityUDP(void);
|
||||
~SecurityUDP(void);
|
||||
|
||||
// Packet CheckSum
|
||||
protected:
|
||||
void EncryptMsg( CPacket &rkPacket );
|
||||
void DecryptMsg( CPacket &rkPacket );
|
||||
|
||||
public:
|
||||
virtual bool IsCheckSum( CPacket &rkPacket );
|
||||
|
||||
// Packet Replay
|
||||
public:
|
||||
virtual int GetSndState();
|
||||
virtual void UpdateSndState();
|
||||
virtual int GetRcvState();
|
||||
virtual void UpdateRcvState();
|
||||
virtual bool CheckState( CPacket &rkPacket );
|
||||
|
||||
// Send
|
||||
public:
|
||||
virtual void PrepareMsg( CPacket &rkPacket );
|
||||
virtual void CompletionMsg( CPacket &rkPacket );
|
||||
|
||||
public:
|
||||
void RcvPeerInfo( char *iip, int iPort );
|
||||
|
||||
protected:
|
||||
FSM m_SndState;
|
||||
FSM m_RcvState;
|
||||
char m_recent_rcv_ip[16];
|
||||
int m_recent_rcv_port;
|
||||
char m_pre_recent_rcv_ip[16];
|
||||
int m_pre_recent_rcv_port;
|
||||
|
||||
};
|
||||
@@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "SendBuffer.h"
|
||||
|
||||
SendBuffer::SendBuffer()
|
||||
{
|
||||
InitBuffer();
|
||||
}
|
||||
|
||||
SendBuffer::~SendBuffer()
|
||||
{
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
void SendBuffer::InitBuffer()
|
||||
{
|
||||
memset(m_pBuffer, 0, sizeof(m_pBuffer) );
|
||||
m_pStart = m_pEnd = m_pBuffer;
|
||||
m_iRestCnt = 0;
|
||||
m_bBlock = false;
|
||||
}
|
||||
|
||||
void SendBuffer::ClearBuffer()
|
||||
{
|
||||
memset(m_pBuffer, 0, sizeof(m_pBuffer) );
|
||||
m_pStart = m_pEnd = m_pBuffer;
|
||||
m_iRestCnt = 0;
|
||||
m_bBlock = false;
|
||||
}
|
||||
|
||||
bool SendBuffer::EnqueueData( const char *pData, int iPacketSize)
|
||||
{
|
||||
if( m_iRestCnt + iPacketSize > MAX_BUFFER )
|
||||
return false;
|
||||
|
||||
memcpy(m_pEnd, pData, iPacketSize);
|
||||
|
||||
int iExtra = 0;
|
||||
iExtra = m_pEnd + iPacketSize - m_pBuffer - MAX_BUFFER;
|
||||
if( iExtra >= 0) // MAX_TEMP_BUFF 까지 복사가 되었는지
|
||||
{
|
||||
memcpy(m_pBuffer, m_pBuffer + MAX_BUFFER, iExtra);
|
||||
m_pEnd = m_pBuffer + iExtra;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pEnd += iPacketSize;
|
||||
}
|
||||
|
||||
m_iRestCnt += iPacketSize;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int SendBuffer::DequeueData(int iTransfered)
|
||||
{
|
||||
int iExtra = m_pStart + iTransfered - m_pBuffer - MAX_BUFFER;
|
||||
int iRestSize = 0;
|
||||
|
||||
if( iExtra >= 0)
|
||||
m_pStart = m_pBuffer + iExtra;
|
||||
else
|
||||
m_pStart += iTransfered;
|
||||
|
||||
m_iRestCnt -= iTransfered;
|
||||
iRestSize = m_iRestCnt;
|
||||
|
||||
if( iRestSize > 0)
|
||||
{
|
||||
if( iRestSize > MAX_TEMP_BUFF ) iRestSize = MAX_TEMP_BUFF;
|
||||
|
||||
iExtra = m_pBuffer + MAX_BUFFER - m_pStart;
|
||||
|
||||
if( iExtra < iRestSize ) // 앞쪽에 있는 데이터를 뒤로 복사해옴
|
||||
{
|
||||
memcpy( m_pBuffer + MAX_BUFFER, m_pBuffer, iRestSize - iExtra );
|
||||
}
|
||||
}
|
||||
|
||||
return iRestSize;
|
||||
}
|
||||
|
||||
int SendBuffer::GetRestCnt()
|
||||
{
|
||||
int iRestSize = m_iRestCnt;
|
||||
int iExtra = 0;
|
||||
|
||||
if( iRestSize > 0)
|
||||
{
|
||||
if( iRestSize > MAX_TEMP_BUFF ) iRestSize = MAX_TEMP_BUFF;
|
||||
|
||||
iExtra = m_pBuffer + MAX_BUFFER - m_pStart;
|
||||
|
||||
if( iExtra < iRestSize )
|
||||
{
|
||||
memcpy( m_pBuffer + MAX_BUFFER, m_pBuffer, iRestSize - iExtra);
|
||||
}
|
||||
}
|
||||
|
||||
return iRestSize;
|
||||
}
|
||||
|
||||
char* SendBuffer::GetQueuePtr() const
|
||||
{
|
||||
return m_pStart;
|
||||
}
|
||||
|
||||
void SendBuffer::SetBlock( bool bBlock )
|
||||
{
|
||||
m_bBlock = bBlock;
|
||||
}
|
||||
|
||||
bool SendBuffer::IsBlocked() const
|
||||
{
|
||||
return m_bBlock;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
#ifndef _SendBuffer_h_
|
||||
#define _SendBuffer_h_
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
|
||||
class SendBuffer
|
||||
{
|
||||
private:
|
||||
char m_pBuffer[MAX_BUFFER + MAX_TEMP_BUFF];
|
||||
char *m_pStart;
|
||||
char *m_pEnd;
|
||||
|
||||
int m_iRestCnt;
|
||||
bool m_bBlock;
|
||||
|
||||
public:
|
||||
void InitBuffer();
|
||||
void ClearBuffer();
|
||||
|
||||
public:
|
||||
bool EnqueueData( const char *pData, int iPacketSize ); // return : Can Now Send ?
|
||||
int DequeueData( int iTransfered );
|
||||
|
||||
public:
|
||||
int GetRestCnt();
|
||||
char* GetQueuePtr() const;
|
||||
|
||||
public:
|
||||
void SetBlock( bool bBlock );
|
||||
bool IsBlocked() const;
|
||||
|
||||
public:
|
||||
SendBuffer();
|
||||
~SendBuffer();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
#ifndef _TownPortal_h_
|
||||
#define _TownPortal_h_
|
||||
|
||||
|
||||
#ifdef STATIC_TOWN_PORTAL_API
|
||||
#define TOWN_PORTAL_API
|
||||
#else
|
||||
#ifdef EXPORT_TOWN_PORTAL
|
||||
#define TOWN_PORTAL_API __declspec(dllexport)
|
||||
#else
|
||||
#define TOWN_PORTAL_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
#include "Packet.h"
|
||||
#include "ioClientTCPSocket.h"
|
||||
#include "ioUDPSocket.h"
|
||||
#include "NetworkSecurity.h"
|
||||
#include "FSM.h"
|
||||
#include "cryption.h"
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "../stdafx.h"
|
||||
#include "md5.h"
|
||||
#include "cryption.h"
|
||||
|
||||
void Encrypt(BYTE *szSrc, int len)
|
||||
{
|
||||
BYTE ch;
|
||||
BYTE temp;
|
||||
|
||||
for( int i=0 ; i<len ; i++ )
|
||||
{
|
||||
ch = szSrc[i];
|
||||
ch ^= 0xff;
|
||||
temp = (ch & 0xe0) >> 5;
|
||||
ch <<= 3;
|
||||
ch |= temp;
|
||||
szSrc[i] = ch;
|
||||
}
|
||||
}
|
||||
|
||||
void Decrypt(BYTE *szSrc, int len)
|
||||
{
|
||||
BYTE ch;
|
||||
BYTE temp;
|
||||
|
||||
for( int i=0 ; i<len ; i++ )
|
||||
{
|
||||
ch = szSrc[i];
|
||||
temp = (ch & 0x07) << 5;
|
||||
ch>>=3;
|
||||
ch |= temp;
|
||||
ch ^= 0xff;
|
||||
szSrc[i] = ch;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD MakeDigest( BYTE *szSrc, int len )
|
||||
{
|
||||
MD5Context md5_ctx;
|
||||
DWORD dwDigest[4];
|
||||
|
||||
MD5Init( &md5_ctx );
|
||||
MD5Update( &md5_ctx, (unsigned char const *)szSrc, len );
|
||||
MD5Final( (BYTE*)&dwDigest, &md5_ctx );
|
||||
|
||||
DWORD dwResult;
|
||||
dwResult = dwDigest[0] ^ dwDigest[1] ^ dwDigest[2] ^ dwDigest[3];
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
void Encrypt(BYTE *szSrc, int len);
|
||||
void Decrypt(BYTE *szSrc, int len);
|
||||
DWORD MakeDigest( BYTE *szSrc, int len );
|
||||
@@ -0,0 +1,345 @@
|
||||
|
||||
|
||||
#include "../StdAfx.h"
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ioPortalHelp.h"
|
||||
#include "ioClientTCPSocket.h"
|
||||
#include "NetworkSecurity.h"
|
||||
#include "SendBuffer.h"
|
||||
#include "RecvBuffer.h"
|
||||
|
||||
ioClientTCPSocket::ioClientTCPSocket()
|
||||
{
|
||||
m_Socket = INVALID_SOCKET;
|
||||
m_hWnd = 0;
|
||||
m_WndMsg = 0;
|
||||
|
||||
m_pSndBuf = new SendBuffer;
|
||||
m_pRcvBuf = new RecvBuffer;
|
||||
|
||||
memset( m_szConnectedIP, 0, MAX_PATH );
|
||||
m_iConnectedPort = 0;
|
||||
|
||||
m_bConnected = false;
|
||||
m_pNS = NULL;
|
||||
m_bNoNagle = FALSE;
|
||||
}
|
||||
|
||||
ioClientTCPSocket::~ioClientTCPSocket()
|
||||
{
|
||||
CloseClientTCP();
|
||||
|
||||
SAFEDELETE(m_pSndBuf);
|
||||
SAFEDELETE(m_pRcvBuf);
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::InitClientTCP( HWND hWnd, UINT uMsg, const char *szIP, int iPort )
|
||||
{
|
||||
m_pSndBuf->InitBuffer();
|
||||
m_pRcvBuf->InitBuffer();
|
||||
|
||||
m_Socket = socket( AF_INET, SOCK_STREAM, 0 );
|
||||
if( m_Socket == INVALID_SOCKET )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::InitClientTCP - socket setting error" );
|
||||
ioPortalHelp::CheckSocketError( __FILE__, __LINE__ );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hWnd = hWnd;
|
||||
m_WndMsg = uMsg;
|
||||
m_bNoNagle = FALSE;
|
||||
|
||||
int iMaxSize = MAX_BUFFER * 8;
|
||||
setsockopt( m_Socket, SOL_SOCKET, SO_SNDBUF, (const char *)&iMaxSize, sizeof(int) );
|
||||
setsockopt( m_Socket, SOL_SOCKET, SO_RCVBUF, (const char *)&iMaxSize, sizeof(int) );
|
||||
|
||||
BOOL bFlag = TRUE;
|
||||
setsockopt( m_Socket, SOL_SOCKET, SO_KEEPALIVE, (const char*)&bFlag, sizeof(BOOL) );
|
||||
|
||||
SOCKADDR_IN kLocalSockIn;
|
||||
memset( &kLocalSockIn, 0, sizeof(kLocalSockIn) );
|
||||
kLocalSockIn.sin_family = AF_INET;
|
||||
kLocalSockIn.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
kLocalSockIn.sin_port = htons(iPort);
|
||||
kLocalSockIn.sin_addr.s_addr = inet_addr(szIP);
|
||||
|
||||
if( WSAAsyncSelect( m_Socket, m_hWnd, m_WndMsg, FD_CONNECT) == SOCKET_ERROR )
|
||||
{
|
||||
DebugMBox( __FILE__, __LINE__, NULL,
|
||||
"ioClientTCPSocket::InitClientTCP-WSAAsyncSelect setting error" );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( connect( m_Socket, (LPSOCKADDR)&kLocalSockIn, sizeof(kLocalSockIn) ) == SOCKET_ERROR )
|
||||
{
|
||||
if( WSAGetLastError() != WSAEWOULDBLOCK )
|
||||
{
|
||||
DebugMBox( __FILE__, __LINE__, NULL,
|
||||
"ioClientTCPSocket::InitClientTCP-WSAAsyncSelect setting error" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
strcpy( m_szConnectedIP, szIP );
|
||||
m_iConnectedPort = iPort;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ioClientTCPSocket::SetNS( NetworkSecurity *pNS )
|
||||
{
|
||||
m_pNS = pNS;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::ReConnect()
|
||||
{
|
||||
if( m_hWnd == NULL )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::ReConnect -"
|
||||
"Window Handle NULL" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( strcmp( m_szConnectedIP, "" ) == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::ReConnect -"
|
||||
" Connect IP Zero" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_iConnectedPort == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::ReConnect -"
|
||||
" Connect PORT Zero" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_WndMsg == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::ReConnect -"
|
||||
" Window Message Zero" );
|
||||
return false;
|
||||
}
|
||||
|
||||
return InitClientTCP( m_hWnd, m_WndMsg, m_szConnectedIP, m_iConnectedPort );
|
||||
}
|
||||
|
||||
void ioClientTCPSocket::CloseClientTCP()
|
||||
{
|
||||
if( m_Socket != INVALID_SOCKET )
|
||||
closesocket( m_Socket );
|
||||
|
||||
m_Socket = INVALID_SOCKET;
|
||||
m_bConnected = false;
|
||||
m_bNoNagle = FALSE;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::EvaluateSocket( WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( WSAGETSELECTEVENT(lParam) )
|
||||
{
|
||||
case FD_CONNECT:
|
||||
if( WSAAsyncSelect( m_Socket, m_hWnd, m_WndMsg, FD_READ|FD_WRITE|FD_CLOSE) == SOCKET_ERROR )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::EvaluateSocket -"
|
||||
"AsyncSelect can not request FD_READ|FD_WRITE|FD_CLOSE" );
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case FD_CLOSE:
|
||||
CloseClientTCP();
|
||||
DisconnectProcess();
|
||||
break;
|
||||
case FD_WRITE:
|
||||
if( !m_bConnected )
|
||||
{
|
||||
m_bConnected = true;
|
||||
ConnectProcess();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pSndBuf->SetBlock( false );
|
||||
BufferSendLoop();
|
||||
}
|
||||
break;
|
||||
case FD_READ:
|
||||
RecvLoop( (SOCKET)wParam );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::SendLoop( CPacket &rkPacket )
|
||||
{
|
||||
if( m_Socket == INVALID_SOCKET || !m_bConnected )
|
||||
return false;
|
||||
|
||||
if( m_pNS )
|
||||
m_pNS->PrepareMsg( rkPacket );
|
||||
|
||||
if( m_pSndBuf->EnqueueData( rkPacket.GetBuffer(), rkPacket.GetBufferSize() ) )
|
||||
{
|
||||
bool bResult = BufferSendLoop();
|
||||
|
||||
if( m_pNS )
|
||||
m_pNS->CompletionMsg( rkPacket );
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
LOG.DebugLog( 0, __FILE__, __LINE__, "ioClientTCPSocket::SendLoop - Buffer Over Flow!!!" );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::RecvLoop( SOCKET cSocket )
|
||||
{
|
||||
int iRecvSize = recv( cSocket, m_pRcvBuf->GetFreeSpacePtr(), m_pRcvBuf->GetFreeSpaceSize(), 0 );
|
||||
|
||||
if( iRecvSize > 0 )
|
||||
{
|
||||
m_pRcvBuf->UpdateRecvSize( iRecvSize );
|
||||
|
||||
while( m_pRcvBuf->GetCurRcvSize() > 0 )
|
||||
{
|
||||
int iCurBufferRcvSize = m_pRcvBuf->GetCurRcvSize();
|
||||
|
||||
CPacket kPacket( m_pRcvBuf->GetStartPtr(), iCurBufferRcvSize );
|
||||
if( kPacket.IsValidPacket() &&
|
||||
iCurBufferRcvSize >= kPacket.GetBufferSize() )
|
||||
{
|
||||
if( CheckNS( kPacket ) )
|
||||
ProcessPacket( kPacket );
|
||||
m_pRcvBuf->RewindBuffer( kPacket.GetBufferSize() );
|
||||
}
|
||||
else
|
||||
{
|
||||
break; // 아직 패킷을 다 받지 못했다.
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if( iRecvSize == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::RecvLoop - Client TCP Socket Graceful Close" );
|
||||
return false;
|
||||
}
|
||||
else if( iRecvSize == SOCKET_ERROR )
|
||||
{
|
||||
int iLastError = WSAGetLastError();
|
||||
if ( iLastError == WSAEWOULDBLOCK )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::RecvLoop - Client TCP Socket recv Error" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::RecvLoop - EXCEPT : Exception TCP recv state" );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::CheckNS( CPacket &rkPacket )
|
||||
{
|
||||
if( !m_pNS ) return true;
|
||||
|
||||
if( !m_pNS->UpdateReceiveCount() )
|
||||
return false;
|
||||
|
||||
if( !m_pNS->IsCheckSum( rkPacket ) )
|
||||
return false;
|
||||
|
||||
if( !m_pNS->CheckState( rkPacket ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::BufferSendLoop()
|
||||
{
|
||||
if( m_pSndBuf->IsBlocked() )
|
||||
return true;
|
||||
|
||||
int nleft = m_pSndBuf->GetRestCnt();
|
||||
int nRet = 0;
|
||||
|
||||
while(nleft>0)
|
||||
{
|
||||
nRet = send( m_Socket, m_pSndBuf->GetQueuePtr(), nleft, 0 );
|
||||
|
||||
if( nRet == SOCKET_ERROR )
|
||||
{
|
||||
if( WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
{
|
||||
m_pSndBuf->SetBlock( true );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioClientTCPSocket::BufferSendLoop - Send Error" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nleft = m_pSndBuf->DequeueData(nRet);
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* ioClientTCPSocket::GetConnectedIP() const
|
||||
{
|
||||
return m_szConnectedIP;
|
||||
}
|
||||
|
||||
int ioClientTCPSocket::GetConnectedPort() const
|
||||
{
|
||||
return m_iConnectedPort;
|
||||
}
|
||||
|
||||
bool ioClientTCPSocket::IsConnected() const
|
||||
{
|
||||
return m_bConnected;
|
||||
}
|
||||
|
||||
SOCKET ioClientTCPSocket::GetSocket() const
|
||||
{
|
||||
return m_Socket;
|
||||
}
|
||||
|
||||
void ioClientTCPSocket::SetNagleAlgorithm( bool bOn )
|
||||
{
|
||||
if( m_Socket == INVALID_SOCKET )
|
||||
return;
|
||||
|
||||
if( bOn )
|
||||
{
|
||||
// Nagle On
|
||||
if( m_bNoNagle == FALSE )
|
||||
return;
|
||||
|
||||
m_bNoNagle = FALSE;
|
||||
::setsockopt( m_Socket, IPPROTO_TCP, TCP_NODELAY, (const char*)&m_bNoNagle, sizeof(m_bNoNagle) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nagle Off
|
||||
if( m_bNoNagle == TRUE )
|
||||
return;
|
||||
|
||||
m_bNoNagle = TRUE;
|
||||
::setsockopt( m_Socket, IPPROTO_TCP, TCP_NODELAY, (const char*)&m_bNoNagle, sizeof(m_bNoNagle) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
|
||||
#ifndef _ioClientTCPSocket_h_
|
||||
#define _ioClientTCPSocket_h_
|
||||
|
||||
class CPacket;
|
||||
class SendBuffer;
|
||||
class RecvBuffer;
|
||||
class NetworkSecurity;
|
||||
|
||||
class TOWN_PORTAL_API ioClientTCPSocket
|
||||
{
|
||||
protected:
|
||||
SOCKET m_Socket;
|
||||
HWND m_hWnd;
|
||||
UINT m_WndMsg;
|
||||
|
||||
SendBuffer *m_pSndBuf;
|
||||
RecvBuffer *m_pRcvBuf;
|
||||
|
||||
char m_szConnectedIP[MAX_PATH];
|
||||
int m_iConnectedPort;
|
||||
bool m_bConnected;
|
||||
BOOL m_bNoNagle;
|
||||
|
||||
public:
|
||||
bool InitClientTCP( HWND hWnd, UINT uMsg, const char *szIP, int iPort );
|
||||
void CloseClientTCP();
|
||||
bool ReConnect();
|
||||
|
||||
public:
|
||||
bool EvaluateSocket( WPARAM wParam, LPARAM lParam );
|
||||
|
||||
virtual bool SendLoop( CPacket &rkPacket );
|
||||
virtual bool RecvLoop( SOCKET cSocket );
|
||||
|
||||
protected:
|
||||
bool BufferSendLoop();
|
||||
|
||||
public:
|
||||
virtual void ConnectProcess() = 0;
|
||||
virtual void DisconnectProcess() = 0;
|
||||
virtual void ProcessPacket( CPacket &rkPacket ) = 0;
|
||||
|
||||
public:
|
||||
const char* GetConnectedIP() const;
|
||||
int GetConnectedPort() const;
|
||||
bool IsConnected() const;
|
||||
|
||||
SOCKET GetSocket() const;
|
||||
|
||||
public:
|
||||
void SetNagleAlgorithm( bool bOn );
|
||||
|
||||
protected:
|
||||
NetworkSecurity *m_pNS;
|
||||
|
||||
public:
|
||||
void SetNS( NetworkSecurity *pNS );
|
||||
virtual bool CheckNS( CPacket &rkPacket );
|
||||
|
||||
public:
|
||||
ioClientTCPSocket();
|
||||
virtual ~ioClientTCPSocket();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
#include "../stdafx.h"
|
||||
#include "ioHashString.h"
|
||||
|
||||
ioHashString::ioHashString()
|
||||
{
|
||||
m_iCapacity = DEFAULT_CAPACITY;
|
||||
m_pString = new char[ m_iCapacity ];
|
||||
|
||||
Clear();
|
||||
|
||||
m_dwHashCode = CalcHashCode( m_pString );
|
||||
}
|
||||
|
||||
ioHashString::ioHashString( const char* str ) : m_pString(NULL)
|
||||
{
|
||||
m_iLength = strlen( str );
|
||||
|
||||
int iCapacity = max( m_iLength + 1, DEFAULT_CAPACITY );
|
||||
ReAllocCapacity( iCapacity );
|
||||
|
||||
strcpy( m_pString, str );
|
||||
m_dwHashCode = CalcHashCode( str );
|
||||
}
|
||||
|
||||
ioHashString::ioHashString( const ioHashString &rhs ) : m_pString(NULL)
|
||||
{
|
||||
m_iLength = rhs.Length();
|
||||
|
||||
ReAllocCapacity( rhs.m_iCapacity );
|
||||
|
||||
strcpy( m_pString, rhs.m_pString );
|
||||
m_dwHashCode = rhs.m_dwHashCode;
|
||||
}
|
||||
|
||||
ioHashString::~ioHashString()
|
||||
{
|
||||
if( m_pString )
|
||||
{
|
||||
delete[] m_pString;
|
||||
m_pString = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool ioHashString::IsEmpty() const
|
||||
{
|
||||
return ( m_iLength == 0 );
|
||||
}
|
||||
|
||||
int ioHashString::Length() const
|
||||
{
|
||||
return m_iLength;
|
||||
}
|
||||
|
||||
void ioHashString::Clear()
|
||||
{
|
||||
memset( m_pString, 0, m_iCapacity );
|
||||
m_iLength = 0;
|
||||
}
|
||||
|
||||
const char* ioHashString::c_str() const
|
||||
{
|
||||
return m_pString;
|
||||
}
|
||||
|
||||
void ioHashString::ReAllocCapacity( int iNewCapacity )
|
||||
{
|
||||
if( m_pString )
|
||||
{
|
||||
delete[] m_pString;
|
||||
m_pString = NULL;
|
||||
}
|
||||
|
||||
m_iCapacity = iNewCapacity;
|
||||
m_pString = new char[iNewCapacity];
|
||||
}
|
||||
|
||||
DWORD ioHashString::CalcHashCode( const char *str )
|
||||
{
|
||||
DWORD dwLen, dwCh, dwResult;
|
||||
|
||||
dwLen = strlen( str );
|
||||
dwResult = HASH_CONST;
|
||||
|
||||
for( DWORD i=0; i<dwLen ; i++ )
|
||||
{
|
||||
dwCh = (DWORD)str[i];
|
||||
dwResult = ((dwResult<< 5) + dwResult) + dwCh; // hash * 33 + ch
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
DWORD ioHashString::GetHashCode() const
|
||||
{
|
||||
return m_dwHashCode;
|
||||
}
|
||||
|
||||
void ioHashString::MakeLower()
|
||||
{
|
||||
if( m_pString )
|
||||
{
|
||||
strlwr( m_pString );
|
||||
m_dwHashCode = CalcHashCode( m_pString );
|
||||
}
|
||||
}
|
||||
|
||||
void ioHashString::MakeUpper()
|
||||
{
|
||||
if( m_pString )
|
||||
{
|
||||
strupr( m_pString );
|
||||
m_dwHashCode = CalcHashCode( m_pString );
|
||||
}
|
||||
}
|
||||
|
||||
bool ioHashString::operator<( const ioHashString &rhs ) const
|
||||
{
|
||||
if( m_dwHashCode != rhs.m_dwHashCode )
|
||||
return ( m_dwHashCode < rhs.m_dwHashCode );
|
||||
|
||||
return ( strcmp( m_pString, rhs.m_pString ) < 0 );
|
||||
}
|
||||
|
||||
char ioHashString::At( int i ) const
|
||||
{
|
||||
if( m_iLength < i || !m_pString )
|
||||
{
|
||||
//assert( false );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_pString[i];
|
||||
}
|
||||
|
||||
ioHashString& ioHashString::operator=( const ioHashString &rhs )
|
||||
{
|
||||
m_iLength = rhs.Length();
|
||||
if( m_iCapacity < m_iLength + 1 )
|
||||
{
|
||||
ReAllocCapacity( m_iLength + 1 );
|
||||
}
|
||||
|
||||
strcpy(m_pString, rhs.m_pString );
|
||||
m_dwHashCode = rhs.m_dwHashCode;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ioHashString& ioHashString::operator=( const char *szText )
|
||||
{
|
||||
m_iLength = strlen( szText );
|
||||
if( m_iCapacity < m_iLength + 1 )
|
||||
{
|
||||
ReAllocCapacity( m_iLength + 1 );
|
||||
}
|
||||
|
||||
strcpy( m_pString, szText );
|
||||
m_dwHashCode = CalcHashCode( szText );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool ioHashString::operator==( const ioHashString &rhs ) const
|
||||
{
|
||||
if( m_dwHashCode != rhs.m_dwHashCode )
|
||||
return false;
|
||||
|
||||
if( strcmp( m_pString, rhs.m_pString ) != 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioHashString::operator==( const char *szText ) const
|
||||
{
|
||||
if( strcmp( m_pString, szText ) != 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioHashString::operator!=( const ioHashString &rhs ) const
|
||||
{
|
||||
if( *this == rhs )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioHashString::operator!=( const char *szText ) const
|
||||
{
|
||||
if( *this == szText )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
#ifndef _ioHashString_h_
|
||||
#define _ioHashString_h_
|
||||
|
||||
#define HASH_CONST 5381
|
||||
|
||||
#ifdef THAILAND_LONG_ID
|
||||
#define DEFAULT_CAPACITY 44 // SetReturnData() size을 사용하므로 ID_NUM_PLUS_ONE 길이 보다 길어야함
|
||||
#else
|
||||
#define DEFAULT_CAPACITY 32 // SetReturnData() size을 사용하므로 ID_NUM_PLUS_ONE 길이 보다 길어야함
|
||||
#endif
|
||||
|
||||
// Original version is www.gamza.net
|
||||
#include <vector>
|
||||
|
||||
class ioHashString
|
||||
{
|
||||
private:
|
||||
char *m_pString;
|
||||
DWORD m_dwHashCode;
|
||||
int m_iLength;
|
||||
int m_iCapacity;
|
||||
|
||||
private:
|
||||
void ReAllocCapacity( int iNewCapacity );
|
||||
|
||||
public:
|
||||
void Clear();
|
||||
|
||||
bool IsEmpty() const;
|
||||
int Length() const;
|
||||
char At( int i ) const;
|
||||
|
||||
DWORD GetHashCode() const;
|
||||
const char* c_str() const;
|
||||
|
||||
void MakeLower();
|
||||
void MakeUpper();
|
||||
|
||||
public:
|
||||
static DWORD CalcHashCode( const char *str );
|
||||
|
||||
public:
|
||||
bool operator < ( const ioHashString &rhs ) const;
|
||||
|
||||
ioHashString& operator=( const ioHashString &rhs );
|
||||
ioHashString& operator=( const char *szText );
|
||||
|
||||
bool operator==( const ioHashString &rhs ) const;
|
||||
bool operator==( const char *szText ) const;
|
||||
|
||||
bool operator!=( const ioHashString &rhs ) const;
|
||||
bool operator!=( const char *szText ) const;
|
||||
|
||||
public:
|
||||
ioHashString();
|
||||
ioHashString( const char *str );
|
||||
ioHashString( const ioHashString &rhs );
|
||||
~ioHashString();
|
||||
};
|
||||
|
||||
typedef std::vector< ioHashString > ioHashStringVec;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
|
||||
|
||||
#include "../StdAfx.h"
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
|
||||
bool ioPortalHelp::InitWinSock()
|
||||
{
|
||||
WSADATA WOSAdata;
|
||||
if( WSAStartup(0x0002, &WOSAdata) != 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ioPortalHelp::CloseWinSock()
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
int ioPortalHelp::CheckSocketError( LPSTR szFileName, int iLineNum )
|
||||
{
|
||||
int iErrorCode = WSAGetLastError();
|
||||
|
||||
switch( iErrorCode )
|
||||
{
|
||||
case WSAEACCES:
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEACCES");break;
|
||||
case WSAEADDRINUSE:
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEADDRINUSE");break;
|
||||
case WSAEADDRNOTAVAIL :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEADDRNOTAVAIL ");break;
|
||||
case WSAEAFNOSUPPORT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEAFNOSUPPORT ");break;
|
||||
case WSAEALREADY :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEALREADY ");break;
|
||||
case WSAECONNABORTED :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAECONNABORTED ");break;
|
||||
case WSAECONNREFUSED :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAECONNREFUSED ");break;
|
||||
case WSAECONNRESET :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAECONNRESET ");break;
|
||||
case WSAEDESTADDRREQ :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEDESTADDRREQ ");break;
|
||||
case WSAEFAULT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEFAULT ");break;
|
||||
case WSAEHOSTDOWN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEHOSTDOWN ");break;
|
||||
case WSAEHOSTUNREACH :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEHOSTUNREACH ");break;
|
||||
case WSAEINPROGRESS :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEINPROGRESS ");break;
|
||||
case WSAEINTR :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEINTR ");break;
|
||||
case WSAEINVAL :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEINVAL ");break;
|
||||
case WSAEISCONN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEISCONN ");break;
|
||||
case WSAEMFILE :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEMFILE ");break;
|
||||
case WSAEMSGSIZE :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEMSGSIZE ");break;
|
||||
case WSAENETDOWN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENETDOWN ");break;
|
||||
case WSAENETRESET :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENETRESET ");break;
|
||||
case WSAENETUNREACH :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENETUNREACH ");break;
|
||||
case WSAENOBUFS :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENOBUFS ");break;
|
||||
case WSAENOPROTOOPT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENOPROTOOPT ");break;
|
||||
case WSAENOTCONN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENOTCONN ");break;
|
||||
case WSAENOTSOCK :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAENOTSOCK ");break;
|
||||
case WSAEOPNOTSUPP :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEOPNOTSUPP ");break;
|
||||
case WSAEPFNOSUPPORT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEPFNOSUPPORT ");break;
|
||||
case WSAEPROCLIM :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEPROCLIM ");break;
|
||||
case WSAEPROTONOSUPPORT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEPROTONOSUPPORT ");break;
|
||||
case WSAEPROTOTYPE :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEPROTOTYPE ");break;
|
||||
case WSAESHUTDOWN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAESHUTDOWN ");break;
|
||||
case WSAESOCKTNOSUPPORT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAESOCKTNOSUPPORT ");break;
|
||||
case WSAETIMEDOUT :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAETIMEDOUT ");break;
|
||||
// case WSATYPE_NOT_FOUND :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSATYPE_NOT_FOUND ");break;
|
||||
case WSAEWOULDBLOCK :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEWOULDBLOCK ");break;
|
||||
case WSAHOST_NOT_FOUND :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAHOST_NOT_FOUND ");break;
|
||||
// case WSA_INVALID_HANDLE :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSA_INVALID_HANDLE ");break;
|
||||
// case WSA_INVALID_PARAMETER :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSA_INVALID_PARAMETER ");break;
|
||||
// case WSAINVALIDPROCTABLE :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAINVALIDPROCTABLE ");break;
|
||||
// case WSAINVALIDPROVIDER :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAINVALIDPROVIDER ");break;
|
||||
// case WSA_IO_INCOMPLETE :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSA_IO_INCOMPLETE ");break;
|
||||
// case WSA_IO_PENDING :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSA_IO_PENDING ");break;
|
||||
// case WSA_NOT_ENOUGH_MEMORY :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSA_NOT_ENOUGH_MEMORY ");break;
|
||||
case WSANOTINITIALISED :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSANOTINITIALISED ");break;
|
||||
case WSANO_DATA :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSANO_DATA ");break;
|
||||
case WSANO_RECOVERY :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSANO_RECOVERY ");break;
|
||||
// case WSASYSCALLFAILURE :
|
||||
// LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSASYSCALLFAILURE ");break;
|
||||
case WSASYSNOTREADY :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSASYSNOTREADY ");break;
|
||||
case WSATRY_AGAIN :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSATRY_AGAIN ");break;
|
||||
case WSAVERNOTSUPPORTED :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAVERNOTSUPPORTED ");break;
|
||||
case WSAEDISCON :
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError:WSAEDISCON ");break;
|
||||
default:
|
||||
LOG.DebugLog(0, szFileName, iLineNum,"CheckSocketError : Exception (%d)", iErrorCode );
|
||||
break;
|
||||
}
|
||||
|
||||
return iErrorCode;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
#ifndef _ioPortalHelp_h_
|
||||
#define _ioPortalHelp_h_
|
||||
|
||||
namespace ioPortalHelp
|
||||
{
|
||||
TOWN_PORTAL_API bool InitWinSock();
|
||||
TOWN_PORTAL_API void CloseWinSock();
|
||||
|
||||
TOWN_PORTAL_API int CheckSocketError( LPSTR szFileName, int iLineNum );
|
||||
};
|
||||
|
||||
#define MAX_BUFFER 32768 //8192 * 4
|
||||
#define MAX_TEMP_BUFF MAX_BUFFER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,266 @@
|
||||
|
||||
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
#include "ioUDPSocket.h"
|
||||
#include "Packet.h"
|
||||
#include "NetworkSecurity.h"
|
||||
|
||||
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
||||
|
||||
|
||||
ioUDPSocket::ioUDPSocket()
|
||||
{
|
||||
m_Socket = INVALID_SOCKET;
|
||||
m_hWnd = 0;
|
||||
m_WndMsg = 0;
|
||||
m_pNS = NULL;
|
||||
|
||||
ClearIPInfo();
|
||||
}
|
||||
|
||||
ioUDPSocket::~ioUDPSocket()
|
||||
{
|
||||
CloseUDP();
|
||||
}
|
||||
|
||||
void ioUDPSocket::ClearIPInfo()
|
||||
{
|
||||
memset( m_RecentRcvIP, 0, sizeof(m_RecentRcvIP) );
|
||||
m_iRecentRcvPort = 0;
|
||||
m_iMainPort = 0;
|
||||
|
||||
memset( m_PreRecentRcvIP, 0, sizeof(m_PreRecentRcvIP) );
|
||||
m_iPreRecentRcvPort = 0;
|
||||
|
||||
memset( m_szMyIP, 0, sizeof(m_szMyIP) );
|
||||
}
|
||||
|
||||
bool ioUDPSocket::InitUDP( HWND hWnd, UINT uMsg, int iPort )
|
||||
{
|
||||
ClearIPInfo();
|
||||
|
||||
m_Socket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
if( m_Socket == INVALID_SOCKET )
|
||||
{
|
||||
DebugMBox(__FILE__,__LINE__,NULL,"ioUDPSocket::InitUDP - socket setting error");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwBytesReturned = 0;
|
||||
BOOL bNewBehavior = FALSE;
|
||||
DWORD status;
|
||||
status = WSAIoctl( m_Socket, SIO_UDP_CONNRESET, &bNewBehavior, sizeof( dwBytesReturned ), NULL, 0, &dwBytesReturned, NULL, NULL );
|
||||
if( status == SOCKET_ERROR )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::InitUDP Opt None SIO_UDP_CONNRESET : %d", WSAGetLastError() );
|
||||
}
|
||||
|
||||
m_hWnd = hWnd;
|
||||
m_WndMsg = uMsg;
|
||||
|
||||
SOCKADDR_IN kLocalSockIn;
|
||||
memset( &kLocalSockIn, 0, sizeof(kLocalSockIn) );
|
||||
kLocalSockIn.sin_family = AF_INET;
|
||||
kLocalSockIn.sin_addr.s_addr = htonl( INADDR_ANY );
|
||||
kLocalSockIn.sin_port = htons( iPort );
|
||||
m_iMainPort = iPort;
|
||||
|
||||
if( bind( m_Socket, (LPSOCKADDR)&kLocalSockIn, sizeof(kLocalSockIn) ) == SOCKET_ERROR )
|
||||
{
|
||||
DebugMBox(__FILE__,__LINE__,NULL, "ioUDPSocket::InitUDP - bind setting error" );
|
||||
return false;
|
||||
}
|
||||
|
||||
int iMaxSize = MAX_BUFFER * 8;
|
||||
setsockopt( m_Socket, SOL_SOCKET, SO_SNDBUF, (const char *)&iMaxSize, sizeof(iMaxSize));
|
||||
setsockopt( m_Socket, SOL_SOCKET, SO_RCVBUF, (const char *)&iMaxSize, sizeof(iMaxSize));
|
||||
|
||||
// BOOL is_flag = TRUE;
|
||||
// setsockopt(m_socket_object, SOL_SOCKET, SO_KEEPALIVE , (const char *)&is_flag, sizeof(is_flag));
|
||||
|
||||
// BOOL no_nagle = TRUE;
|
||||
// setsockopt(m_socket_object, IPPROTO_TCP, TCP_NODELAY, (const char *)&no_nagle, sizeof(no_nagle));
|
||||
|
||||
if( WSAAsyncSelect( m_Socket, hWnd, uMsg, FD_READ) > 0 )
|
||||
{
|
||||
DebugMBox(__FILE__,__LINE__,NULL,"ioUDPSocket::InitUDP - WSAAsyncSelect error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ioUDPSocket::SetNS( NetworkSecurity *pNS )
|
||||
{
|
||||
m_pNS = pNS;
|
||||
}
|
||||
|
||||
void ioUDPSocket::CloseUDP()
|
||||
{
|
||||
if( m_Socket != INVALID_SOCKET )
|
||||
{
|
||||
closesocket( m_Socket );
|
||||
m_Socket = INVALID_SOCKET;
|
||||
}
|
||||
}
|
||||
|
||||
void ioUDPSocket::RcvPeerInfo( char *iip, int iPort )
|
||||
{
|
||||
//¿ÜºÎ ó¸®.
|
||||
}
|
||||
|
||||
bool ioUDPSocket::EvaluateSocket( WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
if( WSAGETSELECTEVENT( lParam ) == FD_READ )
|
||||
return RecvLoop( wParam );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioUDPSocket::SendLoop( const char *szIP, int iPort, CPacket &rkPacket )
|
||||
{
|
||||
SOCKADDR_IN server_sin;
|
||||
server_sin.sin_family = AF_INET;
|
||||
server_sin.sin_addr.s_addr = inet_addr( szIP );
|
||||
server_sin.sin_port = htons( iPort );
|
||||
|
||||
int server_sin_len = sizeof( server_sin );
|
||||
|
||||
if( m_pNS )
|
||||
m_pNS->PrepareMsg( rkPacket );
|
||||
|
||||
int iSendSize = sendto( m_Socket, rkPacket.GetBuffer(), rkPacket.GetBufferSize(), 0, (struct sockaddr FAR *)&server_sin, server_sin_len );
|
||||
if( iSendSize == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::SendLoop(%s:%d) : SizeZero( %d ) PacketType:%d", szIP, iPort, WSAGetLastError(), rkPacket.GetPacketID() );
|
||||
ioPortalHelp::CheckSocketError(__FILE__, __LINE__);
|
||||
}
|
||||
else if( iSendSize == SOCKET_ERROR )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::SendLoop(%s:%d) : SocketError( %d ) PacketType:%d", szIP, iPort, WSAGetLastError(), rkPacket.GetPacketID() );
|
||||
ioPortalHelp::CheckSocketError(__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
if( m_pNS )
|
||||
m_pNS->CompletionMsg( rkPacket );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ioUDPSocket::RecvLoop( SOCKET cSocket )
|
||||
{
|
||||
int iRecvSize;
|
||||
|
||||
SOCKADDR_IN kPeerSockIn;
|
||||
int iPeerSockInSize = sizeof(kPeerSockIn);
|
||||
|
||||
iRecvSize = recvfrom( cSocket,
|
||||
m_szRcvBuf,
|
||||
MAX_BUFFER,
|
||||
0,
|
||||
(struct sockaddr FAR *)&kPeerSockIn,
|
||||
&iPeerSockInSize );
|
||||
|
||||
if( iRecvSize > 0 )
|
||||
{
|
||||
wsprintf( m_RecentRcvIP, "%d.%d.%d.%d", kPeerSockIn.sin_addr.s_net,
|
||||
kPeerSockIn.sin_addr.s_host,
|
||||
kPeerSockIn.sin_addr.s_lh,
|
||||
kPeerSockIn.sin_addr.s_impno );
|
||||
|
||||
m_iRecentRcvPort = ntohs(kPeerSockIn.sin_port);
|
||||
|
||||
CPacket kPacket( m_szRcvBuf, iRecvSize );
|
||||
if( kPacket.IsValidPacket() && kPacket.GetBufferSize() == iRecvSize )
|
||||
{
|
||||
RcvPeerInfo( m_RecentRcvIP, m_iRecentRcvPort );
|
||||
if( CheckNS( kPacket ) == false ) return false;
|
||||
|
||||
ProcessPacket( kPacket, m_RecentRcvIP, m_iRecentRcvPort );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::RecvLoop - Packet Error" );
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::RecvLoop - Valid(%d), BufSize:(%d), ID(%d), RecvSize(%d)",
|
||||
kPacket.IsValidPacket(), kPacket.GetBufferSize(),
|
||||
kPacket.GetPacketID(), iRecvSize );
|
||||
ioPortalHelp::CheckSocketError( __FILE__, __LINE__ );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if( iRecvSize == 0 )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::RecvLoop - UDP Socket Graceful Close");
|
||||
ioPortalHelp::CheckSocketError(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
else if( iRecvSize==SOCKET_ERROR )
|
||||
{
|
||||
int iWSAError = WSAGetLastError();
|
||||
if( iWSAError != WSAEWOULDBLOCK )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::RecvLoop - UDP Socket SOCKET_ERROR(%d)", iWSAError );
|
||||
ioPortalHelp::CheckSocketError(__FILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG.PrintTimeAndLog( 0, "ioUDPSocket::RecvLoop - Except Unknown Error" );
|
||||
ioPortalHelp::CheckSocketError( __FILE__, __LINE__ );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ioUDPSocket::CheckNS( CPacket &rkPacket )
|
||||
{
|
||||
if( !m_pNS ) return true;
|
||||
|
||||
if( !m_pNS->UpdateReceiveCount() )
|
||||
return false;
|
||||
|
||||
if( !m_pNS->IsCheckSum( rkPacket ) )
|
||||
return false;
|
||||
|
||||
if( !m_pNS->CheckState( rkPacket ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ioUDPSocket::SocketErrorMsg( const char *szError )
|
||||
{
|
||||
if( szError )
|
||||
{
|
||||
LOG.PrintTimeAndLog( 0, "%s:%d - %s", m_RecentRcvIP, m_iRecentRcvPort, szError );
|
||||
}
|
||||
}
|
||||
|
||||
void ioUDPSocket::GetRecentIPPort( char *szIP, int &iPort )
|
||||
{
|
||||
strcpy( szIP, m_RecentRcvIP );
|
||||
iPort = m_iRecentRcvPort;
|
||||
}
|
||||
|
||||
const char* ioUDPSocket::GetMyIP()
|
||||
{
|
||||
char szHost[MAX_PATH];
|
||||
gethostname( szHost, MAX_PATH );
|
||||
|
||||
HOSTENT *pHost = gethostbyname( szHost );
|
||||
if( !pHost )
|
||||
{
|
||||
sprintf(m_szMyIP, "%d.%d.%d.%d", 127,0,0,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(m_szMyIP, "%d.%d.%d.%d", (BYTE)pHost->h_addr_list[0][0],
|
||||
(BYTE)pHost->h_addr_list[0][1],
|
||||
(BYTE)pHost->h_addr_list[0][2],
|
||||
(BYTE)pHost->h_addr_list[0][3]);
|
||||
}
|
||||
|
||||
return m_szMyIP;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
#ifndef _ioUDPSocket_h_
|
||||
#define _ioUDPSocket_h_
|
||||
|
||||
#include "ioPortalHelp.h"
|
||||
|
||||
class CPacket;
|
||||
class NetworkSecurity;
|
||||
|
||||
class TOWN_PORTAL_API ioUDPSocket
|
||||
{
|
||||
protected:
|
||||
SOCKET m_Socket;
|
||||
HWND m_hWnd;
|
||||
UINT m_WndMsg;
|
||||
|
||||
char m_RecentRcvIP[16];
|
||||
int m_iRecentRcvPort;
|
||||
|
||||
int m_iMainPort;
|
||||
|
||||
char m_PreRecentRcvIP[16];
|
||||
int m_iPreRecentRcvPort;
|
||||
|
||||
char m_szRcvBuf[MAX_BUFFER];
|
||||
char m_szMyIP[MAX_PATH];
|
||||
|
||||
protected:
|
||||
void ClearIPInfo();
|
||||
|
||||
public:
|
||||
bool InitUDP( HWND hWnd, UINT uMsg, int iPort );
|
||||
void CloseUDP();
|
||||
|
||||
public:
|
||||
bool EvaluateSocket( WPARAM wParam, LPARAM lParam );
|
||||
bool SendLoop( const char *szIP, int iPort, CPacket &rkPacket );
|
||||
|
||||
protected:
|
||||
bool RecvLoop( SOCKET cSocket );
|
||||
virtual void ProcessPacket( CPacket &rkPacket, char *RcvIP, int iRcvPort ) = 0;
|
||||
|
||||
public:
|
||||
virtual void RcvPeerInfo( char *iip, int iPort );
|
||||
virtual void SocketErrorMsg( const char *szError );
|
||||
void GetRecentIPPort( char *szIP, int &iPort );
|
||||
const char* GetMyIP();
|
||||
|
||||
protected:
|
||||
NetworkSecurity *m_pNS;
|
||||
|
||||
public:
|
||||
void SetNS( NetworkSecurity *pNS );
|
||||
virtual bool CheckNS( CPacket &rkPacket );
|
||||
|
||||
public:
|
||||
ioUDPSocket();
|
||||
virtual ~ioUDPSocket();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "md5.h"
|
||||
#include <memory.h>
|
||||
|
||||
#ifndef HIGHFIRST
|
||||
#define byteReverse(buf, len) /* Nothing */
|
||||
#else
|
||||
void byteReverse(unsigned char *buf, unsigned longs);
|
||||
|
||||
#ifndef ASM_MD5
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
*/
|
||||
void byteReverse(unsigned char *buf, unsigned longs)
|
||||
{
|
||||
DWORD t;
|
||||
do {
|
||||
t = (DWORD) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(DWORD *) buf = t;
|
||||
buf += 4;
|
||||
} while (--longs);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(MD5Context *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bits[0] = 0;
|
||||
ctx->bits[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||
{
|
||||
DWORD t;
|
||||
|
||||
/* Update bitcount */
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((DWORD) len << 3)) < t)
|
||||
ctx->bits[1]++; /* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
|
||||
if (t) {
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
|
||||
t = 64 - t;
|
||||
if (len < t) {
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (DWORD *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (DWORD *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(unsigned char digest[16], MD5Context *ctx)
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
p = ctx->in + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 64 bytes */
|
||||
count = 64 - 1 - count;
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8) {
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (DWORD *) ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
} else {
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
((DWORD *) ctx->in)[14] = ctx->bits[0];
|
||||
((DWORD *) ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform(ctx->buf, (DWORD *) ctx->in);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
#ifndef ASM_MD5
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(DWORD buf[4], DWORD const in[16])
|
||||
{
|
||||
register DWORD a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct tagMD5Context
|
||||
{
|
||||
DWORD buf[4];
|
||||
DWORD bits[2];
|
||||
unsigned char in[64];
|
||||
}MD5Context;
|
||||
|
||||
void MD5Init( MD5Context *context );
|
||||
void MD5Update( MD5Context *context, unsigned char const *buf,
|
||||
unsigned len );
|
||||
void MD5Final( unsigned char digest[16], MD5Context *context );
|
||||
void MD5Transform( DWORD buf[4], DWORD const in[16] );
|
||||
|
||||
/*
|
||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||
*/
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
name="Microsoft.Windows.LS_TTBot"
|
||||
type="win32"
|
||||
/>
|
||||
<description>여기에 응용 프로그램 설명을 추가합니다.</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// LS_TTBot.RC2 - resources Microsoft Visual C++에서 직접 편집하지 않는 리소스
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error 이 파일은 Microsoft Visual C++에서 편집할 수 없습니다.
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 여기에 수동으로 편집한 리소스를 추가합니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,33 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by LS_TTBot.rc
|
||||
//
|
||||
#define IDM_ABOUTBOX 0x0010
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDS_ABOUTBOX 101
|
||||
#define IDD_LS_TTBOT_DIALOG 102
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_EDIT_IP 1000
|
||||
#define IDC_EDIT_PORT 1001
|
||||
#define IDC_BUTTON_CONNECT 1002
|
||||
#define IDC_BUTTON_DISCONNECT 1003
|
||||
#define IDC_EDIT_INTERVAL 1004
|
||||
#define IDC_EDIT_COUNT 1005
|
||||
#define IDC_COMBO_TESTCASE 1006
|
||||
#define IDC_BUTTON_PLAY 1007
|
||||
#define IDC_BUTTON_STOP 1008
|
||||
#define IDC_LIST_LOG 1009
|
||||
#define IDC_EDIT_INTERVAL2 1010
|
||||
#define IDC_EDIT_CONCURRENT 1010
|
||||
#define IDC_STATIC_SENDRECV 1011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1012
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
// stdafx.cpp : 표준 포함 파일을 포함하는 소스 파일입니다.
|
||||
// LS_TTBot.pch는 미리 컴파일된 헤더가 됩니다.
|
||||
// stdafx.obj는 미리 컴파일된 형식 정보를 포함합니다.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
int m_iDBAgentThreadID = 0;
|
||||
@@ -0,0 +1,74 @@
|
||||
// stdafx.h : 잘 변경되지 않고 자주 사용하는
|
||||
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
|
||||
// 들어 있는 포함 파일입니다.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Windows 헤더에서 거의 사용되지 않는 내용을 제외시킵니다.
|
||||
#endif
|
||||
|
||||
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
||||
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
||||
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
|
||||
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
|
||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
|
||||
#define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
|
||||
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
|
||||
#endif
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다.
|
||||
|
||||
// MFC의 공통 부분과 무시 가능한 경고 메시지에 대한 숨기기를 해제합니다.
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC 핵심 및 표준 구성 요소
|
||||
#include <afxext.h> // MFC 익스텐션
|
||||
#include <afxdisp.h> // MFC 자동화 클래스
|
||||
|
||||
#include "common.h"
|
||||
#include <winsock2.h>
|
||||
|
||||
#include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#define WM_LOG WM_USER +1
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "network\ioHashString.h"
|
||||
#include "QueryData\QueryData.h"
|
||||
#include "QueryData\QueryResultData.h"
|
||||
#include "QueryData\cSerialize.h"
|
||||
|
||||
//결과 행동
|
||||
#define _RESULT_CHECK 0
|
||||
#define _RESULT_NAUGHT 1
|
||||
#define _RESULT_DESTROY 2
|
||||
|
||||
//작업 방식
|
||||
#define _INSERTDB 0
|
||||
#define _DELETEDB 1
|
||||
#define _SELECTDB 2
|
||||
#define _UPDATEDB 3
|
||||
#define _SELECTEX1DB 4
|
||||
|
||||
#define DBAGENT_TOTAL_REG_USER_SET 0x0002
|
||||
#define DBAGENT_GUILD_INFO_GET 0x0003
|
||||
|
||||
#define GUILD_NAME_NUM_PLUS_ONE 21
|
||||
#define GUILD_TITLE_NUMBER_PLUS_ONE 111
|
||||
|
||||
extern int m_iDBAgentThreadID;
|
||||
Reference in new issue
Block a user