-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
450165f
commit dd2a3ed
Showing
19 changed files
with
171 additions
and
100 deletions.
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
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
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,13 @@ | ||
import Foundation | ||
|
||
public enum Message { | ||
public protocol Request { | ||
associatedtype Response: Message.Response | ||
func encoded() -> Data | ||
} | ||
|
||
public protocol Response { | ||
var header: Header { get } | ||
init(data: Data) | ||
} | ||
} |
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
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
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
55 changes: 55 additions & 0 deletions
55
Sources/SMBClient/Messages/Write+CustomDebugStringConvertible.swift
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,55 @@ | ||
import Foundation | ||
|
||
extension Write.Request: CustomDebugStringConvertible { | ||
public var debugDescription: String { | ||
""" | ||
\(header) | ||
Write Request (\(String(format: "0x%02x", header.command))) | ||
StructureSize: \(structureSize) | ||
Data Offset: \(dataOffset) | ||
Write Length: \(length) | ||
File Offset: \(offset) | ||
GUID handle: \(fileId.to(type: UUID.self)) | ||
Channel: 0x\(String(format: "%08x", channel)) | ||
Remaining Bytes: \(remainingBytes) | ||
Write Flags: \(flags) | ||
Blob Offset: \(writeChannelInfoOffset) | ||
Blob Length: \(writeChannelInfoLength) | ||
Channel Info Blob: \(buffer.hex) | ||
""" | ||
} | ||
} | ||
|
||
extension Write.Response: CustomDebugStringConvertible { | ||
public var debugDescription: String { | ||
""" | ||
\(header) | ||
Read Response (\(String(format: "0x%02x", header.command))) | ||
StructureSize: \(structureSize) | ||
Reserved: \(String(format: "%04x", reserved)) | ||
Write Count: \(count) | ||
Write Remaining: \(remaining) | ||
Channel Info Offset: \(writeChannelInfoOffset) | ||
Channel Info Length: \(writeChannelInfoLength) | ||
""" | ||
} | ||
} | ||
|
||
extension Write.Flags: CustomDebugStringConvertible { | ||
public var debugDescription: String { | ||
var values = [String]() | ||
|
||
if contains(.writeThrough) { | ||
values.append("Write Through") | ||
} | ||
if contains(.writeUnbuffered) { | ||
values.append("Unbuffered") | ||
} | ||
|
||
if values.isEmpty { | ||
return "0x\(String(format: "%08x", rawValue))" | ||
} else { | ||
return "0x\(String(format: "%08x", rawValue)) (\(values.joined(separator: ", ")))" | ||
} | ||
} | ||
} |
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.