CaptureCommonDataTypesRequirements() 공개 정적인 메소드

Capture Common Data Types structure requirements.
public static CaptureCommonDataTypesRequirements ( object obj ) : void
obj object The object.
리턴 void
예제 #1
0
        /// <summary>
        /// Send message MSG_GETBLKLIST.
        /// </summary>
        /// <param name="sid">segment id.</param>
        /// <param name="blockRang">Block ranges client wants to get.</param>
        /// <param name="isVersionSupported">The version in message is supported by server or not.</param>
        public void SendMsgGetBlkList(byte[] sid, BLOCKRANGE[] blockRang, bool isVersionSupported)
        {
            PccrrGETBLKLISTRequestPacket packet;

            BLOCK_RANGE[] blockRanges = Helper.ConvertToStackBLOCKRANGEArray(blockRang);

            if (!isVersionSupported)
            {
                packet = this.pccrrStack.CreateMsgGetBlkListRequest(sid, blockRanges, this.cryptoAlgo, MsgType_Values.MSG_GETBLKLIST, this.protoErrorVer);
            }
            else
            {
                packet = this.pccrrStack.CreateMsgGetBlkListRequest(sid, blockRanges, this.cryptoAlgo, MsgType_Values.MSG_GETBLKLIST, this.protoVer);
            }

            this.pccrrStack.SendPacket(packet, new TimeSpan(0, 0, this.timeout));

            PccrrPacket respMSG = this.pccrrStack.ExpectPacket();

            if (!isVersionSupported)
            {
                PccrrNegoResponsePacket pccrrNegoResponsePacket = respMSG as PccrrNegoResponsePacket;

                if (pccrrNegoResponsePacket != null)
                {
                    this.ReceiveMsgNegoResp();
                }
            }
            else
            {
                PccrrBLKLISTResponsePacket pccrrBLKLISTResponsePacket = respMSG as PccrrBLKLISTResponsePacket;

                MSG_BLKLIST               msgBLKLIST     = pccrrBLKLISTResponsePacket.MsgBLKLIST;
                MESSAGE_HEADER            messageHeader  = pccrrBLKLISTResponsePacket.MessageHeader;
                TRANSPORT_RESPONSE_HEADER transportRespH = pccrrBLKLISTResponsePacket.TransportResponseHeader;
                RESPONSE_MESSAGE          respMessage    = new RESPONSE_MESSAGE();
                respMessage.MESSAGEBODY             = msgBLKLIST;
                respMessage.MESSAGEHEADER           = messageHeader;
                respMessage.TRANSPORTRESPONSEHEADER = transportRespH;

                if (msgBLKLIST.BlockRanges.Length != 0)
                {
                    BLOCK_RANGE blockRange = pccrrBLKLISTResponsePacket.MsgBLKLIST.BlockRanges[0];
                    PccrrBothRoleCaptureCode.CaptureBlockRangeRequirements(blockRange);
                }

                this.VerifyMsgBlkList(msgBLKLIST);
                PccrrBothRoleCaptureCode.CaptureCommonDataTypesRequirements(msgBLKLIST);
                this.VerifyResponseMessage(respMessage);

                BLOCKRANGE[] blkRanges = Helper.ConvertFromStackBLOCKRANGEArray(msgBLKLIST.BlockRanges);
                this.ReceiveMsgBlkList(msgBLKLIST.BlockRangeCount, blkRanges, msgBLKLIST.NextBlockIndex);
            }
        }
예제 #2
0
        /// <summary>
        /// Verify the received message from client.
        /// </summary>
        /// <param name="remoteAddr">The remote address.</param>
        /// <param name="pccrrPacket">The pccrrPacket.</param>
        private void RetrievalTransport_Receive(IPEndPoint remoteAddr, PccrrPacket pccrrPacket)
        {
            PccrrGETBLKSRequestPacket pccrrGETBLKSRequestPacket = pccrrPacket as PccrrGETBLKSRequestPacket;

            if (pccrrGETBLKSRequestPacket != null)
            {
                MSG_GETBLKS    msgGETBLKS    = pccrrGETBLKSRequestPacket.MsgGetBLKS;
                MESSAGE_HEADER messageHEADER = pccrrGETBLKSRequestPacket.MessageHeader;
                this.sid = msgGETBLKS.SegmentID;
                REQUEST_MESSAGE requestMESSAGE = new REQUEST_MESSAGE();
                requestMESSAGE.MESSAGEBODY   = msgGETBLKS;
                requestMESSAGE.MESSAGEHEADER = messageHEADER;
                this.uiPayload = Marshal.SizeOf(messageHEADER) + Marshal.SizeOf(msgGETBLKS) + 24;

                PccrrBothRoleCaptureCode.CaptureBlockRangeRequirements(msgGETBLKS.ReqBlockRanges[0]);
                PccrrBothRoleCaptureCode.CaptureMessageHeaderRequirements(messageHEADER, this.uiPayload);
                this.VerifyGetBlocks(msgGETBLKS);
                this.VerifyRequestMessage(requestMESSAGE);
                PccrrBothRoleCaptureCode.CaptureSegmentIdRequirements(msgGETBLKS.SegmentID);
                PccrrBothRoleCaptureCode.CaptureHttpRequirements();
                PccrrBothRoleCaptureCode.CaptureMessageRequirements();

                this.ReceiveMsgGetBlk(msgGETBLKS.ReqBlockRanges[0].Index);
            }
            else
            {
                PccrrGETBLKLISTRequestPacket pccrrGETBLKLISTRequestPacket = pccrrPacket as PccrrGETBLKLISTRequestPacket;

                if (pccrrGETBLKLISTRequestPacket != null)
                {
                    MSG_GETBLKLIST msgGETBLKLIST = pccrrGETBLKLISTRequestPacket.MsgGetBLKLIST;
                    this.sid = msgGETBLKLIST.SegmentID;

                    this.VerifyGetBlkList(msgGETBLKLIST);
                    PccrrBothRoleCaptureCode.CaptureCommonDataTypesRequirements(msgGETBLKLIST);
                    _BLOCKRANGE[] blockRanges = ClientHelper.ConvertFromStackBLOCKRANGEArray(msgGETBLKLIST.NeededBlockRanges);

                    this.ReceiveMsgGetBlkList(blockRanges);
                }
                else
                {
                    this.ReceiveMsgNegoReq();
                }
            }
        }