1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use env;
use PathBuf;
// Generate bindings for Npcap on Windows, using the Npcap SDK specified
// by the environment variables `NPCAP_SDK_INCLUDE` and `NPCAP_SDK_LIB`.
// `NPCAP_SDK_INCLUDE` should point to the include directory (where pcap.h is),
// and `NPCAP_SDK_LIB` should point to the lib directory (where wpcap.lib, Packet.lib are).
// Windows builds still have some problems, so this is disabled by default.
//
// #[cfg(windows)]
// fn main() {
// println!("cargo:rerun-if-changed=wrapper.h");
// println!("cargo:rustc-link-lib=wpcap");
// println!("cargo:rustc-link-lib=Packet");
//
// let npcapsdk_include = env::var("NPCAP_SDK_INCLUDE")
// .expect("Please set NPCAP_SDK_INCLUDE to Npcap SDK include directory (where pcap.h is)");
// let npcapsdk_lib = env::var("NPCAP_SDK_LIB").expect(
// "Please set NPCAP_SDK_LIB to Npcap SDK lib directory (where wpcap.lib, Packet.lib are)",
// );
//
// println!("cargo:rustc-link-search=native={npcapsdk_lib}\\x64");
//
// let bindings = bindgen::Builder::default()
// .header("wrapper.h")
// .allowlist_function("pcap_.*")
// .allowlist_type("pcap_.*")
// .allowlist_var("PCAP_.*")
// .generate_inline_functions(true)
// .generate_comments(true)
// .clang_arg("-Wno-everything")
// .clang_arg(format!("-I{npcapsdk_include}"))
// .generate()
// .expect("Unable to generate libpcap (Npcap) bindings on Windows");
//
// let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
// bindings
// .write_to_file(out_path.join("bindings.rs"))
// .expect("Couldn't write bindings!");
// }