/// <summary> /// Marshal the PDU structure to bytes array. /// </summary> /// <param name="pdu">The PDU to marshal.</param> /// <returns>The marshaled byte array</returns> public static byte[] Marshal(BasePDU pdu) { PduMarshaler m = new PduMarshaler(); pdu.Encode(m); return(m.RawData); }
/// <summary> /// Marshal the PDU structure to bytes array. /// </summary> /// <param name="pdu">The PDU to marshal.</param> /// <param name="bLittleEndian">Indicates whether encode the numbers to little endian.</param> /// <returns>The marshaled byte array</returns> public static byte[] Marshal(BasePDU pdu, bool bLittleEndian) { PduMarshaler m = new PduMarshaler(bLittleEndian); pdu.Encode(m); return(m.RawData); }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { header.Decode(marshaler); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { bool fDecoded = base.Decode(marshaler); if (fDecoded) { return (this.Header.PacketType == PacketTypeValues.TSMM_PACKET_TYPE_CLIENT_NOTIFICATION || this.Header.PacketType == PacketTypeValues.TSMM_PACKET_TYPE_PRESENTATION_RESPONSE); } else { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); frameNumber = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { offset = marshaler.ReadUInt32(); length = marshaler.ReadUInt32(); status = (USBD_STATUS)marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU to the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to Decode the fields of this PDU.</param> /// <returns></returns> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); MaxNumMonitors = marshaler.ReadUInt32(); MaxMonitorAreaFactorA = marshaler.ReadUInt32(); MaxMonitorAreaFactorB = marshaler.ReadUInt32(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { len = marshaler.ReadUInt16(); numberOfPipes = marshaler.ReadUInt16(); interfaceNumber = marshaler.ReadByte(); alternateSetting = marshaler.ReadByte(); padding = marshaler.ReadUInt16(); numberOfPipes = marshaler.ReadUInt32(); informations = new TS_USBD_PIPE_INFORMATION[numberOfPipes]; for (int i = 0; i < numberOfPipes; i++) { informations[i].Decode(marshaler); } } catch (Exception) { // TODO: All generic exceptions should be got rid of. return false; } return true; }
/// <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.WriteUInt16(len); marshaler.WriteUInt16(numberOfPipesExpected); marshaler.WriteByte(interfaceNumber); marshaler.WriteByte(alternateSetting); marshaler.WriteUInt16(padding); marshaler.WriteUInt32(numberOfPipes); for (int i = 0; i < informations.Length; i++) { informations[i].Encode(marshaler); } }
/// <summary> /// Encode this PDU to the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public abstract void Encode(PduMarshaler marshaler);
/// <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(frameNumber); }
/// <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> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.Version = (RdpevorVersionValues)marshaler.ReadByte(); this.Command = (CommandValues)marshaler.ReadByte(); this.FrameRate = marshaler.ReadByte(); this.AverageBitrateKbps = marshaler.ReadUInt16(); this.Reserved = marshaler.ReadUInt16(); this.SourceWidth = marshaler.ReadUInt32(); this.SourceHeight = marshaler.ReadUInt32(); this.ScaledWidth = marshaler.ReadUInt32(); this.ScaledHeight = marshaler.ReadUInt32(); this.hnsTimestampOffset = marshaler.ReadUInt64(); this.GeometryMappingId = marshaler.ReadUInt64(); this.VideoSubtypeId = marshaler.ReadBytes(16); this.cbExtra = marshaler.ReadUInt32(); this.pExtraData = marshaler.ReadBytes((int)this.cbExtra); this.Reserved2 = marshaler.ReadByte(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { if (!base.Decode(marshaler)) { return false; } configurationHandle = marshaler.ReadUInt32(); numInterfaces = marshaler.ReadUInt32(); if (numInterfaces == 0) { interfaces = null; } else { interfaces = new TS_USBD_INTERFACE_INFORMATION_RESULT[numInterfaces]; for (int i = 0; i < numInterfaces; i++) { interfaces[i] = new TS_USBD_INTERFACE_INFORMATION_RESULT(); if (!interfaces[i].Decode(marshaler)) { return false; } } } } catch (Exception) { return false; } return true; }
/// <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(Header.cbSize); marshaler.WriteUInt32((uint)Header.PacketType); }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { size = marshaler.ReadUInt16(); padding = marshaler.ReadUInt16(); usbdStatus = marshaler.ReadUInt32(); } catch (Exception) { return false; } return true; }
/// <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.WriteUInt16(size); marshaler.WriteUInt16(padding); marshaler.WriteUInt32(usbdStatus); }
/// <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) { header.Encode(marshaler); }
/// <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(startFrame); marshaler.WriteUInt32(numberOfPackets); marshaler.WriteUInt32(errorCount); for (int i = 0; i < isoPacket.Length; i++) { isoPacket[i].Encode(marshaler); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); startFrame = marshaler.ReadUInt32(); numberOfPackets = marshaler.ReadUInt32(); errorCount = marshaler.ReadUInt32(); isoPacket = new USBD_ISO_PACKET_DESCRIPTOR[numberOfPackets]; for (int i = 0; i < isoPacket.Length; i++) { isoPacket[i].Decode(marshaler); } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { length = marshaler.ReadUInt16(); interfaceNumber = marshaler.ReadByte(); alternateSetting = marshaler.ReadByte(); class_field = marshaler.ReadByte(); subClass = marshaler.ReadByte(); protocol = marshaler.ReadByte(); padding = marshaler.ReadByte(); interfaceHandle = marshaler.ReadUInt32(); numberOfPipes = marshaler.ReadUInt32(); if (numberOfPipes > 0) { pipes = new TS_USBD_PIPE_INFORMATION_RESULT[numberOfPipes]; for (int i = 0; i < pipes.Length; i++) { pipes[i] = new TS_USBD_PIPE_INFORMATION_RESULT(); pipes[i].Decode(marshaler); } } else { pipes = null; } } catch (Exception) { return false; } return true; }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.ResponseFlags = marshaler.ReadByte(); this.ResultFlags = marshaler.ReadUInt16(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU to the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to Decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { Header.cbSize = marshaler.ReadUInt32(); Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { this.Header.cbSize = marshaler.ReadUInt32(); this.Header.PacketType = (PacketTypeValues)marshaler.ReadUInt32(); this.PresentatioinId = marshaler.ReadByte(); this.Version = (RdpevorVersionValues)marshaler.ReadByte(); this.Flags = (TsmmVideoData_FlagsValues)marshaler.ReadByte(); this.Reserved = marshaler.ReadByte(); this.HnsTimestamp = marshaler.ReadUInt64(); this.HnsDuration = marshaler.ReadUInt64(); this.CurrentPacketIndex = marshaler.ReadUInt16(); this.PacketsInSample = marshaler.ReadUInt16(); this.SampleNumber = marshaler.ReadUInt32(); this.cbSample = marshaler.ReadUInt32(); this.pSample = marshaler.ReadBytes((int)this.cbSample); this.Reserved2 = marshaler.ReadByte(); return true; } catch { marshaler.Reset(); throw new PDUDecodeException(this.GetType(), marshaler.ReadToEnd()); } }
/// <summary> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to encode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { Data = marshaler.ReadToEnd(); return Data != null; }
/// <summary> /// Unmarshal bytes array to the PDU structure. /// </summary> /// <param name="data">The bytes array to unmarshal.</param> /// <param name="pdu">The PDU to be filled.</param> /// <param name="bLittleEndian">Indicates whether encode the numbers to little endian.</param> /// <returns>The PDU</returns> public static bool Unmarshal(byte[] data, BasePDU pdu, bool bLittleEndian) { PduMarshaler m = new PduMarshaler(data, bLittleEndian); return(pdu.Decode(m)); }
/// <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> /// Unmarshal bytes array to the PDU structure. /// </summary> /// <param name="data">The bytes array to unmarshal.</param> /// <param name="pdu">The PDU to be filled.</param> /// <returns>The PDU</returns> public static bool Unmarshal(byte[] data, BasePDU pdu) { PduMarshaler m = new PduMarshaler(data); return(pdu.Decode(m)); }
/// <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> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public abstract bool Decode(PduMarshaler marshaler);
/// <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(this.ResponseFlags); marshaler.WriteUInt16(this.ResultFlags); }
/// <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(configurationHandle); marshaler.WriteUInt32(numInterfaces); if (null != Interface) { for (int i = 0; i < Interface.Length; i++) { interfaces[i].Encode(marshaler); } } }
/// <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> /// Decode this PDU from the PduMarshaler. /// </summary> /// <param name="marshaler">This is used to decode the fields of this PDU.</param> public override bool Decode(PduMarshaler marshaler) { try { base.Decode(marshaler); interface_field.Decode(marshaler); } catch (Exception) { return false; } return true; }
/// <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); }
/// <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); interface_field.Encode(marshaler); }