public StackPacket DecodeServerHeartbeatPDU(
byte[] data,
byte[] decryptedUserData,
SecurityHeaderType type)
{
Server_Heartbeat_PDU pdu = new Server_Heartbeat_PDU();
// data index
int dataIndex = 0;
// Server_Heartbeat_PDU: commonHeader
pdu.commonHeader = ParseMcsCommonHeader(data, ref dataIndex, type);
// user data index
int userDataIndex = 0;
if (type == SecurityHeaderType.None)
{
pdu.commonHeader.securityHeader = ParseTsSecurityHeaderBasic(decryptedUserData, ref userDataIndex);
}
// reserved
pdu.reserved = ParseByte(decryptedUserData, ref userDataIndex);
// reserved
pdu.period = ParseByte(decryptedUserData, ref userDataIndex);
// reserved
pdu.count1 = ParseByte(decryptedUserData, ref userDataIndex);
// reserved
pdu.count2 = ParseByte(decryptedUserData, ref userDataIndex);
// Check if data length exceeded expectation
VerifyDataLength(decryptedUserData.Length, userDataIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
return pdu;
}