public ModelResiliencyRequest( IoCtlInputCount inputCount, ResilientTimeout timeout) : base(0) { InputCount = inputCount; Timeout = timeout; }
public static void IoCtlResiliencyRequest( IoCtlInputCount inputCount, ResilientTimeout timeout) { Condition.IsTrue(State == ModelState.Connected); Condition.IsNotNull(Open); Condition.IsNull(Request); Request = new ModelResiliencyRequest(inputCount, timeout); }
public void IoCtlResiliencyRequest(IoCtlInputCount inputCount, ResilientTimeout timeout) { uint timeoutValue = 0; switch (timeout) { case ResilientTimeout.InvalidTimeout: // if the requested Timeout in seconds is greater than MaxResiliencyTimeout in seconds timeoutValue = testConfig.MaxResiliencyTimeoutInSecond + 1; break; case ResilientTimeout.ValidTimeout: timeoutValue = testConfig.MaxResiliencyTimeoutInSecond; break; case ResilientTimeout.ZeroTimeout: timeoutValue = 0; break; default: throw new ArgumentException("timeout"); } // convert seconds to milliseconds timeoutValue *= 1000; uint inputCountValue = 0; switch (inputCount) { case IoCtlInputCount.InputCountGreaterThanRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE + 1; break; case IoCtlInputCount.InputCountSmallerThanRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE - 1; break; case IoCtlInputCount.InputCountEqualToRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE; break; default: throw new ArgumentException("inputCount"); } Packet_Header ioCtlHeader; IOCTL_Response ioCtlResponse; byte[] inputInResponse; byte[] outputInResponse; uint status = prepareOpenClient.ResiliencyRequest( treeId, fileId, timeoutValue, inputCountValue, out ioCtlHeader, out ioCtlResponse, out inputInResponse, out outputInResponse, checker: (header, response) => { // do nothing, skip the exception } ); #region Verify IOCTL Response TD 3.3.5.15.9 if ((NtStatus)status == NtStatus.STATUS_SUCCESS) { Site.Assert.AreEqual <CtlCode_Values>( CtlCode_Values.FSCTL_LMR_REQUEST_RESILIENCY, (CtlCode_Values)ioCtlResponse.CtlCode, "CtlCode MUST be set to FSCTL_LMR_REQUEST_RESILIENCY."); Site.Assert.AreEqual <FILEID>( fileId, ioCtlResponse.FileId, "FileId.Persistent MUST be set to Open.DurableFileId. FileId.Volatile MUST be set to Open.FileId."); if (testConfig.Platform != Platform.NonWindows) {// Windows Site.Assert.IsTrue( inputInResponse == null || inputInResponse.Length == 0, "InputCount SHOULD be set to zero."); } Site.Assert.IsTrue( outputInResponse == null || outputInResponse.Length == 0, "OutputCount MUST be set to zero."); Site.Assert.AreEqual <uint>( 0, (uint)ioCtlResponse.Flags, "Flags MUST be set to zero."); } #endregion IoCtlResiliencyResponse((ModelSmb2Status)status, resilientHandleConfig); }
public void IoCtlResiliencyRequest(IoCtlInputCount inputCount, ResilientTimeout timeout) { uint timeoutValue = 0; switch(timeout) { case ResilientTimeout.InvalidTimeout: // if the requested Timeout in seconds is greater than MaxResiliencyTimeout in seconds timeoutValue = testConfig.MaxResiliencyTimeoutInSecond + 1; break; case ResilientTimeout.ValidTimeout: timeoutValue = testConfig.MaxResiliencyTimeoutInSecond; break; case ResilientTimeout.ZeroTimeout: timeoutValue = 0; break; default: throw new ArgumentException("timeout"); } // convert seconds to milliseconds timeoutValue *= 1000; uint inputCountValue = 0; switch(inputCount) { case IoCtlInputCount.InputCountGreaterThanRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE + 1; break; case IoCtlInputCount.InputCountSmallerThanRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE - 1; break; case IoCtlInputCount.InputCountEqualToRequestSize: inputCountValue = NETWORK_RESILIENCY_REQUEST_SIZE; break; default: throw new ArgumentException("inputCount"); } Packet_Header ioCtlHeader; IOCTL_Response ioCtlResponse; byte[] inputInResponse; byte[] outputInResponse; uint status = prepareOpenClient.ResiliencyRequest( treeId, fileId, timeoutValue, inputCountValue, out ioCtlHeader, out ioCtlResponse, out inputInResponse, out outputInResponse, checker: (header, response)=> { // do nothing, skip the exception } ); #region Verify IOCTL Response TD 3.3.5.15.9 if((NtStatus)status == NtStatus.STATUS_SUCCESS) { Site.Assert.AreEqual<CtlCode_Values>( CtlCode_Values.FSCTL_LMR_REQUEST_RESILIENCY, (CtlCode_Values)ioCtlResponse.CtlCode, "CtlCode MUST be set to FSCTL_LMR_REQUEST_RESILIENCY."); Site.Assert.AreEqual<FILEID>( fileId, ioCtlResponse.FileId, "FileId.Persistent MUST be set to Open.DurableFileId. FileId.Volatile MUST be set to Open.FileId."); if (testConfig.Platform != Platform.NonWindows) {// Windows Site.Assert.IsTrue( inputInResponse == null || inputInResponse.Length == 0, "InputCount SHOULD be set to zero."); } Site.Assert.IsTrue( outputInResponse == null || outputInResponse.Length == 0, "OutputCount MUST be set to zero."); Site.Assert.AreEqual<uint>( 0, (uint)ioCtlResponse.Flags, "Flags MUST be set to zero."); } #endregion IoCtlResiliencyResponse((ModelSmb2Status)status, resilientHandleConfig); }