public void OplockBreakAcknowledgementRequest(OplockVolatilePortion volatilePortion, OplockPersistentPortion persistentPortion, OplockLevel_Values oplockLevel) { bool volatilePortionFound = volatilePortion == OplockVolatilePortion.VolatilePortionFound; bool persistentMatchesDurableFileId = persistentPortion == OplockPersistentPortion.PersistentMatchesDurableFileId; FILEID fileIdRequest = fileId; if (!volatilePortionFound) { fileIdRequest.Volatile = FILEID.Invalid.Volatile; } if (!persistentMatchesDurableFileId) { fileIdRequest.Persistent = FILEID.Invalid.Persistent; } OPLOCK_BREAK_Response?oplockBreakResponse = null; uint status = testClient.OplockAcknowledgement( treeId, fileIdRequest, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)oplockLevel, (header, response) => oplockBreakResponse = response); OplockBreakResponse((ModelSmb2Status)status, oplockBreakResponse.Value.OplockLevel, oplockLevelOnOpen); }
private void OplockBreakAcknowledgment(Smb2FunctionalClient client) { OPLOCK_BREAK_Acknowledgment_OplockLevel_Values acknowledgementOplockLevel = default(OPLOCK_BREAK_Acknowledgment_OplockLevel_Values); //OpLockBreakNotifyReceived.OplockLevel can only be one of the next two values, otherwise AssertionError will be got in OnOpLockBreakNotificationReceived if (OpLockBreakNotifyReceived.OplockLevel == OPLOCK_BREAK_Notification_Packet_OplockLevel_Values.OPLOCK_LEVEL_II) { acknowledgementOplockLevel = OPLOCK_BREAK_Acknowledgment_OplockLevel_Values.OPLOCK_LEVEL_II; } else if (OpLockBreakNotifyReceived.OplockLevel == OPLOCK_BREAK_Notification_Packet_OplockLevel_Values.OPLOCK_LEVEL_NONE) { acknowledgementOplockLevel = OPLOCK_BREAK_Acknowledgment_OplockLevel_Values.OPLOCK_LEVEL_NONE; } client.OplockAcknowledgement(treeId, fileId, acknowledgementOplockLevel); }
/// <summary> /// Handle the oplock break notification. /// </summary> /// <param name="respHeader">The SMB2 header included in the notification.</param> /// <param name="oplockBreakNotify">Oplock break notification payload in the notification.</param> private void OnOplockBreakNotificationReceived(Packet_Header respHeader, OPLOCK_BREAK_Notification_Packet oplockBreakNotify) { Smb2FunctionalClient client = null; if (smb2ClientMainChannel != null) { client = smb2ClientMainChannel; } else if (smb2ClientAlternativeChannel != null) { client = smb2ClientAlternativeChannel; } if (client != null) { Site.Log.Add(LogEntryKind.Debug, "Receive an oplock break notification and will send oplock break acknowledgment."); client.OplockAcknowledgement( treeIdMainChannel, fileIdMainChannel, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)oplockBreakNotify.OplockLevel, checker: (responseHeader, response) => { } ); } }
private void OnLeaseBreakNotificationReceived(Packet_Header header, OPLOCK_BREAK_Notification_Packet notification) { breakType = ModelBreakType.OplockBreak; oplockClient.OplockAcknowledgement(treeIdOplock, notification.FileId, (OPLOCK_BREAK_Acknowledgment_OplockLevel_Values)notification.OplockLevel); }