Last active
November 16, 2017 01:26
-
-
Save picatz/b0a2381c6b306eaa526c6f03f54f6196 to your computer and use it in GitHub Desktop.
Using pcap_open_live
This file contains hidden or 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
@[Link("pcap")] | |
lib LibPcap | |
# previous code ... | |
type PcapT = Void* | |
alias UChar = UInt8 | |
alias BpfUInt32 = LibC::UInt | |
struct Timeval | |
tv_sec : LibC::Long | |
tv_usec : LibC::Long | |
end | |
struct PcapPkthdr | |
ts : Timeval | |
caplen : BpfUInt32 | |
len : BpfUInt32 | |
end | |
fun pcap_open_live(device : LibC::Char*, | |
snaplen : LibC::Int, | |
promisc : LibC::Int, | |
to_ms : LibC::Int, | |
errbuf : LibC::Char*) : PcapT | |
fun pcap_next_ex(capture : PcapT, header : PcapPkthdr**, data : UChar**) : LibC::Int | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment