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,149 @@
#include "stdafx.h"
#include "ChatSend.h"
#include "ChatAgentServerDispatch.h"
#include "ChatGameServerDispatch.h"
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/ChatPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Packet/PacketStruct/CharConfigPacket.h>
#include <Network/Packet/PacketStruct/FriendPacket.h>
#include <Network/Broadcast/ChatCharData.h>
#include <Network/Winsock/SocketFactory.h>
#include <Creature/Character/CharacterStructure.h>
#include <Log/ServerLog.h>
#include <Utility/Setup/ServerSetup.h>
CSingleDispatch& CChatAgentServerDispatch::GetDispatchTable()
{
static CSingleDispatch singleDispatch;
return singleDispatch;
}
CChatAgentServerDispatch::CChatAgentServerDispatch(CSession& Session)
: CRylServerDispatch(Session, MAX_PACKET_DISPATCH_PER_PULSE)
{
}
void CChatAgentServerDispatch::Connected()
{
DETLOG1(g_Log, "this:0x%p/중계서버와 연결되었습니다.", this);
if(!SendServerLoginToAgentServer(CServerSetup::GetInstance().GetServerID()))
{
INET_Addr& agentAddress =
CServerSetup::GetInstance().GetServerAddress(CServerSetup::AgentServer);
ERRLOG1(g_Log, "중계 서버(%16s)에 채팅 서버 로그인 메시지를 보낼 수 없습니다.",
agentAddress.get_addr_string());
}
}
void CChatAgentServerDispatch::Disconnected()
{
GetDispatchTable().RemoveDispatch(this);
DETLOG1(g_Log, "this:0x%p/중계서버와의 연결이 끊겼습니다.", this);
}
bool CChatAgentServerDispatch::DispatchPacket(PktBase* lpPktBase)
{
bool bResult = false;
switch(lpPktBase->GetCmd())
{
case CmdSysServerLogin: bResult = ProcessServerLoginAck(static_cast<PktSLAck*>(lpPktBase)); break;
case CmdHanBTNWarning: bResult = ProcessHanBTNWarning(static_cast<PktHanBTN*>(lpPktBase)); break;
default:
bResult = true;
ERRLOG2(g_Log, "DP:0x%p/Cmd:0x%02x/Unknown Command packet", this, lpPktBase->GetCmd());
break;
}
if(!bResult)
{
ERRLOG2(g_Log, "DP:0x%p/Cmd:0x%02x/Packet process failed", this, lpPktBase->GetCmd());
}
// 잘못된 커맨드 패킷이 와도 끊지는 않는다.
return true;
}
// 중계서버로 로그인 Ack
bool CChatAgentServerDispatch::ProcessServerLoginAck(PktSLAck* lpPktSLAck)
{
GetDispatchTable().SetDispatch(this);
return true;
}
bool CChatAgentServerDispatch::SendServerLoginToAgentServer(unsigned long dwServerID)
{
char* lpBuffer = m_SendStream.GetBuffer(sizeof(PktSL));
if (NULL != lpBuffer)
{
PktSL* lpPktSL = reinterpret_cast<PktSL*>(lpBuffer);
lpPktSL->m_dwServerID = dwServerID;
const int MAX_ADDRESS = 128;
char szAddress[MAX_ADDRESS];
CTCPFactory tcpFactory;
tcpFactory.GetNetworkInfo(szAddress, MAX_ADDRESS);
lpPktSL->m_Address.S_un.S_addr = inet_addr(szAddress);
return m_SendStream.WrapHeader(sizeof(PktSL), CmdSysServerLogin, 0, 0);
}
return false;
}
bool CChatAgentServerDispatch::ProcessHanBTNWarning(PktHanBTN* lpPktHanBTN)
{
ChatData::CCharInfo* lpCharInfo =
ChatData::CCharInfoMap::GetInstance().GetCharInfoByCID(lpPktHanBTN->m_dwCID);
if(0 != lpCharInfo && lpCharInfo->GetUID() == lpPktHanBTN->m_dwUID)
{
GET_MULTI_DISPATCH(lpDispatch, lpCharInfo->GetServerID(),
CChatGameServerDispatch, CChatGameServerDispatch::GetDispatchTable());
if(0 != lpDispatch)
{
lpPktHanBTN->m_szMsg[PktHanBTN::MAX_HAN_BTN - 1] = 0;
CServerChatPacket serverChatPacket(lpPktHanBTN->m_szMsg,
PktChat::NOTICE, 0, lpCharInfo->GetInclinationData(),
lpCharInfo->GetName(), &lpPktHanBTN->m_dwCID, 1);
if(serverChatPacket.IsValid())
{
DETLOG3(g_Log, "UID:%u/CID:%u/한게임 빌링서버 접속 끊기 전 경고 메시지 출력 성공(%s)",
lpPktHanBTN->m_dwUID, lpPktHanBTN->m_dwCID, lpPktHanBTN->m_szMsg);
return lpDispatch->GetSendStream().PutBuffer(
serverChatPacket.GetCompressedPacket(),
serverChatPacket.GetCompressedSize(), CmdCharChat);
}
}
}
ERRLOG3(g_Log, "UID:%u/CID:%u/한게임 빌링서버 접속 끊기 전 경고 메시지 출력 실패(%s)",
lpPktHanBTN->m_dwUID, lpPktHanBTN->m_dwCID, lpPktHanBTN->m_szMsg);
return true;
}

View File

@@ -0,0 +1,56 @@
#ifndef _CHAT_SERVER_DISPATCH_H_
#define _CHAT_SERVER_DISPATCH_H_
#include <Network/Dispatch/RylServerDispatch.h>
#include <Network/Dispatch/SingleDispatchStorage.h>
// 전방 참조
struct PktSLAck; // 서버 로그인 Ack
struct PktHanBTN;
/* sphawk : oldchat
struct PktChatLogin; // 캐릭터 로그인
struct PktChatLogout; // 캐릭터 로그아웃
struct PktFriendDB;
struct PktConfigInfo;
*/
class CChatAgentServerDispatch : public CRylServerDispatch
{
protected:
enum
{
MAX_PACKET_DISPATCH_PER_PULSE = 30,
MAX_STREAM_BUFFER_SIZE = 16000
};
public:
static CSingleDispatch& GetDispatchTable();
CChatAgentServerDispatch(CSession& Session);
virtual void Connected();
virtual void Disconnected();
bool SendServerLoginToAgentServer(unsigned long dwServerID);
private:
virtual bool DispatchPacket(PktBase* lpPktBase);
bool ProcessServerLoginAck(PktSLAck* lpPktSLAck); // 중계서버로 로그인 Ack
bool ProcessHanBTNWarning(PktHanBTN* lpPktHanBTN); // 한게임 빌링 경고.
/* sphawk : oldchat
bool ProcessCharLogin(PktChatLogin* lpChatCharLogin); // 캐릭터 로그인
bool ProcessCharLogout(PktChatLogout* lpChatCharLogout); // 캐릭터 로그아웃
bool ProcessConfigInfo(PktConfigInfo* lpConfigInfo); // 설정 정보 받기
bool ProcessUpdateFriendDB(PktFriendDB* lpFriendDB); // 친구 정보 받기
*/
};
#endif

View File

@@ -0,0 +1,302 @@
#include "stdafx.h"
/*
#include "ChatClientDispatch.h"
#include "ChatSend.h"
#include <BaseLibrary/Log/ServerLog.h>
#include <Network/Packet/ChatPacket.h>
#include <Network/Session/Session.h>
#include <RylServerLibrary/Network/Packet/PacketCommand.h>
#include <RylGameLibrary/Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <RylGameLibrary/Network/Packet/PacketStruct/CharMovePacket.h>
#include <mmsystem.h>
CChatClientDispatch::ChatClientDispatchMap& CChatClientDispatch::GetDispatchMap()
{
static CChatClientDispatch::ChatClientDispatchMap chatClientDispatchMap;
return chatClientDispatchMap;
}
CChatClientDispatch::CChatClientDispatch(CSession& Session)
: CRylServerDispatch(Session, MAX_PACKET_DISPATCH_PER_PULSE),
m_dwUID(0), m_dwCID(0), m_dwServerID(0), m_usFlag(0)
{
}
bool CChatClientDispatch::DispatchPacket(PktBase* lpPktBase)
{
bool bResult = false;
switch(lpPktBase->GetCmd())
{
case CmdSysPing:
m_CheckPing.SetLastPingRecvTime(timeGetTime());
return true;
case CmdChatClientLogin: bResult = ParseCharChatLogin(static_cast<PktChatClientLogin*>(lpPktBase)); break;
case CmdCharMoveUpdate: bResult = ParseCharMoveUpdate(static_cast<PktMU*>(lpPktBase)); break;
case CmdCharChat: bResult = ParseCharChat(static_cast<PktChat*>(lpPktBase)); break;
case CmdCharWhisper: bResult = ParseCharWhisper(static_cast<PktWh*>(lpPktBase)); break;
default:
bResult = true;
ERRLOG2(g_Log, "DP:0x%p/Cmd:0x%02x/Unknown Command packet", this, lpPktBase->GetCmd());
break;
}
if(!bResult)
{
ERRLOG2(g_Log, "DP:0x%p/Cmd:0x%02x/Packet process failed", this, lpPktBase->GetCmd());
}
return true;
}
bool CChatClientDispatch::Dispatch()
{
unsigned long dwCurrentTime = timeGetTime();
if(m_CheckPing.CheckPing(dwCurrentTime))
{
return CRylServerDispatch::Dispatch();
}
else
{
unsigned long dwPingCount = 0;
unsigned long dwLastPingRecvTime = 0;
unsigned long dwFirstCheckTime = 0;
m_CheckPing.GetPingData(dwPingCount,
dwLastPingRecvTime, dwFirstCheckTime);
const int MAX_BUFFER = 256;
char szBuffer[MAX_BUFFER];
_snprintf(szBuffer, MAX_BUFFER - 1,
"UID:%u/CID:%u/ServerID:0x%08x/CurrentTime:%u/LastPingTime:%u/PingCount:%u/FirstCheckTime:%u/"
"PingCheck failed. disconnect now.",
m_dwUID, m_dwCID, m_dwServerID, dwCurrentTime,
dwLastPingRecvTime, dwPingCount, dwFirstCheckTime);
szBuffer[MAX_BUFFER - 1] = 0;
LogErrorPacket(szBuffer, 0);
}
return false;
}
void CChatClientDispatch::Disconnected()
{
SetFlag(CHAR_DISCONNECTED);
DETLOG3(g_Log, "UID:%10d/CID:%10d/%15s/클라이언트와의 연결이 종료되었습니다.", m_dwUID, m_dwCID,
m_Session.GetRemoteAddr().get_addr_string());
CChatClientDispatch::GetDispatchMap().erase(m_dwUID);
}
bool CChatClientDispatch::ParseCharChatLogin(PktChatClientLogin* lpPktChatClientLogin)
{
m_dwUID = lpPktChatClientLogin->m_dwUID;
m_dwCID = lpPktChatClientLogin->m_dwCID;
m_dwServerID = lpPktChatClientLogin->m_dwServerID;
CChatClientDispatch::GetDispatchMap().insert(std::make_pair(m_dwUID, this));
SetFlag(CHAR_CONNECTED);
DETLOG3(g_Log, "UID:%10d/CID:%10d/%15s/클라이언트와 연결되었습니다.",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string());
CChatSend::Rebind* lpRebind = CChatSend::GetInstance().GetRebind(m_dwUID, m_dwCID);
if(NULL != lpRebind)
{
CChatCharInfo& ChatInfo = lpRebind->m_ChatInfo;
// 만일 로그인 데이터 및 friend, ban 데이터가 전부 있으면 클라이언트로 보낸다.
if(ChatInfo.IsSetFlags(CChatCharInfo::SendLoginComplete) &&
!ChatInfo.IsSetFlags(CChatCharInfo::SendFriendInfo) &&
ChatInfo.IsSetFlags(CChatCharInfo::FriendListReceived | CChatCharInfo::BanListReceived))
{
ChatInfo.SetFlags(CChatCharInfo::SendFriendInfo);
CChatSend::SendFriendInfo(ChatInfo, m_SendStream);
DETLOG2(g_Log, "UID:%10d/CID:%10d/ ChatClientDispatch에서 친구 정보를 클라이언트로 보냈습니다.",
ChatInfo.GetUID(), ChatInfo.GetCID());
}
}
return true;
///*
// 클라이언트로 Ack를 보낸다.
char* szBuffer = m_SendStream.GetBuffer(sizeof(PktChatClientLogin));
if(NULL != szBuffer)
{
PktChatClientLogin* lpPktChatClientLoginAck =
reinterpret_cast<PktChatClientLogin*>(szBuffer);
lpPktChatClientLoginAck->m_dwUID = m_dwUID;
lpPktChatClientLoginAck->m_dwCID = m_dwCID;
lpPktChatClientLoginAck->m_dwServerID = m_dwServerID;
if(m_SendStream.WrapCrypt(sizeof(PktChatClientLogin), CmdChatClientLogin, 0, 0))
{
return true;
}
}//
ERRLOG2(g_Log, "UID:%10d/CID:%10d/ 로그인에 실패했습니다. 패킷을 보낼 수 없습니다.", m_dwUID, m_dwCID);
return false;
}
bool CChatClientDispatch::ParseCharMoveUpdate(PktMU* lpPktMU)
{
m_ChatPos.SetPos(
static_cast<CChatPosition::position_t>(lpPktMU->m_Position.fPointX),
static_cast<CChatPosition::position_t>(lpPktMU->m_Position.fPointY),
static_cast<CChatPosition::position_t>(lpPktMU->m_Position.fPointZ));
return true;
}
bool CChatClientDispatch::ParseCharChat(PktChat* lpPktChat)
{
CChatPosition::position_t MAX_SQUARED_RANGE = 32 * 32;
const int nDefaultMaxPacketLen = sizeof(PktChat) + PktChat::PktChatMaxSize;
int nPacketLength = lpPktChat->GetLen();
if(nPacketLength < sizeof(PktChat))
{
ERRLOG4(g_Log, "UID:%10d/CID:%10d/%15s/패킷 길이가 이상합니다/길이:%d/",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), nPacketLength);
return false;
}
if(0 == m_dwUID || 0 == m_dwCID || !IsSetFlag(CHAR_CONNECTED))
{
ERRLOG4(g_Log, "UID:%10d/CID:%10d/%15s/연결패킷:%s/UID, CID가 0이거나 연결 패킷을 주지 않은 자입니다/",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), IsSetFlag(CHAR_CONNECTED) ? "받았음" : "못받음");
}
switch(lpPktChat->m_cCmd)
{
case PktChat::NORMAL:
case PktChat::PARTY:
case PktChat::GUILD:
case PktChat::SHOUT:
case PktChat::CLIENT_LOG: // 로그
case PktChat::ADMIN_NORMAL_CHAT:
case PktChat::ADMIN_SHOUT:
// 거리 체크해서 주변 인물들에게 전부 전송.
if(0 != lpPktChat->m_cNum || nDefaultMaxPacketLen < nPacketLength)
{
ERRLOG4(g_Log, "UID:%10d/CID:%10d/%15s/패킷 길이가 이상합니다/길이:%d/",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), nPacketLength);
return false;
}
{
char* lpChat = reinterpret_cast<char*>(lpPktChat + 1);
int nMsgLen = nPacketLength - sizeof(PktChat);
if(0 < nMsgLen)
{
// 마지막 문자를 NULL로 바꾼다.
*(lpChat + nMsgLen - 1) = NULL;
switch(lpPktChat->m_cCmd)
{
case PktChat::NORMAL:
case PktChat::ADMIN_NORMAL_CHAT:
CChatSend::GetInstance().SendNearCharacter(m_dwUID, m_dwCID,
m_ChatPos, MAX_SQUARED_RANGE, lpChat, nMsgLen, lpPktChat->m_cCmd);
break;
case PktChat::SHOUT:
case PktChat::ADMIN_SHOUT:
CChatSend::GetInstance().SendShout(m_dwUID, m_dwCID,
m_ChatPos, lpChat, nMsgLen, lpPktChat->m_cCmd);
break;
case PktChat::PARTY:
CChatSend::GetInstance().SendPartyChat(m_dwUID, m_dwCID,
m_ChatPos, lpChat, nMsgLen);
break;
case PktChat::GUILD:
CChatSend::GetInstance().SendGuildChat(m_dwUID, m_dwCID,
m_ChatPos, lpChat, nMsgLen);
break;
case PktChat::CLIENT_LOG: // 로그
DETLOG4(g_Log, "UID:%10d/CID:%10d/%15s/CLIENT_LOG: %s",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), lpChat);
break;
}
}
}
break;
case PktChat::FRIEND:
case PktChat::STALL:
// 이름 목록을 받아 주변 인물들에게 전부 전송.
{
if(0 == lpPktChat->m_cNum ||
nPacketLength < int(sizeof(PktChat) + (CHAR_INFOST::MAX_NAME_LEN * lpPktChat->m_cNum)) ||
nDefaultMaxPacketLen + CHAR_INFOST::MAX_NAME_LEN * lpPktChat->m_cNum < nPacketLength)
{
ERRLOG4(g_Log, "UID:%10d/CID:%10d/%15s/패킷 길이가 이상합니다/길이:%d/",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), nPacketLength);
return false;
}
const char* lpNames = reinterpret_cast<char*>(lpPktChat + 1);
const char* lpChat = reinterpret_cast<char*>(lpPktChat + 1) + CHAR_INFOST::MAX_NAME_LEN * lpPktChat->m_cNum;
int nMsgLen = nPacketLength - sizeof(PktChat) - (CHAR_INFOST::MAX_NAME_LEN * lpPktChat->m_cNum);
if(0 < nMsgLen)
{
CChatSend::GetInstance().SendTargetChat(m_dwUID, m_dwCID, m_ChatPos,
lpNames, lpChat, nMsgLen, lpPktChat->m_cNum, lpPktChat->m_cCmd);
}
}
break;
default:
return false;
}
return true;
}
bool CChatClientDispatch::ParseCharWhisper(PktWh* lpPktWh)
{
int nPacketLength = lpPktWh->GetLen();
if (nPacketLength < sizeof(PktWh) || sizeof(PktWh) + PktWh::PktWhMaxSize < nPacketLength)
{
ERRLOG4(g_Log, "UID:%10d/CID:%10d/%15s/패킷 길이가 이상합니다/길이:%d/",
m_dwUID, m_dwCID, m_Session.GetRemoteAddr().get_addr_string(), nPacketLength);
return false;
}
CChatSend::GetInstance().SendWhisper(m_dwUID, m_dwCID, m_ChatPos, m_SendStream, lpPktWh);
return true;
}
*/

View File

@@ -0,0 +1,85 @@
/*
#ifndef _CCHAT_DISPATCH_H_
#define _CCHAT_DISPATCH_H_
#include <Network/Stream/SendStream.h>
#include <Network/Dispatch/RylServerDispatch.h>
#include <Network/Dispatch/CheckPing.h>
#include "ChatPosition.h"
// 패킷 전방 참조
struct PktChatClientLogin;
struct PktChat;
struct PktChat;
struct PktWh;
struct PktMU;
class CChatClientDispatch : public CRylServerDispatch
{
protected:
enum
{
MAX_PACKET_DISPATCH_PER_PULSE = 5,
MAX_STREAM_BUFFER_SIZE = 16000
};
public:
typedef std::map<unsigned long, CChatClientDispatch*> ChatClientDispatchMap;
CChatClientDispatch(CSession& Session);
virtual void Disconnected();
static ChatClientDispatchMap& GetDispatchMap();
unsigned long GetUID() const { return m_dwUID; }
unsigned long GetCID() const { return m_dwCID; }
unsigned long GetServerID() const { return m_dwServerID; }
CChatPosition& GetChatPos() { return m_ChatPos; }
protected:
enum Flags
{
CHAR_CONNECTED = (1 << 0),
CHAR_DISCONNECTED = (1 << 1)
};
bool Dispatch();
void SetFlag(unsigned short usFlag) { m_usFlag |= usFlag; }
void ResetFlag(unsigned short usFlag) { m_usFlag &= ~usFlag; }
void ClearFlag() { m_usFlag = 0; }
bool IsSetFlag(unsigned short usFlag) { return usFlag == (m_usFlag & usFlag); }
private:
virtual bool DispatchPacket(PktBase* lpPktBase);
// Packet Dispatch Functions
bool ParseCharChatLogin(PktChatClientLogin* lpPktChatClientLogin);
bool ParseCharMoveUpdate(PktMU* lpPktMU);
bool ParseCharChat(PktChat* lpPktChat);
bool ParseCharWhisper(PktWh* lpPktWh);
unsigned long m_dwUID; // UID
unsigned long m_dwCID; // CID
unsigned long m_dwServerID; // ServerID
unsigned short m_usFlag; // Flag
CChatPosition m_ChatPos; // 채팅하는 위치
CCheckPing m_CheckPing; // 핑 체크
};
#endif
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
#ifndef _CHAT_GAME_SERVER_DISPATCH_H_
#define _CHAT_GAME_SERVER_DISPATCH_H_
#include <vector>
#include <Network/Dispatch/RylServerDispatch.h>
#include <Network/Dispatch/MultiDispatchStorage.h>
#include <Network/Stream/SendStream.h>
// 전방 참조
struct PktSL; // 서버 로그인
struct PktChatData; // 캐릭터 정보 변경됨
struct PktFriendDB; // 친구 정보 변경시
struct PktChatRequest; // 채팅 패킷
struct PktChatBan; // 채팅 금지
struct PktChatBanInfo; // 채팅 금지 정보 얻어오기.
// forward decl.
class CServerChatPacket;
class CChatGameServerDispatch : public CRylServerDispatch
{
protected:
enum
{
MAX_PACKET_DISPATCH_PER_PULSE = 30,
MAX_STREAM_BUFFER_SIZE = 16000
};
public:
static CMultiDispatch& GetDispatchTable();
CChatGameServerDispatch(CSession& Session);
virtual void Connected();
virtual void Disconnected();
unsigned long GetServerID() const { return m_dwServerID; }
private:
virtual bool DispatchPacket(PktBase* lpPktBase);
bool ProcessServerLogin(PktSL* lpPktSL); // 서버 로그인
bool ProcessCharInfoChange(PktChatData* lpChatInfoChange); // 캐릭터 정보 변경됨
bool ProcessUpdateFriendDB(PktFriendDB* lpFriendDB); // 친구 정보 주기
bool ProcessChat(PktChatRequest* lpPktChatReq); // 채팅
bool ProcessChatBan(PktChatBan* lpPktChatBan); // 채팅 금지
bool ProcessChatBanInfo(PktChatBanInfo* lpPktChatBanInfo); // 채팅 금지 정보.
unsigned long m_dwServerID;
};
class CSendChatAllGameServer
{
public:
CSendChatAllGameServer(CServerChatPacket& serverChatPacket);
bool operator () (unsigned long dwServerID, CPacketDispatch& dispatch);
private:
CServerChatPacket& m_ServerChatPacket;
};
#endif

View File

@@ -0,0 +1,122 @@
#include "stdafx.h"
#include "ChatLog.h"
#include "ChatToolServerDispatch.h"
#include <Log/ServerLog.h>
#include <Utility/Setup/ServerSetup.h>
CServerLog g_ChattingLog("ChattingLog", 0);
CChatLog& CChatLog::GetInstance()
{
static CChatLog chatLog;
return chatLog;
}
CChatLog::CChatLog()
: m_dwLogNum(0LL)
{
}
CChatLog::~CChatLog()
{
}
unsigned __int64 CChatLog::GetLogDataSize() const
{
return g_ChattingLog.GetTotalLoggedSize();
}
static char szGroupName[20][20] = { "Ichman", "Ponpon", "Other", };
bool CChatLog::Log(ChatData::CCharInfo& charInfo, const char cZone, const char cChannel, const char* szChatMsg, PktChat::PktChatCmd eChatType,
unsigned short usXPos, unsigned short usYPos, unsigned short usZPos, unsigned short usLang)
{
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
int GroupID = CServerSetup::GetInstance().GetServerGroup() > 2 ? 2 : CServerSetup::GetInstance().GetServerGroup();
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d][ServerID:0x%08x][Group:%-15s]"
"[Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
charInfo.GetServerID(), szGroupName[GroupID], cZone, cChannel, usXPos, usZPos,
charInfo.GetUID(), charInfo.GetCID(), eChatType + 1, charInfo.GetName(), "", szChatMsg);
++m_dwLogNum;
CChatToolServerDispatch::GetDispatchTable().Process(
CSendAllDispatch(charInfo, szChatMsg, NULL, usXPos, usZPos, eChatType, usLang, false));
return true;
}
bool CChatLog::WhisperLog(ChatData::CCharInfo& charInfo, const char cZone, const char cChannel, const char* szChatMsg, const char* szTargetName,
unsigned short usXPos, unsigned short usYPos, unsigned short usZPos, unsigned short usLang, bool bIsChatToolAdmin)
{
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
int GroupID = CServerSetup::GetInstance().GetServerGroup() > 2 ? 2 : CServerSetup::GetInstance().GetServerGroup();
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d][ServerID:0x%08x][Group:%-15s]"
"[Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
charInfo.GetServerID(), szGroupName[GroupID], cZone, cChannel, usXPos, usZPos,
charInfo.GetUID(), charInfo.GetCID(), PktChat::WHISPER + 1, charInfo.GetName(), szTargetName, szChatMsg);
++m_dwLogNum;
CChatToolServerDispatch::GetDispatchTable().Process(
CSendAllDispatch(charInfo, szChatMsg, szTargetName,
usXPos, usZPos, PktChat::WHISPER, usLang, bIsChatToolAdmin));
return true;
}
bool CChatLog::AdminLog(unsigned long dwTargetUID, unsigned long dwTargetCID,
const char* szAdminID, const char* szSenderName, const char* szTargetName,
const char* szChatMsg, unsigned char cChatType, unsigned short usLang)
{
if(0 != szAdminID && 0 != szChatMsg && 0 != szSenderName)
{
SYSTEMTIME sysTime;
GetLocalTime(&sysTime);
if(0 != szTargetName)
{
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d][ServerID:0x%08x][Group:%-15s]"
"[Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
0, "Tool", 0, 0, 0, 0, 0, 0, cChatType + 1, szSenderName, szTargetName, szChatMsg);
}
else
{
g_ChattingLog.Log("[%04d-%02d-%02d %02d:%02d:%02d][ServerID:0x%08x][Group:%-15s]"
"[Zone:%2d][CH:%2d][X:%4d][Z:%4d][UID:%10d][CID:%10d][Type:%2d][S:%-15s][T:%-15s][%s]\r\n",
sysTime.wYear, sysTime.wMonth, sysTime.wDay,
sysTime.wHour, sysTime.wMinute, sysTime.wSecond,
0, "Tool", 0, 0, 0, 0, 0, 0, cChatType + 1, szSenderName, "NOTICE", szChatMsg);
}
++m_dwLogNum;
CChatToolServerDispatch::GetDispatchTable().Process(
CSendAdminDispatch(dwTargetUID, dwTargetCID, szSenderName, szTargetName, szChatMsg, cChatType, usLang));
}
return true;
}
void CChatLog::Flush()
{
SERLOG0(g_ChattingLog, "·Î±×¸¦ FlushÇÕ´Ï´Ù");
}

View File

@@ -0,0 +1,39 @@
#ifndef _CHAT_LOG_H_
#define _CHAT_LOG_H_
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Broadcast/ChatCharData.h>
#include <Log/ServerLog.h>
extern CServerLog g_ChattingLog;
class CChatLog
{
public:
static CChatLog& GetInstance();
bool Log(ChatData::CCharInfo& charInfo, const char cZone, const char cChannel, const char* szChatMsg, PktChat::PktChatCmd eChatType,
unsigned short usXPos, unsigned short usYPos, unsigned short usZPos, unsigned short usLang);
bool WhisperLog(ChatData::CCharInfo& charInfo, const char cZone, const char cChannel, const char* szChatMsg, const char* szTargetName,
unsigned short usXPos, unsigned short usYPos, unsigned short usZPos, unsigned short usLang, bool bIsChatToolAdmin);
bool AdminLog(unsigned long dwTargetUID, unsigned long dwTargetCID,
const char* szAdminID, const char* szSendName, const char* szReceiveName,
const char* szChatMsg, unsigned char cChatType, unsigned short usLang);
void Flush();
unsigned __int64 GetLogDataSize() const;
unsigned __int64 GetLogNum() const { return m_dwLogNum; }
private:
CChatLog();
~CChatLog();
unsigned __int64 m_dwLogNum;
};
#endif

View File

@@ -0,0 +1,21 @@
#include "stdafx.h"
/*
#include "ChatPosition.h"
CChatPosition::CChatPosition()
: m_posX(0), m_posY(0), m_posZ(0)
{
}
CChatPosition::CChatPosition(CChatPosition::position_t posX,
CChatPosition::position_t posY,
CChatPosition::position_t posZ)
: m_posX(posX), m_posY(posY), m_posZ(posZ)
{
}
*/

View File

@@ -0,0 +1,49 @@
/*
#ifndef _CCHAT_POSITION_H_
#define _CCHAT_POSITION_H_
#include <cmath>
class CChatPosition
{
public:
typedef unsigned short position_t;
typedef unsigned int range_t;
CChatPosition();
CChatPosition(position_t posX, position_t posY, position_t posZ);
inline range_t GetSquaredRange(CChatPosition& ChatPosition);
inline range_t GetRange(CChatPosition& ChatPosition);
position_t GetXPos() const { return m_posX; }
position_t GetYPos() const { return m_posY; }
position_t GetZPos() const { return m_posZ; }
void SetPos(position_t posX, position_t posY, position_t posZ) { m_posX = posX; m_posY = posY; m_posZ = posZ; }
void GetPos(position_t& posX, position_t& posY, position_t& posZ) { posX = m_posX; posY = m_posY; posZ = m_posZ; }
private:
position_t m_posX;
position_t m_posY;
position_t m_posZ;
};
inline CChatPosition::range_t CChatPosition::GetSquaredRange(CChatPosition& ChatPosition)
{
return (m_posX - ChatPosition.GetXPos()) * (m_posX - ChatPosition.GetXPos()) +
(m_posY - ChatPosition.GetYPos()) * (m_posY - ChatPosition.GetYPos()) +
(m_posZ - ChatPosition.GetZPos()) * (m_posZ - ChatPosition.GetZPos());
}
inline CChatPosition::range_t CChatPosition::GetRange(CChatPosition& ChatPosition)
{
return static_cast<CChatPosition::range_t>(std::sqrt(static_cast<float>(GetSquaredRange(ChatPosition))));
}
#endif
*/

View File

@@ -0,0 +1,156 @@
#include "stdafx.h"
#include "ChatServerConfig.h"
#include <Utility/Setup/ServerSetup.h>
const char* CChatServerConfig::ms_szDefaultSetupFileName = "./Script/Server/ChatServerConfig.txt";
CChatServerConfig& CChatServerConfig::GetInstance()
{
static CChatServerConfig chatServerConfig;
return chatServerConfig;
}
CChatServerConfig::CChatServerConfig()
: m_lpLimitUserByIP(new CLimitUserByIP(0))
{
}
CChatServerConfig::~CChatServerConfig()
{
if(m_lpLimitUserByIP)
{
delete m_lpLimitUserByIP;
m_lpLimitUserByIP = 0;
}
}
//! 파일로부터 셋업을 로드한다. (이전의 내용은 전부 지워진다.)
bool CChatServerConfig::LoadSetup(const char* szFileName)
{
if(0 != m_lpLimitUserByIP)
{
m_lpLimitUserByIP->ClearIPList();
m_lpLimitUserByIP->OperateMode(CLimitUserByIP::DENY_ALL);
m_lpLimitUserByIP->ReserveAllowIP(256);
m_ChatToolAuthMap.clear();
FILE* lpFile = fopen(szFileName, "rt");
if(lpFile)
{
const int MAX_BUFFER = 4096;
char szBuffer[MAX_BUFFER];
char* szToken = 0;
enum SetupMode
{
NONE,
USER_PASSWORD,
ALLOW_IP
};
SetupMode eSetupMode = NONE;
unsigned long dwAddress = 0;
std::string szUserID;
std::string szPassword;
while(fgets(szBuffer, MAX_BUFFER - 1, lpFile))
{
szBuffer[MAX_BUFFER - 1] = 0;
szToken = strtok(szBuffer, "\r\n\t= ");
if(0 != szToken)
{
char szTokenBuffer[MAX_BUFFER];
strcpy(szTokenBuffer, szToken);
_strupr(szTokenBuffer);
if(0 == strcmp(szTokenBuffer, "//"))
{
// 주석처리...
continue;
}
else if(0 == strcmp(szTokenBuffer, "[USER]"))
{
eSetupMode = USER_PASSWORD;
}
else if(0 == strcmp(szTokenBuffer, "[ALLOW_IP]"))
{
eSetupMode = ALLOW_IP;
if (true == CServerSetup::GetInstance().GetChatToolIPCheck())
{
// 허가받은 사람들만 들어올 수 있도록 설정.
m_lpLimitUserByIP->OperateMode(CLimitUserByIP::ALLOW_SOME);
}
else
{
m_lpLimitUserByIP->OperateMode(CLimitUserByIP::ALLOW_ALL);
}
}
else
{
switch(eSetupMode)
{
case USER_PASSWORD:
szUserID.assign(szToken);
szToken = strtok(0, "\r\n\t= ");
if(0 != szToken)
{
szPassword.assign(szToken);
m_ChatToolAuthMap.insert(
std::make_pair(szUserID, std::make_pair(szPassword, 0)));
}
break;
case ALLOW_IP:
dwAddress = inet_addr(szToken);
if(0 != dwAddress)
{
m_lpLimitUserByIP->AddAllowIP(dwAddress);
}
break;
}
}
}
};
fclose(lpFile);
return true;
}
}
return false;
}
//! 유저 ID와 패스워드를 받아서, 셋업 파일에 존재하는 유저ID/Password인지 확인한다.
bool CChatServerConfig::Authorize(const char* szUserID, const char* szPassword)
{
ChatToolAuthMap::iterator pos = m_ChatToolAuthMap.find(szUserID);
ChatToolAuthMap::iterator end = m_ChatToolAuthMap.end();
if (pos != end && 0 == pos->second.second &&
0 == pos->second.first.compare(szPassword))
{
// 로그인 상태로 전환
pos->second.second = 1;
return true;
}
return false;
}
void CChatServerConfig::Logout(const char* szUserID)
{
ChatToolAuthMap::iterator pos = m_ChatToolAuthMap.find(szUserID);
ChatToolAuthMap::iterator end = m_ChatToolAuthMap.end();
if (pos != end && 0 != pos->second.second)
{
// 로그아웃 상태로 전환
pos->second.second = 0;
}
}

View File

@@ -0,0 +1,40 @@
#ifndef _GAMA_CHAT_SERVER_CONFIGURATIONS_H_
#define _GAMA_CHAT_SERVER_CONFIGURATIONS_H_
#include <string>
#include <map>
#include <Network/Session/LimitUserByIP.h>
class CChatServerConfig
{
public:
static CChatServerConfig& GetInstance();
//! 파일로부터 셋업을 로드한다. (이전의 내용은 전부 지워진다.)
bool LoadSetup(const char* szFileName = ms_szDefaultSetupFileName);
//! 유저 ID와 패스워드를 받아서, 셋업 파일에 존재하는 유저ID/Password인지 확인한다.
//! 중복 로그인 체크도 겸한다.
bool Authorize(const char* szUserID, const char* szPassword);
void Logout(const char* szUserID);
//! IP제한을 거는 클래스를 넘긴다.
CLimitUserByIP* GetAllowIP() { return m_lpLimitUserByIP; }
private:
CChatServerConfig();
~CChatServerConfig();
static const char* ms_szDefaultSetupFileName;
typedef std::map<std::string, std::pair<std::string, unsigned long> > ChatToolAuthMap;
ChatToolAuthMap m_ChatToolAuthMap;
CLimitUserByIP* m_lpLimitUserByIP;
};
#endif

View File

@@ -0,0 +1,595 @@
#include "stdafx.h"
#include "ChatToolServerDispatch.h"
#include "ChatServerConfig.h"
#include "ChatGameServerDispatch.h"
#include "ChatClientDispatch.h"
#include "ChatLog.h"
#include <Network/Packet/ChatPacket.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <Network/Address/INET_Addr.h>
#include <Log/ServerLog.h>
#include <mmsystem.h>
#include <Network/Broadcast/ChatCharData.h>
CMultiDispatch& CChatToolServerDispatch::GetDispatchTable()
{
static CMultiDispatch multiDispatch;
return multiDispatch;
}
CChatAdminNames& CChatAdminNames::GetInstance()
{
static CChatAdminNames chatAdminNames;
return chatAdminNames;
}
bool CChatAdminNames::RegisterName(const char* szAdminName)
{
std::string adminName(szAdminName);
NameSet::iterator pos = m_NameSet.lower_bound(adminName);
NameSet::iterator end = m_NameSet.end();
return (pos == end || *pos != adminName) ? m_NameSet.insert(szAdminName).second : true;
}
bool CChatAdminNames::RemoveName(const char* szAdminName)
{
return 0 != m_NameSet.erase(szAdminName);
}
bool CChatAdminNames::HasName(const char* szAdminName)
{
return m_NameSet.end() != m_NameSet.find(szAdminName);
}
CChatToolServerDispatch::CChatToolServerDispatch(CSession& Session)
: CRylServerDispatch(Session, MAX_PACKET_DISPATCH_PER_PULSE),
m_bAuthorized(false), m_dwLastPingRecvTime(timeGetTime())
{
memset(m_szUserID, 0, sizeof(char) * ChatToolPkt::MAX_USER_ID);
memset(m_szPassword, 0, sizeof(char) * ChatToolPkt::MAX_PASSWORD);
memset(m_cChatOptions, 0, sizeof(char) * ChatToolPkt::ChatOption::MAX_OPTION);
}
void CChatToolServerDispatch::Connected()
{
DETLOG3(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/채팅 모니터링 툴이 연결되었습니다. ",
&GetSession(), this, GetRemoteAddr().get_addr_string());
}
void CChatToolServerDispatch::Disconnected()
{
DETLOG3(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/채팅 모니터링 툴이 연결이 끊겼습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string());
if (m_bAuthorized)
{
// 세션 셋에서 제거한다.
GetDispatchTable().RemoveDispatch(reinterpret_cast<unsigned long>(this));
CChatAdminNames::GetInstance().RemoveName(m_szUserID);
CChatServerConfig::GetInstance().Logout(m_szUserID);
}
}
bool CChatToolServerDispatch::Dispatch()
{
unsigned long dwCurrentTime = timeGetTime();
if (2 * 1000 * 60 < dwCurrentTime - m_dwLastPingRecvTime)
{
// 2분동안 Ping이 들어오지 않으면 접속 해제
DETLOG5(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/"
"핑 패킷을 보내지 않아서 끊습니다. : dwCurrentTime:%u / dwLastPingRecvTime:%u",
&GetSession(), this, GetRemoteAddr().get_addr_string(),
dwCurrentTime, m_dwLastPingRecvTime);
return false;
}
return CRylServerDispatch::Dispatch();
}
bool CChatToolServerDispatch::DispatchPacket(PktBase* lpPktBase)
{
if (lpPktBase->GetCmd() == ChatToolCMD::ChatPing)
{
CheckPing(lpPktBase);
}
else if (!m_bAuthorized)
{
if (lpPktBase->GetCmd() == ChatToolCMD::Authorize)
{
Authorize(lpPktBase);
}
else
{
DETLOG4(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/인증받지 않은 유저가 패킷 0x%02d를 전송하였습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string(), lpPktBase->GetCmd());
}
}
else
{
switch(lpPktBase->GetCmd())
{
case ChatToolCMD::ChangeOption:
ChangeOption(lpPktBase);
break;
case ChatToolCMD::ChatRequest:
ChatRequest(lpPktBase);
break;
case ChatToolCMD::ChatAdminStatus:
ChatAdminStatus(lpPktBase);
break;
}
}
return true;
}
bool CChatToolServerDispatch::Authorize(PktBase* lpPktBase)
{
m_bAuthorized = false;
ChatToolPkt::Authorize* lpAuthorize = static_cast<ChatToolPkt::Authorize*>(lpPktBase);
if (sizeof(ChatToolPkt::Authorize) != lpPktBase->GetLen())
{
DETLOG3(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/인증 패킷 길이가 맞지 않습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string());
}
else
{
// for prevent buffer overflow.
lpAuthorize->m_szUserID[ChatToolPkt::MAX_USER_ID - 1] = 0;
lpAuthorize->m_szPassword[ChatToolPkt::MAX_PASSWORD - 1] = 0;
if (CChatServerConfig::GetInstance().Authorize(
lpAuthorize->m_szUserID, lpAuthorize->m_szPassword))
{
// 인증 성공. 세션 셋에 추가한다. 전송의 대상이 된다.
m_bAuthorized = true;
memcpy(m_szUserID, lpAuthorize->m_szUserID, sizeof(char) * ChatToolPkt::MAX_USER_ID);
memcpy(m_szPassword, lpAuthorize->m_szPassword, sizeof(char) * ChatToolPkt::MAX_PASSWORD);
GetDispatchTable().SetDispatch(reinterpret_cast<unsigned long>(this), this);
CChatAdminNames::GetInstance().RegisterName(m_szUserID);
DETLOG3(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/인증에 성공했습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string());
}
else
{
DETLOG5(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/인증에 실패했습니다. ID:%s/Password:%s",
&GetSession(), this, GetRemoteAddr().get_addr_string(),
lpAuthorize->m_szUserID, lpAuthorize->m_szPassword);
}
}
char* szBuffer = m_SendStream.GetBuffer(sizeof(ChatToolPkt::Authorize));
if (0 != szBuffer)
{
ChatToolPkt::Authorize* lpAuthResult = reinterpret_cast<ChatToolPkt::Authorize*>(szBuffer);
*lpAuthResult = *lpAuthorize;
lpAuthResult->m_cResult = m_bAuthorized ? 1 : 0;
if (!m_SendStream.WrapCrypt(sizeof(ChatToolPkt::Authorize), ChatToolCMD::Authorize, 0, 0))
{
ERRLOG4(g_Log, "SS:0x%08x/DP:0x%08x/ID:%16s/IP:%15s/ChatMonitor/인증 결과 전송에 실패했습니다. /",
&GetSession(), this, lpAuthorize->m_szUserID, GetRemoteAddr().get_addr_string());
}
}
return m_bAuthorized;
}
bool CChatToolServerDispatch::ChangeOption(PktBase* lpPktBase)
{
if (sizeof(ChatToolPkt::ChatOption) != lpPktBase->GetLen())
{
DETLOG3(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/옵션 변경 패킷 길이가 맞지 않습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string());
return false;
}
ChatToolPkt::ChatOption* lpChatOption = static_cast<ChatToolPkt::ChatOption*>(lpPktBase);
memcpy(m_cChatOptions, lpChatOption->m_cChatOption,
sizeof(char) * ChatToolPkt::ChatOption::MAX_OPTION);
return true;
}
bool CChatToolServerDispatch::ChatRequest(PktBase* lpPktBase)
{
ChatToolPkt::ChatRequest* lpChatRequest = static_cast<ChatToolPkt::ChatRequest*>(lpPktBase);
unsigned short usError = 0;
if (lpPktBase->GetLen() < sizeof(ChatToolPkt::ChatRequest) ||
lpChatRequest->m_cChatMsgLen + sizeof(ChatToolPkt::ChatRequest) != lpPktBase->GetLen())
{
usError = ChatToolPkt::ChatRequest::PACKET_ERROR;
DETLOG4(g_Log, "SS:0x%08x/DP:0x%08x/IP:%15s/ChatMonitor/Len:%d/채팅 요청 패킷 길이가 맞지 않습니다.",
&GetSession(), this, GetRemoteAddr().get_addr_string(), lpPktBase->GetLen());
}
else
{
// 버퍼 오버플로우 방지.
lpChatRequest->m_szAdminName[ChatToolPkt::MAX_CHAR_NAME - 1] = 0;
lpChatRequest->m_szTargetName[ChatToolPkt::MAX_CHAR_NAME - 1] = 0;
*(reinterpret_cast<char*>(lpChatRequest + 1) + lpChatRequest->m_cChatMsgLen - 1) = 0;
BattleInclination::CharData charData;
memset(&charData, 0, sizeof(BattleInclination::CharData));
charData.m_dwCID = 0; // 캐릭터 CID
charData.m_dwGID = 0; // 캐릭터 GID
charData.m_dwCastleID = 0; // 공성 병기인 경우, 속한 성의 ID를 넣음.
charData.m_cSiegeState = 0; // 공성 병기인 경우, 공성 병기 상태를 넣음.
charData.m_cNation = Creature::KARTERANT; // 캐릭터 국적
charData.m_cAdminLevel = 1;
charData.m_cFlags = 0; // 기타 정보
ChatData::CCharInfoMap& charInfoMap = ChatData::CCharInfoMap::GetInstance();
ChatData::CCharInfo* lpChatData = 0;
switch(lpChatRequest->m_cChatType)
{
case PktChat::ADMIN_SHOUT:
case PktChat::SHOUT:
{
char szMessage[PktChat::PktChatMaxSize];
int nMsgLen = _snprintf(szMessage, PktChat::PktChatMaxSize - 1,
"%s : %s", lpChatRequest->m_szAdminName, reinterpret_cast<char*>(lpChatRequest + 1));
szMessage[PktChat::PktChatMaxSize - 1] = 0;
if (0 < nMsgLen)
{
CServerChatPacket serverChatPacket(szMessage,
static_cast<PktChat::PktChatCmd>(lpChatRequest->m_cChatType), 0,
charData, lpChatRequest->m_szAdminName);
if (serverChatPacket.IsValid())
{
// 각 게임서버에 모두 전송한다.
CChatGameServerDispatch::GetDispatchTable().Process(
CSendChatAllGameServer(serverChatPacket));
CChatLog::GetInstance().AdminLog(0, 0, m_szUserID,
lpChatRequest->m_szAdminName, lpChatRequest->m_szTargetName,
szMessage, lpChatRequest->m_cChatType, 0);
}
else
{
usError = ChatToolPkt::ChatRequest::PACKET_ERROR;
}
}
else
{
usError = ChatToolPkt::ChatRequest::PACKET_ERROR;
}
}
break;
case PktChat::WHISPER:
switch(lpChatRequest->m_cTargetType)
{
case ChatToolPkt::TARGET_UID:
lpChatData = charInfoMap.GetCharInfoByUID(lpChatRequest->m_dwUID);
break;
case ChatToolPkt::TARGET_CHARNAME:
lpChatData = charInfoMap.GetCharInfoByName(lpChatRequest->m_szTargetName);
break;
case ChatToolPkt::TARGET_ACCOUNTNAME:
lpChatData = charInfoMap.GetCharInfoByAccountName(lpChatRequest->m_szTargetName);
break;
}
if (0 != lpChatData)
{
const char* szMessage = reinterpret_cast<char*>(lpChatRequest + 1);
unsigned long dwTargetCID = lpChatData->GetCID();
CServerChatPacket serverChatPacket(szMessage,
static_cast<PktChat::PktChatCmd>(lpChatRequest->m_cChatType), 0,
charData, lpChatRequest->m_szAdminName, &dwTargetCID, 1);
GET_MULTI_DISPATCH(lpDispatch, lpChatData->GetServerID(),
CChatGameServerDispatch, CChatGameServerDispatch::GetDispatchTable());
if (0 != lpDispatch && serverChatPacket.IsValid())
{
// 게임서버로 전송한다.
lpDispatch->GetSendStream().PutBuffer(
serverChatPacket.GetCompressedPacket(),
serverChatPacket.GetCompressedSize(), CmdCharChat);
// 전송 성공한 UID를 세팅해준다.
lpChatRequest->m_dwUID = lpChatData->GetUID();
// 전송 성공한 CCID를 세팅해준다.
lpChatRequest->m_dwCID = lpChatData->GetCID();
// 로그를 남긴다.
CChatLog::GetInstance().AdminLog(lpChatData->GetUID(), dwTargetCID,
m_szUserID, lpChatRequest->m_szAdminName, lpChatRequest->m_szTargetName,
szMessage, lpChatRequest->m_cChatType, 0);
}
else
{
usError = ChatToolPkt::ChatRequest::PACKET_ERROR;
}
}
else
{
usError = ChatToolPkt::ChatRequest::NONE_CHARACTER;
}
break;
default:
usError = ChatToolPkt::ChatRequest::PACKET_ERROR;
break;
}
}
GetSendStream().WrapCompress(reinterpret_cast<char*>(lpChatRequest),
sizeof(ChatToolPkt::ChatRequest), ChatToolCMD::ChatRequest, 0, usError);
return (0 == usError);
}
bool CChatToolServerDispatch::SendChatMessage(ChatData::CCharInfo& charInfo,
const char* szChatMsg, const char* szTargetName,
unsigned short usXPos, unsigned short usZPos,
unsigned char cChatMsgType, unsigned short usLang, bool bTargetIsToolAdmin)
{
// Dispatch 옵션 가지고 Culling 필요.
if (0 == m_cChatOptions[ChatToolPkt::ChatOption::DO_LISTEN])
{
// 안듣고 싶으면 듣지 않는다.
return true;
}
unsigned char cOptionIndex = 0;
switch(cChatMsgType)
{
case PktChat::NORMAL: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_NORMAL_CHAT; break;
case PktChat::PARTY: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_PARTY_CHAT; break;
case PktChat::DICE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_DICE_CHAT; break;
case PktChat::FRIEND: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_FRIEND_CHAT; break;
case PktChat::GUILD: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_GUILD_CHAT; break;
case PktChat::STALL:
case PktChat::CAMP_SHOP:
cOptionIndex = ChatToolPkt::ChatOption::LISTEN_STALL_CHAT;
break;
case PktChat::TRADE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_TRADE_CHAT; break;
case PktChat::SHOUT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_SHOUT_CHAT; break;
case PktChat::ADMIN_NORMAL_CHAT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_ADMIN_NORMAL_CHAT; break;
case PktChat::ADMIN_SHOUT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_ADMIN_SHOUT; break;
case PktChat::WHISPER: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_WHISPER_CHAT; break;
case PktChat::NOTICE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_NOTICE; break;
}
if (!bTargetIsToolAdmin && 0 == m_cChatOptions[cOptionIndex])
{
// 듣고 싶지 않은 채팅 타입은 듣지 않는다.
return true;
}
char szBuffer[sizeof(ChatToolPkt::ChatDataSend) + PktChat::PktChatMaxSize + 1];
ChatToolPkt::ChatDataSend* lpChatDataSend = reinterpret_cast<ChatToolPkt::ChatDataSend*>(szBuffer);
char* szWriteChatMsg = reinterpret_cast<char*>(lpChatDataSend + 1);
lpChatDataSend->m_dwUID = charInfo.GetUID();
lpChatDataSend->m_dwCID = charInfo.GetCID();
lpChatDataSend->m_dwServerID = charInfo.GetServerID();
lpChatDataSend->m_usLang = usLang;
lpChatDataSend->m_cRace = charInfo.GetRace();
strncpy(lpChatDataSend->m_szSenderName,
charInfo.GetName(), CHAR_INFOST::MAX_NAME_LEN);
lpChatDataSend->m_szSenderName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
if (0 != szTargetName)
{
strncpy(lpChatDataSend->m_szTargetName,
szTargetName, CHAR_INFOST::MAX_NAME_LEN);
lpChatDataSend->m_szTargetName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
}
else
{
memset(lpChatDataSend->m_szTargetName, 0,
sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
}
lpChatDataSend->m_usXPos = usXPos;
lpChatDataSend->m_usZPos = usZPos;
lpChatDataSend->m_cChatType = cChatMsgType;
size_t nChatMsgLen = strlen(szChatMsg);
if (PktChat::PktChatMaxSize <= nChatMsgLen)
{
nChatMsgLen = PktChat::PktChatMaxSize - 1;
}
lpChatDataSend->m_cChatMsgLen = static_cast<unsigned char>(nChatMsgLen);
memcpy(szWriteChatMsg, szChatMsg, lpChatDataSend->m_cChatMsgLen);
szWriteChatMsg[PktChat::PktChatMaxSize - 1] = 0;
return GetSendStream().WrapCompress(szBuffer,
sizeof(ChatToolPkt::ChatDataSend) + lpChatDataSend->m_cChatMsgLen, ChatToolCMD::ChatSend, 0, 0);
}
bool CChatToolServerDispatch::SendChatMessage(unsigned long dwTargetUID, unsigned long dwTargetCID,
const char* szSenderName, const char* szTargetName,
const char* szChatMsg, unsigned char cChatMsgType, unsigned short usLang)
{
// Dispatch 옵션 가지고 Culling 필요.
if (0 == m_cChatOptions[ChatToolPkt::ChatOption::DO_LISTEN])
{
// 안듣고 싶으면 듣지 않는다.
return true;
}
unsigned char cOptionIndex = 0;
switch(cChatMsgType)
{
case PktChat::NORMAL: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_NORMAL_CHAT; break;
case PktChat::PARTY: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_PARTY_CHAT; break;
case PktChat::DICE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_DICE_CHAT; break;
case PktChat::FRIEND: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_FRIEND_CHAT; break;
case PktChat::GUILD: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_GUILD_CHAT; break;
case PktChat::STALL:
case PktChat::CAMP_SHOP:
cOptionIndex = ChatToolPkt::ChatOption::LISTEN_STALL_CHAT;
break;
case PktChat::TRADE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_TRADE_CHAT; break;
case PktChat::SHOUT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_SHOUT_CHAT; break;
case PktChat::ADMIN_NORMAL_CHAT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_ADMIN_NORMAL_CHAT; break;
case PktChat::ADMIN_SHOUT: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_ADMIN_SHOUT; break;
case PktChat::WHISPER: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_WHISPER_CHAT; break;
case PktChat::NOTICE: cOptionIndex = ChatToolPkt::ChatOption::LISTEN_NOTICE; break;
}
if (0 == m_cChatOptions[cOptionIndex])
{
// 듣고 싶지 않은 채팅 타입은 듣지 않는다.
return true;
}
char szBuffer[sizeof(ChatToolPkt::ChatDataSend) + PktChat::PktChatMaxSize + 1];
ChatToolPkt::ChatDataSend* lpChatDataSend = reinterpret_cast<ChatToolPkt::ChatDataSend*>(szBuffer);
char* szWriteChatMsg = reinterpret_cast<char*>(lpChatDataSend + 1);
lpChatDataSend->m_dwUID = dwTargetUID;
lpChatDataSend->m_dwCID = dwTargetCID;
lpChatDataSend->m_usLang = usLang;
ChatData::CCharInfoMap& charInfoMap = ChatData::CCharInfoMap::GetInstance();
ChatData::CCharInfo* lpChatData = charInfoMap.GetCharInfoByUID(dwTargetUID);
// edith 2009.07.15 모니터링툴에서 계정으로 귓말보내기 버그수정.
// 이 부분은 챗툴에서만 들어가기 때문에 GM이 채팅을 강제로 보낸다면 Send도 GM이름이 아닌 다른
// 이름으로 선택한다.
if(lpChatData)
{
lpChatDataSend->m_dwServerID = lpChatData->GetServerID();
lpChatDataSend->m_cRace = lpChatData->GetRace();
strncpy(lpChatDataSend->m_szTargetName, lpChatData->GetName(), CHAR_INFOST::MAX_NAME_LEN);
lpChatDataSend->m_szTargetName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
}
else
{
lpChatDataSend->m_dwServerID = 0;
lpChatDataSend->m_cRace = 0;
if (0 != szTargetName)
{
strncpy(lpChatDataSend->m_szTargetName, szTargetName, CHAR_INFOST::MAX_NAME_LEN);
lpChatDataSend->m_szTargetName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
}
else
{
memset(lpChatDataSend->m_szTargetName, 0, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
}
}
strncpy(lpChatDataSend->m_szSenderName, szSenderName, CHAR_INFOST::MAX_NAME_LEN);
lpChatDataSend->m_szSenderName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
lpChatDataSend->m_usXPos = 0;
lpChatDataSend->m_usZPos = 0;
lpChatDataSend->m_cChatType = cChatMsgType;
size_t nChatMsgLen = strlen(szChatMsg);
if (PktChat::PktChatMaxSize <= nChatMsgLen)
{
nChatMsgLen = PktChat::PktChatMaxSize - 1;
}
lpChatDataSend->m_cChatMsgLen = static_cast<unsigned char>(nChatMsgLen);
memcpy(szWriteChatMsg, szChatMsg, lpChatDataSend->m_cChatMsgLen);
szWriteChatMsg[PktChat::PktChatMaxSize - 1] = 0;
return GetSendStream().WrapCompress(szBuffer,
sizeof(ChatToolPkt::ChatDataSend) + lpChatDataSend->m_cChatMsgLen, ChatToolCMD::ChatSend, 0, 0);
}
bool CChatToolServerDispatch::CheckPing(PktBase* lpPktBase)
{
m_dwLastPingRecvTime = timeGetTime();
char* szBuffer = GetSendStream().GetBuffer(sizeof(PktSyP));
if (0 != szBuffer)
{
PktSyP* lpPktSyP = reinterpret_cast<PktSyP*>(szBuffer);
lpPktSyP->m_dwTickTime = timeGetTime();
return GetSendStream().WrapCrypt(
sizeof(PktSyP), ChatToolCMD::ChatPing, 0, 0);
}
return false;
}
bool CChatToolServerDispatch::ChatAdminStatus(PktBase* lpPktBase)
{
if (lpPktBase->GetLen() != sizeof(ChatToolPkt::ChatAdminStatus))
{
return false;
}
ChatToolPkt::ChatAdminStatus* lpChatAdminStatus =
reinterpret_cast<ChatToolPkt::ChatAdminStatus*>(lpPktBase);
switch(lpChatAdminStatus->m_cChangeStatus)
{
case ChatToolPkt::ChatAdminStatus::LOGIN:
CChatAdminNames::GetInstance().RegisterName(m_szUserID);
break;
case ChatToolPkt::ChatAdminStatus::LOGOUT:
CChatAdminNames::GetInstance().RemoveName(m_szUserID);
break;
}
return true;
}

View File

@@ -0,0 +1,168 @@
#ifndef _GAMA_CHATSERVER_CHAT_TOOL_SERVER_DISPATCH_H_
#define _GAMA_CHATSERVER_CHAT_TOOL_SERVER_DISPATCH_H_
#include <Network/Dispatch/RylServerDispatch.h>
#include <Network/Dispatch/MultiDispatchStorage.h>
#include <Network/Packet/ChatToolPacketCmd.h>
#include <set>
#include <string>
#include <boost/pool/pool_alloc.hpp>
// forward decl.
class CChatCharInfo;
class CChatPosition;
namespace ChatData
{
class CCharInfo;
}
class CChatAdminNames
{
public:
static CChatAdminNames& GetInstance();
bool RegisterName(const char* szAdminName);
bool RemoveName(const char* szAdminName);
bool HasName(const char* szAdminName);
private:
typedef std::set<std::string, std::less<std::string>,
boost::fast_pool_allocator<std::string> > NameSet;
NameSet m_NameSet;
};
class CChatToolServerDispatch : public CRylServerDispatch
{
protected:
enum
{
MAX_PACKET_DISPATCH_PER_PULSE = 5,
MAX_STREAM_BUFFER_SIZE = 16000
};
public:
static CMultiDispatch& GetDispatchTable();
CChatToolServerDispatch(CSession& Session);
virtual void Connected();
virtual void Disconnected();
//! 인증되었는지 여부를 리턴.
bool IsAuthorized() const { return m_bAuthorized; }
bool SendChatMessage(ChatData::CCharInfo& charInfo,
const char* szChatMsg, const char* szTargetName,
unsigned short usXPos, unsigned short usZPos,
unsigned char cChatMsgType, unsigned short usLang, bool bTargetIsToolAdmin);
bool SendChatMessage(unsigned long dwTargetUID, unsigned long dwTargetCID,
const char* szSenderName, const char* szTargetName,
const char* szChatMsg, unsigned char cChatMsgType, unsigned short usLang);
private:
virtual bool Dispatch();
virtual bool DispatchPacket(PktBase* lpPktBase);
bool Authorize(PktBase* lpPktBase);
bool ChangeOption(PktBase* lpPktBase);
bool ChatRequest(PktBase* lpPktBase);
bool CheckPing(PktBase* lpPktBase);
bool ChatAdminStatus(PktBase* lpPktBase);
//! 변수 선언.
char m_szUserID[ChatToolPkt::MAX_USER_ID];
char m_szPassword[ChatToolPkt::MAX_PASSWORD];
char m_cChatOptions[ChatToolPkt::ChatOption::MAX_OPTION];
unsigned long m_dwLastPingRecvTime;
bool m_bAuthorized;
};
class CSendAllDispatch
{
public:
CSendAllDispatch(ChatData::CCharInfo& chatInfo,
const char* szChatMsg, const char* szTargetName,
unsigned short usXPos, unsigned short usZPos,
unsigned char cChatMsgType, unsigned short usLang, bool bTargetIsToolAdmin)
: m_chatInfo(chatInfo),
m_usXPos(usXPos),
m_usZPos(usZPos),
m_cChatMsgType(cChatMsgType),
m_szChatMsg(szChatMsg),
m_szTargetName(szTargetName),
m_usLang(usLang),
m_bTargetIsToolAdmin(bTargetIsToolAdmin)
{
}
bool operator() (unsigned long dwDispatchKey, CPacketDispatch& dispatch)
{
return static_cast<CChatToolServerDispatch&>(dispatch).SendChatMessage(
m_chatInfo, m_szChatMsg, m_szTargetName,
m_usXPos, m_usZPos, m_cChatMsgType, m_usLang, m_bTargetIsToolAdmin);
}
private:
ChatData::CCharInfo& m_chatInfo;
const char* m_szChatMsg;
const char* m_szTargetName;
unsigned short m_usXPos;
unsigned short m_usZPos;
unsigned short m_usLang;
unsigned char m_cChatMsgType;
unsigned char m_bTargetIsToolAdmin;
};
class CSendAdminDispatch
{
public:
CSendAdminDispatch(unsigned long dwTargetUID, unsigned long dwTargetCID,
const char* szSenderName, const char* szTargetName,
const char* szChatMsg, unsigned char cChatMsgType, unsigned short usLang)
: m_dwTargetUID(dwTargetUID), m_dwTargetCID(dwTargetCID),
m_szSenderName(szSenderName), m_szTargetName(szTargetName),
m_szChatMsg(szChatMsg), m_cChatMsgType(cChatMsgType), m_usLang(usLang)
{
}
bool operator() (unsigned long dwDispatchKey, CPacketDispatch& dispatch)
{
return static_cast<CChatToolServerDispatch&>(dispatch).SendChatMessage(
m_dwTargetUID, m_dwTargetCID, m_szSenderName, m_szTargetName, m_szChatMsg, m_cChatMsgType, m_usLang);
}
private:
unsigned long m_dwTargetUID;
unsigned long m_dwTargetCID;
const char* m_szSenderName;
const char* m_szTargetName;
const char* m_szChatMsg;
unsigned char m_cChatMsgType;
unsigned short m_usLang;
};
#endif

View File

@@ -0,0 +1,533 @@
#include "stdafx.h"
#include "RylChatServer.h"
#include "ChatClientDispatch.h"
#include "ChatGameServerDispatch.h"
#include "ChatAgentServerDispatch.h"
#include "ChatLog.h"
#include "ChatServerConfig.h"
#include "ChatToolServerDispatch.h"
#include <Network/IOCP/IOCPNet.h>
#include <Network/Session/CreatePolicy.h>
#include <Network/Packet/PacketCommand.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <Network/Packet/PacketStruct/ServerPacket.h>
#include <mmsystem.h>
#include <Utility/Setup/ServerSetup.h>
#include <Utility/Time/Pulse/Pulse.h>
#include <Utility/Debug/PerformanceCheck.h>
#include <Log/ServerLog.h>
#include <DB/DBComponent.h>
CRylChatServer& CRylChatServer::GetInstance()
{
static CRylChatServer chatServer;
return chatServer;
}
class CRylChatServerProcess : public CProcessThread
{
public:
CRylChatServerProcess(CRylChatServer& RylChatServer, unsigned long dwProcessTick)
: CProcessThread(RylChatServer, dwProcessTick),
m_RylChatServer(RylChatServer)
{
}
virtual void Cleanup(CPulse& Pulse)
{
ChatData::CCharInfoMap::GetInstance().Destroy();
}
virtual void InternalRun(CPulse& Pulse)
{
unsigned long dwLastTick = Pulse.GetLastTick();
unsigned long dwCurrentPulse = Pulse.GetCurrentPulse();
long dwTicksPerSec = Pulse.GetTicksPerSec();
#ifdef AUTH_MY
m_RylChatServer.Update( Pulse.GetCurrentPulse() );
#endif
// 콘솔 정보 업데이트
if (0 == (dwCurrentPulse % (3 * dwTicksPerSec)))
{
m_RylChatServer.PrintServerInfo();
m_RylChatServer.PrintStatistics();
}
// 퍼포먼스 로그 출력 (20분에 한번씩)
if (0 == (dwCurrentPulse % (20 * 60 * dwTicksPerSec)))
{
GetFunctionTimingResult("RowChatServer");
}
// 채금 리스트 프로세싱
if (0 == (dwCurrentPulse % (60 * dwTicksPerSec)))
{
ChatData::CCharInfoMap::GetInstance().ProcessCharChatBan(
CChatGameServerDispatch::GetDispatchTable());
}
// 연결 상태 flag세팅
if (0 == (dwCurrentPulse % (5 * dwTicksPerSec)))
{
unsigned long dwStatusFlag = 0;
if (0 != CChatAgentServerDispatch::GetDispatchTable().GetDispatchNum())
{
dwStatusFlag |= (1 << CServerSetup::AgentServer);
}
m_RylChatServer.SetStatusFlag(dwStatusFlag);
}
}
private:
CRylChatServer& m_RylChatServer;
};
CRylChatServer::CRylChatServer()
: m_lpClientPolicy(0),
m_lpGameServerPolicy(0),
m_lpAgentSessionPolicy(0),
m_lpChatToolPolicy(0),
m_tServerStart(0)
{
}
CRylChatServer::~CRylChatServer()
{
#define SAFE_CHAT_RELEASE(p) if (p) { (p)->Release(); (p) = 0; }
SAFE_CHAT_RELEASE(m_lpClientPolicy);
SAFE_CHAT_RELEASE(m_lpGameServerPolicy);
SAFE_CHAT_RELEASE(m_lpAgentSessionPolicy);
SAFE_CHAT_RELEASE(m_lpChatToolPolicy);
}
bool CRylChatServer::ApplicationSpecificInit(const TCHAR* szCmdLine)
{
#define CHAT_INIT_ERR(detailText) TEXT("ChatServer initialize failed - "##detailText)
const TCHAR* szErrorMessage = 0;
// 서버 셋업 초기화 - 그 다음으로 해야 한다.
if (!CServerSetup::GetInstance().Initialize(CServerSetup::ChatServer))
{
szErrorMessage = CHAT_INIT_ERR("ServerSetup initialize failed");
}
else if (!InitializeCommand())
{
// 서버 커맨드 초기화
szErrorMessage = CHAT_INIT_ERR("Server command init failed");
}
else if (!InitializeMsgProc())
{
// 서버 메시지 프로시저 초기화
szErrorMessage = CHAT_INIT_ERR("Server message proc init failed");
}
else if (!CChatServerConfig::GetInstance().LoadSetup())
{
// 채팅서버 설정파일 읽어오기 셋업
szErrorMessage = CHAT_INIT_ERR("ChatSetupFile load failed");
}
else if (0 == (m_lpGameServerPolicy = SessionPolicy::CreateTCPPolicy<CChatGameServerDispatch>()))
{
// 게임 서버가 붙는 Dispatch 생성
szErrorMessage = CHAT_INIT_ERR("CChatGameServerDispatch policy create failed");
}
else if (0 == (m_lpChatToolPolicy = SessionPolicy::CreateTCPPolicy<CChatToolServerDispatch>()))
{
// 채팅 모니터링 툴이 붙는 Dispatch 생성
szErrorMessage = CHAT_INIT_ERR("CChatToolServerDispatch policy create failed");
}
else if (!GetIOCPNet()->AddListener(m_lpGameServerPolicy, 0, CServerSetup::ChatServerGameServerListen))
{
// 게임 서버가 붙는 Listener 생성
szErrorMessage = CHAT_INIT_ERR("GameServerListener create failed");
}
else if (!GetIOCPNet()->AddListener(m_lpChatToolPolicy, 0,
CServerSetup::ChatServerMonitoringToolListen, 10,
CChatServerConfig::GetInstance().GetAllowIP()))
{
// 채팅 모니터링 톨이 붙는 Listener 생성
szErrorMessage = CHAT_INIT_ERR("ChatToolListener create failed");
}
else if (!AddProcessThread(new CRylChatServerProcess(*this, 100)))
{
szErrorMessage = CHAT_INIT_ERR("CRylChatServerProcess add failed");
}
else if (!CDBSingleObject::GetInstance().Connect(CDBComponent::Class_AdminDB))
{
// 운영 DB 접속 (채팅 금지용)
szErrorMessage = "Admin DB connect failed.";
}
#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;
}
m_tServerStart = time(NULL);
ConnectToAgentServer();
DETLOG0(g_Log, "채팅서버를 시작합니다.");
return true;
}
#ifdef AUTH_MY
void CRylChatServer::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, "8269886794deb52939753f9857918ddc") == 0) // nfchat
{
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 CRylChatServer::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 CRylChatServer::EventConnect(BOOL bConnect)
{
CPacketEvent::EventConnect(bConnect);
m_EasyCmd = 0;
m_dwServerType = AT_CHAT;
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_CHAT, 0), strMD5);
m_Counter = 61;
}
}
static int iExitLoopCount = 0;
void CRylChatServer::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 = 62;
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 CRylChatServer::PrintStatistics()
{
CIOCPNet* lpIOCPNet = GetIOCPNet();
if (0 != lpIOCPNet)
{
PrintOutput("Accept Pending : %d / Session : %d",
lpIOCPNet->GetAcceptPendingNum(), lpIOCPNet->GetSessionNum());
}
}
int CRylChatServer::MakeChatLog(char* szBuffer, size_t nBufferLength)
{
time_t tCurrent = time(NULL);
time_t tDiffTime = tCurrent - m_tServerStart;
time_t tDiffHour = tDiffTime / 3600;
time_t tDiffMinute = (tDiffTime % 3600) / 60;
time_t tDiffSecond = (tDiffTime % 3600) % 60;
struct tm tmServerStart = *localtime(&m_tServerStart);
struct tm tmCurrent = *localtime(&tCurrent);
CChatLog& chatLog = CChatLog::GetInstance();
return _snprintf(szBuffer, nBufferLength,
"Server Start Time : %04dyear %02dmon %02dday %02dhour %02dmin %02dsec\r\n"
"Current Server Time : %04dyear %02dmon %02dday %02dhour %02dmin %02dsec\r\n"
"Server Operate Time : %02dhour %02dmin %02dsec\r\n"
"Chatting Count : %20I64u \r\n"
"Chatting Data Amount : %20I64uBytes \r\n"
" (%20I64uKbytes) \r\n"
" (%20I64uMBytes) \r\n",
tmServerStart.tm_year + 1900, tmServerStart.tm_mon + 1, tmServerStart.tm_mday,
tmServerStart.tm_hour, tmServerStart.tm_min, tmServerStart.tm_sec,
tmCurrent.tm_year + 1900, tmCurrent.tm_mon, tmCurrent.tm_mday,
tmCurrent.tm_hour, tmCurrent.tm_min, tmCurrent.tm_sec,
tDiffHour, tDiffMinute, tDiffSecond,
chatLog.GetLogNum(),
chatLog.GetLogDataSize(),
chatLog.GetLogDataSize() / 1024,
chatLog.GetLogDataSize() / 1024 / 1024);
}
class CMakeGameServerString
{
public:
CMakeGameServerString(char* szBuffer, int nMaxLength, int& nUsed)
: m_szBuffer(szBuffer), m_nMaxLength(nMaxLength), m_nUsed(nUsed) { m_nUsed = 0; }
bool operator () (unsigned long dwServerID, CPacketDispatch& dispatch)
{
int nLength = _snprintf(m_szBuffer + m_nUsed, m_nMaxLength - m_nUsed,
"Game Server Connected (0x%08x).\r\n", dwServerID);
if (0 < nLength)
{
m_nUsed += nLength;
}
return true;
}
private:
char* m_szBuffer;
int m_nMaxLength;
int& m_nUsed;
};
void CRylChatServer::PrintServerInfo()
{
const int MAX_BUFFER = 4096;
char szBuffer[MAX_BUFFER];
szBuffer[0] = 0;
GET_SINGLE_DISPATCH(lpChatAgentDispatch, CChatAgentServerDispatch,
CChatAgentServerDispatch::GetDispatchTable());
int nUsedBytes = _snprintf(szBuffer, MAX_BUFFER, "Connected DBAgentServer %s\r\n",
NULL != lpChatAgentDispatch ? "Succeed" : "Failed");
if (0 < nUsedBytes)
{
int nLength = 0;
CChatGameServerDispatch::GetDispatchTable().Process(
CMakeGameServerString(szBuffer + nUsedBytes, MAX_BUFFER - nUsedBytes, nLength));
if (0 <= nLength)
{
nUsedBytes += nLength;
nUsedBytes += MakeChatLog(szBuffer + nUsedBytes, MAX_BUFFER - nUsedBytes);
if (0 < nUsedBytes)
{
PrintInfo(szBuffer);
}
}
}
}
void CRylChatServer::ConnectToAgentServer()
{
GET_SINGLE_DISPATCH(lpChatAgentDispatch, CChatAgentServerDispatch,
CChatAgentServerDispatch::GetDispatchTable());
if (0 == lpChatAgentDispatch)
{
if (0 != m_lpAgentSessionPolicy)
{
m_lpAgentSessionPolicy->Release();
m_lpAgentSessionPolicy = 0;
}
m_lpAgentSessionPolicy = SessionPolicy::CreateTCPPolicy<CChatAgentServerDispatch>();
INET_Addr& agentServerAddr =
CServerSetup::GetInstance().GetServerAddress(CServerSetup::AgentServer);
if (!GetIOCPNet()->Connect(m_lpAgentSessionPolicy,
agentServerAddr.get_addr_string(), agentServerAddr.get_port_in()))
{
ERRLOG1(g_Log, "중계 서버(%16s)에 연결할 수 없습니다.", agentServerAddr.get_addr_string());
}
}
}
void CRylChatServer::ReloadSetup()
{
if (true != CServerSetup::GetInstance().Initialize(CServerSetup::ChatServer))
{
ERRLOG0(g_Log, "ServerSetup reinitialize failed.");
}
else if(true != CChatServerConfig::GetInstance().LoadSetup())
{
ERRLOG0(g_Log, "ChatServerConfig reinitialize failed.");
}
else
{
PrintOutput("ServerSetup, ChatServerConfig reload success.");
}
}

View File

@@ -0,0 +1,60 @@
#ifndef _RYL_CHAT_SERVER_H_
#define _RYL_CHAT_SERVER_H_
#include <Utility/ServerAppFramework/ServerWindowFramework.h>
#ifdef AUTH_MY
#include "NFAuthClient/AuthClient.h"
#endif
// 전방 참조
class CSessionPolicy;
class CRylChatServer : public CServerWindowFramework
#ifdef AUTH_MY
, public CPacketEvent
#endif
{
public:
static CRylChatServer& GetInstance();
// Desc : 중계서버로 연결한다.
void ConnectToAgentServer();
// Desc : RylChatCommands에서 호출하는 함수들.
void PrintStatistics();
void PrintServerInfo();
void ReloadSetup();
int MakeChatLog(char* szBuffer, size_t nBufferLength);
#ifdef AUTH_MY
public:
virtual void EventConnect(BOOL bConnect);
virtual void EventIRC(CHAR* strCmd, CHAR* strMsg);
virtual void EventCMD(DWORD dwCmd, DWORD dwValue);
void Update(unsigned long dwTick);
#endif
private:
virtual bool ApplicationSpecificInit(const TCHAR* szCmdLine);
bool InitializeCommand();
bool InitializeMsgProc();
CRylChatServer();
virtual ~CRylChatServer();
CSessionPolicy* m_lpClientPolicy;
CSessionPolicy* m_lpGameServerPolicy;
CSessionPolicy* m_lpAgentSessionPolicy;
CSessionPolicy* m_lpChatToolPolicy;
time_t m_tServerStart;
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

View File

@@ -0,0 +1,146 @@
// 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", "ROWChatServer"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "ROWChatServer"
VALUE "LegalCopyright", "Copyright (c) - 2009"
VALUE "OriginalFilename", "RYLChatServer.exe"
VALUE "ProductName", "ROWChatServer"
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
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU MENU
BEGIN
POPUP "Chatting Server"
BEGIN
POPUP "Console"
BEGIN
MENUITEM "Open Console", ID_START_CONSOLE
MENUITEM "Close Console", ID_STOP_CONSOLE
END
POPUP "Connect"
BEGIN
MENUITEM "Connect To DBAgent", ID_CONNECT_TO_AGENT
END
MENUITEM SEPARATOR
MENUITEM "Shutdown", ID_QUIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON "RylChatServer.ico"
#endif // Çѱ¹¾î resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,403 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="RylChatServer"
ProjectGUID="{BDE6A15B-0C26-444A-8115-CBA9221FCA0C}"
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)/RylChatServer.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylChatServer.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)/RylChatServer.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)/RylChatServer.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)/RylChatServer.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylChatServer.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)/RylChatServer.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)/RylChatServer.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT.lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/RylChatServer.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=".\ChatAgentServerDispatch.cpp">
</File>
<File
RelativePath=".\ChatClientDispatch.cpp">
</File>
<File
RelativePath=".\ChatGameServerDispatch.cpp">
</File>
<File
RelativePath=".\ChatLog.cpp">
</File>
<File
RelativePath=".\ChatPosition.cpp">
</File>
<File
RelativePath=".\ChatSend.cpp">
</File>
<File
RelativePath=".\ChatServerConfig.cpp">
</File>
<File
RelativePath=".\ChatToolServerDispatch.cpp">
</File>
<File
RelativePath=".\RylChatServer.cpp">
</File>
<File
RelativePath=".\RylChatServerCommands.cpp">
</File>
<File
RelativePath=".\RylChatServerMain.cpp">
</File>
<File
RelativePath=".\RylChatServerWindow.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=".\ChatAgentServerDispatch.h">
</File>
<File
RelativePath=".\ChatClientDispatch.h">
</File>
<File
RelativePath=".\ChatGameServerDispatch.h">
</File>
<File
RelativePath=".\ChatLog.h">
</File>
<File
RelativePath=".\ChatPosition.h">
</File>
<File
RelativePath=".\ChatSend.h">
</File>
<File
RelativePath=".\ChatServerConfig.h">
</File>
<File
RelativePath=".\ChatToolServerDispatch.h">
</File>
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath=".\RylChatServer.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=".\RylChatServer.ico">
</File>
<File
RelativePath=".\RylChatServer.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,343 @@
<?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>{BDE6A15B-0C26-444A-8115-CBA9221FCA0C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Executable/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">../../Intermediate/$(ProjectName)/$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">true</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_MY|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release_NoGD|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IncludePath);C:\project\trunk\Client\Library\dxx8\include</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\project\trunk\Client\Library\dxx8\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../;./;../BaseLibrary;../RylServerLibrary;../RylGameLibrary;../MemoryManager;../NFAuthClient;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<OpenMPSupport>
</OpenMPSupport>
</ClCompile>
<Link>
<OutputFile>$(OutDir)RylChatServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylChatServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<EnableUAC>true</EnableUAC>
<DataExecutionPrevention>false</DataExecutionPrevention>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
</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)RylChatServer.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)RylChatServer.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)RylChatServer.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylChatServer.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)RylChatServer.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)RylChatServer.exe</OutputFile>
<IgnoreSpecificDefaultLibraries>MSVCRT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)RylChatServer.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ChatAgentServerDispatch.cpp" />
<ClCompile Include="ChatClientDispatch.cpp" />
<ClCompile Include="ChatGameServerDispatch.cpp" />
<ClCompile Include="ChatLog.cpp" />
<ClCompile Include="ChatPosition.cpp" />
<ClCompile Include="ChatSend.cpp" />
<ClCompile Include="ChatServerConfig.cpp" />
<ClCompile Include="ChatToolServerDispatch.cpp" />
<ClCompile Include="RylChatServer.cpp" />
<ClCompile Include="RylChatServerCommands.cpp" />
<ClCompile Include="RylChatServerMain.cpp" />
<ClCompile Include="RylChatServerWindow.cpp" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ChatAgentServerDispatch.h" />
<ClInclude Include="ChatClientDispatch.h" />
<ClInclude Include="ChatGameServerDispatch.h" />
<ClInclude Include="ChatLog.h" />
<ClInclude Include="ChatPosition.h" />
<ClInclude Include="ChatSend.h" />
<ClInclude Include="ChatServerConfig.h" />
<ClInclude Include="ChatToolServerDispatch.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="RylChatServer.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<None Include="RylChatServer.ico" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylChatServer.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BaseLibrary\BaseLibrary.vcxproj">
<Project>{585cfc82-602a-466b-8e86-1a4fd1d442ca}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\MemoryManager\MemoryManager.vcxproj">
<Project>{7b602b2e-c629-4311-b7f6-c9177660ada1}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\RylGameLibrary\RylGameLibrary.vcxproj">
<Project>{3d6dc807-f1db-4f12-8755-4f15fc0b8824}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\RylServerLibrary\RylServerLibrary.vcxproj">
<Project>{91662620-ceb4-4184-b1e5-7ea48a8e2f8d}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\ScriptEngine\ScriptEngine.vcxproj">
<Project>{8ee86398-fbbb-4568-98cf-4a890da9d636}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\zlib\zlib.vcxproj">
<Project>{716d4c86-6d38-4f08-acae-109bf8bc92bd}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<Private>true</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ChatAgentServerDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatClientDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatGameServerDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatLog.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatPosition.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatSend.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatServerConfig.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="ChatToolServerDispatch.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylChatServer.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylChatServerCommands.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylChatServerMain.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="RylChatServerWindow.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ChatAgentServerDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatClientDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatGameServerDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatLog.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatPosition.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatSend.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatServerConfig.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="ChatToolServerDispatch.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="RylChatServer.h">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="RylChatServer.ico">
<Filter>리소스 파일</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RylChatServer.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,141 @@
#include "stdafx.h"
#include "RylChatServer.h"
#include <BaseLibrary/Log/ServerLog.h>
#include <BaseLibrary/Network/IOCP/IOCPNet.h>
#include <RylServerLibrary/Utility/ServerAppFrameWork/ConsoleWindow/ConsoleCMDFactory.h>
#include <Network/Packet/PacketStatistics.h>
#include "ChatLog.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 CCMDShowStatistics : public CConsoleCMDSingleton<CCMDShowStatistics>
{
protected:
virtual bool DoProcess()
{
CRylChatServer::GetInstance().PrintStatistics();
CRylChatServer::GetInstance().PrintServerInfo();
return true;
}
};
class CCMDPrintLog : public CConsoleCMDSingleton<CCMDPrintLog>
{
protected:
virtual bool DoProcess()
{
const int MAX_BUFFER = 4096;
char szBuffer[MAX_BUFFER];
if(CRylChatServer::GetInstance().MakeChatLog(szBuffer, MAX_BUFFER))
{
SERLOG1(g_Log, "채팅 통계를 남깁니다 : \r\n%s", szBuffer);
}
return true;
}
};
class CCMDFlush : public CConsoleCMDSingleton<CCMDFlush>
{
protected:
virtual bool DoProcess()
{
SERLOG0(g_Log, "로그를 Flush합니다");
SERLOG0(g_SessionLog, "로그를 Flush합니다.");
CChatLog::GetInstance().Flush();
return true;
}
};
class CCMDConnect : public CConsoleCMDSingleton<CCMDConnect>
{
protected:
virtual bool DoProcess()
{
CRylChatServer::GetInstance().ConnectToAgentServer();
return true;
}
};
class CCMDReloadSetup : public CConsoleCMDSingleton<CCMDReloadSetup>
{
protected:
virtual bool DoProcess()
{
CRylChatServer::GetInstance().ReloadSetup();
return true;
}
};
class CCMDNewLog : public CConsoleCMDSingleton<CCMDNewLog>
{
protected:
virtual bool DoProcess()
{
if (!g_ChattingLog.NewLog())
{
SERLOG1(g_Log, "this:0x%p/New chatlog make failed", this);
return false;
}
if (!g_Log.NewLog())
{
SERLOG1(g_Log, "this:0x%p/New serverlog make failed", this);
return false;
}
return true;
}
};
bool CRylChatServer::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("pool", CCMDShowStatistics, szErrorMessage);
ADD_COMMAND("log", CCMDPrintLog, szErrorMessage);
ADD_COMMAND("flush", CCMDFlush, szErrorMessage);
ADD_COMMAND("connect", CCMDConnect, szErrorMessage);
ADD_COMMAND("reloadsetup", CCMDReloadSetup, 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,69 @@
// RylChatServer.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "Resource.h"
#include <Thread/Lock.h> // CNamedMutex
#include <Log/ServerLog.h>
#include <Utility/Debug/ExceptionReport.h> // g_CExceptionReport
#include "RylChatServer.h" // CRylChatServerWindow
void __cdecl report_failure(int code, void * unused)
{
SERLOG0(g_Log, "Stack buffer overrun occured. shutdown server.");
SERLOG0(g_SessionLog, "Stack buffer overrun occured. shutdown server.");
// 일부러 Exception을 내서 덤프를 남긴다.
__try
{
int nZero = 0;
int nError = 10 / nZero;
}
__except(UnhandledExceptionFilter(GetExceptionInformation()))
{
SERLOG0(g_Log, "Shit!");
}
exit(1);
}
int WINAPI ExceptionUserFunc(TCHAR* szBuffer, const int nBufferSize)
{
SERLOG0(g_Log, "Flush log");
SERLOG0(g_SessionLog, "Flush log");
return _snprintf(szBuffer, nBufferSize, "Userdata flush completed.");
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CNamedMutex Mutex("RowChatServer", TRUE);
if(GetLastError() == ERROR_ALREADY_EXISTS)
{
ERRLOG0(g_Log, "Already chat server exist. shutdown chatserver and restart");
return 0;
}
// Exception 관련 설정
//_set_security_error_handler(report_failure);
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);
CRylChatServer& ChatServer = CRylChatServer::GetInstance();
if(ChatServer.Initialize(hInstance, "Chat Server", lpCmdLine, IDI_MAIN, IDR_MENU))
{
ChatServer.ProcessMessage();
}
return 0;
}

View File

@@ -0,0 +1,68 @@
#include "stdafx.h"
#include "Resource.h"
#include "RylChatServer.h"
#include <Log/ServerLog.h>
#include <Utility/ServerAppFramework/MsgProc/MsgProc.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleWindow.h>
#include <Utility/ServerAppFramework/ConsoleWindow/ConsoleCMDFactory.h>
class CProcessCOMMAND : public CMsgProc
{
public:
CProcessCOMMAND(CConsoleWindow& ConsoleWindow) : m_ConsoleWindow(ConsoleWindow) { }
virtual ~CProcessCOMMAND() { }
virtual LRESULT operator () (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char* szCommand = 0;
switch (LOWORD(wParam))
{
case ID_START_CONSOLE: m_ConsoleWindow.Initialize("RowChatServer"); break;
case ID_STOP_CONSOLE: m_ConsoleWindow.Destroy(); break;
case ID_CONNECT_TO_AGENT: szCommand = "connect"; break;
case ID_STATUS: szCommand = "pool"; break;
//case ID_RELOADSETUP: szCommand = "reloadsetup"; break;
//case ID_LOG: szCommand = "log"; 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 CRylChatServer::InitializeMsgProc()
{
int nErrorCount = 0;
CMsgProcessMgr* lpMsgProcessMgr = GetMsgProcessMgr();
if(0 != lpMsgProcessMgr)
{
if(GetConsoleWindow())
{
nErrorCount += lpMsgProcessMgr->Register(WM_COMMAND,
new CProcessCOMMAND(*GetConsoleWindow())) ? 0 : 1;
}
}
return (0 == nErrorCount);
}

View File

@@ -0,0 +1,25 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by RylChatServer.rc
//
#define ID_QUIT 0
#define IDR_MENU 101
#define ID_Menu 102
#define IDI_MAIN 106
#define ID_107 107
#define ID_START_CONSOLE 108
#define ID_STOP_CONSOLE 109
#define ID_STATUS 110
#define ID_111 111
#define ID_CONNECT_TO_AGENT 112
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

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

View File

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