/// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteByte(configurationDescriptorIsValid);
     marshaler.WriteBytes(padding);
     marshaler.WriteUInt32(numInterfaces);
     for (int i = 0; i < intefaces.Length; i++)
     {
         intefaces[i].Encode(marshaler);
     }
     marshaler.WriteBytes(descriptor);
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(CbTsUrb);
     marshaler.WriteBytes(TsUrb);
     marshaler.WriteUInt32(OutputBufferSize);
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     if (Data != null)
     {
         marshaler.WriteBytes(Data);
     };
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteUInt32(this.Header.cbSize);
     marshaler.WriteUInt32((uint)this.Header.PacketType);
     marshaler.WriteByte(this.PresentatioinId);
     marshaler.WriteByte((byte)this.Version);
     marshaler.WriteByte((byte)this.Command);
     marshaler.WriteByte(this.FrameRate);
     marshaler.WriteUInt16(this.AverageBitrateKbps);
     marshaler.WriteUInt16(this.Reserved);
     marshaler.WriteUInt32(this.SourceWidth);
     marshaler.WriteUInt32(this.SourceHeight);
     marshaler.WriteUInt32(this.ScaledWidth);
     marshaler.WriteUInt32(this.ScaledHeight);
     marshaler.WriteUInt64(this.hnsTimestampOffset);
     marshaler.WriteUInt64(this.GeometryMappingId);
     marshaler.WriteBytes(this.VideoSubtypeId, 0, 16);
     marshaler.WriteUInt32(this.cbExtra);
     if (this.pExtraData != null)
     {
         marshaler.WriteBytes(this.pExtraData);
     }
     marshaler.WriteByte(this.Reserved2);
 }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);
            marshaler.WriteByte(this.quantIdxY);
            marshaler.WriteByte(this.quantIdxCb);
            marshaler.WriteByte(this.quantIdxCr);
            marshaler.WriteUInt16(this.xIdx);
            marshaler.WriteUInt16(this.yIdx);
            marshaler.WriteBool(this.flags);

            marshaler.WriteUInt16(this.yLen);
            marshaler.WriteUInt16(this.cbLen);
            marshaler.WriteUInt16(this.crLen);
            marshaler.WriteUInt16(this.tailLen);

            if (this.yData != null)
                marshaler.WriteBytes(this.yData);
            if (this.cbData != null)
                marshaler.WriteBytes(this.cbData);
            if (this.crData != null)
                marshaler.WriteBytes(this.crData);
            if (this.tailData != null)
                marshaler.WriteBytes(this.tailData);
        }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);

            marshaler.WriteByte(this.tileSize);
            marshaler.WriteUInt16(this.numRects);
            marshaler.WriteByte(this.numQuant);
            marshaler.WriteByte(this.numProgQuant);
            marshaler.WriteByte(this.flags);
            marshaler.WriteUInt16(this.numTiles);
            marshaler.WriteUInt32(this.tileDataSize);

            // Encode rects, in normal case, it can't be NULL
            if (rects != null)
            {
                for (int i = 0; i < rects.Count(); i++)
                {
                    byte[] arr = Convert2Bytes(rects[i]);
                    marshaler.WriteBytes(arr);
                }
            }

            // Encode quantVals, in normal case, it can't be NULL
            if (quantVals != null)
            {
                for (int i = 0; i < quantVals.Count(); i++)
                {
                    byte[] arr = Convert2Bytes(quantVals[i]);
                    marshaler.WriteBytes(arr);
                }
            }

            if (quantProgVals != null)   // progressive encoding enabled
            {
                for (int i = 0; i < quantProgVals.Count(); i++)
                {
                    byte[] arr;
                    marshaler.WriteByte(quantProgVals[i].quality);

                    arr = Convert2Bytes(quantProgVals[i].yQuantValues);
                    marshaler.WriteBytes(arr);

                    arr = Convert2Bytes(quantProgVals[i].cbQuantValues);
                    marshaler.WriteBytes(arr);

                    arr = Convert2Bytes(quantProgVals[i].crQuantValues);
                    marshaler.WriteBytes(arr);
                }
            }
        }
示例#7
0
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteByte((byte)((byte)(Flags << 4) | (byte)Action));
     marshaler.WriteUInt16(this.PayloadLength);
     marshaler.WriteByte(this.HeaderLength);
     if (SubHeaders != null)
     {
         foreach (RDP_TUNNEL_SUBHEADER subHeader in SubHeaders)
         {
             marshaler.WriteBytes(PduMarshaler.Marshal(subHeader));
         }
     }
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(RequestId);
     marshaler.WriteUInt32(HResult);
     marshaler.WriteUInt32(Information);
     marshaler.WriteUInt32(OutputBufferSize);
     marshaler.WriteBytes(OutputBuffer);
 }
示例#9
0
 public override void Encode(PduMarshaler marshaler)
 {
     byte[] hdData = PduMarshaler.Marshal(this.TunnelHeader);
     marshaler.WriteBytes(hdData);
     marshaler.WriteUInt32(this.HrResponse);
 }
示例#10
0
 public override void Encode(PduMarshaler marshaler)
 {
     byte[] hdData = PduMarshaler.Marshal(this.TunnelHeader);
     marshaler.WriteBytes(hdData);
     if (this.HigherLayerData != null)
     {
         marshaler.WriteBytes(this.HigherLayerData);
     }
 }
示例#11
0
 public override void Encode(PduMarshaler marshaler)
 {
     byte[] hdData = PduMarshaler.Marshal(this.TunnelHeader);
     marshaler.WriteBytes(hdData);
     marshaler.WriteUInt32(this.RequestID);
     marshaler.WriteUInt32(this.Reserved);
     if (this.SecurityCookie != null)
     {
         marshaler.WriteBytes(this.SecurityCookie);
     }
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteByte((byte)descriptor);
     if (descriptor == DescriptorTypes.SINGLE)
     {
         if(bulkData != null)
         {
             marshaler.WriteByte(bulkData.header);
             marshaler.WriteBytes(bulkData.data);
         }
     }
     else
     {
         marshaler.WriteUInt16(segmentCount);
         marshaler.WriteUInt32(uncompressedSize);
         if (segmentArray != null && segmentArray.Length > 0)
         {
             foreach (RDP_DATA_SEGMENT dataSeg in segmentArray)
             {
                 marshaler.WriteUInt32(dataSeg.size);
                 if (dataSeg.bulkData != null)
                 {
                     marshaler.WriteByte(bulkData.header);
                     marshaler.WriteBytes(bulkData.data);
                 }
             }
         }
     }
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(pipeHandle);
     marshaler.WriteUInt32(transferFlags);
     marshaler.WriteUInt32(timeout);
     marshaler.WriteBytes(setupPacket);
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(CbTsUrb);
     marshaler.WriteBytes(TsUrb);
     marshaler.WriteUInt32(OutputBufferSize);
     if (null != OutputBuffer && OutputBuffer.Length > 0)
     {
         marshaler.WriteBytes(OutputBuffer);
     }
 }
示例#15
0
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteByte(this.SubHeaderLength);
     marshaler.WriteByte((byte)this.SubHeaderType);
     if (this.SubHeaderData != null)
     {
         marshaler.WriteBytes(this.SubHeaderData);
     }
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(NumUsbDevice);
     marshaler.WriteUInt32(UsbDevice);
     marshaler.WriteUInt32(cchDeviceInstanceId);
     marshaler.WriteUnicodeString(DeviceInstanceId);
     marshaler.WriteUInt32(cchHwIds);
     if (cchHwIds != 0)
     {
         marshaler.WriteUnicodeString(HardwareIds);
     }
     marshaler.WriteUInt32(cchCompatIds);
     if (cchCompatIds != 0)
     {
         marshaler.WriteUnicodeString(CompatibilityIds);
     }
     marshaler.WriteUInt32(cchContainerId);
     marshaler.WriteUnicodeString(ContainerId);
     marshaler.WriteBytes(UsbDeviceCapabilities);
 }
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteUInt16(eventId);
     marshaler.WriteUInt32(pduLength);
     if (data != null)
     {
         marshaler.WriteBytes(data);
     }
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32((uint)IoControlCode);
     marshaler.WriteUInt32(InputBufferSize);
     if (InputBufferSize != 0)
     {
         marshaler.WriteBytes(InputBuffer);
     }
     marshaler.WriteUInt32(OutputBufferSize);
     marshaler.WriteUInt32(RequestId);
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteUInt32(this.width);
     marshaler.WriteUInt32(this.height);
     marshaler.WriteUInt32(this.monitorCount);
     foreach (TS_MONITOR_DEF monitorDef in monitorDefArray)
     {
         marshaler.WriteUInt32(monitorDef.left);
         marshaler.WriteUInt32(monitorDef.top);
         marshaler.WriteUInt32(monitorDef.right);
         marshaler.WriteUInt32(monitorDef.bottom);
         marshaler.WriteUInt32((uint)monitorDef.flags);
     }
     if (pad != null)
     {
         marshaler.WriteBytes(pad);
     }
 }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);
            marshaler.WriteByte(this.quantIdxY);
            marshaler.WriteByte(this.quantIdxCb);
            marshaler.WriteByte(this.quantIdxCr);
            marshaler.WriteUInt16(this.xIdx);
            marshaler.WriteUInt16(this.yIdx);
            marshaler.WriteByte(this.progressiveQuality);

            marshaler.WriteUInt16(this.ySrlLen);
            marshaler.WriteUInt16(this.yRawLen);
            marshaler.WriteUInt16(this.cbSrlLen);
            marshaler.WriteUInt16(this.cbRawLen);
            marshaler.WriteUInt16(this.crSrlLen);
            marshaler.WriteUInt16(this.crRawLen);

            if (this.ySrlData != null)
                marshaler.WriteBytes(this.ySrlData);
            if (this.yRawData != null)
                marshaler.WriteBytes(this.yRawData);
            if (this.cbSrlData != null)
                marshaler.WriteBytes(this.cbSrlData);
            if (this.cbRawData != null)
                marshaler.WriteBytes(this.cbRawData);
            if (this.crSrlData != null)
                marshaler.WriteBytes(this.crSrlData);
            if (this.crRawData != null)
                marshaler.WriteBytes(this.crRawData);
        }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);
            marshaler.WriteUInt16(this.surfaceId);
            marshaler.WriteUInt16((ushort)this.codecId);
            marshaler.WriteByte((byte)this.pixelFormat);

            // Destination rectangle.
            marshaler.WriteUInt16(this.destRect.left);
            marshaler.WriteUInt16(this.destRect.top);
            marshaler.WriteUInt16(this.destRect.right);
            marshaler.WriteUInt16(this.destRect.bottom);

            // Bitmap.
            marshaler.WriteUInt32(this.bitmapDataLength);
            marshaler.WriteBytes(this.bitmapData);
        }
示例#22
0
        public override void Encode(PduMarshaler marshaler)
        {
            marshaler.WriteUInt32(fecHeader.snSourceAck);
            marshaler.WriteUInt16(fecHeader.uReceiveWindowSize);
            marshaler.WriteUInt16((ushort)fecHeader.uFlags);

            if (SynData.HasValue)
            {
                marshaler.WriteUInt32(SynData.Value.snInitialSequenceNumber);
                marshaler.WriteUInt16(SynData.Value.uUpStreamMtu);
                marshaler.WriteUInt16(SynData.Value.uDownStreamMtu);
                // This datagram MUST be zero-padded to increase the size of this datagram to 1232 bytes.
                int length = 16;
                if (CorrelationId.HasValue)
                {
                    marshaler.WriteBytes(CorrelationId.Value.uCorrelationId);
                    length += 16;
                    marshaler.WriteBytes(CorrelationId.Value.uReserved);
                    length += 16;
                }

                byte[] padBytes = new byte[1232 - length];
                marshaler.WriteBytes(padBytes);
                return;
            }

            if (ackVectorHeader.HasValue)
            {
                // ACK
                marshaler.WriteUInt16(ackVectorHeader.Value.uAckVectorSize);
                if (ackVectorHeader.Value.AckVectorElement != null)
                {
                    List<byte> ackVecElementList = new List<byte>();
                    foreach (AckVector vec in ackVectorHeader.Value.AckVectorElement)
                    {
                        byte vecByte = 0;
                        vecByte |= vec.Length;
                        byte state = (byte)vec.State;
                        vecByte |= (byte)(state << 6);
                        ackVecElementList.Add(vecByte);
                    }
                    ackVecElementList.Reverse();
                    marshaler.WriteBytes(ackVecElementList.ToArray());
                }

                // Padding (variable): A variable-sized array, of length zero or more,
                // such that this structure ends on a DWORD ([MS-DTYP] section 2.2.9) boundary.
                int padLen = 4 - (2 + ackVectorHeader.Value.uAckVectorSize) % 4;

                if (padLen > 0 && padLen != 4)
                {
                    byte[] padding = new byte[padLen];
                    marshaler.WriteBytes(padding);
                }

                // Ack of Acks.
                if (ackOfAckVector.HasValue)
                {
                    marshaler.WriteUInt32(ackOfAckVector.Value.snAckOfAcksSeqNum);
                }
            }

            if (sourceHeader.HasValue || fecPayloadHeader.HasValue)
            {
                if (sourceHeader.HasValue)
                {
                    // Source Data.
                    marshaler.WriteUInt32(sourceHeader.Value.snCoded);
                    marshaler.WriteUInt32(sourceHeader.Value.snSourceStart);
                }
                else
                {
                    // FEC Data.
                    marshaler.WriteUInt32(fecPayloadHeader.Value.snCoded);
                    marshaler.WriteUInt32(fecPayloadHeader.Value.snSourceStart);
                    marshaler.WriteByte(fecPayloadHeader.Value.uRange);
                    marshaler.WriteByte(fecPayloadHeader.Value.uFecIndex);
                    marshaler.WriteUInt16(fecPayloadHeader.Value.uPadding);
                }

                if (payload != null)
                {
                    marshaler.WriteBytes(payload);
                }
            }
        }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);
            marshaler.WriteUInt16(this.surfaceId);
            marshaler.WriteUInt16((ushort)this.codecId);
            marshaler.WriteUInt32(this.codecContextId);
            marshaler.WriteByte((byte)this.pixelFormat);

            // Bitmap.
            marshaler.WriteUInt32(this.bitmapDataLength);
            marshaler.WriteBytes(this.bitmapData);
        }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteUInt32(this.Header.cbSize);
     marshaler.WriteUInt32((uint)this.Header.PacketType);
     marshaler.WriteByte(this.PresentatioinId);
     marshaler.WriteByte((byte)this.NotificationType);
     marshaler.WriteUInt16(this.Reserved);
     marshaler.WriteUInt32(this.cbData);
     marshaler.WriteBytes(this.pData);
 }
        /// <summary>
        /// Encode this PDU to the PduMarshaler.
        /// </summary>
        /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
        public override void Encode(PduMarshaler marshaler)
        {
            base.Encode(marshaler);
            marshaler.WriteUInt16(this.capsSetCount);

            for (int i = 0; i < this.capsSetCount; i++ )
            {
                marshaler.WriteUInt32((uint)capsSets[i].version);
                marshaler.WriteUInt32(capsSets[i].capsDataLength);
                marshaler.WriteBytes(capsSets[i].capsData);
            }
        }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     marshaler.WriteUInt32(this.Header.cbSize);
     marshaler.WriteUInt32((uint)this.Header.PacketType);
     marshaler.WriteByte(this.PresentatioinId);
     marshaler.WriteByte((byte)this.Version);
     marshaler.WriteByte((byte)this.Flags);
     marshaler.WriteByte(this.Reserved);
     marshaler.WriteUInt64(this.HnsTimestamp);
     marshaler.WriteUInt64(this.HnsDuration);
     marshaler.WriteUInt16(this.CurrentPacketIndex);
     marshaler.WriteUInt16(this.PacketsInSample);
     marshaler.WriteUInt32(this.SampleNumber);
     marshaler.WriteUInt32(this.cbSample);
     if (this.pSample != null)
     {
         marshaler.WriteBytes(this.pSample);
     }
     marshaler.WriteByte(this.Reserved2);
 }
 /// <summary>
 /// Encode this PDU to the PduMarshaler.
 /// </summary>
 /// <param name="marshaler">This is used to encode the fields of this PDU.</param>
 public override void Encode(PduMarshaler marshaler)
 {
     base.Encode(marshaler);
     marshaler.WriteByte(recipientAndPadding1);
     marshaler.WriteByte(interfaceNumber);
     marshaler.WriteByte(msPageIndex);
     marshaler.WriteUInt16(msFeatureDescriptorIndex);
     marshaler.WriteBytes(padding2);
 }