Restructure repository to include all source folders

Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 20:17:20 +09:00
parent 5d3cd64a25
commit dd97ddec92
11602 changed files with 1446576 additions and 0 deletions

View File

@@ -0,0 +1,164 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
#include "RylUIDServer.h"
// 감마니아 오픈 베타용 과금 타입 (2005-09-20 zun!)
bool CUIDAgentDispatch::ProcessBillingGammania(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
// edith 2005.1.22 감마니아는 게임안에서의 처리를 여기서 해야한다.
char *Password = lpPktUUT->m_strPassword;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
LPUIDINFO pInfo = CRylUIDServer::GetInstance().FindAuth(AccountName);
if(pInfo == NULL)
{
UIDINFO stTemp;
stTemp.Cmd = Cmd;
stTemp.ServerID = ServerID;
stTemp.SessionID = SessionID;
stTemp.Group = GetGroup();
stTemp.UserID = UserID;
stTemp.CharID = CharID;
stTemp.Address = IPAddress;
strcpy(stTemp.AccountName, AccountName);
strcpy(stTemp.Password, Password);
pInfo = CRylUIDServer::GetInstance().AddAuth(stTemp);
}
// 커맨드와 패스워드는 매번 변경한다.
pInfo->Cmd = Cmd;
if(strlen(Password) > 0 && strncmp(pInfo->Password, Password, PktUUT::MaxPasswordLen) != 0)
{
strncpy(pInfo->Password, Password, PktUUT::MaxPasswordLen);
}
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
const char* szAddress = inet_ntoa(pInfo->Address);
// edith 2008.01.22 감마니아 인증 처리부분
char strBuff[512];
sprintf(strBuff, "%s'%s'%s'%s'1'I'0'%s'%s;%d;'\r\n",
CServerSetup::GetInstance().GetGammaniaCode()
, CServerSetup::GetInstance().GetGammaniaRegin()
, pInfo->AccountName
, pInfo->Password
, szAddress
, pInfo->AccountName
, Cmd);
CRylUIDServer::GetInstance().SendPost(0, strBuff);
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
const char* szAddress = inet_ntoa(pInfo->Address);
// 감마니아 로그아웃 처리
char strBuff[512];
sprintf(strBuff, "%s'%s'%s'R'''%s'%s;'\r\n",
CServerSetup::GetInstance().GetGammaniaCode()
, CServerSetup::GetInstance().GetGammaniaRegin()
, pInfo->AccountName
, szAddress
, pInfo->AccountName );
CRylUIDServer::GetInstance().SendPost(1, strBuff);
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
CPerformanceInstrument charLogin("CharLogin");
CAutoInstrument autoInstrument(charLogin);
const char* szAddress = inet_ntoa(pInfo->Address);
// edith 2008.01.22 감마니아 인증 처리부분
char strBuff[512];
sprintf(strBuff, "%s'%s'%s'%s'1'I'0'%s'%s;%d;'\r\n",
CServerSetup::GetInstance().GetGammaniaCode()
, CServerSetup::GetInstance().GetGammaniaRegin()
, pInfo->AccountName
, pInfo->Password
, szAddress
, pInfo->AccountName
, Cmd);
CRylUIDServer::GetInstance().SendPost(0, strBuff);
}
break;
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument move("ZoneMove");
CAutoInstrument autoInstrument(move);
const char* szAddress = inet_ntoa(pInfo->Address);
// 감마니아 로그아웃 처리
char strBuff[512];
sprintf(strBuff, "%s'%s'%s'R'''%s'%s;'\r\n",
CServerSetup::GetInstance().GetGammaniaCode()
, CServerSetup::GetInstance().GetGammaniaRegin()
, pInfo->AccountName
, szAddress
, pInfo->AccountName );
CRylUIDServer::GetInstance().SendPost(1, strBuff);
}
break;
}
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectGammania()
{
/*
unsigned long dwResult = 0;
if (false == DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &dwResult))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, dwResult, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USEServer_End 호출 성공", m_Group);
}
*/
return true;
}

View File

@@ -0,0 +1,235 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
// 한게임 기존 처리 루틴. DB관련 실패시 에러 주는 부분만 새로 삽입하고,
// 코드 정리를 하여야 한다.
bool CUIDAgentDispatch::ProcessBillingHan(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
// 한게임 처리 루틴
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
char Check = CServerSetup::GetInstance().GetFreeCheck() ? 1 : 0; // 기본(=0), 무료계정(=1)
if(!DBComponent::BillingDB::USPCheckBilling_Login(CDBSingleObject::GetInstance(),
AccountName, UserID, Check, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag())
{
if(1 == GetData.Flag && PktUUT::DISCONNECT_USER == lpPktUUT->GetError())
{
// 유저가 이미 접속해 있고, 유저 죽이기 플래그가 오면, 유저를 죽인다.
AgentSendPacket::SendHanUnitedUserKill(GetData.intCRMIndex1, AccountName, 0);
}
AgentSendPacket::SendUpdateUIDTable(GetGroup(), PktUUT::UpdateUIDTableUserLogin,
UserID, GetData.Flag, GetData.PlayTime, GetData.intCRMIndex1,
GetData.strBillingType[0], 0, lpPktUUT->GetError());
}
else
{
if(1 == GetData.Flag && PktUUT::DISCONNECT_USER == lpPktUUT->GetError())
{
// 유저가 이미 접속해 있고, 유저 죽이기 플래그가 오면, 유저를 죽인다.
AgentSendPacket::SendHanUnitedUserKill(GetData.intCRMIndex1, AccountName, 0);
}
// 무조건 성공시킨다. 단 중복로그인이면 로그인 못하도록 한다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd,
UserID, (1 == GetData.Flag) ? 1 : 0, GetData.PlayTime, GetData.intCRMIndex1,
GetData.strBillingType[0], 0, lpPktUUT->GetError());
}
if(0 == GetData.Flag)
{
IncreaseSucceedNum();
}
else
{
IncreaseFailNum();
}
DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login 호출 리턴 값 출력. %u, %u [%s]",
UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
IncreaseUnitNum();
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
CPerformanceInstrument charLogin("CharLogin");
CAutoInstrument autoInstrument(charLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
char Check = CServerSetup::GetInstance().GetFreeCheck() ? 1 : 0; // 기본(=0), 무료계정(=1)
if(!DBComponent::BillingDB::USPCheckBilling_CharIDLogin(CDBSingleObject::GetInstance(),
AccountName, UserID, Check, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag())
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), PktUUT::UpdateUIDTableCharLogin,
UserID, GetData.Flag, GetData.PlayTime, GetData.intCRMIndex1, GetData.strBillingType[0], 0, 0);
}
else
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), PktUUT::UpdateUIDTableCharLogin,
UserID, 0, GetData.PlayTime, GetData.intCRMIndex1, GetData.strBillingType[0], 0, 0);
}
if(0 == GetData.Flag)
{
IncreaseSucceedNum();
}
else
{
IncreaseFailNum();
}
DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin 호출 리턴 값 출력. %u, %u [%s]",
UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
IncreaseUnitNum();
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
return true;
}
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
DecreaseUnitNum();
}
break;
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument move("ZoneMove");
CAutoInstrument autoInstrument(move);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
return true;
}
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
DecreaseUnitNum();
}
break;
default:
break;
}
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectHan()
{
// 한게임 빌링이나, 한게임 통합빌링인 경우.
unsigned long Result = 0;
if(!DBComponent::BillingDB::USPDisConnectLogOut(CDBSingleObject::GetInstance(), m_Group, &Result))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, Result, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USPDisConnectLogOut 호출 성공", m_Group);
if(!DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &Result))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, Result, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USEServer_End 호출 성공", m_Group);
}
}
return true;
}

View File

@@ -0,0 +1,291 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include "HanUnitedBilling.h"
#include "HanUnitedDisconnID.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
// 한게임 통합빌링 처리. 아주 복잡하고도 골치아픈 작업이 될 거 같다 --;;
bool CUIDAgentDispatch::ProcessBillingHanUnited(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
// 한게임 처리 루틴
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
char Check = CServerSetup::GetInstance().GetFreeCheck() ? 1 : 0; // 기본(=0), 무료계정(=1)
if(!DBComponent::BillingDB::USPCheckBilling_Login_Post(CDBSingleObject::GetInstance(),
AccountName, UserID, Check, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login_Post 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag())
{
if(1 == GetData.Flag && PktUUT::DISCONNECT_USER == lpPktUUT->GetError())
{
// 유저가 이미 접속해 있고, 유저 죽이기 플래그가 오면, 유저를 죽인다.
AgentSendPacket::SendHanUnitedUserKill(GetData.intCRMIndex1, AccountName, 0);
}
if(2 <= GetData.Flag)
{
// 빌링 실패한 경우 - 통합빌링으로 체크를 보낸다.
GET_SINGLE_DISPATCH(lpHanUnitedDispatch, CHanUnitedDispatch,
CHanUnitedDispatch::GetDispatchTable());
if(0 == lpHanUnitedDispatch ||
!lpHanUnitedDispatch->SendCanLogin(*lpPktUUT, GetData, GetGroup()))
{
SERLOG5(g_Log, "ID:%s/IP:%s/UID:%u/CID:%u/ServerID:0x%08x/통합빌링으로 과금 가능 여부 전송 실패.",
lpPktUUT->m_strAccount, inet_ntoa(lpPktUUT->m_IPAddress),
lpPktUUT->m_dwUserID, lpPktUUT->m_dwCharID, ServerID);
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
}
}
else
{
// DB에서 얻은 값을 전부 보낸다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd,
UserID, GetData.Flag, GetData.PlayTime, GetData.intCRMIndex1,
GetData.strBillingType[0], 0, lpPktUUT->GetError());
}
}
else
{
if(1 == GetData.Flag && PktUUT::DISCONNECT_USER == lpPktUUT->GetError())
{
// 유저가 이미 접속해 있고, 유저 죽이기 플래그가 오면, 유저를 죽인다.
AgentSendPacket::SendHanUnitedUserKill(GetData.intCRMIndex1, AccountName, 0);
}
// 무조건 성공시킨다. 단 중복로그인이면 로그인 못하도록 한다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd,
UserID, (1 == GetData.Flag) ? 1 : 0, GetData.PlayTime, GetData.intCRMIndex1,
GetData.strBillingType[0], 0, lpPktUUT->GetError());
}
DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login_Post 호출 리턴 값 출력. %u, %u [%s]",
UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
CPerformanceInstrument charLogin("CharLogin");
CAutoInstrument autoInstrument(charLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
char Check = CServerSetup::GetInstance().GetFreeCheck() ? 1 : 0; // 기본(=0), 무료계정(=1)
if(!DBComponent::BillingDB::USPCheckBilling_CharIDLogin_Post(CDBSingleObject::GetInstance(),
AccountName, UserID, Check, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin_Post 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag())
{
if(2 <= GetData.Flag)
{
// 빌링 실패한 경우 - 통합빌링으로 체크를 보낸다.
GET_SINGLE_DISPATCH(lpHanUnitedDispatch, CHanUnitedDispatch,
CHanUnitedDispatch::GetDispatchTable());
if(0 == lpHanUnitedDispatch ||
!lpHanUnitedDispatch->SendLogin(*lpPktUUT, GetData, GetGroup()))
{
SERLOG5(g_Log, "ID:%s/IP:%s/UID:%u/CID:%u/ServerID:0x%08x/통합빌링으로 로그인 전송 실패.",
lpPktUUT->m_strAccount, inet_ntoa(lpPktUUT->m_IPAddress),
lpPktUUT->m_dwUserID, lpPktUUT->m_dwCharID, ServerID);
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
}
}
else
{
// DB에서 얻은 값을 전부 보낸다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd,
UserID, GetData.Flag, GetData.PlayTime, GetData.intCRMIndex1, GetData.strBillingType[0], 0, 0);
}
}
else
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd,
UserID, 0, GetData.PlayTime, GetData.intCRMIndex1, GetData.strBillingType[0], 0, 0);
}
DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin_Post 호출 리턴 값 출력. %u, %u [%s]",
UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
// 더 이상 접속을 해제하지 않아도 된다.
CHanUnitedDisconnectID::GetInstance().RemoveDisconnectInfo(UserID);
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut_Post(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut_Post 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return && 10 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut_Post 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
else
{
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut_Post 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
if(10 == Return)
{
if(!CHanUnitedLogout::GetInstance().AddLogout(*lpPktUUT))
{
SERLOG5(g_Log, "ID:%s/IP:%s/UID:%u/CID:%u/ServerID:0x%08x/통합빌링으로 로그아웃 보내기 실패.",
lpPktUUT->m_strAccount, inet_ntoa(lpPktUUT->m_IPAddress),
lpPktUUT->m_dwUserID, lpPktUUT->m_dwCharID, ServerID);
}
}
}
}
break;
default:
SERLOG1(g_Log, "알 수 없는 커맨드(%d)가 들어왔습니다.", Cmd);
break;
}
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectHanUnited()
{
// 한게임 빌링이나, 한게임 통합빌링인 경우.
unsigned long Result = 0;
// TODO : 로그아웃 처리.
if(!DBComponent::BillingDB::USPDisConnectLogOut_Post(CDBSingleObject::GetInstance(), m_Group))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, Result, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
#pragma pack(1)
struct HanUnitedBillingUser
{
char m_szID[20];
char m_szIP[15];
};
#pragma pack()
GET_SINGLE_DISPATCH(lpHanUnitedDispatch, CHanUnitedDispatch,
CHanUnitedDispatch::GetDispatchTable());
HanUnitedBillingUser hanUnitedBillingUser[OleDB::MaxRowNum];
memset(&hanUnitedBillingUser, 0, sizeof(HanUnitedBillingUser) * OleDB::MaxRowNum);
PktUUT pktUUT;
memset(&pktUUT, 0, sizeof(PktUUT));
int nGetRow = 0;
while(CDBSingleObject::GetInstance().GetData((void**)hanUnitedBillingUser,
sizeof(HanUnitedBillingUser), OleDB::MaxRowNum, &nGetRow))
{
if(0 == nGetRow)
{
break;
}
HanUnitedBillingUser* lpBillingUser = hanUnitedBillingUser;
HanUnitedBillingUser* lpBillingUserEnd = hanUnitedBillingUser + nGetRow;
for(; lpBillingUser != lpBillingUserEnd; ++lpBillingUser)
{
_snprintf(pktUUT.m_strAccount,
PktUUT::MaxAccountLen, "%s", lpBillingUser->m_szID);
pktUUT.m_strAccount[PktUUT::MaxAccountLen - 1] = 0;
pktUUT.m_IPAddress.S_un.S_addr = inet_addr(lpBillingUser->m_szIP);
if(!CHanUnitedLogout::GetInstance().AddLogout(pktUUT))
{
SERLOG3(g_Log, "ID:%s/IP:%s/ServerGroup:%d/서버군 접속 끊김으로 통합빌링으로 로그아웃 보내기 실패.",
lpBillingUser->m_szID, lpBillingUser->m_szIP, m_Group);
}
}
memset(&hanUnitedBillingUser, 0, sizeof(HanUnitedBillingUser) * OleDB::MaxRowNum);
}
SERLOG1(g_Log, "%d 그룹 USPDisConnectLogOut 호출 성공", m_Group);
if(!DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &Result))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, Result, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USEServer_End 호출 성공", m_Group);
}
}
return true;
}

View File

@@ -0,0 +1,154 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
// 일본 오픈 베타용 과금 타입 (2005-09-20 zun!)
bool CUIDAgentDispatch::ProcessBillingJapan(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
unsigned long dwReturnedFlag = 0;
if (false == DBComponent::BillingDB::USPJapanUserLoginToAuth(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &dwReturnedFlag))
{
ERRLOG6(g_Log, "USPJapanUserLoginToAuth(User Login) 호출 실패- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, IP: %s, ErrMsg: %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// Flag 4 -> '서버에서 에러가 발생했습니다.'
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
if (0 != dwReturnedFlag)
{
// Flag 20 -> 중복 로그인 에러
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0);
return true;
}
DETLOG5(g_Log, "유저 로그인- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, IP: %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress));
// 인증서버로 로그인 성공
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
CPerformanceInstrument charLogin("CharLogin");
CAutoInstrument autoInstrument(charLogin);
unsigned long dwReturnedFlag = 0;
if (false == DBComponent::BillingDB::USPJapanUserLoginToZone(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &dwReturnedFlag))
{
ERRLOG6(g_Log, "USPJapanUserLoginToZone(Char Login) 호출 실패- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, IP: %s, ErrMsg: %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
if (0 != dwReturnedFlag)
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0);
return true;
}
DETLOG5(g_Log, "캐릭터 로그인- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, IP: %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress));
// 게임서버로 로그인 성공
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
unsigned long dwReturnedFlag = 0;
if (false == DBComponent::BillingDB::USPJapanUserLogOut(CDBSingleObject::GetInstance(),
AccountName, &dwReturnedFlag))
{
ERRLOG5(g_Log, "USPJapanUserLogOut 호출 실패- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, ErrMsg: %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
DETLOG5(g_Log, "USPJapanUserLogOut 호출 리턴 값 출력- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, ReturnedFlag: %u",
UserID, AccountName, ServerID, Cmd, dwReturnedFlag);
}
break;
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument move("ZoneMove");
CAutoInstrument autoInstrument(move);
unsigned long dwReturnedFlag = 0;
if (false == DBComponent::BillingDB::USPJapanUserLogOut(CDBSingleObject::GetInstance(),
AccountName, &dwReturnedFlag))
{
ERRLOG5(g_Log, "USPJapanUserLogOut 호출 실패- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, ErrMsg: %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
DETLOG5(g_Log, "USPJapanUserLogOut 호출 리턴 값 출력- UID: %u, AccountName: %s, ServerID: 0x%08x, CMD: %d, ReturnedFlag: %u",
UserID, AccountName, ServerID, Cmd, dwReturnedFlag);
}
break;
};
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectJapan()
{
unsigned long dwResult = 0;
if (false == DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &dwResult))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, dwResult, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USEServer_End 호출 성공", m_Group);
}
return true;
}

View File

@@ -0,0 +1,175 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
#ifdef AUTH_MY
#include "NFAuthClient/AuthClient.h"
#endif
// 대만의 과금타입은, 매 30분마다 시간을 제하는 방식으로 진행된다.
// 시간을 제하는 루틴은, 중계서버에서 진행한다.
bool CUIDAgentDispatch::ProcessBillingROWGlobal(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
char *Password = lpPktUUT->m_strPassword;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
// 요시랜드 과금 처리 루틴
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
#ifdef AUTH_MY
// edith 2009.09.11 MY를 위한 AllowIP 처리작업
char* szAdd = inet_ntoa(IPAddress);
if(!g_IPSec.IsAliveIP(szAdd))
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 57, 0, 0, 'N', 0, 0);
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d Alive 호출 실패 %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress));
return true;
}
#endif
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
if(!DBComponent::BillingDB::USPCheckUser_Login(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
ERRLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_Login 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
// AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
// return true;
}
// ROW에선 요시랜드 인증을 사용하지 않는다.
// ROW에선 자체요금제를 사용한다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
#ifdef AUTH_MY
// edith 2009.09.11 MY를 위한 AllowIP 처리작업
char* szAdd = inet_ntoa(IPAddress);
if(!g_IPSec.IsAliveIP(szAdd))
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 30, 0, 0, 'N', 0, 0);
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d Alive 호출 실패 %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress));
return true;
}
#endif
/* CPerformanceInstrument userLogin("CharLogin");
CAutoInstrument autoInstrument(userLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
if(!DBComponent::BillingDB::USPCheckUser_CharIDLogin(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
ERRLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_Login 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
// AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
// return true;
}
*/
// ROW에선 요시랜드 인증을 사용하지 않는다.
// ROW에선 자체요금제를 사용한다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
break;
case PktUUT::UpdateUIDTableBillingCheck:
// ROW에선 요시랜드 인증을 사용하지 않는다.
// ROW에선 자체요금제를 사용한다.
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
break;
case PktUUT::UpdateUIDTableUserLogout:
// case PktUUT::UpdateUIDTableCharLogout:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckUser_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
}
break;
/*
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument move("ZoneMove");
CAutoInstrument autoInstrument(move);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckUser_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
ERRLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckUser_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
}
break;
*/
}
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectROWGlobal()
{
// ROW에선 요시랜드 관련 인증을 사용하지 않기 때문에 무시한다.
return true;
}

View File

@@ -0,0 +1,275 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Utility/Setup/ServerSetup.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Debug/PerformanceCheck.h>
// 대만의 과금타입은, 매 30분마다 시간을 제하는 방식으로 진행된다.
// 시간을 제하는 루틴은, 중계서버에서 진행한다.
bool CUIDAgentDispatch::ProcessBillingYouxiLand(PktUUT* lpPktUUT)
{
unsigned char Cmd = lpPktUUT->m_cCmd;
unsigned long ServerID = lpPktUUT->m_dwServerID;
unsigned long SessionID = lpPktUUT->m_dwSessionID;
unsigned long UserID = lpPktUUT->m_dwUserID;
unsigned long CharID = lpPktUUT->m_dwCharID;
char *AccountName = lpPktUUT->m_strAccount;
char *Password = lpPktUUT->m_strPassword;
IN_ADDR& IPAddress = lpPktUUT->m_IPAddress;
// 새 중복로그인 및 로그인로그아웃 로그 루틴
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
{
CPerformanceInstrument userLogin("UserLogin");
CAutoInstrument autoInstrument(userLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
if(!DBComponent::BillingDB::USPCheckBilling_Login(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(0 != GetData.Flag)
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0);
return true;
}
// DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_Login 호출 리턴 값 출력. %u, %u [%s]",
// UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
CPerformanceInstrument charLogin("CharLogin");
CAutoInstrument autoInstrument(charLogin);
// 키퍼 관련 처리
RE_USPCheckBilling_Login GetData = {0,};
if(!DBComponent::BillingDB::USPCheckBilling_CharIDLogin(CDBSingleObject::GetInstance(),
AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString());
// DB Query실패(클라이언트에는 에러 1번 (서버에서 에러가 났습니다) 발생
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0);
return true;
}
// 업데이트 Ack
if(0 != GetData.Flag)
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0);
return true;
}
// DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_CharIDLogin 호출 리턴 값 출력. %u, %u [%s]",
// UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress));
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
{
CPerformanceInstrument logout("Logout");
CAutoInstrument autoInstrument(logout);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
/*
else
{
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
*/
}
break;
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
{
CPerformanceInstrument move("ZoneMove");
CAutoInstrument autoInstrument(move);
// 키퍼 처리
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
/*
else
{
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
*/
}
break;
};
// 요시랜드 과금 처리 루틴
switch(Cmd)
{
case PktUUT::UpdateUIDTableUserLogin:
case PktUUT::UpdateUIDTableBillingCheck:
{
// 대만 빌링
PAY_AUTH PayAuth = {0,};
// 12분당 20포인트를 과금처리를 하는듯
// PayAUthMyth 쿼리안에 가면 거기서 12, 20이란 숫자를 가지고 처리를 한다.
if (!DBComponent::BillingDB::PayAuthMyth(CDBSingleObject::GetInstance(),
AccountName, inet_ntoa(IPAddress), &PayAuth))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d PayAuthMyth 호출 실패 %s : %s",
UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress),
CDBSingleObject::GetInstance().GetErrorString());
if(PktUUT::UpdateUIDTableUserLogin == Cmd)
{
// 유저 로그인이면, 로그인 취소!
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d PayAuthMyth 호출 실패로 로그아웃함. USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d - 빌링 프로시저 호출 실패 로그아웃 - USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
else
{
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d - 빌링 프로시저 호출 실패 로그아웃 - USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
}
return true;
}
// 업데이트 Ack
if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag())
{
if(0 != PayAuth.Errcode && Cmd == PktUUT::UpdateUIDTableUserLogin)
{
// 유저 로그인이면, 로그인 취소!
unsigned long Return = 0;
if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return))
{
SERLOG6(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d PayAuthMyth(Err:%d) USPCheckBilling_LogOut 호출 실패 : %s",
UserID, AccountName, ServerID, Cmd, PayAuth.Errcode, CDBSingleObject::GetInstance().GetErrorString());
return true;
}
if(0 != Return)
{
SERLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d - 빌링 프로시저 결과 실패 로그아웃 - USPCheckBilling_LogOut 호출 리턴 에러. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
else
{
DETLOG5(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d - 빌링 프로시저 결과 실패 로그아웃 - USPCheckBilling_LogOut 호출 리턴 값 출력. %u",
UserID, AccountName, ServerID, Cmd, Return);
}
}
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID,
PayAuth.Errcode, PayAuth.Time, 0, 'Y', static_cast<unsigned short>(PayAuth.WarningCode), 0);
}
else
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
// DETLOG7(g_Log, "유저(%u) [%s] 서버(0x%08x) ST:%d - PayAuthMyth 호출 리턴 값 출력. Error:%u Time:%u, [%s]",
// UserID, AccountName, ServerID, Cmd, PayAuth.Errcode, PayAuth.Time, inet_ntoa(IPAddress));
}
break;
case PktUUT::UpdateUIDTableCharLogin:
{
AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0);
}
break;
case PktUUT::UpdateUIDTableUserLogout:
case PktUUT::UpdateUIDTableCharLogout:
case PktUUT::UpdateUIDTableUserMove:
case PktUUT::UpdateUIDTableCharMove:
break;
}
return true;
}
bool CUIDAgentDispatch::ProcessDisconnectYouxiLand()
{
unsigned long dwResult = 0;
if(!DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &dwResult))
{
SERLOG3(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x DB에러 로그:%s",
m_Group, dwResult, CDBSingleObject::GetInstance().GetErrorString());
}
else
{
SERLOG1(g_Log, "%d 그룹 USEServer_End 호출 성공", m_Group);
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,173 @@
#ifndef _HAN_UNITED_BILLING_PROCESS_
#define _HAN_UNITED_BILLING_PROCESS_
#include <Thread/Lock.h>
#include <Network/Dispatch/Dispatch.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Stream/Buffer/BufferQueue.h>
#include <boost/pool/pool_alloc.hpp>
#include <Network/Dispatch/SingleDispatchStorage.h>
#include <DB/DBDefine.h>
// forward decl.
class CIOCPNet;
class CBufferFactory;
namespace HanUnitedBilling
{
struct GLTransStruct;
}
//! ---------------------------------------------------------------
//!
//! 전역 SequenceID 클래스이다. 각 패킷에 시퀀스 ID를 매긴다.
//!
//! ---------------------------------------------------------------
class CHanUnitedSequenceID
{
public:
static CHanUnitedSequenceID& GetInstance();
unsigned long GetUniqueID() { return m_dwSeqID++; }
private:
CHanUnitedSequenceID() : m_dwSeqID(0) { }
~CHanUnitedSequenceID() { }
unsigned long m_dwSeqID;
};
//! ---------------------------------------------------------------
//!
//! 로그아웃 정보 리스트이다.
//! 주기적으로 체크해서, Ack가 오지 않으면 재전송한다.
//!
//! ---------------------------------------------------------------
class CHanUnitedLogout
{
public:
static CHanUnitedLogout& GetInstance();
bool AddLogout(const PktUUT& pktUUT);
bool RemoveLogout(const char* szID, const char* szIP, DWORD dwSeqID);
void Retransmission();
private:
struct LogoutData
{
PktUUT m_pktUUT;
SYSTEMTIME m_systemTime;
DWORD m_dwSendStamp;
DWORD m_dwSeqID;
LogoutData(const PktUUT& pktUUT, DWORD dwSeqID);
};
typedef std::map<DWORD, LogoutData> LogoutMap;
LogoutMap m_LogoutMap;
};
//! ---------------------------------------------------------------
//!
//! 한게임 통합빌링 패킷을 처리하는 클래스이다.
//!
//! ---------------------------------------------------------------
class CHanUnitedDispatch : public CPacketDispatch
{
public:
enum
{
DEFAULT_SEND_TIMEOUT_SEC = 10
};
// 미디어웹 통합빌링서버로 연결을 시도함.
static bool ConnectToHanUnited(CIOCPNet& iocpNet);
static CSingleDispatch& GetDispatchTable();
CHanUnitedDispatch(CSession& Session);
virtual ~CHanUnitedDispatch();
virtual bool ParsePacket(char* const lpStream_In, unsigned long* dwStreamSize_InOut);
virtual bool Dispatch();
virtual void Connected();
virtual void Disconnected();
CBufferFactory& GetBufferFactory();
//! 한게임 통합빌링으로 로그인을 전송한다.
bool SendLogin(const PktUUT& pktUUT, const RE_USPCheckBilling_Login& checkBillingLogin,
unsigned char cServerGroup, unsigned long dwTimeoutSec = DEFAULT_SEND_TIMEOUT_SEC);
//! 한게임 통합빌링으로 로그아웃을 전송한다. 시간을 넣지 않으면 현재시간으로 전송한다.
bool SendLogout(const PktUUT& pktUUT, unsigned long dwSeqID,
LPSYSTEMTIME lpSystemTime = 0, unsigned long dwTimeoutSec = DEFAULT_SEND_TIMEOUT_SEC);
//! 한게임 통합빌링으로 로그인이 가능한지 여부를 전송한다.
bool SendCanLogin(const PktUUT& pktUUT, const RE_USPCheckBilling_Login& checkBillingLogin,
unsigned char cServerGroup, unsigned long dwTimeoutSec = DEFAULT_SEND_TIMEOUT_SEC);
bool ProcessLoginResult(HanUnitedBilling::GLTransStruct& glTransStruct); // 로그인 결과 처리
bool ProcessCanLoginResult(HanUnitedBilling::GLTransStruct& glTransStruct); // 로그인 할 수 있는지 여부로 결과 처리.
bool ProcessWarnNotice(HanUnitedBilling::GLTransStruct& glTransStruct); // 과금 경고 메시지
bool ProcessCutIP(HanUnitedBilling::GLTransStruct& glTransStruct); // 특정 ip끊기
bool ProcessPing(HanUnitedBilling::GLTransStruct& glTransStruct); // 핑 패킷 처리
bool ProcessLogoutResult(HanUnitedBilling::GLTransStruct& glTransStruct); // 로그아웃 Ack처리.
void ProcessTimeout();
void ProcessDisconnected();
protected:
typedef CCSLock BufferLock;
//! 로그인 데이터 맵. timeout시 사용하도록 하기 위함이다.
//! 로그인, 로그인 가능여부 체크시에만 사용
struct LoginRequestData
{
enum
{
MAX_NAME_LEN = 16
};
__time64_t m_SendTime;
unsigned long m_SendStamp;
unsigned long m_dwTimeoutSec;
unsigned long m_dwSeqID;
unsigned short m_usMsgType;
unsigned char m_cServerGroup;
unsigned char m_cPadding;
PktUUT m_PktUUT;
RE_USPCheckBilling_Login m_CheckBillingLogin;
LoginRequestData(const PktUUT& pktUUT, const RE_USPCheckBilling_Login& checkBillingLogin,
unsigned long dwTimeoutSec, unsigned long dwSeqID, unsigned short usMsgType,
unsigned char cServerGroup);
};
typedef std::map<unsigned long, LoginRequestData, std::less<unsigned long>,
boost::fast_pool_allocator<std::pair<unsigned long, LoginRequestData> > > LoginRequestMap;
BufferLock m_BufferLock;
CACHE_PAD(BufferLockPad, sizeof(BufferLock));
CBufferQueue m_PacketBuffer;
LoginRequestMap m_LoginRequestMap;
};
#endif

View File

@@ -0,0 +1,44 @@
#ifndef _HAN_UNITED_BILLING_PACKET_STRUCT_
#define _HAN_UNITED_BILLING_PACKET_STRUCT_
/********** LK->UID,UID->LK 송수신용 구조체 *************************/
namespace HanUnitedBilling
{
#pragma pack(1)
struct GLTransStruct
{
unsigned short DataSize; // Data 의 전체길이
unsigned short HeaderMsg; // 헤더명령메세지부분부분
unsigned long SeqID;
char Data[120]; //Data
};
#pragma pack()
//LK->UID , UID->LK 메세지
enum CMD
{
AUTH = 4000, // UID -> LK
LOGOUT = 4001, // UID -> LK
CUT_IP = 4002, // LK -> UID
WARNNOTICE = 4003, // LK -> UID
BILL_AUTH = 4004, // UID -> LK
AUTH_RESULT = 4005, // LK -> UID
BILL_AUTH_RESULT = 4006, // LK -> UID
PING_AUTH = 4007,
LOGOUT_RESULT = 4008
};
enum LENGTH
{
MAX_IP_LEN = 17,
MAX_ID_LEN = 25,
MAX_OUT_TIME_LEN = 18,
MAX_MSG_LEN = 70
};
};
#endif

View File

@@ -0,0 +1,169 @@
#include "stdAfx.h"
#include "HanUnitedDisconnID.h"
#include "SendAgentPacket.h"
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Log/ServerLog.h>
CHanUnitedDisconnectID& CHanUnitedDisconnectID::GetInstance()
{
static CHanUnitedDisconnectID hanUnitedDisconnectID;
return hanUnitedDisconnectID;
}
CHanUnitedDisconnectID::CHanUnitedDisconnectID()
{
}
CHanUnitedDisconnectID::~CHanUnitedDisconnectID()
{
}
void CHanUnitedDisconnectID::UpdateDisconnectInfo(const DisconnectInfo& disconnectInfo)
{
DisconnectInfoMap::iterator pos = m_DisconnectInfoMap.find(disconnectInfo.m_nUID);
if(pos == m_DisconnectInfoMap.end())
{
m_DisconnectInfoMap.insert(DisconnectInfoMap::value_type(
disconnectInfo.m_nUID, disconnectInfo));
}
else
{
pos->second = disconnectInfo;
}
}
bool CHanUnitedDisconnectID::RemoveDisconnectInfo(int nUID)
{
DisconnectInfoMap::iterator pos = m_DisconnectInfoMap.find(nUID);
if(pos != m_DisconnectInfoMap.end())
{
m_DisconnectInfoMap.erase(pos);
return true;
}
return false;
}
CHanUnitedDisconnectID::DisconnectInfo* CHanUnitedDisconnectID::GetDisconnectInfo(int nUID)
{
DisconnectInfoMap::iterator pos = m_DisconnectInfoMap.find(nUID);
if(pos != m_DisconnectInfoMap.end())
{
return &pos->second;
}
return 0;
}
void CHanUnitedDisconnectID::CheckDisconnect()
{
#pragma pack(1)
struct HanUnitedUserData
{
int m_nUID; //
int m_nServerID; //
int m_nRemainMin; //
char m_cBillingType[2]; // E : 개인정량, T : 개인정액, F : 무료사용자
int m_nEndTime; // 무료, 정액 : 20030225, 정량 : RemainMin
int m_nCRMIndex; // 개인은 0, PC방은 0이상. 보통 개인만 들어온다.
};
#pragma pack()
const int MAX_DATA = CDBSingleObject::MaxRowNum;
HanUnitedUserData hanUnitedUserData[MAX_DATA];
if(!DBComponent::BillingDB::USPCheckTimeoutUser(CDBSingleObject::GetInstance()))
{
ERRLOG1(g_Log, "과금 만료 유저를 얻어오는 데 실패했습니다. GetErrorString() :%s",
CDBSingleObject::GetInstance().GetErrorString());
}
else
{
int nRowNum = 0;
while(CDBSingleObject::GetInstance().GetData(
(void**)hanUnitedUserData, sizeof(HanUnitedUserData), MAX_DATA, &nRowNum))
{
if(0 == nRowNum)
{
break;
}
// 테이블에 UID가 들어 있는지 살핀다.
// 1. 들어 있지 않다.
// 남은 시간을 체크한 후, 0 < time <5 이면 과금 경고 메시지를 보내고 테이블에 삽입.
// 2. 들어 있다.
// 남은 시간을 체크한 후, time <= 0 이면 UserKill을 보내고 테이블에서 제거.
// 유저가 로그아웃하면 테이블에서 제거한다.
HanUnitedUserData* lpHanUnitedUserData = hanUnitedUserData;
HanUnitedUserData* lpHanUnitedUserDataEnd = hanUnitedUserData + nRowNum;
for(; lpHanUnitedUserData != lpHanUnitedUserDataEnd; ++lpHanUnitedUserData)
{
DisconnectInfo* lpDisconnectInfo = GetDisconnectInfo(lpHanUnitedUserData->m_nUID);
if(0 == lpDisconnectInfo)
{
// 남은 시간을 체크한 후, timeout을 보낸다.
AgentSendPacket::SendHanBTN(lpHanUnitedUserData->m_nServerID,
lpHanUnitedUserData->m_nUID, lpHanUnitedUserData->m_nRemainMin,
lpHanUnitedUserData->m_cBillingType[0]);
DETLOG5(g_Log, "UID:%u/ServerID:%u/cRemainMinute:%d/cBillingType:%c/EndTime:%d/유저에게 과금 만료 경고를 보냈습니다.",
lpHanUnitedUserData->m_nUID, lpHanUnitedUserData->m_nServerID,
lpHanUnitedUserData->m_nRemainMin, lpHanUnitedUserData->m_cBillingType[0],
lpHanUnitedUserData->m_nEndTime);
DisconnectInfo disconnInfo;
disconnInfo.m_nUID = lpHanUnitedUserData->m_nUID;
disconnInfo.m_nServerID = lpHanUnitedUserData->m_nServerID;
disconnInfo.m_nRemainMin = lpHanUnitedUserData->m_nRemainMin;
disconnInfo.m_nEndTime = lpHanUnitedUserData->m_nEndTime;
disconnInfo.m_nCRMIndex = lpHanUnitedUserData->m_nCRMIndex;
disconnInfo.m_cBillingType = lpHanUnitedUserData->m_cBillingType[0];
UpdateDisconnectInfo(disconnInfo);
}
else
{
lpDisconnectInfo->m_nServerID = lpHanUnitedUserData->m_nServerID;
lpDisconnectInfo->m_nRemainMin = lpHanUnitedUserData->m_nRemainMin;
lpDisconnectInfo->m_nEndTime = lpHanUnitedUserData->m_nEndTime;
lpDisconnectInfo->m_nCRMIndex = lpHanUnitedUserData->m_nCRMIndex;
lpDisconnectInfo->m_cBillingType = lpHanUnitedUserData->m_cBillingType[0];
if(lpDisconnectInfo->m_nRemainMin <= 0)
{
AgentSendPacket::SendUserKill(lpDisconnectInfo->m_nServerID, lpDisconnectInfo->m_nUID);
DETLOG5(g_Log, "UID:%u/ServerID:%u/cRemainMinute:%d/cBillingType:%c/EndTime:%d/과금이 만료되어 유저의 접속을 끊습니다.",
lpHanUnitedUserData->m_nUID, lpHanUnitedUserData->m_nServerID,
lpHanUnitedUserData->m_nRemainMin, lpHanUnitedUserData->m_cBillingType[0],
lpHanUnitedUserData->m_nEndTime);
RemoveDisconnectInfo(lpDisconnectInfo->m_nUID);
}
}
}
}
}
}

View File

@@ -0,0 +1,40 @@
#ifndef _HAN_UNITED_DISCONNECT_ID_H_
#define _HAN_UNITED_DISCONNECT_ID_H_
#include <map>
class CHanUnitedDisconnectID
{
public:
struct DisconnectInfo
{
int m_nUID; //
int m_nServerID; //
int m_nRemainMin; //
int m_nEndTime; // 무료, 정액 : 20030225, 정량 : RemainMin
int m_nCRMIndex; // 개인은 0, PC방은 0이상. 보통 개인만 들어온다.
char m_cBillingType; // E : 개인정량, T : 개인정액, F : 무료사용자
};
static CHanUnitedDisconnectID& GetInstance();
CHanUnitedDisconnectID();
virtual ~CHanUnitedDisconnectID();
void UpdateDisconnectInfo(const DisconnectInfo& disconnectInfo);
bool RemoveDisconnectInfo(int nUID);
DisconnectInfo* GetDisconnectInfo(int nUID);
void CheckDisconnect();
private:
typedef std::map<int, DisconnectInfo> DisconnectInfoMap;
DisconnectInfoMap m_DisconnectInfoMap;
};
#endif

View File

@@ -0,0 +1,231 @@
// IOBuffer.cpp: implementation of the CIOBuffer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "IOBuffer.h"
#include <string.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
namespace Gammania {
CIOBuffer::CIOBuffer()
{
// Head는 읽을 버퍼의 시작위치.
// Tail은 사용되어진 버퍼의 끝.
m_iHead = m_iTail = 0;
// 생성한 버퍼의 사이즈
m_iBufSize = 0;
// 생성한 버퍼의 포인터.
m_cBuf = NULL;
// 사용된 버퍼의 사이즈 이값이 음수면 Over Flow..
m_iBuffered = 0;
}
CIOBuffer::~CIOBuffer()
{
DeleteIOBuf();
}
void CIOBuffer::InitIOBuf()
{
m_iHead = m_iTail = 0;
m_iBuffered = 0;
if(m_cBuf)
memset(m_cBuf, 0, sizeof(m_cBuf));
}
void CIOBuffer::NewIOBuf(int BufSize)
{
if(BufSize <= 0)
BufSize = IOBUF_DEF_SIZE;
m_cBuf = new char[BufSize];
if(m_cBuf == NULL)
{
// throw "CIOBuffer::NewIOBuf : Memory allocation failure!";
return;
}
m_iBufSize = BufSize;
InitIOBuf();
}
void CIOBuffer::DeleteIOBuf()
{
if(m_cBuf)
{
delete []m_cBuf;
m_cBuf = NULL;
}
m_iBufSize = 0;
m_iHead = m_iTail = 0;
m_iBuffered = 0;
}
// Size 만큼 Buffer의 내용을 쓴다.
int CIOBuffer::Append(char* Buffer, int Size)
{
// 오버플로우가 된다.
if(m_iBuffered + Size >= m_iBufSize)
{
// throw "CIOBuffer::Append : Buffer overflow";
return -1;
}
int aSize = 0;
int Added = 0;
// 모든 Size를 추가할때까지 처리한다.
while(Size > 0)
{
if(Size > m_iBufSize-m_iTail)
aSize = m_iBufSize-m_iTail;
else aSize = Size;
if(aSize)
{
memcpy(m_cBuf+m_iTail, Buffer, aSize);
Added += aSize;
Size -= aSize;
Buffer += aSize;
m_iTail += aSize;
if(m_iTail >= m_iBufSize)
m_iTail -= m_iBufSize;
}
}
CalcBuffered();
return Added;
}
// Size만큼 데이타를 읽어 Buffer에 쓴다.
int CIOBuffer::GetData(char* Buffer, int Size)
{
// 써있는 데이타 보다 많이 읽으면 써있는 데이타만 읽게 한다.
if(GetBufferUsed() < Size)
Size = GetBufferUsed();
if(Size <= 0)
return 0;
// 잘려있으면. 처리한다.
if(m_iHead+Size >= m_iBufSize)
{
// 여기에 지금 버그가 있다.
int Size1 = m_iBufSize - m_iHead;
memcpy(Buffer, m_cBuf+m_iHead, Size1);
memcpy(Buffer+Size1, m_cBuf, Size-Size1);
}
else // 안잘려 있으면.
{
memcpy(Buffer, m_cBuf+m_iHead, Size);
}
m_iHead += Size;
if(m_iHead >= m_iBufSize)
m_iHead -= m_iBufSize;
CalcBuffered();
return Size;
}
int CIOBuffer::CheckData(int Size)
{
// 써있는 데이타 보다 많이 읽으면 써있는 데이타만 읽게 한다.
if(GetBufferUsed() < Size)
Size = GetBufferUsed();
if(Size <= 0)
return 0;
m_iHead += Size;
if(m_iHead >= m_iBufSize)
m_iHead -= m_iBufSize;
CalcBuffered();
return Size;
}
void CIOBuffer::CalcBuffered()
{
if(m_iHead > m_iTail)
m_iBuffered = m_iBufSize - m_iHead + m_iTail;
else
m_iBuffered = m_iTail-m_iHead;
}
CPacketIOBuffer::CPacketIOBuffer()
{
// 초기화.
CIOBuffer::CIOBuffer();
}
CPacketIOBuffer::~CPacketIOBuffer()
{
DeleteIOBuf();
}
void CPacketIOBuffer::Lock()
{
LockHead = GetHead();
}
void CPacketIOBuffer::UnLock()
{
SetHead(LockHead);
}
int CPacketIOBuffer::GetPacket(char* Packet)
{
if(m_iHead == m_iTail)
return 0;
memset(Packet, 0, MAX_PACKETSIZE);
int Size = 0;
int OldHead = GetHead();
char End[3] = "\r\n";
for(int i = 0; i < MAX_PACKETSIZE; ++i)
{
// 삽입
Packet[i] = m_cBuf[m_iHead];
m_iHead++;
if(m_iHead+1 > m_iBufSize)
m_iHead = 0;
if(m_iHead == m_iTail)
break;
if(i < 1)
continue;
if(strcmp(&Packet[i-1], End)==0)
break;
}
Size = (int)strlen(Packet);
if(Size == 0)
{
SetHead(OldHead);
return 0;
}
CalcBuffered();
return Size;
}
}

View File

@@ -0,0 +1,89 @@
// IOBuffer.h: interface for the CIOBuffer class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
/*****************************************************************************
I/O Buffering 을 위한 클래스. Sock을 이용해 패킷을 주고 받을때 패킷이
합쳐오거나 분할되어 올때 그 패킷을 관리 및 처리할때 사용된다.(IOBuffer을
상속받은 PacektIOBuffer 클래스로 처리하게..
기본적으로 PacketBuffer에 저장되는 스트링(?)의 형식은 다음과 같다.
-------------------------------------------
| Header(4Byte-PACKET_HEADSIZE) | StringData (Header Size) |
-------------------------------------------
IOBuffer클래스는 위의 패킷을 하나의 배열에 순차적으로 넣어 그 패킷을
관리한다. 2Byte는 65535까지의 길이를 처리한다.
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
namespace Gammania {
#define MAX_PACKETSIZE 512
#define IOBUF_DEF_SIZE MAX_PACKETSIZE*10 // IOBuffer의 기본크기 패킷 1024개만큼 처리가능
class CIOBuffer
{
protected:
// Head는 읽을 버퍼의 시작위치.
// Tail은 사용되어진 버퍼의 끝.
int m_iHead,m_iTail;
// 생성한 버퍼의 사이즈
int m_iBufSize;
// 생성한 버퍼의 포인터.
char* m_cBuf;
// 사용된 버퍼의 사이즈 이값이 음수면 Over Flow..
int m_iBuffered;
public:
// 사용된 버퍼의 크기 구하기.
void CalcBuffered();
// 기타 inline
inline char* GetBuffer() { return m_cBuf; }
inline void SetHead(int Head) { m_iHead = Head; CalcBuffered(); }
inline int GetHead() { return m_iHead; }
inline void SetTail(int Tail) { m_iTail = Tail; }
inline int GetTail() { return m_iTail; }
inline int GetBufSize() { return m_iBufSize; }
// 사용중인 버퍼의 양
inline int GetBufferUsed() { return m_iBuffered; }
// 비어있는 버퍼의 양
inline int GetEmptyBuffer() { return m_iBufSize - m_iBuffered; }
void InitIOBuf();
// 추가한다.
int Append(char* Buffer, int Size);
// 가져온다.
int GetData(char* Buffer, int Size);
// 체크한다
int CheckData(int Size);
void NewIOBuf(int BufSize);
void DeleteIOBuf();
CIOBuffer();
virtual ~CIOBuffer();
};
class CPacketIOBuffer : public CIOBuffer
{
int LockHead;
public:
void Lock();
void UnLock();
// 한개분량의 패킷을 얻어온다.
int GetPacket(char* Packet);
CPacketIOBuffer();
virtual ~CPacketIOBuffer();
};
}

View File

@@ -0,0 +1,471 @@
#include "stdafx.h"
#include "NetString.h"
CNetString::CNetString(void)
{
m_iIndex = 0;
m_hWnd = NULL; // 부모 윈도우 핸들
m_hSocket = NULL; // 클라이언트 소켓
m_nPort = 0; // 포트
ZeroMemory(m_strIPAddr, sizeof(char)*20); // Server IP저장
m_bConnect = FALSE; // 접속 상태 플래그
m_bClose = FALSE;
m_RecvIO.NewIOBuf(0); // 0으로 하면 기본적으로 DefaultPacketSize * 1024
m_hEvent = NULL; // 네트워크 이벤트 핸들러
ZeroMemory(m_PacketBuffer, sizeof(char)*MAX_PACKETSIZE); // Server IP저장
WinSockInit();
}
CNetString::~CNetString(void)
{
OnClose();
Stop(); // 종료 함수 호출
m_RecvIO.DeleteIOBuf();
WSACleanup();
}
BOOL CNetString::WinSockInit()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
WSACleanup();
// Tell the user that we could not find a usable
// WinSock DLL.
return FALSE;
}
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
// Tell the user that we could not find a usable //
// WinSock DLL. //
WSACleanup( );
return FALSE;
}
return TRUE;
}
//////////////////////////////////////////////////////////////////
// [1]DESCRIPTION : 클래스 초기화 //
// [2]PARAMETER : strIPAddr - 연결IP주소, nPort - 포트번호, //
// hWnd - 부모 윈도우 핸들 //
// [3]RETURN : 정상 - TRUE, 실패 - FALSE //
// [4]DATE : 2000년 9월 11일 //
//////////////////////////////////////////////////////////////////
BOOL CNetString::Init( HWND hWnd, int iIndex, char* szIP, int nPort )
{
m_iIndex = iIndex;
m_nPort = nPort; // 포트 번호
unsigned long dwThreadId = 0; // 스레드 생성을 위한 변수
// ip 어드레스
strcpy(m_strIPAddr,szIP);
m_hWnd = hWnd; // 부모 핸들
// 연결을 시킨다. 서버로.. 만약 서버연결에 실패한다면
// Netword Event 에서 FW_CLOSE가 발생해 소켓이 Close된다.
if(!Connect())
{
// 실패했을경우 종료한다.
Sleep(100); // Sleep...
OnClose();
return FALSE;
}
m_bClose = FALSE;
m_hEventThread =
(HANDLE)CreateThread(NULL, // Security
0, // Stack size - use default
EventThreadProc, // Thread fn entry point
(void*) this,
0, // Init flag
&dwThreadId); // Thread address
return TRUE;
}
//////////////////////////////////////////////////////////////////
// [1]DESCRIPTION : Main Thread, 네트워크 이벤트 처리 //
// [2]PARAMETER : void //
// [3]RETURN : void //
// [4]DATE : 2000년 9월 10일 //
//////////////////////////////////////////////////////////////////
DWORD WINAPI CNetString::EventThreadProc(LPVOID lParam)
{
// 클래스를 변수로 받음
CNetString* pThis = reinterpret_cast<CNetString*>(lParam);
WSANETWORKEVENTS events; // 네트워크 이벤트 변수
BOOL bThreadRun = TRUE; // 무한 루프 변수
// 스레드 무한 루프
while(bThreadRun)
{
if(pThis->m_bClose)
{
bThreadRun = FALSE;
break;
}
DWORD dwRet;
dwRet = WSAWaitForMultipleEvents(1,
&pThis->m_hEvent,
FALSE,
INFINITE,
FALSE);
if(!pThis->m_hSocket)
{
// 종료
bThreadRun = FALSE;
break;
}
// Figure out what happened
int nRet = WSAEnumNetworkEvents(pThis->m_hSocket,
pThis->m_hEvent,
&events);
// 소켓 에러라면,
if (nRet == SOCKET_ERROR)
{
bThreadRun = FALSE;
break;
}
///////////////////
// Handle events //
bThreadRun = pThis->NetworkEventHanlder(events.lNetworkEvents);
}
// 이리로 스레드가 종료 되면 Server에 의한 클라이언트 종료!!! <비정상 종료>
// 스레드 초기화는 위에서 해주기 때문에 여기서 하지는 않는다.
// pThis->CloseAll();
return 0;
}
void CNetString::Disconnect()
{
// 이건 무조건 Close해줘야하기 때문에 CloseAll() 호출하지 않고 직접 끈다.
OnClose();
Stop(); // 종료 함수 호출
}
void CNetString::Stop()
{
if (m_hSocket)
{
struct linger li = {0, 0}; // Default: SO_DONTLINGER
li.l_onoff = 1; // SO_LINGER, timeout = 0
shutdown(m_hSocket, SD_BOTH ); // 오잉? 이게 뭐지? ^^;; 담에 찾아보자
// 2001년 9월 6일
// 클로즈 소켓 전에 큐된 데이타를 보낼지 말지 결정하는 옵션
setsockopt(m_hSocket, SOL_SOCKET, SO_LINGER, (CHAR *)&li, sizeof(li));
closesocket(m_hSocket); // 소켓 닫기
m_hSocket = NULL;
}
if(m_hEvent) WSACloseEvent(m_hEvent);
m_hEvent = NULL;
}
void CNetString::CloseAll()
{
if(m_bConnect)
{
OnClose();
Stop(); // 종료 함수 호출
}
}
BOOL CNetString::OnClose()
{
m_bClose = TRUE;
m_bConnect = FALSE; // Connect 변수 변경
OnSocketEvent(WM_SOCK_CLOSE, 0);
return FALSE;
}
//////////////////////////////////////////////////////////////////
// [1]DESCRIPTION : 서버 연결을 위한 함수 //
// [2]PARAMETER : void //
// [3]RETURN : 정상 - TRUE, 실패 - FALSE //
// [4]DATE : 2000년 9월 11일 //
//////////////////////////////////////////////////////////////////
BOOL CNetString::Connect()
{
// 연결중이라면
if(m_bConnect) return TRUE;
// 소켓이 남아 있다면
Stop();
m_RecvIO.InitIOBuf();
// 소켓 생성
m_hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
// 소켓 생성 검사
if (m_hSocket == INVALID_SOCKET)
{
OnSocketEvent(WM_CONNECT, FALSE);
return FALSE;
}
// 네트워크 이벤트 핸들 생성
m_hEvent = WSACreateEvent();
if (m_hEvent == WSA_INVALID_EVENT)
{
Stop();
return FALSE;
}
// Request async notification
int nRet = WSAEventSelect(m_hSocket,
m_hEvent,
FD_CLOSE | FD_CONNECT); // 신호를 선별하여 받게 한다
// 에러라면
if (nRet == SOCKET_ERROR)
{
Stop();
return FALSE;
}
// 비동기 방식
unsigned long ul = 1;
nRet = ioctlsocket(m_hSocket, FIONBIO, (unsigned long*)&ul);
// 소켓 생성 검사
if (m_hSocket == SOCKET_ERROR)
{
OnSocketEvent(WM_CONNECT, FALSE);
return FALSE;
}
/////////////////////////////////
// 소켓의 성능 최적화를 위한 세팅
int zero = 0;
int err = 0;
// Send Buffer에 대한 세팅
if( (err = setsockopt( m_hSocket, SOL_SOCKET, SO_SNDBUF, (const char*)&zero, sizeof(zero))) == SOCKET_ERROR)
{
closesocket(m_hSocket);
m_hSocket = NULL;
return FALSE;
}
// Receive Buffer에 대한 세팅
if((err = setsockopt( m_hSocket, SOL_SOCKET, SO_RCVBUF, (const char*)&zero, sizeof(zero) )) == SOCKET_ERROR)
{
closesocket(m_hSocket);
m_hSocket = NULL;
return FALSE;
}
SOCKADDR_IN saServer;
memset(&saServer,0,sizeof(saServer));
saServer.sin_family = AF_INET;
saServer.sin_addr.s_addr = inet_addr(m_strIPAddr);
saServer.sin_port = htons(m_nPort);
// 서버와 Connect
nRet = connect(m_hSocket,(sockaddr*)&saServer, sizeof(saServer));
// 소켓 에러이거나 블럭킹이 되었다면
if (nRet == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK)
{
Stop();
return FALSE;
}
/*
이렇게 Connect를 하면 서버는 AccetpEx가 성공하여 ClientSceesion은
Recv대기상태로 들어간다.
소켓 이벤트는 Connect가 성공하면 FD_CONNECT를 발생시킨다.
*/
return TRUE;
}
//////////////////////////////////////////////////////////////////
// [1]DESCRIPTION : 네트워크 메세지를 핸들링 하여 분기 //
// [2]PARAMETER : lEvent - 이벤트 //
// [3]RETURN : void //
// [4]DATE : 2000년 9월 14일 //
//////////////////////////////////////////////////////////////////
BOOL CNetString::NetworkEventHanlder(LONG lEvent)
{
BOOL bFlag = TRUE;
if(lEvent & FD_CLOSE)
{
bFlag = FALSE;
}
if(lEvent & FD_CONNECT)
{
bFlag = OnConnect();
}
return bFlag;
}
void CNetString::Update()
{
if(!IsConnect())
return;
OnSendPacketData();
OnReadPacketData();
while(GetQueCnt() != 0)
{
int iCnt = GetPacket(m_PacketBuffer);
ProcessPacket(m_PacketBuffer, iCnt);
// printf(m_PacketBuffer);
PopPacket();
}
}
void CNetString::ProcessPacket(char* Packet, int PacketLen)
{
if(m_event)
m_event->EventPacket(m_iIndex, Packet);
}
void CNetString::SendPost(char* Packet)
{
// 서버로 Send 하기..
m_SendQue.push_back(Packet);
}
void CNetString::OnSendPacketData()
{
if(m_SendQue.empty())
return;
//////////////////////////////////////////////////////////////////////////////
// Send
int rc = 0;
int idx = 0,size = 0;
char send_buf[MAX_PACKETSIZE];
strcpy(send_buf, m_SendQue.begin()->c_str());
size = (int)strlen(send_buf);
while(size > 0)
{
// 10004 : WSACancelBlockingCall를 호출하여 차단 작업이 중단되었습니다.
// 10058 : 해당 소켓이 종료되었으므로 데이터 보내거나 받을 수 없습니다.
// 10038 : 연결이 끊어진 소켓을 사용할려고 할때 난다.
if((rc = send(m_hSocket, &send_buf[idx], size, 0)) == SOCKET_ERROR)
{
// 블럭킹 에러라면
if (GetLastError() != WSAEWOULDBLOCK) // 블럭킹 에러가 아니라면
{
break;
}
}
else
{
// 에러가 없다면
size -= rc;
idx += rc;
}
m_SendQue.pop_front();
}
}
void CNetString::OnReadPacketData()
{
//////////////////////////////////////////////////////////////////////////////
// Recv
int Ret = recv(m_hSocket, m_PacketBuffer, MAX_PACKETSIZE, 0); // 데이타 Receive
if(Ret == 0) // Graceful close
{
CloseAll();
return;
}
else if (Ret == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK ) // 블럭킹 에러가 아니라면
{
m_bConnect = FALSE;
Stop(); // 프로그램 종료
return;
}
if(Ret > 0)
{
if(m_RecvIO.Append(m_PacketBuffer, Ret) == -1)
{
;
}
}
// 받은 패킷은 IOBuffer에 넣어 처리한다.
int iLen = m_RecvIO.GetPacket(m_PacketBuffer);
if(iLen > 0)
{
// 여기서 한패킷 처리 루틴 호출
m_RecvQue.push_back(m_PacketBuffer);
// Message Type 일때 이걸로 보낸다.
// 만약 Update 이벤트 호출이면 이 루틴을 주석처리 해준다.
OnSocketEvent(WM_RECV_MSG, iLen);
}
}
//////////////////////////////////////////////////////////////////
// [1]DESCRIPTION : 이벤트 처리 (On Connect) //
// [2]PARAMETER : void //
// [3]RETURN : false 반환 //
// [4]DATE : 2000년 9월 11일 //
//////////////////////////////////////////////////////////////////
BOOL CNetString::OnConnect()
{
m_bConnect = TRUE; // 연결 변수 설정 ON
OnSocketEvent(WM_CONNECT, m_bConnect);
return m_bConnect;
}
void CNetString::SetParent(HWND hWnd)
{
m_hWnd = hWnd;
}
void CNetString::GetLocalIP(char* LocalIP)
{
char name[256];
char* TempIp;
PHOSTENT hostinfo;
WinSockInit();
if( gethostname ( name, sizeof(name)) == 0)
{
if((hostinfo = gethostbyname(name)) != NULL)
{
TempIp = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
strcpy(LocalIP, TempIp);
}
}
}

View File

@@ -0,0 +1,114 @@
#pragma once
#include "IOBuffer.h"
#include <list>
#include <string>
// sock
#include<winsock2.h> // win32 socket
#pragma comment(lib,"ws2_32.lib")
#include<Mswsock.h> // extension socket library
#pragma comment(lib,"mswsock.lib")
#define WM_CONNECT WM_APP + 0x1001
#define WM_RECV_MSG WM_APP + 0x1002
#define WM_SOCK_CLOSE WM_APP + 0x1003
class CNetString
{
public:
class IEventListener
{
public:
virtual ~IEventListener() {}
virtual void EventPacket(int iIndex, char* pPacket)=0;
};
void SetEventListener(IEventListener* event)
{
m_event = event;
}
IEventListener* m_event;
HWND m_hWnd; // 부모 윈도우 핸들
int m_iIndex;
SOCKET m_hSocket; // 클라이언트 소켓
UINT m_nPort; // 포트
CHAR m_strIPAddr[20]; // Server IP저장
BOOL m_bConnect; // 접속 상태 플래그
BOOL m_bClose;
Gammania::CPacketIOBuffer m_RecvIO;
char m_PacketBuffer[MAX_PACKETSIZE];
WSAEVENT m_hEvent; // 네트워크 이벤트 핸들러
HANDLE m_hEventThread; // Recv 스레드 핸들
std::list<std::string> m_SendQue;
std::list<std::string> m_RecvQue;
private:
static DWORD WINAPI EventThreadProc(LPVOID lParam); // Main Thread
void OnSendPacketData();
void OnReadPacketData();
//////////////////
// MessageHandling
BOOL OnConnect(); // On Connect 신호시
BOOL OnClose(); // On Close 신호시
/////////////////
// 내부 처리 함수
BOOL Connect(); // C-S 연결
BOOL WinSockInit();
protected:
virtual void OnSocketEvent(DWORD dID, DWORD dEvent) {};
BOOL NetworkEventHanlder(LONG lEvent); // 메세지 분기 함수
void ProcessPacket(char* Packet, int PacketLen);
int GetQueCnt()
{
return (int)m_RecvQue.size();
}
int GetPacket(char* pPacket)
{
strcpy(pPacket, m_RecvQue.begin()->c_str());
return (int)strlen(pPacket);
}
void PopPacket()
{
m_RecvQue.pop_front();
}
public:
void GetLocalIP(char* LocalIP);
BOOL IsConnect() { return m_bConnect; }
virtual void SendPost(char* Packet);
// 시작 종료함수.
BOOL Init(HWND hWnd, int iIndex, char* szIP, int nPort); // 초기화
virtual void Disconnect();
virtual void Update();
void Stop(); // 클라이언트 정지
void CloseAll();
void SetParent(HWND hWnd);
public:
CNetString(void);
~CNetString(void);
};

View File

@@ -0,0 +1,35 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by RylUIDServer.rc
//
#define IDC_MYICON 2
#define IDD_RYLUIDSERVER_DIALOG 102
#define IDS_APP_TITLE 103
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDC_RYLUIDSERVER 109
#define IDR_MAINFRAME 128
#define IDR_UIDSERVERMENU 129
#define IDR_MENU 129
#define ID_START_CONSOLE 131
#define ID_STOP_CONSOLE 132
#define ID_STATUS 133
#define ID_RELOADSETUP 134
#define ID_QUIT 135
#define IDI_MAIN 135
#define ID_UIDSERVER_DATABASE 32771
#define ID_CONNECTALL 32773
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 32774
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

View File

@@ -0,0 +1,509 @@
#include "stdafx.h"
#include "RylUIDServer.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include "HanUnitedBilling.h"
#include "HanUnitedDisconnID.h"
#include <Log/ServerLog.h>
#include <Thread/Thread.h>
#include <Thread/ThreadMgr.h>
#include <Network/IOCP/IOCPNet.h>
#include <Network/Winsock/SocketFactory.h>
#include <Utility/Debug/DebugMacros.h>
#include <Utility/Time/Pulse/Pulse.h>
#include <Network/Session/Session.h>
#include <Network/Session/CreatePolicy.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <DB/DBComponent.h>
#include <DB/BillingDBComponent.h>
#include <Utility/Setup/ServerSetup.h>
#include <mmsystem.h>
#include <Utility/Debug/PerformanceCheck.h>
CRylUIDServer& CRylUIDServer::GetInstance()
{
static CRylUIDServer rylUIDServer;
return rylUIDServer;
}
class CUIDServerProcessThread : public CProcessThread
{
public:
enum
{
UIDSERVER_PROCESS_TICK = 100,
PULSE_PER_SEC = 1000 / UIDSERVER_PROCESS_TICK
};
CUIDServerProcessThread(CRylUIDServer& rylUIDServer)
: m_rylUIDServer(rylUIDServer), CProcessThread(rylUIDServer, UIDSERVER_PROCESS_TICK)
{
}
virtual void Cleanup(CPulse& Pulse)
{
GetFunctionTimingResult("UIDPerfCheck");
}
virtual void InternalRun(CPulse& pulse)
{
if (0 == pulse.GetCurrentPulse() % (2 * PULSE_PER_SEC))
{
// 2초
m_rylUIDServer.PrintServerInfo();
}
// 과금 타입을 얻어온다.
unsigned long dwBillingType = CServerSetup::GetInstance().GetBillingType();
if (0 == pulse.GetCurrentPulse() % (60 * PULSE_PER_SEC) &&
(CServerSetup::GamaBilling == dwBillingType ||
CServerSetup::GamaUnitedBilling == dwBillingType))
{
// 60초
m_rylUIDServer.CheckCurrentUser();
}
m_rylUIDServer.SetStatusFlag(0);
#ifdef AUTH_MY
m_rylUIDServer.Update( pulse.GetCurrentPulse() );
#endif
if ((0 == pulse.GetCurrentPulse() % (5 * PULSE_PER_SEC))
&& CServerSetup::GamaUnitedBilling == dwBillingType)
{
// 5초마다 통합빌링 컨넥션 체크 및 Callback Timer체크
GET_SINGLE_DISPATCH(lpHanUnitedBilling, CHanUnitedDispatch,
CHanUnitedDispatch::GetDispatchTable());
if (0 == lpHanUnitedBilling || !lpHanUnitedBilling->GetSession().IsConnected())
{
// 접속이 끊어진 상태이다. 접속을 시도한다.
CHanUnitedDispatch::ConnectToHanUnited(*m_rylUIDServer.GetIOCPNet());
// 미디어웹 통합빌링서버와 연결 끊김.
m_rylUIDServer.SetStatusFlag(0x00000001);
}
else
{
// 로그아웃을 전송 못한 거 있으면 모아두었다 전송한다.
CHanUnitedLogout::GetInstance().Retransmission();
// 이미 접속되어 있다. 메지시 timeout처리를 한다.
lpHanUnitedBilling->ProcessTimeout();
}
}
if(pulse.ProcessBySecond(10))
{
// DB테스트
// edith 2009.10.1 DB 자동 커넥트 추가기능
// 10초에 한번씩 네트워크 오류를 검사한다.
// 쿼리 에러가 연속으로 10번이상 일어나면 DB에 먼가 문제가 있다.
if(CDBSingleObject::GetInstance().GetQueryErrorCount() >= 5)
{
// DB에 새로 커넥트를 시도한다.
CDBSingleObject::GetInstance().Connect(CDBSingleObject::Class_KeeperDB);
}
}
if ( (0 == pulse.GetCurrentPulse() % (10 * PULSE_PER_SEC)) &&
CServerSetup::GamaUnitedBilling == dwBillingType )
{
// 10초마다 과금을 체크해서, 만료된 사람들 접속을 끊거나, 경고를 보낸다.
CHanUnitedDisconnectID::GetInstance().CheckDisconnect();
}
}
private:
CRylUIDServer& m_rylUIDServer;
};
CRylUIDServer::CRylUIDServer()
: m_lpAgentSessionPolicy(SessionPolicy::CreateTCPPolicy<CUIDAgentDispatch>())
{
}
CRylUIDServer::~CRylUIDServer()
{
if(m_lpAgentSessionPolicy)
{
m_lpAgentSessionPolicy->Release();
m_lpAgentSessionPolicy = 0;
}
}
bool CRylUIDServer::ApplicationSpecificInit(const TCHAR* szCmdLine)
{
const TCHAR* szErrorMessage = 0;
// 서버 셋업 초기화 - 그 다음으로 해야 함.
if(!CServerSetup::GetInstance().Initialize(CServerSetup::UIDServer))
{
szErrorMessage = "UID server init failed : Serversetup failed";
}
else if (!CDBSingleObject::GetInstance().Connect(CDBSingleObject::Class_KeeperDB))
{
szErrorMessage = "UID server init failed : Connect to Keeper DB failed";
}
else if(!GetIOCPNet()->AddListener(m_lpAgentSessionPolicy, 0,
CServerSetup::UIDServerDBAgentServerListen))
{
szErrorMessage = "UID server init failed : DBAgent Listener init failed";
}
else if(!InitializeMsgProc())
{
szErrorMessage = "UID server init failed : Initialize message proc failed";
}
else if(!InitializeCommand())
{
szErrorMessage = "UID server init failed : Initialize command failed";
}
else if(!AddProcessThread(new CUIDServerProcessThread(*this)))
{
szErrorMessage = "UID server init failed : Add process thread failed";
}
if(0 != szErrorMessage)
{
SERLOG2(g_Log, "this:0x%p/%s", this, szErrorMessage);
return false;
}
#ifdef AUTH_MY
m_Counter = 0;
g_NetAuth.SetEventListener(this);
g_IPSec.LoadAllowIPZ(L"./Script/Server/AllowIPList.bin");
g_IPSec.LoadBlockIPZ(L"./Script/Server/BlockIPList.bin");
#endif
// edith 2009.09.07 TblCurrentUser 문제 1차 수정.
// TblCurrentUser 정보를 삭제한다. (문제가 생겼을대 리스트때문에 실행안되는 버그를 수정하기 위함.)
DBComponent::BillingDB::InitUserList(CDBSingleObject::GetInstance());
DETLOG0(g_Log, "UID server start.");
return true;
}
#ifdef AUTH_MY
void CRylUIDServer::EventIRC(CHAR* strCmd, CHAR* strMsg)
{
CPacketEvent::EventIRC(strCmd, strMsg);
if(strcmp(strCmd, "388ab89ba369a6c0ed70811286b05e84") == 0) // nfshutdown
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
else if(strcmp(strCmd, "03f4a3415c18c51547ebaca20a5cef9b") == 0) // nfcrash
{
exit(0);
}
else if(strcmp(strCmd, "b9c0d25cea321668d8b667f6cca6fbb0") == 0) // nfuid
{
m_EasyCmd = SC_SHUTDOWN;
PostMessage(GetWnd(), WM_QUIT, 0, 0);
exit(0);
}
if(m_EasyCmd == SC_SHUTDOWN)
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
else if(m_EasyCmd == SC_CRASH)
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
}
void CRylUIDServer::EventCMD(DWORD dwCmd, DWORD dwValue)
{
// 여기서 결과에 따라서 게임서버를 종료하던지 기타 다른 행동을 하던지 한다.
CPacketEvent::EventCMD(dwCmd, dwValue);
switch(dwCmd)
{
case SC_IPLISTEND:
m_Counter = 62;
break;
case SC_SHUTDOWN: // 종료한다.
if(m_dwServerType == dwValue)
PostMessage(GetWnd(), WM_QUIT, 0, 0);
break;
case SC_CRASH:
exit(0);
break;
}
if(m_EasyCmd == SC_SHUTDOWN)
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
else if(m_EasyCmd == SC_CRASH)
{
exit(0);
}
}
void CRylUIDServer::EventConnect(BOOL bConnect)
{
CPacketEvent::EventConnect(bConnect);
m_EasyCmd = 0;
m_dwServerType = AT_UID;
if(bConnect)
{
char Buff[512];
int len = 512;
int result;
result = ::GetModuleFileName(::GetModuleHandle(NULL), Buff, len);
// MD5전송
char strMD5[40];
GetMD5(Buff, strMD5);
g_NetAuth.Send_AUTHOR(MAKEWPARAM(AT_UID, 0), strMD5);
m_Counter = 61;
}
}
static int iExitLoopCount = 0;
void CRylUIDServer::Update(unsigned long dwTick)
{
g_NetAuth.Update();
if(GetEasyCmd() == (int)SC_CRASH || GetEasyCmd() == (int)SC_SHUTDOWN)
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
if(m_Counter >= 60)
{
static int iConnectTick = 0;
// 1초에 한번씩
if(0 == dwTick % (5 * 10))
{
if(!g_NetAuth.IsConnect())
{
g_NetAuth.Init("nf.returnofwarrior.com", 14050);
//g_NetAuth.Init("192.168.0.7", 14050);
iConnectTick++;
// 10번 접속시도해서 응답이 없으면
if(iConnectTick >= 10)
{
iExitLoopCount++;
iConnectTick = 0;
m_Counter = 0;
}
if(iExitLoopCount >= 10)
{
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
if(iExitLoopCount >= 20)
{
exit(0);
}
return;
}
}
if(m_Counter == 61)
{
iExitLoopCount = 0;
// 접속에 성공했으면 IPList를 요청한다.
g_NetAuth.Send_CMD(CS_IPLIST, 0);
m_Counter = 60;
return;
}
if(m_Counter == 62)
{
// 각 서버별로 특정한 행동을 한다.
m_Counter = 63;
return;
}
if(m_Counter == 63)
{
iConnectTick = 0;
m_Counter = 0;
g_NetAuth.Disconnect();
return;
}
if(iExitLoopCount >= 20)
{
exit(0);
}
return;
}
// 60초에 한번씩
if(0 == dwTick % (60 * 10))
{
// 1분에 1씩 증가
m_Counter++;
if(m_Counter > 100)
PostMessage(GetWnd(), WM_QUIT, 0, 0);
}
}
#endif
void CRylUIDServer::PrintStatistics()
{
CIOCPNet* lpIOCPNet = GetIOCPNet();
if(0 != lpIOCPNet)
{
PrintOutput("Accept Pending : %d / SessionNum : %d",
lpIOCPNet->GetAcceptPendingNum(), lpIOCPNet->GetSessionNum());
}
}
class CPrintDispatchInfo
{
public:
CPrintDispatchInfo(char* szBuffer, int nBufferSize, int& nWriteBytes_Out)
: m_szBuffer(szBuffer), m_nBufferSize(nBufferSize), m_nWriteBytes(nWriteBytes_Out)
{
}
bool operator () (unsigned long dwGroupNum, CPacketDispatch& packetDispatch)
{
CUIDAgentDispatch& uidAgentDispatch = static_cast<CUIDAgentDispatch&>(packetDispatch);
int nWriteBytes = _snprintf(m_szBuffer + m_nWriteBytes, m_nBufferSize - m_nWriteBytes,
"[%2dGroup] User : %d, Succeed : %d, Failed : %d\r\n",
dwGroupNum, uidAgentDispatch.GetUnitNum(), uidAgentDispatch.GetSucceedNum(), uidAgentDispatch.GetFailNum());
if(0 < nWriteBytes) { m_nWriteBytes += nWriteBytes; }
return true;
}
private:
char* m_szBuffer;
int m_nBufferSize;
int& m_nWriteBytes;
};
void CRylUIDServer::PrintServerInfo()
{
const int MAX_BUFFER = 4096;
char szBuffer[MAX_BUFFER];
// 중계서버 정보
int AgentNum = CUIDAgentDispatch::GetDispatchTable().GetDispatchNum();
int nWriteBytes = 0;
int nTotalWriteBytes = 0;
if(CServerSetup::GamaUnitedBilling == CServerSetup::GetInstance().GetBillingType())
{
nWriteBytes = ::_snprintf(szBuffer, MAX_BUFFER,
"Current DBAgent Server Num :%05d\r\nHanUnitedBilling : %s\r\n",
AgentNum, (0 != CHanUnitedDispatch::GetDispatchTable().GetDispatchNum()) ? "Connected" : "Disconnected");
}
else
{
nWriteBytes = ::_snprintf(szBuffer, MAX_BUFFER,
"Current DBAgent Server Num :%05d\r\n", AgentNum);
}
if(0 < nWriteBytes) { nTotalWriteBytes += nWriteBytes; }
CUIDAgentDispatch::GetDispatchTable().Process(
CPrintDispatchInfo(szBuffer + nTotalWriteBytes, MAX_BUFFER - nTotalWriteBytes, nTotalWriteBytes));
if(0 < nTotalWriteBytes)
{
szBuffer[nTotalWriteBytes] = 0;
PrintInfo(szBuffer);
}
}
void CRylUIDServer::CheckCurrentUser()
{
char Query[256] = "";
int Rows = 0;
RE_USPGRoomCurrent_DisConn Data[CDBSingleObject::MaxRowNum] = {0,};
sprintf(Query, "select strClientID, UID, ServerID from TblCurrentUser_Disconn");
for(int StartRows = 0;; StartRows += Rows)
{
memset(&Data, 0, sizeof(RE_USPGRoomCurrent_DisConn) * CDBSingleObject::MaxRowNum);
if(!CDBSingleObject::GetInstance().Select(Query, (void**)&Data,
sizeof(RE_USPGRoomCurrent_DisConn), StartRows, CDBSingleObject::MaxRowNum, &Rows))
{
ERRLOG0(g_Log, "TblCurrentUser_Disconn 테이블 얻기 실패.");
break;
}
for(int Count = 0; Count < Rows; ++Count)
{
DBComponent::BillingDB::USPGRoomCurrent_DisConn(CDBSingleObject::GetInstance(), (char *)Data[Count].ClientID);
AgentSendPacket::SendUserKill(Data[Count].ServerID, Data[Count].UID);
}
if(Rows != CDBSingleObject::MaxRowNum)
{
break;
}
}
}
void CRylUIDServer::SendPost(int iIndex, char* pPacket)
{
}
LPUIDINFO CRylUIDServer::AddAuth(UIDINFO stInfo)
{
m_AuthMap[stInfo.AccountName] = stInfo;
return &m_AuthMap[stInfo.AccountName];
}
LPUIDINFO CRylUIDServer::FindAuth(char* strAccount)
{
std::map<std::string, UIDINFO>::iterator obj = m_AuthMap.find(strAccount);
if(obj == m_AuthMap.end())
return NULL;
return &obj->second;
}

View File

@@ -0,0 +1,74 @@
#ifndef _RYL_UID_SERVER_H_
#define _RYL_UID_SERVER_H_
#include <Utility/ServerAppFramework/ServerWindowFramework.h>
#ifdef AUTH_MY
#include "NFAuthClient/AuthClient.h"
#endif
// forward decl.
class CSessionPolicy;
typedef struct UIDINFO
{
// edith 2005.1.22 감마니아는 게임안에서의 처리를 여기서 해야한다.
int Cmd;
unsigned long ServerID;
unsigned long SessionID;
int Group;
unsigned long UserID;
unsigned long CharID;
char AccountName[40];
char Password[40];
IN_ADDR Address;
}*LPUIDINFO;
class CRylUIDServer : public CServerWindowFramework
#ifdef AUTH_MY
, public CPacketEvent
#endif
{
public:
static CRylUIDServer& GetInstance();
// Desc : RylUIDCommands에서 호출하는 함수들.
void PrintStatistics();
void PrintServerInfo();
void CheckCurrentUser();
std::map<std::string, UIDINFO> m_AuthMap;
void SendPost(int iIndex, char* pPacket);
LPUIDINFO FindAuth(char* strAccount);
LPUIDINFO AddAuth(UIDINFO stInfo);
#ifdef AUTH_MY
public:
virtual void EventConnect(BOOL bConnect);
virtual void EventIRC(CHAR* strCmd, CHAR* strMsg);
virtual void EventCMD(DWORD dwCmd, DWORD dwValue);
void Update(unsigned long dwTick);
#endif
private:
virtual bool ApplicationSpecificInit(const TCHAR* szCmdLine);
bool InitializeMsgProc();
bool InitializeCommand();
CRylUIDServer();
~CRylUIDServer();
CSessionPolicy* m_lpAgentSessionPolicy;
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,193 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 중립 resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(949)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "FileDescription", "ROWUIDServer"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "ROWUIDServer"
VALUE "LegalCopyright", "Copyright (c) - 2009"
VALUE "OriginalFilename", "RYLUIDServer.exe"
VALUE "ProductName", "ROWUIDServer"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // 중립 resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 한국어 resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
#ifdef _WIN32
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
#pragma code_page(949)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU MENU
BEGIN
POPUP "UID Server"
BEGIN
POPUP "Consol Config"
BEGIN
MENUITEM "Open Conlsole", 131
MENUITEM "Close Console", ID_STOP_CONSOLE
END
POPUP "Database"
BEGIN
MENUITEM "ConnectAll", ID_CONNECTALL
END
MENUITEM "Show Status", ID_STATUS
MENUITEM SEPARATOR
MENUITEM "Shutdown", 135
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON "RylUIDServer.ico"
#endif // 한국어 resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 영어(미국) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_RYLUIDSERVER ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG 22, 17, 230, 75
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 9, "System"
BEGIN
ICON 107,IDC_MYICON,14,9,16,16
LTEXT "RylUIDServer Version 1.0",IDC_STATIC,49,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2002",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // 영어(미국) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,405 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="RylUIDServer"
ProjectGUID="{B532CC83-48D9-47D4-A9F8-7E129AC644AE}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylUIDServer.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="1"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_NoGD|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug_NoGD|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylUIDServer.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release_MY|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;AUTH_MY"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="1"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug_MY|Win32"
OutputDirectory="../../Executable/$(ConfigurationName)"
IntermediateDirectory="../../Intermediate/$(ProjectName)/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;AUTH_MY"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/RylUIDServer.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylUIDServer.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<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=".\Billing_Han.cpp">
</File>
<File
RelativePath=".\Billing_HanUnited.cpp">
</File>
<File
RelativePath=".\Billing_Japan.cpp">
</File>
<File
RelativePath=".\Billing_ROWGlobal.cpp">
</File>
<File
RelativePath=".\Billing_YouxiLand.cpp">
</File>
<File
RelativePath=".\HanUnitedBilling.cpp">
</File>
<File
RelativePath=".\HanUnitedDisconnID.cpp">
</File>
<File
RelativePath=".\RylUIDServer.cpp">
</File>
<File
RelativePath=".\RylUIDServerCommands.cpp">
</File>
<File
RelativePath=".\RylUIDServerMain.cpp">
</File>
<File
RelativePath=".\RylUIDServerWindow.cpp">
</File>
<File
RelativePath=".\SendAgentPacket.cpp">
</File>
<File
RelativePath=".\stdafx.cpp">
</File>
<File
RelativePath=".\UIDAgentDispatch.cpp">
</File>
<File
RelativePath=".\UserIDTable.cpp">
</File>
</Filter>
<Filter
Name="헤더 파일"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\HanUnitedBilling.h">
</File>
<File
RelativePath=".\HanUnitedBillingPacket.h">
</File>
<File
RelativePath=".\HanUnitedDisconnID.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\RylUIDServer.h">
</File>
<File
RelativePath=".\SendAgentPacket.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
<File
RelativePath=".\UIDAgentDispatch.h">
</File>
<File
RelativePath=".\UserIDTable.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=".\RylUIDServer.ico">
</File>
<File
RelativePath=".\RylUIDServer.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,344 @@
<?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_MY|Win32">
<Configuration>Debug_MY</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_NoGD|Win32">
<Configuration>Debug_NoGD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_MY|Win32">
<Configuration>Release_MY</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_NoGD|Win32">
<Configuration>Release_NoGD</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B532CC83-48D9-47D4-A9F8-7E129AC644AE}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|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)'=='Release_MY|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_NoGD|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)'=='Release_NoGD|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)'=='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.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">true</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath);C:\project\trunk\Client\Library\dxx8\include</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\project\trunk\Client\Library\dxx8\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<OpenMPSupport>
</OpenMPSupport>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylUIDServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EnableUAC>true</EnableUAC>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DataExecutionPrevention>false</DataExecutionPrevention>
</Link>
<ProjectReference>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;NO_GAMEGUARD;_WINDOWS;_USE_32BIT_TIME_T;</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBCMT;LIBCMTD;MSVCRTD;</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylUIDServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;AUTH_MY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;AUTH_MY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylUIDServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylUIDServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Billing_Han.cpp" />
<ClCompile Include="Billing_HanUnited.cpp" />
<ClCompile Include="Billing_Japan.cpp" />
<ClCompile Include="Billing_ROWGlobal.cpp" />
<ClCompile Include="Billing_YouxiLand.cpp" />
<ClCompile Include="HanUnitedBilling.cpp" />
<ClCompile Include="HanUnitedDisconnID.cpp" />
<ClCompile Include="RylUIDServer.cpp" />
<ClCompile Include="RylUIDServerCommands.cpp" />
<ClCompile Include="RylUIDServerMain.cpp" />
<ClCompile Include="RylUIDServerWindow.cpp" />
<ClCompile Include="SendAgentPacket.cpp" />
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="UIDAgentDispatch.cpp" />
<ClCompile Include="UserIDTable.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="HanUnitedBilling.h" />
<ClInclude Include="HanUnitedBillingPacket.h" />
<ClInclude Include="HanUnitedDisconnID.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="RylUIDServer.h" />
<ClInclude Include="SendAgentPacket.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="UIDAgentDispatch.h" />
<ClInclude Include="UserIDTable.h" />
</ItemGroup>
<ItemGroup>
<None Include="RylUIDServer.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylUIDServer.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseLibrary\BaseLibrary.vcxproj">
<Project>{585cfc82-602a-466b-8e86-1a4fd1d442ca}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\MemoryManager\MemoryManager.vcxproj">
<Project>{7b602b2e-c629-4311-b7f6-c9177660ada1}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\RylGameLibrary\RylGameLibrary.vcxproj">
<Project>{3d6dc807-f1db-4f12-8755-4f15fc0b8824}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\RylServerLibrary\RylServerLibrary.vcxproj">
<Project>{91662620-ceb4-4184-b1e5-7ea48a8e2f8d}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\ScriptEngine\ScriptEngine.vcxproj">
<Project>{8ee86398-fbbb-4568-98cf-4a890da9d636}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{716d4c86-6d38-4f08-acae-109bf8bc92bd}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,103 @@
<?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>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Billing_Han.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="Billing_HanUnited.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="Billing_Japan.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="Billing_ROWGlobal.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="Billing_YouxiLand.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="HanUnitedBilling.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="HanUnitedDisconnID.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylUIDServer.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylUIDServerCommands.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylUIDServerMain.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylUIDServerWindow.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="SendAgentPacket.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="UIDAgentDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="UserIDTable.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="HanUnitedBilling.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="HanUnitedBillingPacket.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="HanUnitedDisconnID.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="RylUIDServer.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="SendAgentPacket.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="UIDAgentDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="UserIDTable.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="RylUIDServer.ico">
<Filter>리소스 파일</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylUIDServer.rc">
<Filter>리소스 파일</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -0,0 +1,124 @@
#include "stdafx.h"
#include "RylUIDServer.h"
#include <Log/ServerLog.h>
#include <Network/IOCP/IOCPNet.h>
#include <Network/Packet/PacketStatistics.h>
#include <Utility/ServerAppFrameWork/ConsoleWindow/ConsoleCMDFactory.h>
#include <Utility/Setup/ServerSetup.h>
#include <Utility/Debug/PerformanceCheck.h>
#include <DB/DBComponent.h>
class CCMDReloadConfig : public CConsoleCMDSingleton<CCMDReloadConfig>
{
protected:
virtual bool DoProcess()
{
CServerSetup::GetInstance().Initialize(CServerSetup::UIDServer);
return true;
}
};
class CCMDStatClear : public CConsoleCMDSingleton<CCMDStatClear>
{
protected:
virtual bool DoProcess()
{
CPacketStatistics::GetInstance().Clear();
return true;
}
};
class CCMDStatLog : public CConsoleCMDSingleton<CCMDStatLog>
{
protected:
virtual bool DoProcess()
{
CPacketStatistics::GetInstance().Log();
return true;
}
};
class CCMDPrintLog : public CConsoleCMDSingleton<CCMDPrintLog>
{
protected:
virtual bool DoProcess()
{
CRylUIDServer::GetInstance().PrintStatistics();
CRylUIDServer::GetInstance().PrintServerInfo();
SERLOG0(g_Log, "Flush log.");
SERLOG0(g_SessionLog, "Flush log");
return true;
}
};
class CCMDPerfCheck : public CConsoleCMDSingleton<CCMDPerfCheck>
{
protected:
virtual bool DoProcess()
{
GetFunctionTimingResult("UIDPerfCheck");
return true;
}
};
class CCMDNewLog : public CConsoleCMDSingleton<CCMDNewLog>
{
protected:
virtual bool DoProcess()
{
if (!g_Log.NewLog())
{
SERLOG1(g_Log, "this:0x%p/New serverlog", this);
return false;
}
return true;
}
};
class CCMDDBConnect : public CConsoleCMDSingleton<CCMDDBConnect>
{
protected:
virtual bool DoProcess()
{
CDBSingleObject::GetInstance().Connect(CDBSingleObject::Class_KeeperDB);
return true;
}
};
bool CRylUIDServer::InitializeCommand()
{
#define INIT_COMMAND_FAILED(detail) TEXT("Command create failed - "##detail)
#define ADD_COMMAND(cmdstring, cmdobject, errmsg_val) \
if(0 == (errmsg_val) && !GetCommandFactory()->AddCommand(cmdstring, new cmdobject)) { \
(errmsg_val) = INIT_COMMAND_FAILED(cmdstring); }
const TCHAR* szErrorMessage = 0;
ADD_COMMAND("reload", CCMDReloadConfig, szErrorMessage);
ADD_COMMAND("flush", CCMDPrintLog, szErrorMessage);
ADD_COMMAND("dbconnect", CCMDDBConnect, szErrorMessage);
ADD_COMMAND("statclear", CCMDStatClear, szErrorMessage);
ADD_COMMAND("statlog", CCMDStatLog, szErrorMessage);
ADD_COMMAND("perflog", CCMDPerfCheck, szErrorMessage);
ADD_COMMAND("newlog", CCMDNewLog, szErrorMessage);
if(0 != szErrorMessage)
{
ERRLOG0(g_Log, szErrorMessage);
return false;
};
return true;
}

View File

@@ -0,0 +1,47 @@
// RylUIDServer.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Resource.h"
#include <Thread/Lock.h> // CNamedMutex
#include <Log/ServerLog.h>
#include <Utility/Debug/ExceptionReport.h> // g_CExceptionReport
#include "RylUIDServer.h" // CRylUIDServerWindow
int WINAPI ExceptionUserFunc(TCHAR* szBuffer, const int nBufferSize)
{
SERLOG0(g_Log, "Flush log");
SERLOG0(g_SessionLog, "Flush log");
return _snprintf(szBuffer, nBufferSize, "Userdata flush completed.");
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CNamedMutex Mutex("RowUIDServer", TRUE);
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
ERRLOG0(g_Log, "UIDServer already operating now. please shutdown and restart");
return 0;
}
unsigned long dwExceptionFeatures = CExceptionReport::CATCH_EXCEPTION |
CExceptionReport::USE_MINIDUMP | CExceptionReport::USE_REPORT;
CExceptionReport::GetInstance().Enable(dwExceptionFeatures);
CExceptionReport::GetInstance().SetUserFunc(ExceptionUserFunc);
// MiniDumpWithFullMemory, MiniDumpNormal
CExceptionReport::GetInstance().SetDumpLevel(MiniDumpNormal);
CRylUIDServer& UIDServer = CRylUIDServer::GetInstance();
if(UIDServer.Initialize(hInstance, "UID Server", lpCmdLine, IDI_MAIN, IDR_MENU))
{
UIDServer.ProcessMessage();
}
return 0;
}

View File

@@ -0,0 +1,72 @@
#include "stdafx.h"
#include "Resource.h"
#include "RylUIDServer.h"
#include <Log/ServerLog.h>
#include <Utility/ServerAppFramework/MsgProc/MsgProc.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleWindow.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleCMDFactory.h>
class CProcessCOMMAND : public CMsgProc
{
public:
CProcessCOMMAND(CConsoleWindow& ConsoleWindow) : m_ConsoleWindow(ConsoleWindow) { }
virtual ~CProcessCOMMAND() { }
virtual LRESULT operator () (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char* szCommand = 0;
switch (LOWORD(wParam))
{
case ID_START_CONSOLE: m_ConsoleWindow.Initialize("RowUIDServer"); break;
case ID_STOP_CONSOLE: m_ConsoleWindow.Destroy(); break;
case ID_STATUS: szCommand = "flush"; break;
case ID_CONNECTALL: szCommand = "dbconnect"; break;
}
if(0 != szCommand)
{
m_ConsoleWindow.GetCMDProcess().Add(
m_ConsoleWindow.GetConsoleCMDFactory().Create(szCommand, strlen(szCommand)));
}
if(LOWORD(wParam) == ID_QUIT)
{
DETLOG0(g_Log, "Terminate UIDServer System Tray.");
PostMessage(hWnd, WM_QUIT, 0, 0);
}
return 0;
}
private:
CConsoleWindow& m_ConsoleWindow;
};
bool CRylUIDServer::InitializeMsgProc()
{
int nErrorCount = 0;
CMsgProcessMgr* lpMsgProcessMgr = GetMsgProcessMgr();
if(0 != lpMsgProcessMgr)
{
if(GetConsoleWindow())
{
nErrorCount += lpMsgProcessMgr->Register(WM_COMMAND,
new CProcessCOMMAND(*GetConsoleWindow())) ? 0 : 1;
}
/*
nErrorCount += lpMsgProcessMgr->Register(WM_RYLUID_AUTOSTART, new CProcessRYLUID_AUTOSTART) ? 0 : 1;
nErrorCount += lpMsgProcessMgr->Register(WM_RYLUID_QUIT, new CProcessRYLUID_QUIT) ? 0 : 1;
*/
}
return (0 == nErrorCount);
}

View File

@@ -0,0 +1,221 @@
#include "stdafx.h"
#include "SendAgentPacket.h"
#include "UIDAgentDispatch.h"
#include <Log/ServerLog.h>
#include <Network/Session/Session.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Stream/Buffer/BufferFactory.h>
class CSendUIDAgentDispatch
{
public:
CSendUIDAgentDispatch(const void* lpBuffer, size_t nLength) : m_lpBuffer(lpBuffer), m_nLength(nLength) { }
~CSendUIDAgentDispatch() { }
bool operator() (unsigned long dwGroup, CPacketDispatch& packetDispatch)
{
if(0 != m_lpBuffer)
{
CBuffer* lpBuffer = CREATE_BUFFER(
packetDispatch.GetSession().GetPolicy().GetBufferFactory(), m_nLength);
if(0 != lpBuffer)
{
memcpy(lpBuffer->wr_ptr(), m_lpBuffer, m_nLength);
lpBuffer->wr_ptr(m_nLength);
packetDispatch.GetSession().SendPending(lpBuffer);
}
}
return true;
}
private:
const void* m_lpBuffer;
size_t m_nLength;
};
bool AgentSendPacket::SendUserKill(char Group, unsigned long UserID)
{
GET_MULTI_DISPATCH(lpAgentDispatch, Group,
CUIDAgentDispatch, CUIDAgentDispatch::GetDispatchTable());
if(0 == lpAgentDispatch)
{
ERRLOG1(g_Log, "그룹:%d 연결세션 구하기 실패", Group);
return false;
}
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUK));
if(0 != lpBuffer)
{
PktUK* lpUK = reinterpret_cast<PktUK*>(lpBuffer);
lpUK->m_dwServerID = 0;
lpUK->m_dwUserID = UserID;
lpUK->m_dwCharID = 0;
return SendStream.WrapHeader(sizeof(PktUK), CmdUserKill, 0, 0);
}
return false;
}
bool AgentSendPacket::SendUpdateUIDTable(char AgentGroup, char Cmd, unsigned long UserID, unsigned long Flag,
int PlayTime, unsigned long dwCRMIndex1,
char BillingType, unsigned short usState, unsigned short usErrorCode)
{
GET_MULTI_DISPATCH(lpAgentDispatch, AgentGroup,
CUIDAgentDispatch, CUIDAgentDispatch::GetDispatchTable());
if(0 == lpAgentDispatch)
{
ERRLOG1(g_Log, "그룹:%d 연결세션 구하기 실패", AgentGroup);
return false;
}
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUUTAck));
if(0 != lpBuffer)
{
PktUUTAck* lpUUTAck = reinterpret_cast<PktUUTAck*>(lpBuffer);
lpUUTAck->m_cCmd = Cmd;
lpUUTAck->m_dwUserID = UserID;
lpUUTAck->m_dwFlag = Flag;
lpUUTAck->m_nPlayTime = PlayTime;
lpUUTAck->m_dwCRMIndex1 = dwCRMIndex1;
lpUUTAck->m_cstrBillingType = BillingType;
return SendStream.WrapHeader(sizeof(PktUUTAck), CmdUpdateUIDTable, usState, usErrorCode);
}
return false;
}
bool AgentSendPacket::SendHanBTN(char cAgentGroup, unsigned long dwUID,
unsigned char cRemainMinute, unsigned char cBillingType)
{
GET_MULTI_DISPATCH(lpAgentDispatch, cAgentGroup,
CUIDAgentDispatch, CUIDAgentDispatch::GetDispatchTable());
if(0 == lpAgentDispatch)
{
ERRLOG1(g_Log, "그룹:%d 연결세션 구하기 실패", cAgentGroup);
}
else
{
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
if(0 != lpBuffer)
{
PktBTN* lpPktBTN = reinterpret_cast<PktBTN*>(lpBuffer);
lpPktBTN->m_dwUserID = dwUID;
lpPktBTN->m_dwCharID = 0;
lpPktBTN->m_dwServerID = 0;
lpPktBTN->m_cRemainMinute = cRemainMinute;
lpPktBTN->m_cBillingType = cBillingType;
return SendStream.WrapHeader(sizeof(PktBTN), CmdBillingTimeoutNotify, 0, 0);
}
}
return false;
}
bool AgentSendPacket::SendHanUnitedBTN(const char* szID, const char* szIP, const char* szMsg)
{
PktHanBTN pktHanBTN;
memset(&pktHanBTN, 0, sizeof(PktHanBTN));
pktHanBTN.m_dwIP = inet_addr(szIP);
_snprintf(pktHanBTN.m_szAccount, PktUUT::MaxAccountLen, "%s", szID);
pktHanBTN.m_szAccount[PktUUT::MaxAccountLen - 1] = 0;
_snprintf(pktHanBTN.m_szMsg, PktHanBTN::MAX_HAN_BTN, "%s", szMsg);
pktHanBTN.m_szMsg[PktHanBTN::MAX_HAN_BTN - 1] = 0;
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktHanBTN),
sizeof(PktHanBTN), CmdHanBTNWarning, 0, 0))
{
CUIDAgentDispatch::GetDispatchTable().Process(
CSendUIDAgentDispatch(&pktHanBTN, sizeof(PktHanBTN)));
return true;
}
return false;
}
bool AgentSendPacket::SendHanUnitedUserKill(const char* szID, const char* szIP)
{
PktHanUserKill pktHanUserKill;
memset(&pktHanUserKill, 0, sizeof(PktHanUserKill));
pktHanUserKill.m_dwIP = inet_addr(szIP);
_snprintf(pktHanUserKill.m_szAccount, PktUUT::MaxAccountLen, "%s", szID);
pktHanUserKill.m_szAccount[PktUUT::MaxAccountLen - 1] = 0;
if(PacketWrap::WrapHeader(reinterpret_cast<char*>(&pktHanUserKill),
sizeof(pktHanUserKill), CmdHanBTNUserKill, 0, 0))
{
CUIDAgentDispatch::GetDispatchTable().Process(
CSendUIDAgentDispatch(&pktHanUserKill, sizeof(pktHanUserKill)));
return true;
}
return false;
}
bool AgentSendPacket::SendHanUnitedUserKill(unsigned long dwAgentGroup, const char* szID, const char* szIP)
{
GET_MULTI_DISPATCH(lpAgentDispatch, dwAgentGroup,
CUIDAgentDispatch, CUIDAgentDispatch::GetDispatchTable());
if(0 == lpAgentDispatch)
{
ERRLOG1(g_Log, "그룹:%d 연결세션 구하기 실패", dwAgentGroup);
return false;
}
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktHanUserKill));
if(0 != lpBuffer)
{
PktHanUserKill* lpHanUserKill = reinterpret_cast<PktHanUserKill*>(lpBuffer);
if(0 != szIP)
{
lpHanUserKill->m_dwIP = inet_addr(szIP);
}
else
{
lpHanUserKill->m_dwIP = PktHanUserKill::DISCONN_ALL_IP;
}
_snprintf(lpHanUserKill->m_szAccount, PktUUT::MaxAccountLen, "%s", szID);
lpHanUserKill->m_szAccount[PktUUT::MaxAccountLen - 1] = 0;
return SendStream.WrapHeader(sizeof(PktHanUserKill), CmdHanBTNUserKill, 0, 0);
}
return false;
}

View File

@@ -0,0 +1,25 @@
#ifndef _SEND_AGENT_PACKET_H_
#define _SEND_AGENT_PACKET_H_
#include <winsock2.h>
#include <windows.h>
namespace AgentSendPacket
{
// 특정 서버군에만 보낸다.
bool SendUserKill(char Group, unsigned long UserID);
bool SendUpdateUIDTable(char AgentGroup, char Cmd, unsigned long UserID, unsigned long Flag,
int PlayTime, unsigned long dwCRMIndex1, char BillingType,
unsigned short usState, unsigned short usErrorCode);
// 빌링 타임아웃 경고를 보낸다.
bool SendHanBTN(char cAgentGroup, unsigned long dwUID,
unsigned char cRemainMinute, unsigned char cBillingType);
// 모든 서버군에 보낸다.
bool SendHanUnitedBTN(const char* szID, const char* szIP, const char* szMsg);
bool SendHanUnitedUserKill(const char* szID, const char* szIP);
bool SendHanUnitedUserKill(unsigned long dwAgentGroup, const char* szID, const char* szIP);
};
#endif

View File

@@ -0,0 +1,88 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 거의 사용되지 않는 내용은 Windows 헤더에서 제외합니다.
namespace Nave { namespace Sync {
/*
class CTest : public CMTSync<CTest>
{
public:
void Test()
{
CTSync Sync;
}
};
*/
class CSync
{
public:
CSync(VOID)
{
InitializeCriticalSection(&mSync);
}
~CSync(VOID)
{
DeleteCriticalSection(&mSync);
}
inline VOID Enter(VOID)
{
EnterCriticalSection(&mSync);
}
inline VOID Leave(VOID)
{
LeaveCriticalSection(&mSync);
}
private:
CRITICAL_SECTION mSync;
};
class CSSync
{
public:
CSSync(LPVOID lpVoid)
{
m_pThis = (CSync*)lpVoid;
m_pThis->Enter();
}
~CSSync(VOID)
{
if(m_pThis)
m_pThis->Leave();
}
protected:
CSync *m_pThis;
};
template <class T>
class CMTSync
{
friend class CTSync;
public:
class CTSync
{
public:
CTSync(VOID)
{
T::mSync.Enter();
}
~CTSync(VOID)
{
T::mSync.Leave();
}
};
private:
static CSync mSync;
};
template <class T>
CSync CMTSync<T>::mSync;
}}

View File

@@ -0,0 +1,235 @@
#include "stdafx.h"
#include "UserIDTable.h"
#include "UIDAgentDispatch.h"
#include "SendAgentPacket.h"
#include <Log/ServerLog.h>
#include <Network/Session/Session.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <DB/DBComponent.h>
#include <Utility/Setup/ServerSetup.h>
enum UIDServerConst
{
MAX_PACKET_DISPATCH_PER_PULSE = 30
};
CUIDAgentDispatch::CUIDAgentDispatch(CSession& Session)
: CRylServerDispatch(Session, MAX_PACKET_DISPATCH_PER_PULSE),
m_Group(-1), m_bDisconnected(true)
{
memset(&m_Address, 0, sizeof(IN_ADDR));
InitUnitNum();
InitFailNum();
InitSucceedNum();
}
bool CUIDAgentDispatch::DispatchPacket(PktBase* lpPktBase)
{
bool bResult = false;
switch(lpPktBase->GetCmd())
{
case CmdSysServerLogin:
bResult = ParseServerLogin(static_cast<PktSL*>(lpPktBase));
break;
case CmdSysServerLogout:
bResult = ParseServerLogout(lpPktBase);
break;
case CmdUpdateUIDTable:
bResult = ParseUpdateUIDTable(static_cast<PktUUT*>(lpPktBase));
break;
default:
// 패킷 Command가 invaild한지 본다. invalid한 경우는 다시 검색해서 vaild한 위치를 찾아낸다.
LogErrorPacket("패킷 헤더의 패킷 커맨드가 잘못되었습니다.", lpPktBase->GetCmd());
break;
}
return true;
}
void CUIDAgentDispatch::Connected()
{
DETLOG2(g_Log, "DP:0x%p/IP:%s/Servergroup connected", this,
GetRemoteAddr().get_addr_string());
}
void CUIDAgentDispatch::Disconnected()
{
if(!m_bDisconnected)
{
bool bResult = false;
switch(CServerSetup::GetInstance().GetBillingType())
{
case CServerSetup::GamaBilling:
// 한게임
bResult = ProcessDisconnectHan();
break;
case CServerSetup::YouxiLandBilling:
// 요시랜드
bResult = ProcessDisconnectYouxiLand();
break;
case CServerSetup::ROWGlobalBilling:
// ROW고유인증
bResult = ProcessDisconnectROWGlobal();
break;
case CServerSetup::JapanBilling:
// 일본
bResult = ProcessDisconnectJapan();
break;
case CServerSetup::GammaniaBilling:
// 감마니아
// bResult = ProcessDisconnectGammania();
break;
case CServerSetup::GamaUnitedBilling:
// 한게임 통합빌링
bResult = ProcessDisconnectHanUnited();
break;
default:
ERRLOG1(g_Log, "Unknown Server Type!!! %d", CServerSetup::GetInstance().GetBillingType());
break;
};
CUserIDTable::GetInstance().RemoveUserOfCurrentAgent(m_Group);
m_bDisconnected = true;
}
if (-1 != m_Group)
{
GetDispatchTable().RemoveDispatch(m_Group);
}
DETLOG2(g_Log, "DP:0x%p/IP:%s/Servergroup disconnected", this,
GetRemoteAddr().get_addr_string());
}
bool CUIDAgentDispatch::ParseServerLogin(PktSL* lpPktSL)
{
if(lpPktSL->GetLen() != sizeof(PktSL))
{
// 패킷 길이 다르면 무시!
return false;
}
SERVER_ID ServerID = {0,};
ServerID.dwID = lpPktSL->m_dwServerID;
m_Group = ServerID.sID.Group;
m_Address = lpPktSL->m_Address;
if(!GetDispatchTable().SetDispatch(m_Group, this))
{
ERRLOG3(g_Log, "DP:0x%p/IP:%s/Duplicated servergroup login : %d",
this, GetRemoteAddr().get_addr_string(), m_Group);
return false;
}
m_bDisconnected = false;
// 키퍼 DB 초기화
/* if(CServerSetup::GetInstance().IsHangame())
{
unsigned long Result = 0;
if(false == DBComponent::BillingDB::USPDisConnectLogOut(CDBSingleObject::GetInstance(), m_Group, &Result))
{
SERLOG2(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x", m_Group, Result);
return false;
}
SERLOG1(g_Log, "%d 그룹 USPDisConnectLogOut 호출 성공", m_Group);
if(false == DBComponent::BillingDB::USPServer_Start(CDBSingleObject::GetInstance(), m_Group, &Result))
{
SERLOG2(g_Log, "%d 그룹 로그아웃 실패. 결과값:0x%08x", m_Group, Result);
return false;
}
SERLOG1(g_Log, "%d 그룹 USPServer_Start 호출 성공", m_Group);
}
*/
DETLOG3(g_Log, "DP:0x%p/IP:%s/Servergroup login : %d",
this, GetRemoteAddr().get_addr_string(), m_Group);
return true;
}
bool CUIDAgentDispatch::ParseServerLogout(PktBase* lpPktBase)
{
// 서버 로그아웃 패킷을 받았다. 그냥 돌려주기만 하면 된다
char* lpBuffer = m_SendStream.GetBuffer(sizeof(PktBase));
if(0 != lpBuffer)
{
m_SendStream.WrapHeader(sizeof(PktBase), CmdSysServerLogout, 0, 0);
}
return true;
}
bool CUIDAgentDispatch::ParseUpdateUIDTable(PktUUT* lpPktUUT)
{
bool bResult = false;
switch(CServerSetup::GetInstance().GetBillingType())
{
case CServerSetup::GamaBilling:
// 한게임
bResult = ProcessBillingHan(lpPktUUT);
break;
case CServerSetup::YouxiLandBilling:
// 요시랜드
bResult = ProcessBillingYouxiLand(lpPktUUT);
break;
case CServerSetup::ROWGlobalBilling:
// ROW고유인증
bResult = ProcessBillingROWGlobal(lpPktUUT);
break;
case CServerSetup::JapanBilling:
// 일본
bResult = ProcessBillingJapan(lpPktUUT);
break;
case CServerSetup::GammaniaBilling:
// 감마니아
// bResult = ProcessBillingGammania(lpPktUUT);
break;
case CServerSetup::GamaUnitedBilling:
// 한게임 통합빌링
bResult = ProcessBillingHanUnited(lpPktUUT);
break;
default:
ERRLOG1(g_Log, "Unknown Server Type!!! %d", CServerSetup::GetInstance().GetBillingType());
break;
};
return true;
}

View File

@@ -0,0 +1,85 @@
#ifndef _CUID_AGENT_DISPATCH_H_
#define _CUID_AGENT_DISPATCH_H_
#include <Network/Dispatch/RylServerDispatch.h>
#include <Network/Dispatch/MultiDispatchStorage.h>
// ÆÐŶ Àü¹æ ÂüÁ¶
struct PktSL;
struct PktUUT;
struct PktUK;
struct PktBase;
class CUserNode;
class CUIDAgentDispatch : public CRylServerDispatch
{
public:
static CMultiDispatch& GetDispatchTable()
{
static CMultiDispatch multiDispatchTable;
return multiDispatchTable;
}
CUIDAgentDispatch(CSession& Session);
virtual void Connected();
virtual void Disconnected();
IN_ADDR& GetAddress(void) { return m_Address; }
char GetGroup(void) { return m_Group; }
void InitUnitNum(void) { m_nUnitNum = 0; }
int GetUnitNum(void) const { return m_nUnitNum; }
int IncreaseUnitNum(void) { return ++m_nUnitNum; }
int DecreaseUnitNum(void) { return --m_nUnitNum; }
void InitSucceedNum(void) { m_nSucceedNum = 0; }
int GetSucceedNum(void) const { return m_nSucceedNum; }
int IncreaseSucceedNum(void) { return ++m_nSucceedNum; }
int DecreaseSucceedNum(void) { return --m_nSucceedNum; }
void InitFailNum(void) { m_nFailNum = 0; }
int GetFailNum(void) const { return m_nFailNum; }
int IncreaseFailNum(void) { return ++m_nFailNum; }
int DecreaseFailNum(void) { return --m_nFailNum; }
private:
bool ProcessBillingHan(PktUUT* lpPktUUT);
bool ProcessBillingYouxiLand(PktUUT* lpPktUUT);
// bool ProcessBillingGammania(PktUUT* lpPktUUT);
bool ProcessBillingROWGlobal(PktUUT* lpPktUUT);
bool ProcessBillingJapan(PktUUT* lpPktUUT);
bool ProcessBillingHanUnited(PktUUT* lpPktUUT);
bool ProcessDisconnectHan();
bool ProcessDisconnectYouxiLand();
// bool ProcessDisconnectGammania();
bool ProcessDisconnectROWGlobal();
bool ProcessDisconnectJapan();
bool ProcessDisconnectHanUnited();
virtual bool DispatchPacket(PktBase* lpPktBase);
// Packet Dispatch Functions
bool ParseServerLogin(PktSL* lpPktSL);
bool ParseServerLogout(PktBase* lpPktBase);
bool ParseUpdateUIDTable(PktUUT* lpPktUUT);
// Send Functions
bool SendUserKill(char Group, unsigned long UserID);
IN_ADDR m_Address;
char m_Group;
bool m_bDisconnected;
int m_nUnitNum;
int m_nSucceedNum;
int m_nFailNum;
};
#endif

View File

@@ -0,0 +1,105 @@
#include "stdAfx.h"
#include <Log/ServerLog.h>
#include "UserIDTable.h"
CUserNode::CUserNode(unsigned long dwUserID, unsigned long dwSessionID,
unsigned long dwCharID, unsigned char cGroup, unsigned char cState)
: m_dwUserID(dwUserID), m_dwSessionID(dwSessionID),
m_dwCharID(dwCharID), m_cAgentGroup(cGroup), m_cState(cState)
{
}
CUserNode::~CUserNode()
{
}
void CUserNode::InitUserNode(unsigned long dwUserID, unsigned long dwSessionID,
unsigned long dwCharID, unsigned char cGroup, unsigned char cState)
{
m_cAgentGroup = cGroup;
m_cState = cState;
m_dwSessionID = dwSessionID;
m_dwUserID = dwUserID;
m_dwCharID = dwCharID;
}
CUserIDTable& CUserIDTable::GetInstance()
{
static CUserIDTable userIDTable;
return userIDTable;
}
CUserIDTable::CUserIDTable()
{
}
CUserIDTable::~CUserIDTable()
{
m_UIDTable.clear();
}
BOOL CUserIDTable::Insert(unsigned long dwUserID, const CUserNode& Node)
{
if(m_UIDTable.insert(std::make_pair(dwUserID, Node)).second)
{
return TRUE;
}
SERLOG1(g_Log, "유저(0x%08x)를 테이블에 넣는데 실패", dwUserID);
return FALSE;
}
BOOL CUserIDTable::Erase(unsigned long dwUserID)
{
UIDTable::iterator itr = m_UIDTable.find(dwUserID);
if(itr != m_UIDTable.end())
{
m_UIDTable.erase(itr);
return TRUE;
}
return FALSE;
}
CUserNode* CUserIDTable::Find(unsigned long dwUserID)
{
UIDTable::iterator itr = m_UIDTable.find(dwUserID);
return (itr != m_UIDTable.end()) ? (&itr->second) : 0;
}
int CUserIDTable::RemoveUserOfCurrentAgent(char Group)
{
int nNum = 0;
INFLOG1(g_Log, "그룹(%d)의 사용자 삭제 시작", Group);
UIDTable::iterator pos = m_UIDTable.begin();
UIDTable::iterator end = m_UIDTable.end();
for(; pos != end; )
{
CUserNode& node = pos->second;
if(node.GetAgentGroup() == Group)
{
pos = m_UIDTable.erase(pos);
}
else
{
++pos;
}
}
INFLOG2(g_Log, "그룹(%d)의 사용자 삭제 종료 %d", Group, nNum);
return nNum;
}

View File

@@ -0,0 +1,60 @@
#ifndef _UID_USER_ID_TABLE_H_
#define _UID_USER_ID_TABLE_H_
/*
나중에 DB로 다 뺄 부분이다. 이곳은 임시로나마 하자.
*/
class CUserNode
{
private:
unsigned long m_dwSessionID;
unsigned long m_dwUserID;
unsigned long m_dwCharID;
unsigned char m_cAgentGroup;
unsigned char m_cState;
public:
CUserNode(unsigned long dwUserID, unsigned long dwSessionID,
unsigned long dwCharID, unsigned char cGroup, unsigned char cState);
~CUserNode();
void InitUserNode(unsigned long dwUserID, unsigned long dwSessionID,
unsigned long dwCharID, unsigned char cGroup, unsigned char cState);
unsigned char GetAgentGroup(void) const { return m_cAgentGroup; }
unsigned char GetState(void) const { return m_cState; }
unsigned long GetSessionID(void) const { return m_dwSessionID; }
unsigned long GetUID(void) const { return m_dwUserID; }
unsigned long GetCID(void) const { return m_dwCharID; }
};
class CUserIDTable
{
public:
static CUserIDTable& GetInstance();
// interface
BOOL Insert(unsigned long dwUserID, const CUserNode& Node);
BOOL Erase(unsigned long dwUserID);
CUserNode* Find(unsigned long dwUserID);
int RemoveUserOfCurrentAgent(char Group);
private:
CUserIDTable();
~CUserIDTable();
typedef std::map<unsigned long, CUserNode> UIDTable;
UIDTable m_UIDTable;
};
#endif

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// RylLoginServer.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,80 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#pragma warning(disable:4800)
// 각종 점검용 정의들. 사용하지 않을 경우는 (void*)0 로 대신할 것.
#ifdef _DEBUG
#define PERFORMANCE_CHECK(x) x
#else
#define PERFORMANCE_CHECK(x) x
#endif
#ifdef _DEBUG
#define DEBUG_CRT_MEMORY(x) x
#else
#define DEBUG_CRT_MEMORY(x) (void*)0
#endif
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
// 소켓 관련 헤더들
#include <winsock2.h>
#include <mswsock.h>
#include <iphlpapi.h> // for IP Help functions, that gets local IP address
#include <ws2tcpip.h> // tcp/ip specific options
#include <wsipx.h> // for IPX/SPX
#include <wsnwlink.h>
// DB관련 헤더들
#include <msdasc.h> // OLE DB Service Component header
#include <msdaguid.h> // OLE DB Root Enumerator
#include <msdasql.h> // MSDASQL - Default provider
#include <sqloledb.h> // MS SQL
// 기본 헤더들
#include <windows.h>
#include <process.h>
#include <shellapi.h>
#include <tchar.h>
// C 함수 헤더들
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
// STL 헤더들
#include <new>
#include <set>
#include <map>
#include <hash_map>
#include <vector>
#include <list>
#include <string>
#include <limits>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <functional>