pcapplusplus-sys 0.1.0

Compile PcapPlusPlus and make its library and header files available. See also https://github.com/seladb/PcapPlusPlus
Documentation
  • Coverage
  • 0%
    0 out of 1 items documented0 out of 0 items with examples
  • Size
  • Source code size: 6.75 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 228.91 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • IzumiRaine/tcp-stream-capture
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • IzumiRaine

pcapplusplus-sys

Compile PcapPlusPlus and make its library and header files available.

Two environment variables will be made available to build.rs of dependent crates:

  • DEP_PCAPPLUSPLUS_INCLUDE contains the path to PcapPlusPlus header files
  • DEP_PCAPPLUSPLUS_LIB contains the path to the compiled PcapPlusPlus libraries

To use PcapPlusPlus with cxx, use something like this in your build.rs:

let mut cpp = cxx_build::bridge("src/bridge.rs");

// Set include path for PcapPlusPlus
let pcpp_include = env::var_os("DEP_PCAPPLUSPLUS_INCLUDE")
    .expect("Environment variable DEP_PCAPPLUSPLUS_INCLUDE should have been set");
cpp.include(pcpp_include);

// ...

You also need to link to the PcapPlusPlus libraries and possibly libpcap:

// Link to PcapPlusPlus libraries
let pcpp_lib = env::var("DEP_PCAPPLUSPLUS_LIB")
    .expect("Environment variable DEP_PCAPPLUSPLUS_LIB should have been set");
println!("cargo:rustc-link-search=native={}", pcpp_lib);
println!("cargo:rustc-link-lib=static=Common++");
println!("cargo:rustc-link-lib=static=Packet++");
println!("cargo:rustc-link-lib=static=Pcap++");

// Link to libpcap
println!("cargo:rustc-link-lib=dylib=pcap");