I was trying this code from https://github.com/dfrencham/swiftPCap
pcap_loop(pcapSession, numberOfPackets,
{
(args: UnsafeMutablePointer<u_char>,
pkthdr:UnsafePointer<pcap_pkthdr>,
packet: UnsafePointer<u_char>) ->Void in
// lets handle the result using a call to a singleton
// we can keep state this way, and not have to
// tool around by passing pointers to UnsafePointers
// and dereferencing later
let pa = PacketAnalyser.sharedInstance
pa.Process()
},
nil)
Now it is Swift 3, I cannot compile with the following errors cannot convert value of type '(UnsafeMutablePointer, UnsafePointer, UnsafePointer) -> Void' to expected argument type 'pcap_handler!'
Not really sure how to proceed, pretty much a newbie at referencing C code from Swift. I have read the documentation, but not having much luck.
Thanks