-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Async Create Request/Response with Oplock implementation. #354
Open
yin19941005
wants to merge
14
commits into
hierynomus:master
Choose a base branch
from
yin19941005:implement-async-create-oplock
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
20a98d2
Implement Async Create Request/Response with Oplock implementation.
yin19941005 eb92e52
Add taskQueue for DiskShare notifyHandler. Allow user pass in executo…
yin19941005 bbcf322
Add factory to create oplock break related message. Add super class f…
yin19941005 86b602b
Add test case for async create and oplock lock related.
yin19941005 66a5bef
Change NotificationHandler to have single handle method for each Noti…
yin19941005 9df5b0f
Reverse the order of SMBJ Apache license and Eclipse Vert.x Apache li…
yin19941005 0dc92ae
Merge branch 'master' into implement-async-create-oplock
hierynomus b8c878d
Fix didn't check should handle or not when receive a async notificati…
yin19941005 b4aee52
Merge branch 'implement-async-create-oplock' of https://github.com/yi…
yin19941005 a48ad30
Fix publishing connection internal event through global EventBus. Enh…
yin19941005 a3fed23
Change TaskQueue to interface and allow set by config. Remove set exe…
yin19941005 eedacd5
Merge SMB2_OPLOCK_BREAK_LEVEL to SMB2_OPLOCK_LEVEL.
yin19941005 e8517b6
Remove unused import
yin19941005 cf27e09
Codacy Cleanup
yin19941005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/hierynomus/mssmb2/SMB2OplockBreakLevel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C)2016 - SMBJ Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.hierynomus.mssmb2; | ||
|
||
import com.hierynomus.protocol.commons.EnumWithValue; | ||
|
||
/** | ||
* [MS-SMB2].pdf 2.2.23 SMB2 OPLOCK_BREAK Notification - OplockLevel | ||
*/ | ||
public enum SMB2OplockBreakLevel implements EnumWithValue<SMB2OplockBreakLevel> { | ||
SMB2_OPLOCK_LEVEL_NONE(0x00L), | ||
SMB2_OPLOCK_LEVEL_II(0x01L); | ||
|
||
private long value; | ||
|
||
SMB2OplockBreakLevel(long value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public long getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C)2016 - SMBJ Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.hierynomus.mssmb2; | ||
|
||
import com.hierynomus.protocol.commons.EnumWithValue; | ||
|
||
/** | ||
* [MS-SMB2].pdf 2.2.13 SMB2 CREATE Request - OplockLevel | ||
* <p> | ||
*/ | ||
public enum SMB2OplockLevel implements EnumWithValue<SMB2OplockLevel> { | ||
SMB2_OPLOCK_LEVEL_NONE(0x00L), | ||
SMB2_OPLOCK_LEVEL_II(0x01L), | ||
SMB2_OPLOCK_LEVEL_EXCLUSIVE(0x08L), | ||
SMB2_OPLOCK_LEVEL_BATCH(0x09L), | ||
// TODO: implement and support using lease | ||
OPLOCK_LEVEL_LEASE(0xFFL); | ||
|
||
private long value; | ||
|
||
SMB2OplockLevel(long value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public long getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this weith the SMB2OplockLevel, they're exactly the same values. I don't see any additional benefit to separating this Enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the valid set is different between requesting oplock and breaking oplock. Only
LEVEL_NONE
andLEVEL_II
are valid for breaking oplock. Base on my understanding, each enum class should only contain the valid values (and also null in Java). Addingvalid check
functions maybe is an alternative butvalid check
function check on run time. Separating this enum will force the checking on compile time. In my opinion, error checking on compile time is better than on run time. For me, I think simply separate this enum should make the code looks simpler than callingvalid check
function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please model it according to spec, there is no
SMB2_OPLOCK_BREAK_LEVEL
, onlySMB2_OPLOCK_LEVEL
. With different enums we need to have translation code in place to transform one into the other. Please merge them.