当前位置: 首页>>代码示例>>C#>>正文


C# Smb2FunctionalClient.LeaseBreakAcknowledgment方法代码示例

本文整理汇总了C#中Smb2FunctionalClient.LeaseBreakAcknowledgment方法的典型用法代码示例。如果您正苦于以下问题:C# Smb2FunctionalClient.LeaseBreakAcknowledgment方法的具体用法?C# Smb2FunctionalClient.LeaseBreakAcknowledgment怎么用?C# Smb2FunctionalClient.LeaseBreakAcknowledgment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smb2FunctionalClient的用法示例。


在下文中一共展示了Smb2FunctionalClient.LeaseBreakAcknowledgment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AcknowledgeLeaseBreak

 /// <summary>
 /// Acknowledge LeaseBreakNotification received from server
 /// </summary>
 /// <param name="client">Client to send the acknowledgement</param>
 /// <param name="treeId">TreeId associated to send the acknowledgement</param>
 /// <param name="leaseBreakNotify">LeaseBreakNotification received from server</param>
 protected virtual void AcknowledgeLeaseBreak(Smb2FunctionalClient client, uint treeId, LEASE_BREAK_Notification_Packet leaseBreakNotify)
 {
     if (receivedLeaseBreakNotify.Flags == LEASE_BREAK_Notification_Packet_Flags_Values.SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED)
     {
         BaseTestSite.Log.Add(
             LogEntryKind.Debug,
             "Server requires an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");
         // Will add verification for response after SDK change
         uint status = client.LeaseBreakAcknowledgment(treeId, leaseBreakNotify.LeaseKey, leaseBreakNotify.NewLeaseState);
         BaseTestSite.Assert.AreEqual(
             Smb2Status.STATUS_SUCCESS,
             status,
             "LeaseBreakAcknowledgement should succeed, actual status is {0}", Smb2Status.GetStatusCode(status));
     }
     else
     {
         BaseTestSite.Log.Add(
             LogEntryKind.Debug,
             "Server does not require an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");
     }
 }
开发者ID:XiaotianLiuMS,项目名称:WindowsProtocolTestSuites,代码行数:27,代码来源:SMB2LeasingTestBase.cs

示例2: DirecotryLeasing


//.........这里部分代码省略.........

                    if (expectedDialect == DialectRevision.Smb2002 || expectedDialect == DialectRevision.Smb21)
                    {
                        BaseTestSite.Assert.AreEqual(
                            OplockLevel_Values.OPLOCK_LEVEL_NONE,
                            response.OplockLevel,
                            "The expected oplock level is OPLOCK_LEVEL_NONE.");
                    }
                });

            #endregion

            if (expectedDialect >= DialectRevision.Smb30)
            {
                // Break the lease with creating another file in the directory
                sutProtocolController.CreateFile(Path.Combine(Smb2Utility.GetUncPath(TestConfig.SutComputerName, TestConfig.BasicFileShare), testDirectory), CurrentTestCaseName, string.Empty);

                // Wait until LEASE_BREAK_Notification is received
                BaseTestSite.Assert.IsTrue(
                    // Wait for notification arrival
                    notificationReceived.WaitOne(TestConfig.WaitTimeoutInMilliseconds),
                    "LeaseBreakNotification should be raised.");

                if (receivedLeaseBreakNotify.Flags == LEASE_BREAK_Notification_Packet_Flags_Values.SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED)
                {
                    BaseTestSite.Log.Add(
                        LogEntryKind.Debug,
                        "Server requires an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");

                    #region LEASE_BREAK_ACK
                    switch (leaseBreakAckType)
                    {
                        case LeaseBreakAckType.None:
                            status = client.LeaseBreakAcknowledgment(treeId, receivedLeaseBreakNotify.LeaseKey, receivedLeaseBreakNotify.NewLeaseState);
                            break;

                        case LeaseBreakAckType.InvalidLeaseState:
                            LeaseStateValues newLeaseState = LeaseStateValues.SMB2_LEASE_WRITE_CACHING;
                            BaseTestSite.Log.Add(
                                LogEntryKind.Comment,
                                "Client attempts to send LEASE_BREAK_ACK with an invalid LeaseState {0} on this LEASE_BREAK_NOTIFY", newLeaseState);
                            status = client.LeaseBreakAcknowledgment(
                                treeId,
                                receivedLeaseBreakNotify.LeaseKey,
                                newLeaseState,
                                checker: (header, response) =>
                                {
                                    BaseTestSite.Assert.AreNotEqual(
                                        Smb2Status.STATUS_SUCCESS,
                                        header.Status,
                                        "LEASE_BREAK_ACK with invalid LeaseState is not expected to SUCCESS, actually server returns {0}.", Smb2Status.GetStatusCode(header.Status));
                                    BaseTestSite.CaptureRequirementIfAreEqual(
                                        Smb2Status.STATUS_REQUEST_NOT_ACCEPTED,
                                        header.Status,
                                        RequirementCategory.STATUS_REQUEST_NOT_ACCEPTED.Id,
                                        RequirementCategory.STATUS_REQUEST_NOT_ACCEPTED.Description);
                                });
                            break;

                        case LeaseBreakAckType.InvalidLeaseKey:
                            Guid invalidLeaseKey = Guid.NewGuid();
                            BaseTestSite.Log.Add(
                                LogEntryKind.Debug,
                                "Client attempts to send LEASE_BREAK_ACK with an invalid LeaseKey {0} on this LEASE_BREAK_NOTIFY", invalidLeaseKey);
                            status = client.LeaseBreakAcknowledgment(
                                treeId,
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:67,代码来源:DirectoryLeasing.cs


注:本文中的Smb2FunctionalClient.LeaseBreakAcknowledgment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。