Microsoft.Protocols.TestSuites.MS_OXCROPS.MS_OXCROPSAdapter.VerifyMessageSyntaxRequestAndResponseBuffer C# (CSharp) Method

VerifyMessageSyntaxRequestAndResponseBuffer() private method

Verify each ROP request and response buffer structure
private VerifyMessageSyntaxRequestAndResponseBuffer ( object ropSize, byte ropList, List serverOHTable, byte rawData ) : void
ropSize object The size of Request buffer or Response buffer
ropList byte The RopList of request or response
serverOHTable List The ROP server object handle table of request or response
rawData byte The ROP response payload
return void
        private void VerifyMessageSyntaxRequestAndResponseBuffer(object ropSize, byte[][] ropList, List<uint> serverOHTable, byte[] rawData)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R6");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R6
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ushort),
                ropSize.GetType(),
                6,
                @"[In ROP Input and Output Buffers] RopSize (2 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R11");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R11
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(List<uint>),
                serverOHTable.GetType(),
                11,
                @"[In ROP Input and Output Buffers] ServerObjectHandleTable (variable): An array of 32-bit values.");

            int serverOHTableLength = serverOHTable.Count * sizeof(uint);

            // The actual bytes count of ServerObjectHandleTable. RPC_HEADER_EXT_LEN:the length of RPC_HEADER_EXT
            int actualsOHTableLength = rawData.Length - (ushort)ropSize - RPCHEADEREXTLEN;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4675");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4675
            Site.CaptureRequirementIfAreEqual<int>(
                serverOHTableLength,
                actualsOHTableLength,
                4675,
                @"[In ROP Input and Output Buffers] ServerObjectHandleTable (variable):The size of this field is equal to the number of bytes of data remaining in the ROP Input and Output Buffers after the RopsList field.");

            // Mark byte count of ropList
            ushort ropsBytesCount = 0;
            foreach (byte[] bytes in ropList)
            {
                // Get byte count of ropList
                ropsBytesCount += (ushort)bytes.Length;
            }

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4673");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4673
            Site.CaptureRequirementIfAreEqual<ushort>(
                (ushort)ropSize,
                (ushort)(ropsBytesCount + 2),
                4673,
                @"[In ROP Input and Output Buffers] RopsList (variable): The size of this field is 2 bytes less than the value specified in the RopSize field.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R4671");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R4671
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte[][]),
                ropList.GetType(),
                4671,
                @"[In ROP Input and Output Buffers] RopsList (variable): For a ROP output buffer, this field contains an array of ROP response buffers.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3
            // If the previous requirements can be verified correctly, that is, the response message is parsed in little-endian byte order, this requirement can verified directly.
            Site.CaptureRequirement(
                3,
                @"[In Messages] Unless otherwise specified, buffers and fields in this section are depicted in little-endian byte order.");
        }
        #endregion
MS_OXCROPSAdapter