Created
September 15, 2019 05:19
-
-
Save zengcity/ed710ff963ce7038d4c3d43d545d6ea6 to your computer and use it in GitHub Desktop.
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
public init(payload: NSData) { | |
let vl = UnsafePointer<UInt8>(payload.bytes).memory | |
version = IPVersion(rawValue: vl >> 4)! | |
IPHeaderLength = Int(vl & 0x0F) * 4 | |
let p = UnsafePointer<UInt8>(payload.bytes.advancedBy(9)).memory | |
proto = TransportType(rawValue: p)! | |
self.payload = NSMutableData(data: payload) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment