/// <summary>
        /// Handler when receive LeaseBreakNotification
        /// </summary>
        /// <param name="respHeader">Packet header in LeaseBreakNotification</param>
        /// <param name="leaseBreakNotify">Received LeaseBreakNotification</param>
        protected virtual void OnLeaseBreakNotificationReceived(Packet_Header respHeader, LEASE_BREAK_Notification_Packet leaseBreakNotify)
        {
            BaseTestSite.Log.Add(
                LogEntryKind.Debug,
                "LeaseBreakNotification was received from server");
            receivedLeaseBreakNotify = leaseBreakNotify;

            BaseTestSite.Assert.AreEqual <ulong>(
                0xFFFFFFFFFFFFFFFF,
                respHeader.MessageId,
                "Expect that the field MessageId is set to 0xFFFFFFFFFFFFFFFF.");
            BaseTestSite.Assert.AreEqual <ulong>(
                0,
                respHeader.SessionId,
                "Expect that the field SessionId is set to 0.");
            BaseTestSite.Assert.AreEqual <uint>(
                0,
                respHeader.TreeId,
                "Expect that the field TreeId is set to 0.");
            BaseTestSite.Assert.AreEqual <uint>(
                0,
                leaseBreakNotify.BreakReason,
                "Expect that the field BreakReason is set to 0.");
            BaseTestSite.Assert.AreEqual <uint>(
                0,
                leaseBreakNotify.AccessMaskHint,
                "Expect that the field AccessMaskHint is set to 0.");
            BaseTestSite.Assert.AreEqual <uint>(
                0,
                leaseBreakNotify.ShareMaskHint,
                "Expect that the field ShareMaskHint is set to 0.");

            notificationReceived.Set();
        }
        /// <summary>
        /// Handle the lease break notification.
        /// </summary>
        /// <param name="respHeader">The SMB2 header included in the notification.</param>
        /// <param name="leaseBreakNotify">Lease break notification payload in the notification.</param>
        private void OnLeaseBreakNotificationReceived(Packet_Header respHeader, LEASE_BREAK_Notification_Packet leaseBreakNotify)
        {
            Smb2FunctionalClient client = null;

            if (smb2ClientMainChannel != null)
            {
                client = smb2ClientMainChannel;
            }
            else if (smb2ClientAlternativeChannel != null)
            {
                client = smb2ClientAlternativeChannel;
            }

            if (client != null)
            {
                Site.Log.Add(LogEntryKind.Debug, "Receive a lease break notification and will send lease break acknowledgment.");
                client.LeaseBreakAcknowledgment(
                    treeIdMainChannel,
                    leaseKeyMainChannel,
                    leaseBreakNotify.NewLeaseState);
            }
        }
Example #3
0
 /// <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");
     }
 }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, LEASE_BREAK_Notification_Packet notification)
 {
     // Set Lease breake state
     leaseBreakState = LeaseBreakState.LeaseBreakExisted;
 }
 protected override void OnLeaseBreakNotificationReceived(Packet_Header respHeader, LEASE_BREAK_Notification_Packet leaseBreakNotify)
 {
     BaseTestSite.Log.Add(LogEntryKind.Debug, "LeaseBreakNotification was received from server");
     isLeaseBreakReceived = true;
 }
 private void OnLeaseBreakNotificationReceived(Packet_Header header, LEASE_BREAK_Notification_Packet notification)
 {
     // Set Lease break state
     breakType = ModelBreakType.LeaseBreak;
     leaseClient.LeaseBreakAcknowledgment(treeIdLease, notification.LeaseKey, notification.NewLeaseState);
 }