/// <summary> /// Parse the SeekEntries request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The SeekEntries request type response body.</returns> public static SeekEntriesResponseBody Parse(byte[] rawData) { SeekEntriesResponseBody responseBody = new SeekEntriesResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.HasState = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasState) { responseBody.State = STAT.Parse(rawData, ref index); } else { responseBody.State = null; } responseBody.HasColumnsAndRows = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasColumnsAndRows) { responseBody.Columns = LargePropertyTagArray.Parse(rawData, ref index); responseBody.RowCount = BitConverter.ToUInt32(rawData, index); responseBody.RowData = new AddressBookPropertyRow[(uint)responseBody.RowCount]; index += sizeof(uint); for (int i = 0; i < responseBody.RowCount; i++) { responseBody.RowData[i] = AddressBookPropertyRow.Parse(rawData, (LargePropertyTagArray)responseBody.Columns, ref index); } } else { responseBody.Columns = null; responseBody.RowCount = null; responseBody.RowData = null; } responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize]; Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize); return(responseBody); }
/// <summary> /// Parse the SeekEntries request type response body. /// </summary> /// <param name="rawData">The raw data of response.</param> /// <returns>The SeekEntries request type response body.</returns> public static SeekEntriesResponseBody Parse(byte[] rawData) { SeekEntriesResponseBody responseBody = new SeekEntriesResponseBody(); int index = 0; responseBody.StatusCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.ErrorCode = BitConverter.ToUInt32(rawData, index); index += sizeof(uint); responseBody.HasState = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasState) { responseBody.State = STAT.Parse(rawData, ref index); } else { responseBody.State = null; } responseBody.HasColumnsAndRows = BitConverter.ToBoolean(rawData, index); index += sizeof(bool); if (responseBody.HasColumnsAndRows) { responseBody.Columns = LargePropertyTagArray.Parse(rawData, ref index); responseBody.RowCount = BitConverter.ToUInt32(rawData, index); responseBody.RowData = new AddressBookPropertyRow[(uint)responseBody.RowCount]; index += sizeof(uint); for (int i = 0; i < responseBody.RowCount; i++) { responseBody.RowData[i] = AddressBookPropertyRow.Parse(rawData, (LargePropertyTagArray)responseBody.Columns, ref index); } } else { responseBody.Columns = null; responseBody.RowCount = null; responseBody.RowData = null; } responseBody.AuxiliaryBufferSize = BitConverter.ToUInt32(rawData, index); index += 4; responseBody.AuxiliaryBuffer = new byte[responseBody.AuxiliaryBufferSize]; Array.Copy(rawData, index, responseBody.AuxiliaryBuffer, 0, responseBody.AuxiliaryBufferSize); return responseBody; }
/// <summary> /// This method is used by the client to search for and set the logical position in a specific table to the first entry greater than or equal to a specified value. /// </summary> /// <param name="seekEntriesRequestBody">The SeekEntries request type request body.</param> /// <returns>The response body of SeekEntries request type.</returns> public SeekEntriesResponseBody SeekEntries(SeekEntriesRequestBody seekEntriesRequestBody) { CommonResponse commonResponse = this.SendAddressBookRequest(seekEntriesRequestBody, RequestType.SeekEntries); SeekEntriesResponseBody seekEntriesResponseBody = SeekEntriesResponseBody.Parse(commonResponse.ResponseBodyRawData); this.VerifySeekEntriesResponseBody(seekEntriesResponseBody); if (seekEntriesResponseBody.HasColumnsAndRows) { foreach (AddressBookPropertyRow row in seekEntriesResponseBody.RowData) { this.VerifyAddressBookPropertyRowStructure(row); } this.VerifyLargePropertyTagArrayStructure(seekEntriesResponseBody.Columns.Value); } return(seekEntriesResponseBody); }
/// <summary> /// Verify the requirements related to SeekEntries request type response body. /// </summary> /// <param name="responseBody">The SeekEntries response body to be verified.</param> private void VerifySeekEntriesResponseBody(SeekEntriesResponseBody responseBody) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1038"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1038 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.StatusCode, typeof(uint), 1038, @"[In SeekEntries Request Type Success Response Body] StatusCode (4 bytes): An unsigned integer that specifies the status of the request."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1039"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1039 this.Site.CaptureRequirementIfAreEqual<uint>( 0x00000000, responseBody.StatusCode, 1039, @"[In SeekEntries Request Type Success Response Body] [StatusCode] This field MUST be set to 0x00000000."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1040"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1040 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.ErrorCode, typeof(uint), 1040, @"[In SeekEntries Request Type Success Response Body] ErrorCode (4 bytes): An unsigned integer that specifies the return status of the operation."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1041"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1041 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.HasState, typeof(bool), 1041, @"[In SeekEntries Request Type RSuccess esponse Body] HasState (1 byte): A Boolean value that specifies whether the State field is present."); if (responseBody.HasState) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1042"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1042 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.State.Value, typeof(STAT), 1042, @"[In SeekEntries Request Type Success Response Body] State (optional) (36 bytes): A STAT structure ([MS-OXNSPI] section 2.3.7) that specifies the state of a specific address book container."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1044"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1044 // Because the HasState is true. So if the State has a value, then R1044 will be verified. this.Site.CaptureRequirementIfIsNotNull( responseBody.State, 1044, @"[In SeekEntries Request Type Success Response Body] [State] This field is present when the HasState field is nonzero."); } else { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1045"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1045 // Because the HasState is false. So if the State does not have a value, R1045 will be verified. this.Site.CaptureRequirementIfIsNull( responseBody.State, 1045, @"[In SeekEntries Request Type Success Response Body] [State] This field is not present when the HasState field is zero."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1046"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1046 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.HasColumnsAndRows, typeof(bool), 1046, @"[In SeekEntries Request Type Success Response Body] HasColumnsAndRows (1 byte): A Boolean value that specifies whether the Columns, RowCount, and RowData fields are present."); if (responseBody.HasColumnsAndRows) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1048"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1048 // Because the HasColumnsAndRows is true. So if the Columns field is not Null, R1048 will be verified. this.Site.CaptureRequirementIfIsNotNull( responseBody.Columns, 1048, @"[In SeekEntries Request Type Success Response Body] [Columns] This field is present when the value of the HasColumnsAndRows field is nonzero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1050"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1050 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.RowCount.Value, typeof(uint), 1050, @"[In SeekEntries Request Type Success Response Body] RowCount (optional) (4 bytes): An unsigned integer that specifies the number of structures contained in the RowData field."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1051"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1051 // Because the HasColumnsAndRows is true. So if the RowCount field is not Null, R1051 will be verified. this.Site.CaptureRequirementIfIsNotNull( responseBody.RowCount, 1051, @"[In SeekEntries Request Type Success Response Body] [RowCount] This field is present when the value of the HasColumnsAndRows field is nonzero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1054"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1054 // Because the HasColumnsAndRows is true. So if the RowCount field is not Null, R1051 will be verified. this.Site.CaptureRequirementIfIsNotNull( responseBody.RowData, 1054, @"[In SeekEntries Request Type Success Response Body] [RowData] This field is present when the HasColumnsAndRows field is nonzero."); } else { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1049"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1049 // Because the HasColumnsAndRows is false. So if the Columns field is Null, R1049 will be verified. this.Site.CaptureRequirementIfIsNull( responseBody.Columns, 1049, @"[In SeekEntries Request Type Success Response Body] [Columns] This field is not present when the value of the HasColumnsAndRows field is zero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1052"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1052 // Because the HasColumnsAndRows is false. So if the RowCount field is Null, R1052 will be verified. this.Site.CaptureRequirementIfIsNull( responseBody.RowCount, 1052, @"[In SeekEntries Request Type Success Response Body] [RowCount] This field is not present when the value of the HasColumnsAndRows field is zero."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1055"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1055 // Because the HasColumnsAndRows is false. So if the RowData field is Null, R1055 will be verified. this.Site.CaptureRequirementIfIsNull( responseBody.RowData, 1055, @"[In SeekEntries Request Type Success Response Body] [RowData] This field is not present when the HasColumnsAndRows field is zero."); } // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1056"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1056 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.AuxiliaryBufferSize, typeof(uint), 1056, @"[In SeekEntries Request Type Success Response Body] AuxiliaryBufferSize (4 bytes): An unsigned integer that specifies the size, in bytes, of the AuxiliaryBuffer field."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1057"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1057 this.Site.CaptureRequirementIfIsInstanceOfType( responseBody.AuxiliaryBuffer, typeof(byte[]), 1057, @"[In SeekEntries Request Type Success Response Body] AuxiliaryBuffer (variable): An array of bytes that constitute the auxiliary payload data returned from the server."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R1058"); // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R1058 this.Site.CaptureRequirementIfAreEqual<uint>( responseBody.AuxiliaryBufferSize, (uint)responseBody.AuxiliaryBuffer.Length, 1058, @"[In SeekEntries Request Type Success Response Body] [AuxiliaryBuffer] The size of this field, in bytes, is specified by the AuxiliaryBufferSize field."); }