/// <summary>
        /// Parse TS_CONTROL_PDU
        /// (parser index is updated according to parsed length)
        /// </summary>
        /// <param name="data">data to be parsed</param>
        /// <param name="currentIndex">current parser index</param>
        /// <returns>TS_CONTROL_PDU</returns>
        private TS_CONTROL_PDU ParseTsControlPdu(byte[] data, ref int currentIndex)
        {
            TS_CONTROL_PDU pdu = new TS_CONTROL_PDU();

            // TS_CONTROL_PDU: shareDataHeader
            pdu.shareDataHeader = ParseTsShareDataHeader(data, ref currentIndex);

            // TS_CONTROL_PDU: action
            pdu.action = (action_Values)ParseUInt16(data, ref currentIndex, false);

            // TS_CONTROL_PDU: grantId
            pdu.grantId = ParseUInt16(data, ref currentIndex, false);

            // TS_CONTROL_PDU: controlId
            pdu.controlId = ParseUInt32(data, ref currentIndex, false);

            return pdu;
        }
Esempio n. 2
0
        /// <summary>
        /// Encode controlPduData field.
        /// </summary>
        /// <param name="controlPduData">The data to be encoded.</param>
        /// <returns>The encoded data.</returns>
        private static byte[] EncodeControlData(TS_CONTROL_PDU controlPduData)
        {
            List<byte> dataBuffer = new List<byte>();

            RdpbcgrEncoder.EncodeStructure(dataBuffer, controlPduData.shareDataHeader);
            RdpbcgrEncoder.EncodeStructure(dataBuffer, (ushort)controlPduData.action);
            RdpbcgrEncoder.EncodeStructure(dataBuffer, controlPduData.grantId);
            RdpbcgrEncoder.EncodeStructure(dataBuffer, controlPduData.controlId);

            return dataBuffer.ToArray();
        }