本文整理汇总了C++中LPDESC::GetSequence方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC::GetSequence方法的具体用法?C++ LPDESC::GetSequence怎么用?C++ LPDESC::GetSequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDESC
的用法示例。
在下文中一共展示了LPDESC::GetSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
bool CInputProcessor::Process(LPDESC lpDesc, const void * c_pvOrig, int iBytes, int & r_iBytesProceed)
{
const char * c_pData = (const char *) c_pvOrig;
BYTE bLastHeader = 0;
int iLastPacketLen = 0;
int iPacketLen;
if (!m_pPacketInfo)
{
sys_err("No packet info has been binded to");
return true;
}
for (m_iBufferLeft = iBytes; m_iBufferLeft > 0;)
{
BYTE bHeader = (BYTE) *(c_pData);
const char * c_pszName;
if (bHeader == 0) // 암호화 처리가 있으므로 0번 헤더는 스킵한다.
iPacketLen = 1;
else if (!m_pPacketInfo->Get(bHeader, &iPacketLen, &c_pszName))
{
sys_err("UNKNOWN HEADER: %d, LAST HEADER: %d(%d), REMAIN BYTES: %d, fd: %d",
bHeader, bLastHeader, iLastPacketLen, m_iBufferLeft, lpDesc->GetSocket());
//printdata((BYTE *) c_pvOrig, m_iBufferLeft);
lpDesc->SetPhase(PHASE_CLOSE);
return true;
}
if (m_iBufferLeft < iPacketLen)
return true;
if (bHeader)
{
if (test_server && bHeader != HEADER_CG_MOVE)
sys_log(0, "Packet Analyze [Header %d][bufferLeft %d] ", bHeader, m_iBufferLeft);
m_pPacketInfo->Start();
int iExtraPacketSize = Analyze(lpDesc, bHeader, c_pData);
if (iExtraPacketSize < 0)
return true;
iPacketLen += iExtraPacketSize;
lpDesc->Log("%s %d", c_pszName, iPacketLen);
m_pPacketInfo->End();
}
// TRAFFIC_PROFILER
if (g_bTrafficProfileOn)
TrafficProfiler::instance().Report(TrafficProfiler::IODIR_INPUT, bHeader, iPacketLen);
// END_OF_TRAFFIC_PROFILER
if (bHeader == HEADER_CG_PONG)
sys_log(0, "PONG! %u %u", m_pPacketInfo->IsSequence(bHeader), *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE)));
if (m_pPacketInfo->IsSequence(bHeader))
{
BYTE bSeq = lpDesc->GetSequence();
BYTE bSeqReceived = *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE));
if (bSeq != bSeqReceived)
{
sys_err("SEQUENCE %x mismatch 0x%x != 0x%x header %u", get_pointer(lpDesc), bSeq, bSeqReceived, bHeader);
LPCHARACTER ch = lpDesc->GetCharacter();
char buf[1024];
int offset, len;
offset = snprintf(buf, sizeof(buf), "SEQUENCE_LOG [%s]-------------\n", ch ? ch->GetName() : "UNKNOWN");
if (offset < 0 || offset >= (int) sizeof(buf))
offset = sizeof(buf) - 1;
for (size_t i = 0; i < lpDesc->m_seq_vector.size(); ++i)
{
len = snprintf(buf + offset, sizeof(buf) - offset, "\t[%03d : 0x%x]\n",
lpDesc->m_seq_vector[i].hdr,
lpDesc->m_seq_vector[i].seq);
if (len < 0 || len >= (int) sizeof(buf) - offset)
offset += (sizeof(buf) - offset) - 1;
else
offset += len;
}
snprintf(buf + offset, sizeof(buf) - offset, "\t[%03d : 0x%x]\n", bHeader, bSeq);
sys_err("%s", buf);
lpDesc->SetPhase(PHASE_CLOSE);
return true;
}
else
{
lpDesc->push_seq(bHeader, bSeq);
lpDesc->SetNextSequence();
//sys_err("SEQUENCE %x match %u next %u header %u", lpDesc, bSeq, lpDesc->GetSequence(), bHeader);
//.........这里部分代码省略.........