QQInPacket::CQQInPacket() {
}
CQQInPacket::~CQQInPacket() {
}
PQQTOKEN CQQInPacket::pop_token() { PQQTOKEN pToken=NULL;
unsigned short v=0; pop_net(v); if (v) { pToken=(PQQTOKEN)MALLOC(sizeof(QQTOKEN)+v+2); if (pToken) { memset(pToken,0,sizeof(QQTOKEN)+v+2); pToken->len=v; pop(pToken->data,pToken->len); } } return pToken; }
UINT CQQInPacket::skip_token() { UINT nSkip=0;
unsigned short v=0; if (pop_net(v)) { nSkip+=2+pop(NULL,v); } return nSkip; }
void CQQInPacket::pop_head(PQQHEADER pHeader) { pop(pHeader,sizeof(QQHEADER)); if (pHeader) { pHeader->ver=byteswap_ushort(pHeader->ver); pHeader->cmd=byteswap_ushort(pHeader->cmd); pHeader->order=byteswap_ushort(pHeader->order); pHeader->qqnum=byteswap_ulong(pHeader->qqnum); } }
BYTE *CQQInPacket::pop_body(unsigned char *key, int &out_len) { BYTE * out=NULL;
if (m_pData && m_nRead<m_Len-1) { unsigned int size=m_Len-m_nRead-1; if (size) { out=(BYTE *)MALLOC(size); if (out) { out_len=size; int ret=qqdecrypt(m_pData+m_nRead,size,key,out,&out_len); } } }
return out; } |