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,855 @@
#include "stdafx.h"
#include <Network/Session/Session.h>
#include <Network/Winsock/SocketFactory.h>
#include <Network/Dispatch/ServerRequest.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Packet/PacketStruct/UnifiedCharPacket.h>
#include <Network/Packet/PacketStruct/AuthServerToDBAgentServer.h>
#include <Network/Packet/PacketStruct/PartyPacket.h>
#include <Network/Packet/PacketStruct/GuildPacket.h>
#include <Stream/Buffer/BufferFactory.h>
#include <Utility/Setup/ServerSetup.h>
#include <Creature/Character/CharacterCreate.h>
#include <Item/ItemStructure.h>
#include <Item/ItemConstants.h>
#include <Item/ItemFactory.h>
#include <Item/Item.h>
#include <Log/ServerLog.h>
#include <Log/CharacterLog.h>
#include <Log/LogCommands.h>
#include "AuthAgentDispatch.h"
#include "AuthClientDispatch.h"
#include "AuthAgentServerTable.h"
#include "ItemCreator.h"
#include "SendUserLoginout.h"
// forward decl.
bool SendPartyLeaveToDBAgent(CSendStream& SendStream, unsigned long dwPID, unsigned long dwCID, const char* szName);
bool SendGuildLeaveToDBAgent(CSendStream& SendStream, unsigned long dwGID, unsigned long dwCID, const char* szName);
CAuthAgentDispatch::CAuthAgentDispatch(CSession& Session)
: CRylServerDispatch(Session, 1000)
{
}
CAuthAgentDispatch::~CAuthAgentDispatch()
{
DETLOG1(g_Log, "DP:0x%p/Destroy AuthAgentDispatch", this);
}
CSingleDispatch& CAuthAgentDispatch::GetDispatchTable()
{
static CSingleDispatch singleDispatchTable;
return singleDispatchTable;
}
void CAuthAgentDispatch::Connected()
{
// 연결 성공시에 호출한다(Connected 오버라이딩)
SendSysServerLogin(CServerSetup::GetInstance().GetServerID());
GetDispatchTable().SetDispatch(this);
DETLOG2(g_Log, "SS:0x%p/DP:0x%p/Connected CAuthAgentDispatch", &GetSession(), this);
}
void CAuthAgentDispatch::Disconnected()
{
GetDispatchTable().RemoveDispatch(this);
DETLOG2(g_Log, "SS:0x%p/DP:0x%p/Disconnected CAuthAgentDispatch", &GetSession(), this);
}
bool CAuthAgentDispatch::DispatchPacket(PktBase* lpPktBase)
{
// DBAgent에서 보낸 패킷을 처리하는 루틴이다.
switch (lpPktBase->GetCmd())
{
case CmdSysServerLogin: return ParseSysServerLogin(static_cast<PktSLAck*>(lpPktBase));
case CmdSysServerVerUpdate: return ParseSysServerVerUpdate(static_cast<PktSVU*>(lpPktBase));
case CmdSysChannelUpdate: return ParseSysChannelUpdate(static_cast<PktSCInfo*>(lpPktBase));
case CmdDBGetData: return ParseDBGetData(static_cast<PktDD*>(lpPktBase));
case CmdAgentZone: return ParseAgentZone(static_cast<PktDD*>(lpPktBase));
case CmdUserKill: return ParseUserKill(static_cast<PktUK*>(lpPktBase));
case CmdBillingTimeoutNotify: return ParseBillingTimeoutNotify(static_cast<PktBTN*>(lpPktBase));
case CmdBillingTimeCheckNotify: return ParseBillingTimeCheckNotify(static_cast<PktBTN*>(lpPktBase));
case CmdUnifiedCharInfo: return ParseUnifiedCharInfo(static_cast<PktUnifiedCharInfo*>(lpPktBase));
case CmdUnifiedCharSelect: return ParseUnifiedCharSelectAck(static_cast<PktUnifiedCharSelectAck*>(lpPktBase));
// 보통은 오지않지만 행여나 에러값이 올지도 모른다.
case CmdGuildCmd: return true;
default:
LogErrorPacket("Invalid packet command(AuthAgentDispatch can't process this packet)",
lpPktBase->GetCmd());
break;
}
// 잘못된 패킷이 오더라도 접속은 끊지 않는다.
return true;
}
bool CAuthAgentDispatch::ParseSysServerLogin(PktSLAck* lpPktSLAck)
{
// 아이템 시리얼 초기화
CItemCreator::GetInstance().SetUID(lpPktSLAck->m_dlItemUID);
// 서버 정보 등록.
RylServerInfo ServerInfo;
ServerInfo.m_dwClientVer = lpPktSLAck->m_dwClientVer;
ServerInfo.m_dwChecksum = lpPktSLAck->m_dwCheckSum;
strncpy(ServerInfo.m_szPatchAddress, lpPktSLAck->m_PatchAddress,
RylServerInfo::PATCH_ADDRESS_LENGTH - 1);
ServerInfo.m_szPatchAddress[RylServerInfo::PATCH_ADDRESS_LENGTH - 1] = '\0';
ServerInfo.m_nPatchAddressLen = strlen(ServerInfo.m_szPatchAddress);
// 서버군 등록.
CAuthAgentServerTable::GetInstance().SetAgentServerInfo(ServerInfo);
return true;
}
bool CAuthAgentDispatch::ParseSysChannelUpdate(PktSCInfo* lpPktSCInfo)
{
CAuthAgentServerTable::GetInstance().UpdateChannelUserNum(
lpPktSCInfo->m_usChannelClientNum, lpPktSCInfo->m_cChannelNum);
return true;
}
bool CAuthAgentDispatch::ParseSysServerVerUpdate(PktSVU* lpPktSVU)
{
CAuthAgentServerTable::GetInstance().UpdateServerData(lpPktSVU->m_dwCheckSum,
lpPktSVU->m_dwClientVer, lpPktSVU->m_PatchAddress);
return true;
}
bool CAuthAgentDispatch::ParseDBGetData(PktDD* lpPktDD)
{
// WORK_LIST 2.3 계정 국적 변경 기능 구현
bool bRemoveRequestKey = true;
if ( PktDD::SCmdNationChangeResult == lpPktDD->m_wCmd )
{
bRemoveRequestKey = false;
}
CServerRequest::Result result(lpPktDD->m_dwRequestKey, bRemoveRequestKey);
CAuthClientDispatch* lpAuthClientDispatch =
static_cast<CAuthClientDispatch*>(result.GetDispatch());
if (0 == lpAuthClientDispatch)
{
ERRLOG2(g_Log, "sCmd:0x%02x/RequestKey:%d/DBRequest Failed.",
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
return true;
}
CSession* lpSession = result.GetSession();
if (0 == lpSession)
{
ERRLOG2(g_Log, "sCmd:0x%02x/RequestKey:%d/Get Session Failed.",
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
return true;
}
DETLOG5(g_Log, "SS:0x%p/DP:0x%p/IP:%15s/sCmd:0x%02x/RequestKey:%d/DBRequest Success.",
&lpAuthClientDispatch->GetSession(), lpAuthClientDispatch,
lpAuthClientDispatch->GetRemoteAddr().get_addr_string(),
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
switch(lpPktDD->m_wCmd)
{
case PktDD::SCmdStartSession: // 인증과정 (세션 오픈후 시작)
{
PktSSD* lpPktSSD = static_cast<PktSSD*>(lpPktDD);
unsigned long UserID = lpPktSSD->m_dwUserID;
unsigned long SessionID = lpPktSSD->m_dwSessionID;
unsigned short wError = lpPktSSD->GetError();
unsigned char cAgentServerType = lpPktSSD->m_cAgentServerType; // 중계서버 타입 (Part1:0 / Part1Unified:1 / Part2:2 / Part2Unified:3 / Part2Selectable:4
unsigned char cFirstLogin = lpPktSSD->m_cFirstLogin; // 최초 로그인 여부 (최초 로그인:0 / 여러번 로그인:1)
// 유저 로그인(세션 열림)
if (wError == 0)
{
lpAuthClientDispatch->UserLogin(SessionID, UserID);
if (lpAuthClientDispatch->GetSession().CalledDisconnected())
{
// 이미 연결이 끊어져서, Disconnected를 호출했으면
// 유저를 로그아웃시킴.
lpAuthClientDispatch->UserLogout();
}
else
{
// 통합서버 정보 저장
lpAuthClientDispatch->SetUnifiedInfo(cAgentServerType, cFirstLogin);
// 앞으로 오는 인증 패킷은 무시.
lpAuthClientDispatch->SetPacketProcessFlag(CAuthClientDispatch::AUTHORIZED_SUCCESS);
}
}
if (!AuthSendPacket::SendAuthAccount(lpAuthClientDispatch, UserID, wError))
{
// 다시 인증 패킷을 받을 수 있음.
lpAuthClientDispatch->ResetPacketProcessFlag(CAuthClientDispatch::AUTHORIZED_SUCCESS);
}
break;
}
case PktDD::SCmdUserLogin:
{
PktULDAck* lpULDAck = static_cast<PktULDAck*>(lpPktDD);
unsigned long UserID = lpULDAck->m_dwUserID;
CHAR_VIEW* lpCharView = lpULDAck->m_CharView;
sGuildData* lpGuildData = lpULDAck->m_GuildData;
int nPlayTime = lpULDAck->m_nPlayTime; // BillingType이 정액인 경우는 남은 날짜. 정량인 경우는 남은 시간(분)
unsigned short AdminLevel = lpULDAck->m_usAdminLevel;
unsigned char cBillingType = lpULDAck->m_cBillingType; // D : 정액 T : 정량 0혹은N : 무료
unsigned char cBillingUser = lpULDAck->m_cBillingUser; // 0 : 개인 1 : 피시방
unsigned char cLoginType = lpULDAck->m_cLoginType;
unsigned long dwFlag = lpULDAck->m_sStoreInfo.Flag;
// WORK_LIST 2.1 계정 국적 추가
unsigned char cAccountNation = lpULDAck->m_cAccountNation; // 계정 국적
lpAuthClientDispatch->SetCharacterView(lpCharView);
// Store Info 정보 //
STORE_INFO* pStoreInfo = lpAuthClientDispatch->GetStoreInfo();
memset(pStoreInfo, 0, sizeof(STORE_INFO));
memcpy(pStoreInfo, &lpULDAck->m_sStoreInfo, sizeof(STORE_INFO));
// WORK_LIST 2.1 계정 국적 추가
AuthSendPacket::SendUserLogin(lpAuthClientDispatch->GetSendStream(), lpAuthClientDispatch->GetSessionID(),
UserID, lpCharView, lpGuildData, dwFlag, cAccountNation, nPlayTime, AdminLevel, cBillingType,
cBillingUser, cLoginType, lpULDAck->GetError());
break;
}
// WORK_LIST 2.1 계정 국적 추가
case PktDD::SCmdSelectNation:
{
PktSAND* lpPktSAND = static_cast<PktSAND*>(lpPktDD);
CAuthClientDispatch::SendSelectAccountNation(lpAuthClientDispatch->GetSendStream(), lpPktSAND->m_dwUserID,
lpPktSAND->m_cType, lpPktSAND->m_cAccountNation, lpPktSAND->GetError());
break;
}
// WORK_LIST 2.3 계정 국적 변경 기능 구현
case PktDD::SCmdNationChangeResult:
{
PktANCAck* lpPktANCAck = static_cast<PktANCAck*>(lpPktDD);
CAuthClientDispatch::SendNationChangeResult(lpAuthClientDispatch->GetSendStream(), lpPktANCAck->m_dwUserID,
lpPktANCAck->m_dwGID, lpPktANCAck->m_dwFame, 0);
break;
}
case PktDD::SCmdCharCreate:
{
PktCCDAck* lpPktCCDAck = static_cast<PktCCDAck*>(lpPktDD);
CAuthClientDispatch::SendCharCreate(lpAuthClientDispatch->GetSendStream(), lpPktCCDAck->m_dwCharID,
lpPktCCDAck->m_dwSlot, &lpPktCCDAck->m_CharView, lpPktCCDAck->GetError());
if (0 == lpPktCCDAck->GetError())
{
SendCreateCharEquipItem(lpPktCCDAck->m_dwCharID,
lpPktCCDAck->m_CharView.Equip[Item::EquipmentPos::SHIRT],
lpPktCCDAck->m_CharView.Equip[Item::EquipmentPos::ARMOUR],
lpPktCCDAck->m_CharView.Equip[Item::EquipmentPos::BOOTS],
lpPktCCDAck->m_CharView.Equip[Item::EquipmentPos::WEAPON_HAND1]);
}
lpAuthClientDispatch->ResetPacketProcessFlag(CAuthClientDispatch::PENDED_CHAR_CREATE);
GAMELOG::LogCharCreateDelete(lpAuthClientDispatch->GetUID(),
&lpSession->GetRemoteAddr().get_addr_in(),
lpPktCCDAck->m_dwCharID, GAMELOG::CMD::CHAR_CREATE, lpPktCCDAck->GetError());
break;
}
case PktDD::SCmdCharDelete:
{
PktCDD* lpPktCDD = static_cast<PktCDD*>(lpPktDD);
GET_SINGLE_DISPATCH(lpAuthAgentDispatch, CAuthAgentDispatch,
CAuthAgentDispatch::GetDispatchTable());
// 에러가 없을때 파티, 길드에서 삭제
if(!lpPktCDD->GetError())
{
CHAR_VIEW& CurrentCharView = lpAuthClientDispatch->GetCharacterView(lpPktCDD->m_dwSlotNum);
if(lpAuthAgentDispatch)
{
if(CurrentCharView.PID)
{
// 파티 멤버일 경우 파티에서 탈퇴
SendPartyLeaveToDBAgent(lpAuthAgentDispatch->GetSendStream(),
CurrentCharView.PID, lpPktCDD->m_dwCharID, CurrentCharView.Name);
}
if(CurrentCharView.GID)
{
// 길드 멤버일 경우 길드에서 탈퇴
SendGuildLeaveToDBAgent(lpAuthAgentDispatch->GetSendStream(),
CurrentCharView.GID, lpPktCDD->m_dwCharID, CurrentCharView.Name);
}
}
}
CAuthClientDispatch::SendCharDelete(lpAuthClientDispatch->GetSendStream(), lpPktCDD->m_dwUserID,
lpPktCDD->m_dwSlotNum, lpPktCDD->GetError());
lpAuthClientDispatch->ResetPacketProcessFlag(CAuthClientDispatch::PENDED_CHAR_DELETE);
GAMELOG::LogCharCreateDelete(lpAuthClientDispatch->GetUID(),
&lpSession->GetRemoteAddr().get_addr_in(), lpPktCDD->m_dwCharID, GAMELOG::CMD::CHAR_DELETE, lpPktCDD->GetError());
break;
}
case PktDD::SCmdCharSelect:
{
PktCSDAck* lpPktCSDAck = static_cast<PktCSDAck*>(lpPktDD);
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::PENDED_CHAR_SELECT);
unsigned long dwChannelCount = std::accumulate(lpPktCSDAck->m_wChannelNum,
lpPktCSDAck->m_wChannelNum + PktCSDAck::MAX_CHANNEL_NUM, 0);
if (0 == lpPktCSDAck->GetError() && 0 < dwChannelCount)
{
lpAuthClientDispatch->SetPacketProcessFlag(
CAuthClientDispatch::CHAR_SELECT_SUCCESS);
}
if (!CAuthClientDispatch::SendCharSelect(lpAuthClientDispatch->GetSendStream(), lpPktCSDAck->m_cZone,
lpPktCSDAck->m_wChannelNum, lpPktCSDAck->GetError()))
{
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::CHAR_SELECT_SUCCESS);
}
break;
}
default:
{
ERRLOG2(g_Log, "DB로부터 이상한 패킷이 들어왔습니다. 커맨드는 %x, 유저 세션 포인터는 0x%p 입니다.",
lpPktDD->GetCmd(), lpSession);
break;
}
}
return true;
}
bool SendPartyLeaveToDBAgent(CSendStream& SendStream, unsigned long dwPID,
unsigned long dwCID, const char* szName)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktPMD));
if (0 != lpBuffer)
{
PktPMD* lpPktPMD = reinterpret_cast<PktPMD *>(lpBuffer);
lpPktPMD->InitPtSubCmd(0, PktCCD::SCmdDeletePartyMem);
lpPktPMD->m_dwPartyID = dwPID;
lpPktPMD->m_dwSenderID = dwCID;
lpPktPMD->m_dwGID = dwCID;
if(0 != szName)
{
strncpy(lpPktPMD->m_strSenderName, szName, CHAR_INFOST::MAX_NAME_LEN);
}
else
{
memset(lpPktPMD->m_strSenderName, 0, CHAR_INFOST::MAX_NAME_LEN);
}
return SendStream.WrapHeader(sizeof(PktPMD), CmdAgentParty, 0, 0);
}
return false;
}
bool CAuthAgentDispatch::ParseAgentZone(PktDD* lpPktDD)
{
CServerRequest::Result result(lpPktDD->m_dwRequestKey);
CAuthClientDispatch* lpAuthClientDispatch =
static_cast<CAuthClientDispatch*>(result.GetDispatch());
if (0 == lpAuthClientDispatch)
{
ERRLOG2(g_Log, "sCmd:0x%02x/RequestKey:%d/DBRequest Failed.",
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
return true;
}
CSession* lpSession = result.GetSession();
if (0 == lpSession)
{
ERRLOG2(g_Log, "sCmd:0x%02x/RequestKey:%d/Get Session Failed.",
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
return true;
}
DETLOG4(g_Log, "SS:0x%p/DP:0x%p/sCmd:0x%02x/RequestKey:%d/DBRequest Success.",
&lpAuthClientDispatch->GetSession(), lpAuthClientDispatch,
lpPktDD->m_wCmd, lpPktDD->m_dwRequestKey);
switch(lpPktDD->m_wCmd)
{
case PktDD::SCmdServerZone:
{
PktSAAck* lpPktSAAck = static_cast<PktSAAck*>(lpPktDD);
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::PENDED_SERVER_ZONE);
if (0 == lpPktSAAck->GetError())
{
// 유저 로그 아웃 처리
// (... 클라이언트가 와서 붙는 것보다 이게 늦게 가면 대략 낭패.)
lpAuthClientDispatch->UserMove();
lpAuthClientDispatch->SetPacketProcessFlag(
CAuthClientDispatch::SERVER_ZONE_SUCCESS);
}
else
{
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::CHAR_SELECT_SUCCESS);
}
lpAuthClientDispatch->SetMoveAddress(lpPktSAAck->m_dwServerID,
INET_Addr(lpPktSAAck->m_GameAddress, CServerSetup::GetGameServerTCPPort(lpPktSAAck->m_dwServerID)));
if (0 != lpPktSAAck->GetError())
{
if (!AuthSendPacket::SendServerZone(lpAuthClientDispatch->GetSendStream(), lpPktSAAck->m_dwServerID,
lpAuthClientDispatch->GetMoveAddress().get_addr_in(), lpPktSAAck->GetError()))
{
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::SERVER_ZONE_SUCCESS);
}
}
else
{
char* lpBuffer = GetSendStream().GetBuffer(sizeof(PktDD));
if (0 != lpBuffer)
{
unsigned long dwRequestKey = CServerRequest::GetInstance().AddRequest(
lpAuthClientDispatch, this, 100);
if (0 != dwRequestKey)
{
PktDD* lpPktDD = reinterpret_cast<PktDD*>(lpBuffer);
lpPktDD->InitPtSubCmd(dwRequestKey, PktDD::SCmdServerZoneEnd);
if (GetSendStream().WrapHeader(sizeof(PktDD), CmdAgentZone, 0, 0))
{
DETLOG5(g_Log, "SS:0x%p/DP:0x%p/IP:%15s/sCmd:0x%02x/RequestKey:%d/DBRequest Send success.",
&lpAuthClientDispatch->GetSession(), lpAuthClientDispatch,
lpAuthClientDispatch->GetRemoteAddr().get_addr_string(),
PktSA::SCmdServerZoneEnd, dwRequestKey);
break;
}
else
{
CServerRequest::GetInstance().RemoveRequest(dwRequestKey);
}
}
}
}
break;
}
case PktDD::SCmdServerZoneEnd:
if (!AuthSendPacket::SendServerZone(lpAuthClientDispatch->GetSendStream(),
lpAuthClientDispatch->GetMoveServerID(), lpAuthClientDispatch->GetMoveAddress().get_addr_in(), 0))
{
lpAuthClientDispatch->ResetPacketProcessFlag(
CAuthClientDispatch::SERVER_ZONE_SUCCESS);
}
break;
default:
ERRLOG2(g_Log, "DB로부터 이상한 패킷이 들어왔습니다. 커맨드는 %x, 유저 세션 포인터는 0x%p 입니다.",
lpPktDD->GetCmd(), lpSession);
return true;
}
return true;
}
bool CAuthAgentDispatch::ParseUserKill(PktUK* lpPktUK)
{
// 유저 얻기
GET_MULTI_DISPATCH(lpAuthClientDispatch, lpPktUK->m_dwUserID,
CAuthClientDispatch, CAuthClientDispatch::GetDispatchTable());
if (0 == lpAuthClientDispatch)
{
ERRLOG1(g_Log, "UID:%u/GetUser failed.", lpPktUK->m_dwUserID);
SendUserKill(lpPktUK->m_dwUserID, 2);
}
else
{
// 소켓 클로즈
ERRLOG3(g_Log, "SS:0x%p/DP:0x%p/UID:%u/Process UserKill.",
&lpAuthClientDispatch->GetSession(),
lpAuthClientDispatch, lpPktUK->m_dwUserID);
lpAuthClientDispatch->Shutdown();
}
return true;
}
bool CAuthAgentDispatch::SendUserKill(unsigned long dwUserID, unsigned short usError)
{
char* lpBuffer = GetSendStream().GetBuffer(sizeof(PktUK));
if (0 != lpBuffer)
{
PktUK* lpPktUK = reinterpret_cast<PktUK*>(lpBuffer);
lpPktUK->m_dwServerID = CServerSetup::GetInstance().GetServerID();
lpPktUK->m_dwUserID = dwUserID;
lpPktUK->m_dwCharID = 0;
return GetSendStream().WrapCrypt(sizeof(PktUK), CmdUserKill, 0, usError);
}
return false;
}
bool CAuthAgentDispatch::SendSysServerLogin(unsigned long ServerID_In)
{
char* lpBuffer = GetSendStream().GetBuffer(sizeof(PktSL));
if (0 != lpBuffer)
{
PktSL* lpPktSL = reinterpret_cast<PktSL*>(lpBuffer);
const int MAX_ADDRESS_SIZE = 128;
char szAddress[MAX_ADDRESS_SIZE];
GetSession().GetPolicy().GetSocketFactory().GetNetworkInfo(szAddress, MAX_ADDRESS_SIZE);
lpPktSL->m_Address.S_un.S_addr = inet_addr(szAddress);
lpPktSL->m_dwServerID = ServerID_In;
return GetSendStream().WrapHeader(sizeof(PktSL), CmdSysServerLogin, 0, 0);
}
return false;
}
bool CAuthAgentDispatch::SendStartSession(CAuthClientDispatch* lpDispatch_In, unsigned long dwSessionID_In,
const char* AccountName_In, const char* Password_In,
unsigned long dwUserID_In, unsigned short usCnFlag_In)
{
GET_SINGLE_DISPATCH(lpAuthAgentDispatch, CAuthAgentDispatch,
CAuthAgentDispatch::GetDispatchTable());
if (0 != lpAuthAgentDispatch && 0 != lpDispatch_In)
{
CSendStream& SendStream = lpAuthAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSSD));
if (0 != lpBuffer)
{
unsigned long dwRequestKey = CServerRequest::GetInstance().AddRequest(
lpDispatch_In, lpAuthAgentDispatch, 100);
if (0 != dwRequestKey)
{
// edith 2008.01.15 Auth에서 Agent에 세션시작 패킷을 보낸다.??
// PktSSD 에 패스워드를 추가해서 Agent에 보내도록 해야한다. 함수를 수정해야함.
PktSSD* lpPktSSDPt = reinterpret_cast<PktSSD*>(lpBuffer);
lpPktSSDPt->InitPtSubCmd(dwRequestKey, PktSSD::SCmdStartSession);
lpPktSSDPt->m_dwSessionID = dwSessionID_In;
lpPktSSDPt->m_dwUserID = dwUserID_In;
if (0 != AccountName_In && strlen(AccountName_In) > 0)
{
memcpy(lpPktSSDPt->m_AccountName, AccountName_In, sizeof(char) * PktSSD::MaxName);
}
else
ZeroMemory(lpPktSSDPt->m_AccountName, sizeof(char) * PktSSD::MaxName);
if (0 != Password_In && strlen(Password_In) > 0)
{
memcpy(lpPktSSDPt->m_Password, Password_In, sizeof(char) * PktSSD::MaxPass);
}
else
ZeroMemory(lpPktSSDPt->m_Password, sizeof(char) * PktSSD::MaxPass);
lpPktSSDPt->m_Address = lpDispatch_In->GetSession().GetRemoteAddr().get_addr_in().sin_addr;
if (SendStream.WrapCrypt(sizeof(PktSSD), CmdDBGetData, 0, usCnFlag_In))
{
INFLOG4(g_Log, "UID:%10u / DP:0x%p / SessionID:%10u / Account:%s / 로그인 성공. DB중계로 세션 시작 보냄",
dwUserID_In, lpDispatch_In, dwSessionID_In, AccountName_In);
DETLOG5(g_Log, "SS:0x%p/DP:0x%p/IP:%15s/sCmd:0x%02x/RequestKey:%d/DBRequest Send success.",
&lpDispatch_In->GetSession(), lpDispatch_In,
lpDispatch_In->GetRemoteAddr().get_addr_string(),
PktSSD::SCmdStartSession, dwRequestKey);
return true;
}
}
}
}
if (lpDispatch_In)
{
AuthSendPacket::SendAuthAccount(lpDispatch_In, lpDispatch_In->GetUID(), 1);
}
return false;
}
bool CAuthAgentDispatch::SendCreateCharEquipItem(unsigned long CharID_In, unsigned short Shirt_In,
unsigned short Armour_In, unsigned short Boots_In, unsigned short Weapon_In)
{
const size_t nMaxPacketLen = sizeof(PktCCID) + Item::MAX_ITEM_SIZE * 4;
char* lpBuffer = GetSendStream().GetBuffer(nMaxPacketLen);
if (NULL != lpBuffer)
{
char* lpItemPos = lpBuffer + sizeof(PktCCID);
PktCCID* lpPktCCID = reinterpret_cast<PktCCID*>(lpBuffer);
size_t nSize = 0;
size_t nTotalSize = 0;
// 아이템 생성
CItemCreator& ItemCreator = CItemCreator::GetInstance();
Item::CItem* lpShirt = (0 != Shirt_In) ? ItemCreator.Create(Shirt_In) : 0;
Item::CItem* lpAmour = (0 != Armour_In) ? ItemCreator.Create(Armour_In) : 0;
Item::CItem* lpBoots = (0 != Boots_In) ? ItemCreator.Create(Boots_In) : 0;
Item::CItem* lpWeapon = (0 != Weapon_In) ? ItemCreator.Create(Weapon_In) : 0;
Item::CEquipment* lpEquip = NULL;
lpEquip = Item::CEquipment::DowncastToEquipment(lpShirt);
if (NULL != lpEquip) { lpEquip->SetNewEquip(); }
lpEquip = Item::CEquipment::DowncastToEquipment(lpAmour);
if (NULL != lpEquip) { lpEquip->SetNewEquip(); }
lpEquip = Item::CEquipment::DowncastToEquipment(lpBoots);
if (NULL != lpEquip) { lpEquip->SetNewEquip(); }
lpEquip = Item::CEquipment::DowncastToEquipment(lpWeapon);
if (NULL != lpEquip) { lpEquip->SetNewEquip(); }
// 셔츠 생성
if (NULL != lpShirt)
{
nSize = nMaxPacketLen - nTotalSize;
lpShirt->MoveItem(Item::ItemPos(1, Item::EquipmentPos::SHIRT));
lpShirt->SerializeOut(lpItemPos, nSize);
lpItemPos += nSize;
nTotalSize += nSize;
DELETE_ITEM(lpShirt);
}
// 아머 생성
if (NULL != lpAmour)
{
nSize = nMaxPacketLen - nTotalSize;
lpAmour->MoveItem(Item::ItemPos(1, Item::EquipmentPos::ARMOUR));
lpAmour->SerializeOut(lpItemPos, nSize);
lpItemPos += nSize;
nTotalSize += nSize;
DELETE_ITEM(lpAmour);
}
// 부츠 생성
if (NULL != lpBoots)
{
nSize = nMaxPacketLen - nTotalSize;
lpBoots->MoveItem(Item::ItemPos(1, Item::EquipmentPos::BOOTS));
lpBoots->SerializeOut(lpItemPos, nSize);
lpItemPos += nSize;
nTotalSize += nSize;
DELETE_ITEM(lpBoots);
}
// 기본 무기 생성
if (NULL != lpWeapon)
{
nSize = nMaxPacketLen - nTotalSize;
lpWeapon->MoveItem(Item::ItemPos(1, Item::EquipmentPos::WEAPON_HAND1));
lpWeapon->SerializeOut(lpItemPos, nSize);
lpItemPos += nSize;
nTotalSize += nSize;
DELETE_ITEM(lpWeapon);
}
lpPktCCID->InitPtSubCmd(0, PktCCID::SCmdCharCreateItem);
lpPktCCID->m_dwItemSerial = ItemCreator.GetUID();
lpPktCCID->m_dwCharID = CharID_In;
lpPktCCID->m_dwSize = (unsigned long)nTotalSize;
return GetSendStream().WrapHeader(
static_cast<unsigned short>(sizeof(PktCCID) + nTotalSize), CmdDBGetData, 0, 0);
}
return false;
}
bool CAuthAgentDispatch::ParseBillingTimeoutNotify(PktBTN* lpPktBTN)
{
GET_MULTI_DISPATCH(lpAuthClientDispatch, lpPktBTN->m_dwUserID,
CAuthClientDispatch, CAuthClientDispatch::GetDispatchTable());
if (0 == lpAuthClientDispatch)
{
ERRLOG1(g_Log, "UID:0x%08d 유저 얻기 실패.", lpPktBTN->m_dwUserID);
}
else
{
CSendStream& SendStream = lpAuthClientDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
if (0 != lpBuffer)
{
memcpy(lpBuffer, lpPktBTN, sizeof(PktBTN));
return SendStream.WrapCrypt(sizeof(PktBTN), CmdBillingTimeoutNotify, 0, 0);
}
}
return false;
}
bool CAuthAgentDispatch::ParseBillingTimeCheckNotify(PktBTN* lpPktBTN)
{
GET_MULTI_DISPATCH(lpAuthClientDispatch, lpPktBTN->m_dwUserID,
CAuthClientDispatch, CAuthClientDispatch::GetDispatchTable());
if (0 == lpAuthClientDispatch)
{
ERRLOG1(g_Log, "UID:0x%08d 유저 얻기 실패.", lpPktBTN->m_dwUserID);
}
else
{
CSendStream& SendStream = lpAuthClientDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktBTN));
if (0 != lpBuffer)
{
memcpy(lpBuffer, lpPktBTN, sizeof(PktBTN));
return SendStream.WrapCrypt(sizeof(PktBTN), CmdBillingTimeCheckNotify, 0, 0);
}
}
return false;
}
bool CAuthAgentDispatch::ParseUnifiedCharInfo(PktUnifiedCharInfo* lpPktUnifiedCharInfo)
{
// DB중계서버에서 받은 데이터를 클라이언트로 넘겨준다.
GET_MULTI_DISPATCH(lpAuthClientDispatch, lpPktUnifiedCharInfo->dwUID,
CAuthClientDispatch, CAuthClientDispatch::GetDispatchTable());
if(0 != lpAuthClientDispatch)
{
// 통합서버 정보를 클라이언트로 넘겨준다.
lpAuthClientDispatch->GetSendStream().WrapCompress(
reinterpret_cast<char*>(lpPktUnifiedCharInfo), lpPktUnifiedCharInfo->GetLen(),
CmdUnifiedCharInfo, 0, lpPktUnifiedCharInfo->GetError());
}
return true;
}
bool CAuthAgentDispatch::ParseUnifiedCharSelectAck(PktUnifiedCharSelectAck* lpPktUnifiedCharSelectAck)
{
unsigned long dwRequestKey = lpPktUnifiedCharSelectAck->dwRequestKey;
CServerRequest::Result result(dwRequestKey);
CAuthClientDispatch* lpAuthClientDispatch =
static_cast<CAuthClientDispatch*>(result.GetDispatch());
if(0 == lpAuthClientDispatch)
{
ERRLOG1(g_Log, "RequestKey:%d/DBRequest Failed.", dwRequestKey);
return true;
}
CSession* lpSession = result.GetSession();
if(0 == lpSession)
{
ERRLOG1(g_Log, "RequestKey:%d/Get Session Failed.", dwRequestKey);
return true;
}
DETLOG3(g_Log, "SS:0x%p/DP:0x%p/RequestKey:%d/DBRequest Success.",
&lpAuthClientDispatch->GetSession(), lpAuthClientDispatch, dwRequestKey);
AuthSendPacket::SendUnifiedCharSelectAck(lpAuthClientDispatch->GetSendStream(),
lpPktUnifiedCharSelectAck->dwUID, 0, lpPktUnifiedCharSelectAck->GetError());
return true;
}

View File

@@ -0,0 +1,62 @@
#ifndef _AUTH_AGENT_DISPATCH_H_
#define _AUTH_AGENT_DISPATCH_H_
#include <Network/Dispatch/MultiThreadDispatch.h>
#include <Network/Dispatch/SingleDispatchStorage.h>
#include "AuthClientDispatch.h"
// Àü¹æ ÂüÁ¶
struct PktSLAck;
struct PktSCInfo;
struct PktSVU;
struct PktDD;
struct PktUK;
struct PktBTN;
struct PktUnifiedCharInfo;
struct PktUnifiedCharSelectAck;
class CAuthAgentDispatch : public CRylServerDispatch
{
public:
static CSingleDispatch& GetDispatchTable();
CAuthAgentDispatch(CSession& Session);
virtual ~CAuthAgentDispatch();
virtual void Connected();
virtual void Disconnected();
static bool SendStartSession(CAuthClientDispatch* lpDispatch_In,
unsigned long dwSessionID_In, const char* AccountName_In, const char* Password_In,
unsigned long dwUserID_In, unsigned short usCnFlag_In);
private:
// Send Functions
bool SendUserKill(unsigned long dwUserID, unsigned short usError);
bool SendSysServerLogin(unsigned long dwServer_In);
bool SendCreateCharEquipItem(unsigned long CharID_In, unsigned short Shirt_In,
unsigned short Armour_In, unsigned short Boots_In, unsigned short Weapon_In);
virtual bool DispatchPacket(PktBase* lpPktBase);
// Packet Dispatch Functions;
bool ParseSysServerLogin(PktSLAck* lpPktSLAck);
bool ParseSysServerVerUpdate(PktSVU* lpPktSVU);
bool ParseSysChannelUpdate(PktSCInfo* lpPktSCInfo);
bool ParseDBGetData(PktDD* lpPktDD);
bool ParseAgentZone(PktDD* lpPktDD);
bool ParseUserKill(PktUK* lpPktUK);
bool ParseBillingTimeoutNotify(PktBTN* lpPktBTN);
bool ParseBillingTimeCheckNotify(PktBTN* lpPktBTN);
bool ParseUnifiedCharInfo(PktUnifiedCharInfo* lpPktUnifiedCharInfo);
bool ParseUnifiedCharSelectAck(PktUnifiedCharSelectAck* lpPktUnifiedCharSelectAck);
};
#endif

View File

@@ -0,0 +1,126 @@
#include "stdafx.h"
#include "AuthAgentDispatch.h"
#include "AuthAgentServerTable.h"
#include <Network/Session/Session.h>
#include <Log/ServerLog.h>
CAuthAgentServerTable& CAuthAgentServerTable::GetInstance()
{
static CAuthAgentServerTable authAgentServerTable;
return authAgentServerTable;
}
CAuthAgentServerTable::CAuthAgentServerTable()
{
memset(&m_AgentServerInfo, 0, sizeof(RylServerInfo));
}
CAuthAgentServerTable::~CAuthAgentServerTable()
{
}
void CAuthAgentServerTable::GetPatchServerAddress(unsigned long& dwClientVer,
char* szPatchAddress_Out, size_t nBufferLen)
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
dwClientVer = m_AgentServerInfo.m_dwClientVer;
int nLength = _snprintf(szPatchAddress_Out, nBufferLen - 1, "%s", m_AgentServerInfo.m_szPatchAddress);
if(0 < nLength)
{
szPatchAddress_Out[nLength] = '\0';
}
}
void CAuthAgentServerTable::UpdateServerData(unsigned long dwChecksum, unsigned long dwClientVer,
const char* szPatchAddress)
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
m_AgentServerInfo.m_dwChecksum = dwChecksum;
m_AgentServerInfo.m_dwClientVer = dwClientVer;
int nLength = _snprintf(m_AgentServerInfo.m_szPatchAddress, RylServerInfo::PATCH_ADDRESS_LENGTH - 1,
"%s", szPatchAddress);
if(0 < nLength)
{
m_AgentServerInfo.m_szPatchAddress[nLength] = '\0';
m_AgentServerInfo.m_nPatchAddressLen = nLength;
}
}
void CAuthAgentServerTable::UpdateChannelUserNum(unsigned short* lpdwClientChannelNum,
unsigned short usChannelNum)
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
m_AgentServerInfo.m_usChannelNum = usChannelNum;
unsigned short* lpdwPastEnd = lpdwClientChannelNum +
std::min(unsigned short(usChannelNum), unsigned short(SERVER_GROUP::CHANNEL_NUM));
std::copy(lpdwClientChannelNum, lpdwPastEnd, m_AgentServerInfo.m_usChannelClientNum);
}
unsigned long CAuthAgentServerTable::GetServerVersion()
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
return m_AgentServerInfo.m_dwClientVer;
}
unsigned long CAuthAgentServerTable::GetServerChecksum()
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
return m_AgentServerInfo.m_dwChecksum;
}
void CAuthAgentServerTable::SetAgentServerInfo(RylServerInfo& AgentServerInfo)
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
m_AgentServerInfo = AgentServerInfo;
}
void CAuthAgentServerTable::GetAgentServerInfo(RylServerInfo& AgentServerInfo)
{
AuthAgentLock::Syncronize sync(m_AuthAgentLock);
AgentServerInfo = m_AgentServerInfo;
}
/*
bool CAuthAgentServerTable::InsertUIDDB(const unsigned long dwUID, CAuthClientDispatch* lpClientDispatch)
{
UIDDBLock::Syncronize sync(m_UIDDBLock);
RemoveUIDDB(dwUID);
return m_UIDDB.insert(std::make_pair(dwUID, lpClientDispatch)).second;
}
void CAuthAgentServerTable::RemoveUIDDB(const unsigned long dwUID)
{
UIDDBLock::Syncronize sync(m_UIDDBLock);
m_UIDDB.erase(dwUID);
}
CAuthClientDispatch* CAuthAgentServerTable::FindInUIDDB(const unsigned long dwUID)
{
UIDDBLock::Syncronize sync(m_UIDDBLock);
UIDDB::iterator find = m_UIDDB.find(dwUID);
return (find != m_UIDDB.end()) ? (find->second) : 0;
}
*/

View File

@@ -0,0 +1,50 @@
#ifndef _AUTH_AGENT_SERVER_TABLE_H_
#define _AUTH_AGENT_SERVER_TABLE_H_
#include <map>
#include <Thread/Lock.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include "AuthAgentDispatch.h"
// Àü¹æ ÂüÁ¶
class CSession;
class CAuthAgentDispatch;
class CAuthClientDispatch;
// MultiThread °¡´É.
class CAuthAgentServerTable
{
public:
static CAuthAgentServerTable& GetInstance();
void Destroy();
// Get Data
void GetPatchServerAddress(unsigned long& dwClientVer,
char* szPatchAddress_Out, size_t nBufferLen);
void SetAgentServerInfo(RylServerInfo& ServerInfo);
void GetAgentServerInfo(RylServerInfo& ServerInfo);
unsigned long GetServerVersion();
unsigned long GetServerChecksum();
// Update Data
void UpdateServerData(unsigned long dwChecksum,
unsigned long dwClientVer, const char* szPatchAddress);
void UpdateChannelUserNum(unsigned short* lpdwClientChannelNum,
unsigned short usChannelNum);
private:
CAuthAgentServerTable();
~CAuthAgentServerTable();
typedef CCSLock AuthAgentLock;
AuthAgentLock m_AuthAgentLock;
CACHE_PAD(PaddingAgent, sizeof(AuthAgentLock));
RylServerInfo m_AgentServerInfo;
};
#endif

View File

@@ -0,0 +1,184 @@
#ifndef _AUTH_CLIENT_DISPATCH_H_
#define _AUTH_CLIENT_DISPATCH_H_
#include <mmsystem.h>
#include <algorithm>
#include <DB/DBDefine.h>
#include <Network/Dispatch/CheckPing.h>
#include <Network/Dispatch/MultiThreadDispatch.h>
#include <Network/Dispatch/MultiDispatchStorage.h>
#include <Network/Address/INET_Addr.h>
// 전방 참조
struct PktAU;
struct PktULi;
struct PktSPI;
struct PktCS;
struct PktCC;
struct PktCD;
// WORK_LIST 2.1 계정 국적 추가
struct PktSelectAccountNation;
struct PktUnifiedCharSelectReq;
struct PktSZ;
struct PktJPAU;
struct CHAR_VIEW;
// 1유저당 CAuthClientDispatch 1클래스 배치
class CAuthClientDispatch : public CRylServerDispatch
{
public:
enum Const
{
// edith 2008.03.17 ID,PASS 길이조정
MAX_PASSWORD_LEN = 36,
PENDED_CHAR_SELECT = (1 << 0),
CHAR_SELECT_SUCCESS = (1 << 1),
PENDED_SERVER_ZONE = (1 << 2),
SERVER_ZONE_SUCCESS = (1 << 3),
AUTHORIZE_PENDED = (1 << 4),
AUTHORIZED_SUCCESS = (1 << 5),
PENDED_CHAR_CREATE = (1 << 6),
PENDED_CHAR_DELETE = (1 << 7)
};
// Do not make inline function : 인라인 함수로 만들지 마시오. 대략 낭패.
static CMultiDispatch& GetDispatchTable();
CAuthClientDispatch(CSession& Session);
virtual ~CAuthClientDispatch();
virtual void Connected();
virtual void Disconnected();
virtual bool Dispatch();
CHAR_VIEW& GetCharacterView(unsigned long Slot_In) { return m_CharView[Slot_In]; }
void SetCharacterView(CHAR_VIEW* lpCharView) { memcpy(m_CharView, lpCharView, sizeof(CHAR_VIEW) * USER_INFO::MAX_CHAR_NUM); }
unsigned long GetUID() const { return m_dwUID; }
unsigned long GetSessionID() const { return m_dwSessionID; }
unsigned char GetAgentServerType() const { return m_cAgentServerType; }
unsigned char GetFirstLogin() const { return m_cFirstLogin; }
void UserLogin(unsigned long dwSessionID, unsigned long dwUID);
void UserLogout(void);
void UserMove(void);
void SetBlockedID(unsigned char cBlockedFlag, const char* szBlockedChar[USER_INFO::MAX_CHAR_NUM]);
void SetSucceededPassword(const char* szPassword)
{
ZeroMemory(m_szSucceededPassword, sizeof(char) * MAX_PASSWORD_LEN);
if(0 != szPassword && strlen(szPassword) > 0)
{
strcpy(m_szSucceededPassword, szPassword);
}
}
void SetUnifiedInfo(unsigned char cAgentServerType, unsigned char cFirstLogin)
{
m_cAgentServerType = cAgentServerType;
m_cFirstLogin = cFirstLogin;
}
void SetCnFlag(unsigned short CnFlag) { m_CnFlag = CnFlag; }
unsigned short GetCnFlag(void) { return m_CnFlag; }
void SetPacketProcessFlag(unsigned short usFlags) { m_usPacketProcessFlag |= usFlags; }
void ResetPacketProcessFlag(unsigned short usFlags) { m_usPacketProcessFlag &= ~usFlags; }
bool IsSetPacketProcessFlag(unsigned short usFlags) { return (usFlags == (m_usPacketProcessFlag & usFlags)); }
void SetMoveAddress(unsigned long dwMoveServerID, const INET_Addr& moveAddress)
{
m_dwMoveServerID = dwMoveServerID;
m_MoveAddress = moveAddress;
}
INET_Addr& GetMoveAddress() { return m_MoveAddress; }
unsigned long GetMoveServerID() { return m_dwMoveServerID; }
// Send Functions
static bool SendCharSelect(CSendStream& SendStream, unsigned char Zone,
unsigned short *lpChannelNum, unsigned short usError_In);
static bool SendCharCreate(CSendStream& SendStream, unsigned long CharID_In, unsigned long Slot_In,
CHAR_VIEW* lpCharView_In, unsigned short usError_In);
static bool SendCharDelete(CSendStream& SendStream, unsigned long UserID_In, unsigned long Slot_In,
unsigned short usError_In);
// WORK_LIST 2.1 계정 국적 추가
static bool SendSelectAccountNation(CSendStream& SendStream, unsigned long UserID_In,
unsigned char cType, unsigned char cAccountNation_In, unsigned short usError_In);
// WORK_LIST 2.3 계정 국적 변경 기능 구현
static bool SendNationChangeResult(CSendStream& SendStream, unsigned long UserID_In,
unsigned long* dwGID, unsigned long* dwFame, unsigned short usError_In);
inline STORE_INFO* GetStoreInfo() { return &m_sStoreInfo; }
private:
// Dispatch Functions
virtual bool DispatchPacket(PktBase* lpPktBase);
bool ParseAuthAccount(PktAU* lpPktAU);
bool ParseUserLogin(PktULi* lpPktULi);
bool ParseSysPatchAddress(PktSPI* lpPktSPI); // 패치 서버 주소를 클라이언트에게 보내준다.
bool ParseCharSelect(PktCS* lpPktCS);
bool ParseCharCreate(PktCC* lpPktCC);
bool ParseCharDelete(PktCD* lpPktCD);
// WORK_LIST 2.1 계정 국적 추가
bool ParseSelectAccountNation(PktSelectAccountNation* lpPktSAN_In);
bool ParseServerZone(PktSZ* lpPktSZ);
bool ParseJapanAuthAccount(PktJPAU* lpPktAU);
bool ParseUnifiedCharSelect(PktUnifiedCharSelectReq* lpPktUnifiedCharSelectReq);
// --------------------------------------------------------------------------------------------------
// 캐릭터 포인터 Get, Set
CCheckPing m_CheckPing;
CHAR_VIEW m_CharView[USER_INFO::MAX_CHAR_NUM];
// --------------------------------------------------------------------------------------------------
// 유저 데이터
unsigned long m_dwSessionID;
unsigned long m_dwUID;
char m_szBlockedID[USER_INFO::MAX_CHAR_NUM][CHAR_INFOST::MAX_NAME_LEN];
char m_szAccountName[CHAR_INFOST::MAX_ACCOUNT_LEN];
char m_szSucceededPassword[MAX_PASSWORD_LEN];
unsigned char m_cBlockedFlag; // 0 : 블록x, 1 : 계정 블록, 2 : 캐릭터 블록
unsigned short m_usPacketProcessFlag;
unsigned short m_CnFlag;
unsigned char m_cAgentServerType;
unsigned char m_cFirstLogin;
INET_Addr m_MoveAddress;
unsigned long m_dwMoveServerID;
STORE_INFO m_sStoreInfo;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,141 @@
#include "stdafx.h"
#include "AuthClientDispatch.h"
#include "AuthAgentServerTable.h"
#include <Network/Session/Session.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/ClientToAuthServer.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Stream/Buffer/BufferFactory.h>
bool CAuthClientDispatch::SendCharSelect(CSendStream& SendStream, unsigned char Zone,
unsigned short *lpChannelNum, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCSAck));
if(NULL != lpBuffer)
{
PktCSAck* lpPktCSAck = reinterpret_cast<PktCSAck*>(lpBuffer);
lpPktCSAck->m_cZone = Zone;
if(NULL != lpChannelNum)
{
memcpy(lpPktCSAck->m_wChannelNum, lpChannelNum, sizeof(unsigned short) * PktCSAck::MAX_CHANNEL_NUM);
}
return SendStream.WrapCrypt(sizeof(PktCSAck), CmdCharSelect, 0, usError_In);
}
return false;
}
bool CAuthClientDispatch::SendCharCreate(CSendStream& SendStream, unsigned long CharID_In, unsigned long Slot_In,
CHAR_VIEW* lpCharView_In, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCCAck));
if(NULL != lpBuffer)
{
PktCCAck* lpPktCCAck = reinterpret_cast<PktCCAck*>(lpBuffer);
if(0 == usError_In)
{
lpPktCCAck->m_dwCharID = CharID_In;
lpPktCCAck->m_dwSlotNum = Slot_In;
lpPktCCAck->m_CharView = *lpCharView_In;
}
else
{
lpPktCCAck->m_dwCharID = CharID_In;
lpPktCCAck->m_dwSlotNum = Slot_In;
memset(&lpPktCCAck->m_CharView, 0, sizeof(CHAR_VIEW));
}
return SendStream.WrapCrypt(sizeof(PktCCAck), CmdCharCreate, 0, usError_In);
}
return false;
}
bool CAuthClientDispatch::SendCharDelete(CSendStream& SendStream, unsigned long UserID_In, unsigned long Slot_In, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktCDAck));
if(NULL != lpBuffer)
{
PktCDAck* lpPktCDAck = reinterpret_cast<PktCDAck*>(lpBuffer);
if(0 == usError_In)
{
lpPktCDAck->m_dwUserID = UserID_In;
lpPktCDAck->m_dwSlotNum = Slot_In;
}
else
{
lpPktCDAck->m_dwUserID = 0;
lpPktCDAck->m_dwSlotNum = 0;
}
return SendStream.WrapCrypt(sizeof(PktCDAck), CmdCharDelete, 0, usError_In);
}
return false;
}
// WORK_LIST 2.1 계정 국적 추가
bool CAuthClientDispatch::SendSelectAccountNation(CSendStream& SendStream, unsigned long UserID_In,
unsigned char cType, unsigned char cAccountNation_In, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSelectAccountNation));
if (NULL != lpBuffer)
{
PktSelectAccountNation* lpPktSAN = reinterpret_cast<PktSelectAccountNation*>(lpBuffer);
if (0 == usError_In)
{
lpPktSAN->m_dwUserID = UserID_In;
lpPktSAN->m_cType = cType;
lpPktSAN->m_cAccountNation = cAccountNation_In;
}
else
{
lpPktSAN->m_dwUserID = 0;
lpPktSAN->m_cType = 0;
lpPktSAN->m_cAccountNation = 0;
}
return SendStream.WrapCrypt(sizeof(PktSelectAccountNation), CmdSelectAccountNation, 0, usError_In);
}
return false;
}
// WORK_LIST 2.3 계정 국적 변경 기능 구현
bool CAuthClientDispatch::SendNationChangeResult(CSendStream& SendStream, unsigned long UserID_In,
unsigned long* dwGID, unsigned long* dwFame, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktNationChangeResult));
if (NULL != lpBuffer)
{
PktNationChangeResult* lpPktANC = reinterpret_cast<PktNationChangeResult*>(lpBuffer);
if (0 == usError_In)
{
lpPktANC->m_dwUserID = UserID_In;
::memcpy(lpPktANC->m_dwGID, dwGID, sizeof(unsigned long) * PktNationChangeResult::MAX_CHAR_VIEW);
::memcpy(lpPktANC->m_dwFame, dwFame, sizeof(unsigned long) * PktNationChangeResult::MAX_CHAR_VIEW);
}
else
{
lpPktANC->m_dwUserID = 0;
::memset(lpPktANC->m_dwGID, 0, sizeof(unsigned long) * PktNationChangeResult::MAX_CHAR_VIEW);
::memset(lpPktANC->m_dwFame, 0, sizeof(unsigned long) * PktNationChangeResult::MAX_CHAR_VIEW);
}
return SendStream.WrapCrypt(sizeof(PktNationChangeResult), CmdNationChangeResult, 0, usError_In);
}
return false;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
#ifndef _CAUTHORIZE_THREAD_H_
#define _CAUTHORIZE_THREAD_H_
#include <Thread/Thread.h>
//#include <map>
// 전방 참조.
class CDBComponent;
class CAuthInfo;
class CAuthorizeThread;
//#include "NetString.h"
class CAuthorizeThread : public CThread
// ,public CNetString::IEventListener
{
public:
// Desc : 타입에 따라 알맞은 인증 스레드 생성 (한게임/대만)
static CAuthorizeThread* Create();
// Desc : 타입에 따라 알맞은 이름/패스워드 검사 (한게임/대만)
static bool CheckUserIDAndPass(const char* szUserAccount_In, const char* szUserPW_In);
virtual ~CAuthorizeThread();
bool Initialize(); // Desc : DBObject등을 생성한다.
void Destroy(); // Desc : DBObject등을 소멸시킨다.
// void EventPacket(int iIndex, char* pPacket);
bool ConnectAll();
private:
unsigned int Run();
virtual BOOL End();
protected:
virtual void Authorize(CAuthInfo* lpAuthInfo) = 0; // Desc : 인증 방법.
CAuthorizeThread(); // Desc : Create 함수를 사용해서만 생성할 수 있게 함.
CDBComponent* m_lpComponent;
CDBComponent* m_lpAdminToolComponent;
BOOL m_bConnectAll;
// NetString을 생성한다.
// CNetString* m_lpLogin;
// CNetString* m_lpLogout;
// std::map<std::string, AUTHINFO> m_AuthMap;
private:
unsigned long m_AuthCount;
public:
unsigned long MakeSessionID(unsigned long SessionID)
{
unsigned long dwSessionID = (SessionID ^ ++m_AuthCount);
return 0 == dwSessionID ? dwSessionID + rand() : dwSessionID;
}
};
#endif

View File

@@ -0,0 +1,262 @@
#include "stdafx.h"
#include "AuthorizeUser.h"
#include "AuthorizeThread.h"
#include "AuthClientDispatch.h"
#include <BaseLibrary/Network/Session/Session.h>
#include <Log/ServerLog.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
CSyncronizedObjectQueue::CSyncronizedObjectQueue()
: m_nMaxSize(LONG_MAX), m_bStop(false)
{
m_hHandles[StopperIndex] = CreateEvent(0, TRUE, FALSE, 0);
m_hHandles[SemaphoreIndex] = CreateSemaphore(0, 0, LONG_MAX, 0);
}
CSyncronizedObjectQueue::~CSyncronizedObjectQueue()
{
clear();
CCSLock::Syncronize sync(m_DataLock);
CloseHandle(m_hHandles[StopperIndex]);
CloseHandle(m_hHandles[SemaphoreIndex]);
}
bool CSyncronizedObjectQueue::enqueue(CAuthInfo* lpCommand, bool bPendHead)
{
CCSLock::Syncronize sync(m_DataLock);
if(0 == lpCommand || m_nMaxSize < m_CommandQueue.size())
{
return false;
}
if(bPendHead) { m_CommandQueue.push_front(lpCommand); }
else { m_CommandQueue.push_back(lpCommand); }
BOOL bResult = ReleaseSemaphore(m_hHandles[SemaphoreIndex], 1, 0);
if(!bResult)
{
if(bPendHead)
{
m_CommandQueue.pop_front();
}
else
{
m_CommandQueue.pop_back();
}
return false;
}
return 0 != bResult;
}
CAuthInfo* CSyncronizedObjectQueue::dequeue(unsigned long dwMilliSecond)
{
CAuthInfo* lpCommand = 0;
switch(WaitForMultipleObjects(MaxIndex, m_hHandles, FALSE, dwMilliSecond))
{
case StopperIndex:
break;
case SemaphoreIndex:
{
CCSLock::Syncronize sync(m_DataLock);
if(!m_CommandQueue.empty())
{
lpCommand = m_CommandQueue.front();
m_CommandQueue.pop_front();
}
}
break;
case WAIT_FAILED:
ERRLOG1(g_Log, "Err:%d/Error from WaitForMultipleObject", GetLastError());
break;
}
return lpCommand;
}
void CSyncronizedObjectQueue::remove(const char* szUserAccount)
{
CCSLock::Syncronize sync(m_DataLock);
CommandQueue::iterator pos = m_CommandQueue.begin();
CommandQueue::iterator end = m_CommandQueue.end();
for(; pos != end;)
{
CAuthInfo* lpAuthInfo = *pos;
if(0 == strncmp(lpAuthInfo->GetUserAccount(),
szUserAccount, PktAU::ID_LEN))
{
pos = m_CommandQueue.erase(pos);
delete lpAuthInfo;
}
else
{
++pos;
}
}
}
void CSyncronizedObjectQueue::stop()
{
CCSLock::Syncronize sync(m_DataLock);
m_bStop = true;
SetEvent(m_hHandles[StopperIndex]);
}
bool CSyncronizedObjectQueue::is_stopped()
{
CCSLock::Syncronize sync(m_DataLock);
return m_bStop;
}
void CSyncronizedObjectQueue::clear()
{
CCSLock::Syncronize sync(m_DataLock);
CommandQueue::iterator pos = m_CommandQueue.begin();
CommandQueue::iterator end = m_CommandQueue.end();
for(; pos != end; ++pos)
{
delete *pos;
}
m_CommandQueue.clear();
}
CAuthInfo::CAuthInfo(CAuthClientDispatch* lpDispatch, unsigned long dwSessionID,
const char* szUserAccount, const char* szUserPassword,
size_t nMaxUserAccountSize, size_t nMaxUserPasswordSize,
unsigned short usFlag, unsigned short usCnFlag)
: m_lpDispatch(lpDispatch), m_dwSessionID(dwSessionID),
m_usFlag(usFlag), m_usCnFlag(usCnFlag)
{
m_dwAuthStartTime = timeGetTime();
nMaxUserAccountSize = min(size_t(PktAU::ID_LEN), nMaxUserAccountSize);
nMaxUserPasswordSize = min(size_t(PktAU::PASS_LEN), nMaxUserPasswordSize);
memcpy(m_szUserAccount, szUserAccount, nMaxUserAccountSize);
memcpy(m_szUserPassword, szUserPassword, nMaxUserPasswordSize);
m_bLogin = TRUE;
if(0 != m_lpDispatch)
{
static_cast<CPacketDispatch*>(m_lpDispatch)->GetSession().AddRef();
}
}
CAuthInfo::CAuthInfo(CAuthClientDispatch* lpDispatch, const char* szUserAccount, size_t nMaxUserAccountSize)
{
m_dwAuthStartTime = timeGetTime();
nMaxUserAccountSize = min(size_t(PktAU::ID_LEN), nMaxUserAccountSize);
memcpy(m_szUserAccount, szUserAccount, nMaxUserAccountSize);
m_bLogin = FALSE;
m_lpDispatch = NULL;
}
CAuthInfo::~CAuthInfo()
{
if(0 != m_lpDispatch)
{
static_cast<CPacketDispatch*>(m_lpDispatch)->GetSession().Release();
}
}
CAuthorizeUser& CAuthorizeUser::GetInstance()
{
static CAuthorizeUser authorizeUser;
return authorizeUser;
}
CAuthorizeUser::CAuthorizeUser()
{
}
CAuthorizeUser::~CAuthorizeUser()
{
Destroy();
}
bool CAuthorizeUser::Initialize(unsigned long nThreadNum, unsigned long dwMaxAuthorizeListSize)
{
m_AuthInfoQueue.set_max_size(dwMaxAuthorizeListSize);
for(; 0 != nThreadNum; --nThreadNum)
{
if(!m_AuthorizeThreadMgr.RegisterAndRun(CAuthorizeThread::Create()))
{
return false;
}
}
return true;
}
void CAuthorizeUser::ConnectAll()
{
int iNum = m_AuthorizeThreadMgr.GetNum();
int iMaxNum = m_AuthorizeThreadMgr.GetMaxNum();
for(int i = 0; i < iMaxNum; ++i)
{
CAuthorizeThread* pAuth = static_cast<CAuthorizeThread*>(m_AuthorizeThreadMgr.GetThread(i));
if(pAuth == NULL)
continue;
pAuth->ConnectAll();
iNum--;
if(iNum < 0)
break;
}
}
void CAuthorizeUser::Destroy()
{
m_AuthInfoQueue.stop();
m_AuthorizeThreadMgr.JoinThread();
m_AuthInfoQueue.clear();
}
CAuthInfo* CAuthorizeUser::GetAuthorizeInfo(unsigned long dwMilliSecond)
{
return m_AuthInfoQueue.dequeue(dwMilliSecond);
}
bool CAuthorizeUser::AddAuthorizeUser(CAuthInfo* lpAuthInfo)
{
return m_AuthInfoQueue.enqueue(lpAuthInfo);
}
void CAuthorizeUser::RemovePending(const char* szUserAccount)
{
return m_AuthInfoQueue.remove(szUserAccount);
}

View File

@@ -0,0 +1,153 @@
#ifndef _CAUTHRORIZE_USER_H_
#define _CAUTHRORIZE_USER_H_
#include <list>
#include <Network/Packet/PacketStruct/ClientToAuthServer.h>
#include <BaseLibrary/Thread/Lock.h>
#include <BaseLibrary/Thread/ThreadMgr.h>
#include <BaseLibrary/Pattern/Singleton.h>
// 전방 참조
class CAuthClientDispatch;
typedef struct AUTHINFO
{
unsigned long dwSessionID; // 세션아이디
char szUserAccount[40]; // 아이디
char szUserPassword[40]; // 패스워드
char szAddr[32]; // 아아피
unsigned long dwUserID;
unsigned short usFlag;
unsigned short usCnFlag;
CAuthClientDispatch* lpDispatch; // 처리클래스
}*LPAUTHINFO;
class CAuthInfo
{
public:
// login 용
CAuthInfo(CAuthClientDispatch* lpDispatch, unsigned long dwSessionID,
const char* szUserAccount, const char* szUserPassword,
size_t nMaxUserAccountSize, size_t nMaxUserPasswordSize,
unsigned short usFlag, unsigned short usCnFlag);
// logout용
CAuthInfo(CAuthClientDispatch* lpDispatch, const char* szUserAccount,
size_t nMaxUserAccountSize);
~CAuthInfo();
BOOL GetIsLogin() { return m_bLogin; }
unsigned long GetSessionID() { return m_dwSessionID; }
char* GetUserAccount() { return m_szUserAccount; }
char* GetUserPassword() { return m_szUserPassword; }
unsigned short GetFlag() { return m_usFlag; }
unsigned short GetCnFlag() { return m_usCnFlag; }
CAuthClientDispatch* GetDispatch() { return m_lpDispatch; }
unsigned long GetAuthStartTime() { return m_dwAuthStartTime; }
protected:
unsigned long m_dwSessionID; // 세션아이디
unsigned long m_dwAuthStartTime; // 인증 시작시간
char m_szUserAccount[PktAU::ID_LEN]; // 아이디
char m_szUserPassword[PktAU::PASS_LEN]; // 패스워드
BOOL m_bLogin; // 로그인 패킷
unsigned short m_usFlag;
unsigned short m_usCnFlag;
CAuthClientDispatch* m_lpDispatch; // 처리클래스
};
class CSyncronizedObjectQueue
{
public:
CSyncronizedObjectQueue();
~CSyncronizedObjectQueue();
bool enqueue(CAuthInfo* lpCommand, bool bPendHead = false);
CAuthInfo* dequeue(unsigned long dwMilliSecond = INFINITE);
void remove(const char* szUserAccount);
void set_max_size(size_t nSize) { m_nMaxSize = nSize; }
size_t get_size() { return m_CommandQueue.size(); }
void stop();
bool is_stopped();
void clear();
protected:
enum Const
{
StopperIndex,
SemaphoreIndex,
MaxIndex
};
private:
typedef std::list<CAuthInfo*> CommandQueue;
CCSLock m_DataLock;
HANDLE m_hHandles[MaxIndex];
CommandQueue m_CommandQueue;
size_t m_nMaxSize;
bool m_bStop;
};
class CAuthorizeUser
{
public:
static CAuthorizeUser& GetInstance();
typedef std::list<CAuthInfo*> AuthorizeList;
// Desc : 인증 스레드 생성 및 처리 시작.
bool Initialize(unsigned long nThreadNum, unsigned long dwMaxAuthorizeListSize);
// Desc : 인증 스레스 소멸 및 처리 종료.
void Destroy();
// Desc : 인증 리스트에 새 인증 요청을 집어 넣음.
// Input : CAuthInfo. 인증에 필요한 정보들
// Output : 리스트에 삽입 성공 : true, 리스트가 일정 개수 이상임 : false;
bool AddAuthorizeUser(CAuthInfo* lpAuthInfo);
// Desc : 현재 가지고 있는 인증 정보를 리스트에 넣어 줌. 데이터가 올 때까지 Wait상태임.
// Input : AuthorizeList& LocalAuthorizeList 인증 정보 리스트.
// Output : 데이터를 얻어 옴 : true, 얻어올 수 없음(종료시) : false
CAuthInfo* GetAuthorizeInfo(unsigned long dwMilliSecond = INFINITE);
size_t GetAuthUserNum() { return m_AuthInfoQueue.get_size(); }
void stop() { m_AuthInfoQueue.stop(); }
bool is_stopped() { return m_AuthInfoQueue.is_stopped(); }
void RemovePending(const char* szUserAccount);
void ConnectAll();
private:
CAuthorizeUser();
~CAuthorizeUser();
enum { DEFAULT_AUTHORIZE_LIST = 10000 };
typedef CCSLock AuthorizeLock;
CSyncronizedObjectQueue m_AuthInfoQueue;
CThreadMgr m_AuthorizeThreadMgr;
};
#endif

View File

@@ -0,0 +1,228 @@
// IOBuffer.cpp: implementation of the CIOBuffer class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "IOBuffer.h"
#include <string.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
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,85 @@
// 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>
#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,68 @@
#include "stdafx.h"
#include <Item/ItemMgr.h>
#include <Item/ItemFactory.h>
#include <Item/ItemStructure.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Utility/Setup/ServerSetup.h>
#include "ItemCreator.h"
CItemCreator& CItemCreator::GetInstance()
{
static CItemCreator itemCreator;
return itemCreator;
}
CItemCreator::CItemCreator()
{
}
// Desc : 아이템 스크립트 로딩 및 초기화 등등.
bool CItemCreator::Initialize()
{
ItemCreationLock::Syncronize sync(m_ItemCreationLock);
char szItemScriptName[MAX_PATH];
if (SERVER_ID::GROUP_BATTLE_SERVER == CServerSetup::GetInstance().GetServerGroup())
{
strncpy(szItemScriptName, "./Script/Game/BGItemScript.txt", MAX_PATH);
}
else
{
strncpy(szItemScriptName, "./Script/Game/ItemScript.txt", MAX_PATH);
}
return Item::CItemMgr::GetInstance().LoadItemProtoType(szItemScriptName);
}
// Desc : 아이템 UID 세팅
void CItemCreator::SetUID(DWORD64 dwUID)
{
ItemCreationLock::Syncronize sync(m_ItemCreationLock);
Item::CItemFactory& ItemFactory = Item::CItemFactory::GetInstance();
if(ItemFactory.GetItemUID() < dwUID)
{
ItemFactory.SetItemUID(dwUID);
}
}
DWORD64 CItemCreator::GetUID() const
{
return Item::CItemFactory::GetInstance().GetItemUID();
}
// Desc : 아이템 생성
Item::CItem* CItemCreator::Create(unsigned short usID)
{
ItemCreationLock::Syncronize sync(m_ItemCreationLock);
return Item::CItemFactory::GetInstance().CreateItem(usID);
}

View File

@@ -0,0 +1,41 @@
#ifndef _CITEM_CREATOR_H_
#define _CITEM_CREATOR_H_
#include <BaseLibrary/Thread/Lock.h>
#include <BaseLibrary/Pattern/Singleton.h>
// 전방 참조
namespace Item
{
class CItem;
class CItemMgr;
class CItemFactory;
};
class CItemCreator
{
public:
static CItemCreator& GetInstance();
// Desc : 아이템 스크립트 로딩 및 초기화 등등.
bool Initialize();
// Desc : 아이템 UID 세팅
void SetUID(DWORD64 dwUID);
DWORD64 GetUID() const;
// Desc : 아이템 생성
Item::CItem* Create(unsigned short usID);
private:
CItemCreator();
typedef CCSLock ItemCreationLock;
ItemCreationLock m_ItemCreationLock;
};
#endif

View File

@@ -0,0 +1,110 @@
#include "stdafx.h"
#include "MasterPassword.h"
#include <Log/ServerLog.h>
#include <winsock2.h>
#include <windows.h>
CMasterPassword::CMasterPassword()
{
Init();
}
CMasterPassword::~CMasterPassword()
{
}
bool CMasterPassword::LoadMasterPassword(const char* szTextFileName)
{
PasswordLock::Syncronize sync(m_Lock);
FILE* lpFile = fopen(szTextFileName, "rt");
if(NULL != lpFile)
{
const int MAX_READ = 4096;
char szRead[MAX_READ];
char* szDelimitChars = " =\t\n\r";
while(fgets(szRead, MAX_READ, lpFile))
{
char* szCommand = strtok(szRead, szDelimitChars);
char* szValue = strtok(NULL, szDelimitChars);
Process(szCommand, szValue);
}
fclose(lpFile);
return true;
}
return false;
}
bool CMasterPassword::CheckMasterPassword(const char* szUserID, const char* szPassword, const sockaddr_in& peerAddr)
{
PasswordLock::Syncronize sync(m_Lock);
if(0 == m_szMasterPassword[0])
{
// Didn't set master password
return false;
}
if(0 == strcmp(szPassword, m_szMasterPassword))
{
unsigned long address = peerAddr.sin_addr.S_un.S_addr;
const char* szPeerAddress = inet_ntoa(peerAddr.sin_addr);
if(NULL == szPeerAddress) { szPeerAddress = "Unknown address"; }
AddressList::iterator pos = m_AddressList.begin();
AddressList::iterator end = m_AddressList.end();
for(;pos != end; ++pos)
{
if(address == *pos)
{
// ÁÖ¼Ò°¡ ÀÏÄ¡ÇÔ.
DETLOG2(g_Log, "Used master password : UserName(%s), from(%15s)", szUserID, szPeerAddress);
return true;
}
}
ERRLOG2(g_Log, "Can't apply master password : Unauthorized IP Address - UserName(%s), from(%15s)",
szUserID, szPeerAddress);
}
return false;
}
void CMasterPassword::Init()
{
PasswordLock::Syncronize sync(m_Lock);
m_AddressList.clear();
memset(m_szMasterPassword, 0, MAX_MASTERPASS);
}
void CMasterPassword::Process(const char* szCommand, const char* szValue)
{
if(NULL != szCommand && NULL != szValue)
{
if(0 == strcmp(szCommand, "//"))
{
// ÁÖ¼®ÀÓ
}
else if(0 == strcmp(szCommand, "MASTER_PASSWORD"))
{
strncpy(m_szMasterPassword, szValue, MAX_MASTERPASS - 1);
m_szMasterPassword[MAX_MASTERPASS - 1] = 0;
}
else if(0 == strcmp(szCommand, "ALLOWED_IP"))
{
m_AddressList.push_back(inet_addr(szValue));
}
}
}

View File

@@ -0,0 +1,43 @@
#ifndef _GAMA_RYL_MASTER_PASSWORD_H_
#define _GAMA_RYL_MASTER_PASSWORD_H_
#include <Thread/Lock.h>
#include <Pattern/Singleton.h>
#include <vector>
// forward decl.
struct sockaddr_in;
class CMasterPassword : public CStaticSingleton<CMasterPassword>
{
public:
enum
{
// edith 2008.03.17 ID,PASS ±æÀÌÁ¶Á¤
MAX_MASTERPASS = 36
};
CMasterPassword();
~CMasterPassword();
bool LoadMasterPassword(const char* szTextFileName = "./Script/Server/masterpass.txt");
bool CheckMasterPassword(const char* szUserID, const char* szPassword, const sockaddr_in& peerAddr);
private:
void Init();
void Process(const char* szCommand, const char* szValue);
typedef CCSLock PasswordLock;
typedef std::vector<unsigned long> AddressList;
PasswordLock m_Lock;
CACHE_PAD(PasswordLockPad, sizeof(PasswordLock));
AddressList m_AddressList;
char m_szMasterPassword[MAX_MASTERPASS];
};
#endif

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;
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,34 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by RylAuthServer.rc
//
#define IDI_MAIN 102
#define IDR_MENU1 103
#define ID_Menu 104
#define ID_CONSOL_START 105
#define IDR_MENU 106
#define ID_ 107
#define ID__108 108
#define ID_START_CONSOLE 109
#define ID_STOP_CONSOLE 110
#define ID_Menu111 111
#define ID_STATUS 112
#define ID__ 113
#define ID_STARTSERVER 114
#define ID_RELOADSETUP 115
#define ID_LOG 116
#define ID_QUIT 117
#define ID_CONNECTALL 40001
#define ID_AUTHSERVER_DATABASE 40002
#define ID_DATABASE_123 40003
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40004
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,546 @@
#include "stdafx.h"
#include <Network/IOCP/IOCPNet.h>
#include <Network/Session/Session.h>
#include <Network/Session/CreatePolicy.h>
#include <Network/Session/LimitUserByIP.h>
#include <Utility/Filter/Filter.h>
#include <Utility/Setup/ServerSetup.h>
#include <Utility/Time/Pulse/Pulse.h>
#include <Utility/Debug/PerformanceCheck.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleWindow.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleCMDFactory.h>
#include <Log/ServerLog.h>
#include <Log/GameLog.h>
#include <Thread/ThreadMgr.h>
#include "AuthAgentServerTable.h"
#include "AuthAgentDispatch.h"
#include "AuthClientDispatch.h"
#include "AuthorizeUser.h"
#include "ItemCreator.h"
#include "MasterPassword.h"
#include "RylAuthServer.h"
#include <mmsystem.h>
#include <GameGuardLib/ggsrv.h>
// edith 2009.08.11 게임가드 2.5 업그레이드
GGAUTHS_API void NpLog(int mode, char* msg)
{
}
GGAUTHS_API void GGAuthUpdateCallback(PGG_UPREPORT report)
{
}
CRylAuthServer& CRylAuthServer::GetInstance()
{
static CRylAuthServer rylAuthServer;
return rylAuthServer;
}
class CRylAuthServerProcess : public CProcessThread
{
public:
CRylAuthServerProcess(CRylAuthServer& RylAuthServer, unsigned long dwProcessTick)
: CProcessThread(RylAuthServer, dwProcessTick),
m_RylAuthServer(RylAuthServer)
{
}
virtual void Cleanup(CPulse& Pulse)
{
CLimitUserByIP* lpLimitUserByIP = m_RylAuthServer.GetLimitUserByIP();
if(0 != lpLimitUserByIP)
{
lpLimitUserByIP->OperateMode(CLimitUserByIP::DENY_ALL);
}
}
virtual void InternalRun(CPulse& Pulse)
{
unsigned long dwLastTick = Pulse.GetLastTick();
unsigned long dwCurrentPulse = Pulse.GetCurrentPulse();
long dwTicksPerSec = Pulse.GetTicksPerSec();;
// 게임 로그 시간 업데이트
CGameLog::GetInstance().UpdateLogTime();
#ifdef AUTH_MY
m_RylAuthServer.Update( Pulse.GetCurrentPulse() );
#endif
// 콘솔 정보 업데이트
if(0 == (dwCurrentPulse % (2 * dwTicksPerSec)))
{
m_RylAuthServer.PrintServerInfo();
m_RylAuthServer.PrintStatistics();
}
// 퍼포먼스 로그 출력 (20분에 한번씩)
if(0 == (dwCurrentPulse % (20 * 60 * dwTicksPerSec)))
{
GetFunctionTimingResult("RowAuthServer");
}
// 연결 체크 및 flag세팅
if(0 == (dwCurrentPulse % (5 * dwTicksPerSec)))
{
unsigned long dwServerStatus = 0;
if(0 != CAuthAgentDispatch::GetDispatchTable().GetDispatchNum())
{
dwServerStatus |= (1 << CServerSetup::AgentServer);
}
m_RylAuthServer.SetStatusFlag(dwServerStatus);
}
}
private:
CRylAuthServer& m_RylAuthServer;
};
CRylAuthServer::CRylAuthServer()
: m_lpDBASessionPolicy(0),
m_lpUserSessionPolicy(0),
m_lpLimitUserByIP(new CLimitUserByIP(0)),
m_bInitializedClientListener(FALSE)
{
}
CRylAuthServer::~CRylAuthServer()
{
#define SAFE_RELEASE(p) if(p) { (p)->Release(); (p) = 0; }
SAFE_RELEASE(m_lpUserSessionPolicy);
SAFE_RELEASE(m_lpDBASessionPolicy);
SAFE_RELEASE(m_lpLimitUserByIP);
#undef SAFE_RELEASE
}
bool CRylAuthServer::ApplicationSpecificInit(const TCHAR* szCmdLine)
{
#define AUTH_INIT_ERR(detailText) TEXT("AuthServer initialize failed - "##detailText)
const TCHAR* szErrorMessage = 0;
if(0 == m_lpLimitUserByIP)
{
szErrorMessage = AUTH_INIT_ERR("CLimitUserByIP create failed");
}
else if(!CServerSetup::GetInstance().Initialize(CServerSetup::AuthServer))
{
// 서버 셋업 초기화.
szErrorMessage = AUTH_INIT_ERR("ServerSetup init failed");
}
else if(!Filter::InitFilter())
{
// 이름 관련 필터 초기화 실패
szErrorMessage = AUTH_INIT_ERR("Filter init failed");
}
else if(!CMasterPassword::GetInstance().LoadMasterPassword())
{
// 마스터 비번 초기화 실패
szErrorMessage = AUTH_INIT_ERR("Master password init failed");
}
else if(!CGameLog::GetInstance().Initialize())
{
// 게임 로그 초기화 실패
szErrorMessage = AUTH_INIT_ERR("GameLog init failed");
}
else if(!CItemCreator::GetInstance().Initialize())
{
// 아이템 생성자 초기화.
szErrorMessage = AUTH_INIT_ERR("ItemCreator init failed");
}
else if(!InitializeCommand())
{
// 서버 커맨드 초기화
szErrorMessage = AUTH_INIT_ERR("Server command init failed");
}
else if(!InitializeMsgProc())
{
// 서버 메시지 프로시저 초기화
szErrorMessage = AUTH_INIT_ERR("Server message proc init failed");
}
else if(!CAuthorizeUser::GetInstance().Initialize(1, 200))
{
// 인증 스레드 생성 및 초기화 실패
szErrorMessage = AUTH_INIT_ERR("AuthorizeUser init failed");
}
else if(!AddProcessThread(new CRylAuthServerProcess(*this, 100)))
{
// 인증 서버 처리 스레드 초기화 실패
szErrorMessage = AUTH_INIT_ERR("Add AuthServer process thread failed");
}
m_lpLimitUserByIP->OperateMode(CLimitUserByIP::ALLOW_ALL);
#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
if(0 != szErrorMessage)
{
ERRLOG2(g_Log, "this:0x%p/%s", this, szErrorMessage);
return false;
}
GetCommandProcess()->Add(GetCommandFactory()->Create("startserver", strlen("startserver")));
return true;
}
#ifdef AUTH_MY
void CRylAuthServer::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 CRylAuthServer::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 CRylAuthServer::EventConnect(BOOL bConnect)
{
CPacketEvent::EventConnect(bConnect);
m_EasyCmd = 0;
m_dwServerType = AT_AUTH;
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_AUTH, 0), strMD5);
m_Counter = 61;
}
}
static int iExitLoopCount = 0;
void CRylAuthServer::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 CRylAuthServer::InitializeClientListener()
{
if(!m_bInitializedClientListener)
{
const TCHAR* szErrorMessage = 0;
CIOCPNet* lpIOCPNet = GetIOCPNet();
if(0 == lpIOCPNet)
{
szErrorMessage = TEXT("IOCPNet is null");
}
else
{
if(0 != m_lpUserSessionPolicy)
{
m_lpUserSessionPolicy->Release();
}
m_lpUserSessionPolicy = SessionPolicy::CreateTCPPolicy<CAuthClientDispatch>();
if(!lpIOCPNet->AddListener(m_lpUserSessionPolicy, 0,
CServerSetup::AuthServerClientListen, 10, m_lpLimitUserByIP))
{
szErrorMessage = TEXT("AddListener failed");
}
else
{
m_bInitializedClientListener = TRUE;
}
}
if(0 != szErrorMessage)
{
ERRLOG0(g_Log, szErrorMessage);
}
}
}
void CRylAuthServer::ConnectToDBAgent()
{
#define CONN_TO_DBA(detailText) TEXT("this:0x%p/"##detailText)
GET_SINGLE_DISPATCH(lpAgentDispatch, CAuthAgentDispatch,
CAuthAgentDispatch::GetDispatchTable());
if(0 != lpAgentDispatch)
{
DETLOG1(g_Log, CONN_TO_DBA("Already connected to DBAgent server"), this);
}
const TCHAR* szErrorMessage = 0;
CIOCPNet* lpIOCPNet = GetIOCPNet();
if(0 == lpIOCPNet)
{
szErrorMessage = CONN_TO_DBA("IOCPNet is null");
}
else
{
if(0 != m_lpDBASessionPolicy)
{
m_lpDBASessionPolicy->Release();
}
m_lpDBASessionPolicy = SessionPolicy::CreateTCPPolicy<CAuthAgentDispatch>();
INET_Addr& agentAddress =
CServerSetup::GetInstance().GetServerAddress(CServerSetup::AgentServer);
if(!lpIOCPNet->Connect(m_lpDBASessionPolicy,
agentAddress.get_addr_string(), agentAddress.get_port_in()))
{
szErrorMessage = CONN_TO_DBA("Cannot connect to DBAgent server");
}
}
if(0 != szErrorMessage)
{
ERRLOG1(g_Log, szErrorMessage, this);
}
}
void CRylAuthServer::PrintStatistics()
{
CIOCPNet* lpIOCPNet = GetIOCPNet();
if(0 != lpIOCPNet)
{
PrintOutput("Accept Pending : %d / Session : %d",
lpIOCPNet->GetAcceptPendingNum(), lpIOCPNet->GetSessionNum());
}
}
void CRylAuthServer::PrintServerInfo()
{
const int MAX_BUFFER = 1024;
TCHAR szBuffer[MAX_BUFFER] = "";
const TCHAR* const szInitialized = m_bInitializedClientListener ?
TEXT("@ Client Open\r\n\r\n") : TEXT("@ Client Closed\r\n\r\n");
int nWriteBytes = _snprintf(szBuffer, MAX_BUFFER,
TEXT("@ Limit Players : %d\r\n%s"), CServerSetup::GetInstance().GetUserLimit(), szInitialized);
if(0 < CAuthAgentDispatch::GetDispatchTable().GetDispatchNum())
{
unsigned long nTotalClientNum = 0;
RylServerInfo AgentServerInfo;
CAuthAgentServerTable::GetInstance().GetAgentServerInfo(AgentServerInfo);
nWriteBytes += ::_snprintf(szBuffer + nWriteBytes, MAX_BUFFER - nWriteBytes,
"Client Version : %d, CheckSum : 0x%08X\r\nPatchAddress : %10s\r\n",
AgentServerInfo.m_dwClientVer, AgentServerInfo.m_dwChecksum, AgentServerInfo.m_szPatchAddress);
if(0 != AgentServerInfo.m_usChannelNum)
{
nWriteBytes += ::_snprintf(szBuffer + nWriteBytes, MAX_BUFFER - nWriteBytes,
TEXT(" Human: %4d, Akhan: %4d, Total: %4d\r\n"),
AgentServerInfo.m_usChannelClientNum[0] - 1,
AgentServerInfo.m_usChannelClientNum[1] - 1,
AgentServerInfo.m_usChannelClientNum[0] - 1 + AgentServerInfo.m_usChannelClientNum[1] - 1);
}
PrintInfo(szBuffer);
}
else
{
PrintInfo("There is no DBAgent Server\r\n");
}
}
void CRylAuthServer::LogPerformance()
{
GetFunctionTimingResult("RowAuthServer");
}
void CRylAuthServer::ReloadSetup()
{
// 셋업 초기화
if(!CServerSetup::GetInstance().Initialize(CServerSetup::AuthServer))
{
ERRLOG0(g_Log, "ServerSetup reinitialize failed.");
}
else
{
PrintOutput("ServerSetup reload success.");
}
}

View File

@@ -0,0 +1,63 @@
#ifndef _RYL_AUTH_SERVER_H_
#define _RYL_AUTH_SERVER_H_
#include <Utility/ServerAppFramework/ServerWindowFramework.h>
#ifdef AUTH_MY
#include "NFAuthClient/AuthClient.h"
#endif
// Àü¹æ ÂüÁ¶
class CSessionPolicy;
class CLimitUserByIP;
class CRylAuthServer : public CServerWindowFramework
#ifdef AUTH_MY
, public CPacketEvent
#endif
{
public:
static CRylAuthServer& GetInstance();
void InitializeClientListener();
void ConnectToDBAgent();
void PrintStatistics();
void PrintServerInfo();
void LogPerformance();
void ReloadSetup();
CLimitUserByIP* GetLimitUserByIP() { return m_lpLimitUserByIP; }
#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:
bool ApplicationSpecificInit(const TCHAR* szCmdLine);
bool InitializeCommand();
bool InitializeMsgProc();
CRylAuthServer();
virtual ~CRylAuthServer();
CSessionPolicy* m_lpDBASessionPolicy;
CSessionPolicy* m_lpUserSessionPolicy;
CLimitUserByIP* m_lpLimitUserByIP;
BOOL m_bInitializedClientListener;
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,154 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Á߸³ resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_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", "ROWAuthServer"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "ROWAuthServer"
VALUE "LegalCopyright", "Copyright (c) - 2009"
VALUE "OriginalFilename", "RYLAuthServer.exe"
VALUE "ProductName", "ROWAuthServer"
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
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON "RylAuthServer.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU MENU
BEGIN
POPUP "Auth Server"
BEGIN
POPUP "Console"
BEGIN
MENUITEM "Open Console", ID_START_CONSOLE
MENUITEM "Close Console", ID_STOP_CONSOLE
END
MENUITEM SEPARATOR
MENUITEM "Show Status", ID_STATUS
POPUP "Database"
BEGIN
MENUITEM "ConnectAll", 40001
END
POPUP "Option"
BEGIN
MENUITEM "Start Server", ID_STARTSERVER
MENUITEM "Reload Config", ID_RELOADSETUP
MENUITEM "Flush Log", ID_LOG
END
MENUITEM SEPARATOR
MENUITEM "Shutdown", ID_QUIT
END
END
#endif // Çѱ¹¾î resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,406 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="RylAuthServer"
ProjectGUID="{39BBD560-05D6-4B58-86A9-FE8981DB8D1A}"
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)/RylAuthServer.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylAuthServer.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)/RylAuthServer.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="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)/RylAuthServer.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)/RylAuthServer.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylAuthServer.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)/RylAuthServer.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)/RylAuthServer.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylAuthServer.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=".\AuthAgentDispatch.cpp">
</File>
<File
RelativePath=".\AuthAgentServerTable.cpp">
</File>
<File
RelativePath=".\AuthClientDispath.cpp">
</File>
<File
RelativePath=".\AuthClientSend.cpp">
</File>
<File
RelativePath=".\AuthorizeThread.cpp">
</File>
<File
RelativePath=".\AuthorizeUser.cpp">
</File>
<File
RelativePath=".\ItemCreator.cpp">
</File>
<File
RelativePath=".\MasterPassword.cpp">
</File>
<File
RelativePath=".\RylAuthServer.cpp">
</File>
<File
RelativePath=".\RylAuthServerCommands.cpp">
</File>
<File
RelativePath=".\RylAuthServerMain.cpp">
</File>
<File
RelativePath=".\RylAuthServerWindow.cpp">
</File>
<File
RelativePath=".\SendUserLoginout.cpp">
</File>
<File
RelativePath=".\stdafx.cpp">
</File>
</Filter>
<Filter
Name="헤더 파일"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\AuthAgentDispatch.h">
</File>
<File
RelativePath=".\AuthAgentServerTable.h">
</File>
<File
RelativePath=".\AuthClientDispatch.h">
</File>
<File
RelativePath=".\AuthorizeThread.h">
</File>
<File
RelativePath=".\AuthorizeUser.h">
</File>
<File
RelativePath=".\ItemCreator.h">
</File>
<File
RelativePath=".\MasterPassword.h">
</File>
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\RylAuthServer.h">
</File>
<File
RelativePath=".\SendUserLoginout.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
</Filter>
<Filter
Name="리소스 파일"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\RylAuthServer.ico">
</File>
<File
RelativePath=".\RylAuthServer.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,315 @@
<?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>{39BBD560-05D6-4B58-86A9-FE8981DB8D1A}</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;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylAuthServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylAuthServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<IgnoreSpecificDefaultLibraries>LIBCMT;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
</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>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylAuthServer.exe</OutputFile>
<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)RylAuthServer.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)RylAuthServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylAuthServer.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)RylAuthServer.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)RylAuthServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylAuthServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="AuthAgentDispatch.cpp" />
<ClCompile Include="AuthAgentServerTable.cpp" />
<ClCompile Include="AuthClientDispath.cpp" />
<ClCompile Include="AuthClientSend.cpp" />
<ClCompile Include="AuthorizeThread.cpp" />
<ClCompile Include="AuthorizeUser.cpp" />
<ClCompile Include="ItemCreator.cpp" />
<ClCompile Include="MasterPassword.cpp" />
<ClCompile Include="RylAuthServer.cpp" />
<ClCompile Include="RylAuthServerCommands.cpp" />
<ClCompile Include="RylAuthServerMain.cpp" />
<ClCompile Include="RylAuthServerWindow.cpp" />
<ClCompile Include="SendUserLoginout.cpp" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AuthAgentDispatch.h" />
<ClInclude Include="AuthAgentServerTable.h" />
<ClInclude Include="AuthClientDispatch.h" />
<ClInclude Include="AuthorizeThread.h" />
<ClInclude Include="AuthorizeUser.h" />
<ClInclude Include="ItemCreator.h" />
<ClInclude Include="MasterPassword.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="RylAuthServer.h" />
<ClInclude Include="SendUserLoginout.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<None Include="RylAuthServer.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylAuthServer.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseLibrary\BaseLibrary.vcxproj">
<Project>{585cfc82-602a-466b-8e86-1a4fd1d442ca}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\MemoryManager\MemoryManager.vcxproj">
<Project>{7b602b2e-c629-4311-b7f6-c9177660ada1}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\RylGameLibrary\RylGameLibrary.vcxproj">
<Project>{3d6dc807-f1db-4f12-8755-4f15fc0b8824}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\RylServerLibrary\RylServerLibrary.vcxproj">
<Project>{91662620-ceb4-4184-b1e5-7ea48a8e2f8d}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\ScriptEngine\ScriptEngine.vcxproj">
<Project>{8ee86398-fbbb-4568-98cf-4a890da9d636}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{716d4c86-6d38-4f08-acae-109bf8bc92bd}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,106 @@
<?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="AuthAgentDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="AuthAgentServerTable.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="AuthClientDispath.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="AuthClientSend.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="AuthorizeThread.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="AuthorizeUser.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ItemCreator.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="MasterPassword.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylAuthServer.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylAuthServerCommands.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylAuthServerMain.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylAuthServerWindow.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="SendUserLoginout.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AuthAgentDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="AuthAgentServerTable.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="AuthClientDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="AuthorizeThread.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="AuthorizeUser.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ItemCreator.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="MasterPassword.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="RylAuthServer.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="SendUserLoginout.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="RylAuthServer.ico">
<Filter>리소스 파일</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylAuthServer.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,156 @@
#include "stdafx.h"
#include <Log/ServerLog.h>
#include <Log/GameLog.h>
#include <Utility/Filter/Filter.h>
#include <Utility/Debug/PerformanceCheck.h>
#include <Utility/ServerAppFrameWork/ConsoleWindow/ConsoleCMDFactory.h>
#include <Network/IOCP/IOCPNet.h>
#include <Network/Packet/PacketStatistics.h>
#include "MasterPassword.h"
#include "RylAuthServer.h"
#include "AuthorizeUser.h"
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 CCMDStartServer : public CConsoleCMDSingleton<CCMDStartServer>
{
protected:
virtual bool DoProcess()
{
CRylAuthServer::GetInstance().InitializeClientListener();
CRylAuthServer::GetInstance().ConnectToDBAgent();
return true;
}
};
class CCMDFlushLog : public CConsoleCMDSingleton<CCMDFlushLog>
{
protected:
virtual bool DoProcess()
{
CRylAuthServer::GetInstance().PrintStatistics();
CRylAuthServer::GetInstance().PrintServerInfo();
GetFunctionTimingResult("RowAuthServer");
CGameLog::GetInstance().Flush();
SERLOG0(g_Log, "Flush Log.");
SERLOG0(g_SessionLog, "Flush Log.");
return true;
}
};
class CCMDReloadSetup : public CConsoleCMDSingleton<CCMDReloadSetup>
{
protected:
virtual bool DoProcess()
{
CRylAuthServer::GetInstance().ReloadSetup();
return true;
}
};
class CCMDMasterPass : public CConsoleCMDSingleton<CCMDMasterPass>
{
protected:
virtual bool DoProcess()
{
Filter::InitFilter();
// ¸¶½ºÅÍ ÆÐ½º¿öµå ÃʱâÈ­
if(!CMasterPassword::GetInstance().LoadMasterPassword())
{
SERLOG1(g_Log, "this:0x%p/Master password reload failed", this);
return false;
}
return true;
}
};
class CCMDNewLog : public CConsoleCMDSingleton<CCMDNewLog>
{
protected:
virtual bool DoProcess()
{
if (!CGameLog::GetInstance().NewLog())
{
SERLOG1(g_Log, "this:0x%p/New gamelog make failed", this);
return false;
}
if (!g_Log.NewLog())
{
SERLOG1(g_Log, "this:0x%p/New serverlog make failed", this);
return false;
}
return true;
}
};
class CCMDDBConnect : public CConsoleCMDSingleton<CCMDDBConnect>
{
protected:
virtual bool DoProcess()
{
CAuthorizeUser::GetInstance().ConnectAll();
return true;
}
};
bool CRylAuthServer::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("startserver", CCMDStartServer, szErrorMessage);
ADD_COMMAND("reloadsetup", CCMDReloadSetup, szErrorMessage);
ADD_COMMAND("flush", CCMDFlushLog, szErrorMessage);
ADD_COMMAND("reloadpass", CCMDMasterPass, szErrorMessage);
ADD_COMMAND("dbconnect", CCMDDBConnect, szErrorMessage);
ADD_COMMAND("statclear", CCMDStatClear, szErrorMessage);
ADD_COMMAND("statlog", CCMDStatLog, szErrorMessage);
ADD_COMMAND("newlog", CCMDNewLog, szErrorMessage);
if(0 != szErrorMessage)
{
ERRLOG0(g_Log, szErrorMessage);
return false;
};
return true;
}

View File

@@ -0,0 +1,52 @@
// RylAuthServer.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Resource.h"
#include <Thread/Lock.h> // CNamedMutex
#include <Log/ServerLog.h>
#include <Log/GameLog.h>
#include <Utility/Debug/ExceptionReport.h> // g_CExceptionReport
#include "RylAuthServer.h" // CRylAuthServerWindow
int WINAPI ExceptionUserFunc(TCHAR* szBuffer, const int nBufferSize)
{
SERLOG0(g_Log, "Flush log");
SERLOG0(g_SessionLog, "Flush log");
CGameLog::GetInstance().Flush();
return _snprintf(szBuffer, nBufferSize, "Userdata flush completed.");
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CNamedMutex Mutex("RowAuthServer", TRUE);
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
ERRLOG0(g_Log, "AuthServer 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);
CRylAuthServer& AuthServer = CRylAuthServer::GetInstance();
if(AuthServer.Initialize(hInstance, "Auth Server", lpCmdLine,
IDI_MAIN, IDR_MENU))
{
AuthServer.ProcessMessage();
}
return 0;
}

View File

@@ -0,0 +1,76 @@
#include "stdafx.h"
#include "Resource.h"
#include "RylAuthServer.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_STARTSERVER: szCommand = "startserver"; break;
case ID_START_CONSOLE: m_ConsoleWindow.Initialize("RowAuthServer"); break;
case ID_STOP_CONSOLE: m_ConsoleWindow.Destroy(); break;
case ID_STATUS: szCommand = "pool"; break;
case ID_RELOADSETUP: szCommand = "reloadsetup"; 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 AuthServer System Tray.");
PostMessage(hWnd, WM_QUIT, 0, 0);
}
return 0;
}
private:
CConsoleWindow& m_ConsoleWindow;
};
bool CRylAuthServer::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_RYLAUTH_AUTOSTART, new CProcessRYLAUTH_AUTOSTART) ? 0 : 1;
nErrorCount += lpMsgProcessMgr->Register(WM_AUTH_CONNECTTOAGENT, new CProcessAUTH_CONNECTTOAGENT) ? 0 : 1;
nErrorCount += lpMsgProcessMgr->Register(WM_RYLAUTH_QUIT, new CProcessRYLAUTH_QUIT) ? 0 : 1;
*/
}
return (0 == nErrorCount);
}

View File

@@ -0,0 +1,203 @@
#include "stdafx.h"
#include "SendUserLoginout.h"
#include "AuthAgentServerTable.h"
#include <Creature/Character/CharacterCreate.h>
#include <Network/Session/Session.h>
#include <Utility/Resource/EnsureCleanup.h>
#include <Network/Packet/WrapPacket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Packet/PacketStruct/UnifiedCharPacket.h>
#include <Network/Packet/PacketStruct/AuthServerToDBAgentServer.h>
#include <Network/Packet/PacketStruct/ClientToAuthServer.h>
#include <Stream/Buffer/BufferFactory.h>
#include <ctime>
#include "AuthClientDispatch.h"
bool AuthSendPacket::SendAuthAccount(CAuthClientDispatch* lpDispatch, unsigned long UserID_In,
unsigned short usErrorCode_In)
{
if(0 != lpDispatch)
{
lpDispatch->ResetPacketProcessFlag(CAuthClientDispatch::AUTHORIZE_PENDED);
CSendStream& SendStream = lpDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktAUAck));
if (0 != lpBuffer)
{
PktAUAck* lpPktAUAck = reinterpret_cast<PktAUAck*>(lpBuffer);
lpPktAUAck->m_dwUserID = UserID_In;
lpPktAUAck->m_cAgentServerType = lpDispatch->GetAgentServerType();
lpPktAUAck->m_cFirstLogin = lpDispatch->GetFirstLogin();
return SendStream.WrapCrypt(sizeof(PktAUAck), CmdAuthAccount, 0, usErrorCode_In);
}
}
return false;
}
// WORK_LIST 2.1 계정 국적 추가
bool AuthSendPacket::SendUserLogin(CSendStream& SendStream, unsigned long SessionID_In, unsigned long UserID_In, CHAR_VIEW* lpCharView_In,
sGuildData* lpGuildData_In, unsigned long dwFlag, unsigned char cAccountNation, int nPlayTime, unsigned short usAdminLevel,
unsigned char cBillingType, unsigned char cBillingUser, unsigned char cLoginType, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktULiAck));
if (0 != lpBuffer)
{
PktULiAck* lpPktULiAck = reinterpret_cast<PktULiAck*>(lpBuffer);
if (0 == usError_In)
{
lpPktULiAck->m_dwSessionID = SessionID_In;
lpPktULiAck->m_dwUserID = UserID_In;
lpPktULiAck->m_dwCurrentTime = time(0);
lpPktULiAck->m_nPlayTime = nPlayTime;
lpPktULiAck->m_usAdminLevel = usAdminLevel;
lpPktULiAck->m_cBillingType = cBillingType;
lpPktULiAck->m_cBillingUser = cBillingUser;
lpPktULiAck->m_dwTabFlag = dwFlag;
lpPktULiAck->m_cLoginType = cLoginType;
// WORK_LIST 2.1 계정 국적 추가
lpPktULiAck->m_cAccountNation = cAccountNation;
memcpy(lpPktULiAck->m_CharView, lpCharView_In, sizeof(CHAR_VIEW) * PktULiAck::MAX_CHAR_VIEW);
memcpy(lpPktULiAck->m_GuildData, lpGuildData_In, sizeof(sGuildData) * PktULiAck::MAX_CHAR_VIEW);
}
else
{
lpPktULiAck->m_dwSessionID = 0;
lpPktULiAck->m_dwUserID = 0;
lpPktULiAck->m_dwCurrentTime = 0;
lpPktULiAck->m_nPlayTime = 0;
lpPktULiAck->m_usAdminLevel = 0;
lpPktULiAck->m_cBillingType = 0;
lpPktULiAck->m_cBillingUser = 0;
lpPktULiAck->m_cLoginType = 0;
// WORK_LIST 2.1 계정 국적 추가
lpPktULiAck->m_cAccountNation = 0;
memset(lpPktULiAck->m_CharView, 0, sizeof(CHAR_VIEW) * PktULiAck::MAX_CHAR_VIEW);
memset(lpPktULiAck->m_GuildData, 0, sizeof(sGuildData) * PktULiAck::MAX_CHAR_VIEW);
}
if (SendStream.WrapCrypt(sizeof(PktULiAck), CmdUserLogin, 0, usError_In))
{
return true;
}
}
return false;
}
bool AuthSendPacket::SendUserLogout(unsigned long SessionID_In, unsigned long UserID_In)
{
GET_SINGLE_DISPATCH(lpAgentDispatch, CAuthAgentDispatch,
CAuthAgentDispatch::GetDispatchTable());
if (0 != lpAgentDispatch)
{
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktULoD));
if (0 != lpBuffer)
{
PktULoD* lpPktULoD = reinterpret_cast<PktULoD*>(lpBuffer);
lpPktULoD->InitPtSubCmd(0, PktDD::SCmdUserLogout);
lpPktULoD->m_dwSessionID = SessionID_In;
lpPktULoD->m_dwUserID = UserID_In;
return SendStream.WrapCrypt(sizeof(PktULoD), CmdDBGetData, 0, 0);
}
}
return false;
}
bool AuthSendPacket::SendUserMove(unsigned long SessionID_In, unsigned long UserID_In)
{
GET_SINGLE_DISPATCH(lpAgentDispatch, CAuthAgentDispatch,
CAuthAgentDispatch::GetDispatchTable());
if (0 != lpAgentDispatch)
{
CSendStream& SendStream = lpAgentDispatch->GetSendStream();
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUMvD));
if (0 != lpBuffer)
{
PktUMvD* lpPktUMvD = reinterpret_cast<PktUMvD*>(lpBuffer);
lpPktUMvD->InitPtSubCmd(0, PktDD::SCmdUserMove);
lpPktUMvD->m_dwSessionID = SessionID_In;
lpPktUMvD->m_dwUserID = UserID_In;
return SendStream.WrapCrypt(sizeof(PktUMvD), CmdDBGetData, 0, 0);
}
}
return false;
}
bool AuthSendPacket::SendServerZone(CSendStream& SendStream, unsigned long ServerID_In,
const sockaddr_in& gameServerTCPAddress, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktSZAck));
if (0 != lpBuffer)
{
PktSZAck* lpPktSZAck = reinterpret_cast<PktSZAck*>(lpBuffer);
lpPktSZAck->m_dwServerID = ServerID_In;
lpPktSZAck->m_GameServerTCPAddr = gameServerTCPAddress;
if (SendStream.WrapCrypt(sizeof(PktSZAck), CmdServerZone, 0, usError_In))
{
return true;
}
}
return false;
}
bool AuthSendPacket::SendUnifiedCharSelectAck(CSendStream& SendStream, unsigned long dwUID,
unsigned long dwRequestKey, unsigned short usError_In)
{
char* lpBuffer = SendStream.GetBuffer(sizeof(PktUnifiedCharSelectAck));
if (0 != lpBuffer)
{
PktUnifiedCharSelectAck* lpPktUnifiedCharSelectAck =
reinterpret_cast<PktUnifiedCharSelectAck*>(lpBuffer);
lpPktUnifiedCharSelectAck->dwUID = dwUID;
lpPktUnifiedCharSelectAck->dwRequestKey = dwRequestKey;
if (SendStream.WrapCrypt(sizeof(PktUnifiedCharSelectAck),
CmdUnifiedCharSelect, 0, usError_In))
{
return true;
}
}
return false;
}

View File

@@ -0,0 +1,34 @@
#ifndef _SEND_USER_LOGINOUT_H_
#define _SEND_USER_LOGINOUT_H_
#include <winsock2.h>
#include <windows.h>
class CSession;
class CAuthClientDispatch;
struct CHAR_VIEW;
struct sGuildData;
class CSendStream;
namespace AuthSendPacket
{
bool SendAuthAccount(CAuthClientDispatch* lpDispatch,
unsigned long UserID_In, unsigned short usErrorCode_In);
// WORK_LIST 2.1 °èÁ¤ ±¹Àû Ãß°¡
bool SendUserLogin(CSendStream& SendStream, unsigned long SessionID_In, unsigned long UserID_In, CHAR_VIEW* lpCharView_In,
sGuildData* lpGuildData_In, unsigned long dwFlag, unsigned char cAccountNation, int nPlayTime, unsigned short usAdminLevel,
unsigned char cBillingType, unsigned char cBillingUser, unsigned char cLoginType, unsigned short usError_In);
bool SendUserLogout(unsigned long SessionID_In, unsigned long UserID_In);
bool SendUserMove(unsigned long SessionID_In, unsigned long UserID_In);
bool SendServerZone(CSendStream& SendStream, unsigned long ServerID_In,
const sockaddr_in& gameServerTCPAddress, unsigned short usError_In);
bool SendUnifiedCharSelectAck(CSendStream& SendStream,
unsigned long dwUID, unsigned long dwRequestKey, unsigned short usError_In);
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : 표준 포함 파일만 들어 있는 소스 파일입니다.
// RylAuthServer.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj에는 미리 컴파일된 형식 정보가 포함됩니다.
#include "stdafx.h"
// TODO: 필요한 추가 헤더는
// 이 파일이 아닌 STDAFX.H에서 참조합니다.

View File

@@ -0,0 +1,17 @@
// stdafx.h : 잘 변경되지 않고 자주 사용하는
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
// 들어 있는 포함 파일입니다.
//
#pragma once
#define WIN32_LEAN_AND_MEAN // 거의 사용되지 않는 내용은 Windows 헤더에서 제외합니다.
// Windows 헤더 파일입니다.
#include <windows.h>
// C의 런타임 헤더 파일입니다.
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// TODO: 프로그램에 필요한 추가 헤더는 여기에서 참조합니다.