本文整理汇总了C++中Packet::GetMessageID方法的典型用法代码示例。如果您正苦于以下问题:C++ Packet::GetMessageID方法的具体用法?C++ Packet::GetMessageID怎么用?C++ Packet::GetMessageID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet::GetMessageID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Response
bool Protocol::Response(Packet& inPacket)
{
if (inPacket.m_bCheckSumError)
{
return generalRespons(inPacket, GeneralResponsePacket::ERROR_MESSAGE);
}
if (!bAuthorized && inPacket.GetMessageID() != Packet::TERMINAL_REGIST
&& inPacket.GetMessageID() != Packet::TERMINAL_AUTHORIZE)
{
m_bCloseConnect = true;
return false;
}
return dispatch(inPacket);
}
示例2: dispatch
bool Protocol::dispatch(Packet& inPacket)
{
bool bResponsed = false;
switch (inPacket.GetMessageID())
{
case Packet::TERMINAL_REGIST:
bResponsed = onRegist(inPacket);
break;
case Packet::MESSAGE_UNKNOWN:
TRACE("unknown message");
m_bCloseConnect = true;
break;
case Packet::TERMINAL_AUTHORIZE:
//FIXME:set according to onAuthorize result;
bAuthorized = true;
bResponsed = generalRespons(inPacket, onAuthorize(inPacket));
break;
case Packet::TERMINAL_GENERAL_HEARTBEAT:
bResponsed = generalRespons(inPacket,GeneralResponsePacket::SUCCESS);
break;
default:
bResponsed = generalRespons(inPacket,
GeneralResponsePacket::NO_SUPPORTED);
break;
}
return bResponsed;
}