LOGW("Received packet doesn't have LEGACY_PFLAG_HAS_SEQ, LEGACY_PFLAG_HAS_RECENT_RECV, or both");
returnfalse;
}
// These are all errors that weren't even used in the first place in newer protocols.
// Also, a call cannot possibly have a wrong call ID and correct encryption key (unless there's some shady legacy stuff that's going on, but for now I won't even consider it).
/*
if(flags&LEGACY_PFLAG_HAS_CALL_ID)
{
unsignedcharpktCallID[16];
in.ReadBytes(pktCallID,16);
if(memcmp(pktCallID,callID,16)!=0)
{
LOGW("Received packet has wrong call id");
// These are all errors that weren't even used in the first place in newer protocols
//lastError = ERROR_UNKNOWN;
//SetState(STATE_FAILED);
returnfalse;
}
}*/
ackId=in.ReadUInt32();
pseq=in.ReadUInt32();
acks=in.ReadUInt32();
if(flags&LEGACY_PFLAG_HAS_PROTO)
{
uint32_tproto=in.ReadUInt32();
if(proto!=PROTOCOL_NAME)
{
LOGW("Received packet uses wrong protocol");
// These are all errors that weren't even used in the first place in newer protocols
//lastError = ERROR_INCOMPATIBLE;
//SetState(STATE_FAILED);
returnfalse;
}
}
if(flags&LEGACY_PFLAG_HAS_EXTRA)
{
uint32_textraLen=in.ReadTlLength();
in.Seek(in.GetOffset()+extraLen+pad4(extraLen));
}
if(flags&LEGACY_PFLAG_HAS_DATA)
{
packetInnerLen=in.ReadTlLength();
}
pflags=0;
}
elseif(tlid==TLID_SIMPLE_AUDIO_BLOCK)
{
in.ReadInt64();// random id
uint32_trandLen=in.ReadTlLength();
in.Seek(in.GetOffset()+randLen+pad4(randLen));
packetInnerLen=in.ReadTlLength();
type=in.ReadByte();
ackId=in.ReadUInt32();
pseq=in.ReadUInt32();
acks=in.ReadUInt32();
if(peerVersion>=6)
pflags=in.ReadByte();
else
pflags=0;
}
else
{
LOGW("Received a packet of unknown type %08X",tlid);