One or more DYNVC_SOFT_SYNC_CHANNEL_LISTs are contained in a Soft-Sync Request PDU to indicate which dynamic virtual channels have data written by the server on the specified multitransport tunnel
        protected override void DoUnmarshal(PduMarshaler marshaler)
        {
            this.Pad             = marshaler.ReadByte();
            this.Length          = marshaler.ReadUInt32();
            this.Flags           = (SoftSyncReqFlags_Value)marshaler.ReadUInt16();
            this.NumberOfTunnels = marshaler.ReadUInt16();
            List <SoftSyncChannelList> list = new List <SoftSyncChannelList>();

            for (int i = 0; i < NumberOfTunnels; ++i)
            {
                SoftSyncChannelList channel = new SoftSyncChannelList((TunnelType_Value)marshaler.ReadUInt32(), marshaler.ReadUInt16());

                List <uint> Ids = new List <uint>();
                for (int k = 0; k < channel.NumberOfDVCs; ++k)
                {
                    Ids.Add(marshaler.ReadUInt32());
                }
                channel.ListOfDVCIds = Ids.ToArray();
                list.Add(channel);
            }
            this.SoftSyncChannelLists = list.ToArray();
        }
        /// <summary>
        /// Send Soft Sync requst.
        /// </summary>
        /// <param name="timeout">wait time</param>
        /// <param name="channelListDic">TunnelType value & Channel Ids</param>
        public void SoftSyncNegotiate(TimeSpan timeout, Dictionary <TunnelType_Value, List <uint> > channelListDic = null)
        {
            SoftSyncReqFlags_Value flags = SoftSyncReqFlags_Value.SOFT_SYNC_TCP_FLUSHED;

            if (channelListDic != null)
            {
                flags |= SoftSyncReqFlags_Value.SOFT_SYNC_CHANNEL_LIST_PRESENT;
            }

            List <SoftSyncChannelList> channelList = new List <SoftSyncChannelList>();
            int numberOfTunnels = 0;

            if (channelListDic != null)
            {
                foreach (KeyValuePair <TunnelType_Value, List <uint> > kvp in channelListDic)
                {
                    SoftSyncChannelList channel = new SoftSyncChannelList(kvp.Key, (ushort)kvp.Value.Count, kvp.Value);
                    channelList.Add(channel);
                }
                numberOfTunnels = channelListDic.Count;
            }

            SoftSyncNegotiate(timeout, flags, (ushort)numberOfTunnels, channelList.ToArray());
        }
 /// <summary>
 ///  Create DYNVC_SOFT_SYNC_REQUEST PDU. 
 /// </summary>
 public SoftSyncReqDvcPDU CreateSoftSyncReqPdu(SoftSyncReqFlags_Value flags, ushort numberOfTunnels, SoftSyncChannelList[] channelList = null)
 {
     return new SoftSyncReqDvcPDU(flags, numberOfTunnels, channelList);
 }
 /// <summary>
 /// Send DYNVC_SOFT_SYNC_REQUEST PDU.
 /// </summary>
 private void SendSoftSyncRequestPDU(SoftSyncReqFlags_Value flags, ushort numberOfTunnels = 0, SoftSyncChannelList[] channelList = null, DynamicVC_TransportType transportType = DynamicVC_TransportType.RDP_TCP)
 {
     SoftSyncReqDvcPDU pdu = pduBuilder.CreateSoftSyncReqPdu(flags, numberOfTunnels, channelList);
     this.Send(pdu, transportType);
 }
        /// <summary>
        /// Send Soft Sync requst.
        /// </summary>
        /// <param name="timeout">wait time</param>
        /// <param name="channelListDic">TunnelType value & Channel Ids</param>
        public void SoftSyncNegotiate(TimeSpan timeout, Dictionary<TunnelType_Value, List<uint>> channelListDic = null)
        {
            SoftSyncReqFlags_Value flags = SoftSyncReqFlags_Value.SOFT_SYNC_TCP_FLUSHED;
            if (channelListDic != null)
            {
                flags |= SoftSyncReqFlags_Value.SOFT_SYNC_CHANNEL_LIST_PRESENT;
            }

            List<SoftSyncChannelList> channelList = new List<SoftSyncChannelList>();
            int numberOfTunnels = 0;
            if (channelListDic != null)
            {
                foreach (KeyValuePair<TunnelType_Value, List<uint>> kvp in channelListDic)
                {
                    SoftSyncChannelList channel = new SoftSyncChannelList(kvp.Key, (ushort)kvp.Value.Count, kvp.Value);
                    channelList.Add(channel);
                }
                numberOfTunnels = channelListDic.Count;
            }

            SoftSyncNegotiate(timeout, flags, (ushort)numberOfTunnels, channelList.ToArray());
        }
 /// <summary>
 /// Send Soft Sync request and wait for Soft Sync response.
 /// </summary>
 /// <param name="timeout">wait time</param>
 /// <param name="flags">specifies the contents of this PDU</param>
 /// <param name="numberOfTunnels">tunnel numbers</param>
 /// <param name="channelList">DYNVC_SOFT_SYNC_CHANNEL_LISTs</param>
 public void SoftSyncNegotiate(TimeSpan timeout, SoftSyncReqFlags_Value flags, ushort numberOfTunnels, SoftSyncChannelList[] channelList = null)
 {
     this.SendSoftSyncRequestPDU(flags, numberOfTunnels, channelList);
     SoftSyncResDvcPdu pdu = this.ExpectSoftSyncResponsePDU(timeout);
     if (pdu == null)
     {
         throw new System.IO.IOException("Cannot receive a Soft Sync Response PDU!");
     }
 }
        protected override void DoUnmarshal(PduMarshaler marshaler)
        {
            this.Pad = marshaler.ReadByte();
            this.Length = marshaler.ReadUInt32();
            this.Flags = (SoftSyncReqFlags_Value)marshaler.ReadUInt16();
            this.NumberOfTunnels = marshaler.ReadUInt16();
            List<SoftSyncChannelList> list = new List<SoftSyncChannelList>();

            for (int i = 0; i < NumberOfTunnels; ++i)
            {
                SoftSyncChannelList channel = new SoftSyncChannelList((TunnelType_Value)marshaler.ReadUInt32(), marshaler.ReadUInt16());

                List<uint> Ids = new List<uint>();
                for (int k = 0; k < channel.NumberOfDVCs; ++k)
                {
                    Ids.Add(marshaler.ReadUInt32());
                }
                channel.ListOfDVCIds = Ids.ToArray();
                list.Add(channel);
            }
            this.SoftSyncChannelLists = list.ToArray();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public SoftSyncReqDvcPDU(SoftSyncReqFlags_Value flags, ushort numberOfTunnels, SoftSyncChannelList[] softSyncChannelLists)
        {
            HeaderBits = new Header(Cmd_Values.SoftSyncReq, 0, 0);
            this.Pad = 0;
            this.Flags = flags;
            this.NumberOfTunnels = numberOfTunnels;
            this.SoftSyncChannelLists = softSyncChannelLists;
            // Section 2.2.5.1, Length (4 bytes): A 32-bit, unsigned integer indicating the total size, in bytes, of SoftSyncChannelLists field.
            // TDI: this length should also including the length of Length(4 bytes), Flags(2 bytes) and NumberOfTunnels(2 bytes) in DYNVC_SOFT_SYNC_REQUEST PDU.
            // this length value is Length(4) + Flags(2) + NumberOfTunnels(2) = 8.
            this.Length = 8;

            if(flags.HasFlag(SoftSyncReqFlags_Value.SOFT_SYNC_CHANNEL_LIST_PRESENT))
            {
                if (softSyncChannelLists == null)
                {
                    DynamicVCException.Throw("Should have one or more Soft-Sync Channel Lists.");
                }

                foreach (var channel in softSyncChannelLists)
                {
                    this.Length += (uint)channel.GetSize();
                }
            }
        }