The MSG_GETSEGLIST (GetSegmentList) message contains a request for a download segment list. It is used when retrieving a set of segments.
Example #1
0
        /// <summary>
        /// Create a MsgGetSegList request.
        /// </summary>
        /// <param name="cryptoAlgoIdValues">The cryptoAlgoId.</param>
        /// <param name="requestID">Request ID.</param>
        /// <param name="segmentIDs">Array of segment IDs.</param>
        /// <param name="extensibleBlob">Extensible blob.</param>
        /// <returns>MsgGetSegList request.</returns>
        public PccrrGetSegListRequestPacket CreateMsgGetSegListRequest(
            CryptoAlgoId_Values cryptoAlgoIdValues,
            Guid requestID,
            byte[][] segmentIDs,
            byte[] extensibleBlob)
        {
            var packet = new PccrrGetSegListRequestPacket();

            var msgGetSegList = new MSG_GETSEGLIST();

            msgGetSegList.RequestID         = requestID;
            msgGetSegList.CountOfSegmentIDs = (uint)segmentIDs.Length;
            msgGetSegList.SegmentIDs        = new SegmentIDStructure[segmentIDs.Length];
            for (int i = 0; i < segmentIDs.Length; i++)
            {
                msgGetSegList.SegmentIDs[i] = new SegmentIDStructure(segmentIDs[i]);
            }
            ///[MS-PCCRR]Section 2.2.4.4 SizeOfExtensibleBlob: Size, in bytes, of the ExtensibleBlob field. Implementations MAY support extensible blobs in MSG_GETSEGLIST
            ///message.Implementations that do not support extensible blobs in MSG_GETSEGLIST messages MUST set SizeOfExtensibleBlob to zero and omit the ExtensibleBlob field.
            msgGetSegList.SizeOfExtensibleBlob = (uint)extensibleBlob.Length;
            msgGetSegList.ExtensibleBlob       = extensibleBlob;

            packet.MsgGetSegList = msgGetSegList;
            MESSAGE_HEADER messageHeader = PccrrUtitlity.CreateMessageHeader(cryptoAlgoIdValues, MsgType_Values.MSG_GETSEGLIST, new ProtoVersion {
                MajorVersion = 2, MinorVersion = 0
            });

            messageHeader.MsgSize += (uint)TypeMarshal.GetBlockMemorySize(msgGetSegList);
            packet.MessageHeader   = messageHeader;

            return(packet);
        }
        /// <summary>
        /// Create a MsgGetSegList request.
        /// </summary>
        /// <param name="cryptoAlgoIdValues">The cryptoAlgoId.</param>
        /// <param name="requestID">Request ID.</param>
        /// <param name="segmentIDs">Array of segment IDs.</param>
        /// <param name="extensibleBlob">Extensible blob.</param>
        /// <returns>MsgGetSegList request.</returns>
        public PccrrGetSegListRequestPacket CreateMsgGetSegListRequest(
            CryptoAlgoId_Values cryptoAlgoIdValues,
            Guid requestID,
            byte[][] segmentIDs,
            byte[] extensibleBlob)
        {
            var packet = new PccrrGetSegListRequestPacket();

            var msgGetSegList = new MSG_GETSEGLIST();
            msgGetSegList.RequestID = requestID;
            msgGetSegList.CountOfSegmentIDs = (uint)segmentIDs.Length;
            msgGetSegList.SegmentIDs = new SegmentIDStructure[segmentIDs.Length];
            for (int i = 0; i < segmentIDs.Length; i++)
            {
                msgGetSegList.SegmentIDs[i] = new SegmentIDStructure(segmentIDs[i]);
            }
            ///[MS-PCCRR]Section 2.2.4.4 SizeOfExtensibleBlob: Size, in bytes, of the ExtensibleBlob field. Implementations MAY support extensible blobs in MSG_GETSEGLIST
            ///message.Implementations that do not support extensible blobs in MSG_GETSEGLIST messages MUST set SizeOfExtensibleBlob to zero and omit the ExtensibleBlob field.
            msgGetSegList.SizeOfExtensibleBlob = (uint)extensibleBlob.Length;
            msgGetSegList.ExtensibleBlob = extensibleBlob;

            packet.MsgGetSegList = msgGetSegList;
            MESSAGE_HEADER messageHeader = PccrrUtitlity.CreateMessageHeader(cryptoAlgoIdValues, MsgType_Values.MSG_GETSEGLIST, new ProtoVersion { MajorVersion = 2, MinorVersion = 0 });
            messageHeader.MsgSize += (uint)TypeMarshal.GetBlockMemorySize(msgGetSegList);
            packet.MessageHeader = messageHeader;

            return packet;
        }