public StackPacket DecodeX224ConnectionRequestPDU(byte[] data)
{
// initialize
int currentIndex = 0;
// TpktHeader
TpktHeader tpktHeader = ParseTpktHeader(data, ref currentIndex);
// X224Crq
X224Crq x224Crq = ParseX224Crq(data, ref currentIndex);
Client_X_224_Connection_Request_Pdu requestPdu = new Client_X_224_Connection_Request_Pdu();
requestPdu.tpktHeader = tpktHeader;
requestPdu.x224Crq = x224Crq;
if (tpktHeader.length > currentIndex)
{
//routingToken or cookie
ParseRoutingTokenOrCookie(data, ref requestPdu.routingToken, ref requestPdu.cookie, ref currentIndex);
if (tpktHeader.length > currentIndex)
{
requestPdu.rdpNegData = ParseRdpNegReq(data, ref currentIndex);
if (requestPdu.rdpNegData.flags.HasFlag(RDP_NEG_REQ_flags_Values.CORRELATION_INFO_PRESENT) && tpktHeader.length > currentIndex)
{
requestPdu.rdpCorrelationInfo = ParseRdpNegCorrelationInfo(data, ref currentIndex);
}
}
else
{
requestPdu.rdpNegData = null;
}
}
// Check if data length exceeded expectation
if(data.Length != currentIndex)
{
server.AddWarning("{0} bytes of extra data found when decoding X224 Connection Request PDU", data.Length - currentIndex);
}
// temprory command out for winblue behavior change
// VerifyDataLength(data.Length, currentIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
return requestPdu;
}