本文整理汇总了C++中MCommand::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ MCommand::GetID方法的具体用法?C++ MCommand::GetID怎么用?C++ MCommand::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCommand
的用法示例。
在下文中一共展示了MCommand::GetID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseUDPPacket
void MMatchClient::ParseUDPPacket(char* pData, MPacketHeader* pPacketHeader, DWORD dwIP, unsigned int nPort)
{
switch (pPacketHeader->nMsg)
{
case MSGID_RAWCOMMAND:
{
unsigned short nCheckSum = MBuildCheckSum(pPacketHeader, pPacketHeader->nSize);
if (pPacketHeader->nCheckSum != nCheckSum) {
static int nLogCount = 0;
if (nLogCount++ < 100) { // Log Flooding 방지
mlog("MMatchClient::ParseUDPPacket() -> CHECKSUM ERROR(R=%u/C=%u)\n",
pPacketHeader->nCheckSum, nCheckSum);
}
return;
} else {
MCommand* pCmd = new MCommand();
if (!pCmd->SetData(pData, &m_CommandManager))
{
mlog("MMatchClient::ParseUDPPacket() -> SetData Error\n");
delete pCmd;
return;
}
MUID uidPeer = FindPeerUID(dwIP, nPort);
if (uidPeer != MUID(0,0))
{
pCmd->m_Sender = uidPeer;
} else {
// TODO: 여기 수정해야함.
sockaddr_in Addr;
Addr.sin_addr.S_un.S_addr = dwIP;
Addr.sin_port = nPort;
char* pszIP = inet_ntoa(Addr.sin_addr);
if (strcmp(pszIP, GetAgentIP()) == 0)
{
pCmd->m_Sender = GetAgentServerUID();
}
else if( (MC_RESPONSE_SERVER_LIST_INFO == pCmd->GetID()) ||
(MC_RESPONSE_BLOCK_COUNTRY_CODE_IP == pCmd->GetID()) )
{
// 특별히 하는건 없음.
// Lcator는 Peer설정이 되지 않기때문에 여기서 따로 처리함.
}
else if (pCmd->GetID() == MC_UDP_PONG)
{
// 특별히 하는건 없음. Command를 넘겨주기 위해서...(밑에 커맨드를 딜리트하기때문에)
}
else
{
delete pCmd; pCmd = NULL;
return;
}
}
pCmd->m_Receiver = m_This;
if( IsUDPCommandValidationCheck(pCmd->GetID()) ) {
LockRecv();
m_CommandManager.Post(pCmd);
UnlockRecv();
} else {
#ifdef _DEBUG
mlog("%s(ID:%d) is Denied Command!\n"
, pCmd->m_pCommandDesc->GetName(), pCmd->GetID());
#endif
}
}
}
break;
case MSGID_COMMAND:
{
int nPacketSize = pPacketHeader->CalcPacketSize(&m_PeerPacketCrypter);
unsigned short nCheckSum = MBuildCheckSum(pPacketHeader, nPacketSize);
if (pPacketHeader->nCheckSum != nCheckSum) {
static int nLogCount = 0;
if (nLogCount++ < 100) { // Log Flooding 방지
mlog("MMatchClient::ParseUDPPacket() -> CHECKSUM ERROR(R=%u/C=%u)\n",
pPacketHeader->nCheckSum, nCheckSum);
}
return;
} else {
MCommand* pCmd = new MCommand();
int nCmdSize = nPacketSize - sizeof(MPacketHeader);
if (!m_PeerPacketCrypter.Decrypt(pData, nCmdSize))
{
mlog("MMatchClient::ParseUDPPacket() -> Decrypt Error\n");
delete pCmd; pCmd = NULL;
return;
}
if (!pCmd->SetData(pData, &m_CommandManager))
{
// TODO: 여기 수정해야함.
sockaddr_in Addr;
//.........这里部分代码省略.........