本文整理汇总了C++中NetworkMessage::skip方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkMessage::skip方法的具体用法?C++ NetworkMessage::skip怎么用?C++ NetworkMessage::skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkMessage
的用法示例。
在下文中一共展示了NetworkMessage::skip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onRecvFirstMessage
void ProtocolOld::onRecvFirstMessage(NetworkMessage& msg)
{
if(g_game.getGameState() == GAMESTATE_SHUTDOWN)
{
getConnection()->close();
return;
}
msg.skip(2);
uint16_t version = msg.get<uint16_t>();
msg.skip(12);
if(version <= 760)
disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STRING " allowed!");
if(!RSA_decrypt(msg))
{
getConnection()->close();
return;
}
uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
enableXTEAEncryption();
setXTEAKey(key);
if(version <= 822)
disableChecksum();
disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STRING " allowed!");
}
示例2: parseFirstPacket
bool ProtocolOld::parseFirstPacket(NetworkMessage& msg)
{
if(g_game.getGameState() == GAMESTATE_SHUTDOWN)
{
getConnection()->close();
return false;
}
/*uint16_t operatingSystem = */msg.get<uint16_t>();
uint16_t version = msg.get<uint16_t>();
msg.skip(12);
if(version <= 760)
disconnectClient(0x0A, CLIENT_VERSION_STRING);
if(!RSA_decrypt(msg))
{
getConnection()->close();
return false;
}
uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
enableXTEAEncryption();
setXTEAKey(key);
if(version <= 822)
disableChecksum();
disconnectClient(0x0A, CLIENT_VERSION_STRING);
return false;
}
示例3: onRecvFirstMessage
void ProtocolLogin::onRecvFirstMessage(NetworkMessage& msg)
{
if(
#if defined(WINDOWS) && !defined(_CONSOLE)
!GUI::getInstance()->m_connections ||
#endif
g_game.getGameState() == GAMESTATE_SHUTDOWN)
{
getConnection()->close();
return;
}
uint32_t clientIp = getConnection()->getIP();
msg.get<uint16_t>();
uint16_t version = msg.get<uint16_t>();
msg.skip(12);
#ifdef _MULTIPLATFORM77
if(!RSA_decrypt(msg))
{
getConnection()->close();
return;
}
uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
enableXTEAEncryption();
setXTEAKey(key);
#endif
uint32_t name = msg.get<uint32_t>();
std::string password = msg.getString();
if(!name)
{
if(!g_config.getBool(ConfigManager::ACCOUNT_MANAGER))
{
disconnectClient(0x0A, "Invalid account name.");
return;
}
name = 1;
password = "1";
}
if(!g_config.getBool(ConfigManager::MANUAL_ADVANCED_CONFIG))
{
if(version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX)
{
disconnectClient(0x0A, CLIENT_VERSION_STRING);
return;
}
else
if(version < g_config.getNumber(ConfigManager::VERSION_MIN) || version > g_config.getNumber(ConfigManager::VERSION_MAX))
{
disconnectClient(0x0A, g_config.getString(ConfigManager::VERSION_MSG).c_str());
return;
}
}
#ifdef CLIENT_VERSION_DATA
if(sprSignature != CLIENT_VERSION_SPR)
{
disconnectClient(0x0A, CLIENT_VERSION_DATA);
return;
}
if(datSignature != CLIENT_VERSION_DAT)
{
disconnectClient(0x0A, CLIENT_VERSION_DATA);
return;
}
if(picSignature != CLIENT_VERSION_PIC)
{
disconnectClient(0x0A, CLIENT_VERSION_DATA);
return;
}
#endif
if(g_game.getGameState() < GAMESTATE_NORMAL)
{
disconnectClient(0x0A, "Server is just starting up, please wait.");
return;
}
if(g_game.getGameState() == GAMESTATE_MAINTAIN)
{
disconnectClient(0x0A, "Server is under maintenance, please re-connect in a while.");
return;
}
if(ConnectionManager::getInstance()->isDisabled(clientIp, protocolId))
{
disconnectClient(0x0A, "Too many connections attempts from your IP address, please try again later.");
return;
}
if(IOBan::getInstance()->isIpBanished(clientIp))
{
disconnectClient(0x0A, "Your IP is banished!");
return;
//.........这里部分代码省略.........